Skip to contentSkip to conversation

signal to PID 1 from serial console like KeyboardRequest or CAD

DISCUSSION Jeremy Jackson 3 participants 7 messages Mar 25, 2011 – Apr 1, 2011

lore
Share & tools
lore
#0 lore raw

Hi,

Sent to linux-console with no reply for over a week...

I ran into a problem recently on a Linux server with a remote serial console. /sbin/init (actually Upstart) was in a state where nothing (useful) was running. I had to power cycle the machine to get back to the boot prompt. This has the side-effect of triggering raid rebuilds.

It would be nice to have what Ctrl-Alt-Del does at the VGA console with PS/2 or USB keyboard. This sends a SIGINT to PID 1, and most distros have this set to do "shutdown -r now" which attempts a clean reboot.

Once upon a time there was KeyboardRequest, which would send a SIGWINCH to PID 1 (when pressing Alt-UP_arrow?). I don't see any sign of this feature in Linux 2.6.32 though.

Looking at the Sysrq handlers in the kernel I don't see any keystrokes that send SIGINT to PID 1 either.

So, I'm wondering if it makes sense to add a Sysrq key to send a signal to PID1 ?

Signature · 3 lines
Coplanar Networks
http://www.coplanar.net
(519)489-4903
#1 lore raw
Quoted 4 lines · On Fri, 25 Mar 2011 13:41:40 -0400 Jeremy Jackson wrote:

Hi,

Sent to linux-console with no reply for over a week...

Quoted 8 lines

I ran into a problem recently on a Linux server with a remote serial console. /sbin/init (actually Upstart) was in a state where nothing (useful) was running. I had to power cycle the machine to get back to the boot prompt. This has the side-effect of triggering raid rebuilds.

It would be nice to have what Ctrl-Alt-Del does at the VGA console with PS/2 or USB keyboard. This sends a SIGINT to PID 1, and most distros have this set to do "shutdown -r now" which attempts a clean reboot.

so C_A_D works at console via PS/2 or USB keyboard, but not on a remote serial console? Could it be an issue with whatever remote/serial software you are using?

Quoted 3 lines

Once upon a time there was KeyboardRequest, which would send a SIGWINCH to PID 1 (when pressing Alt-UP_arrow?). I don't see any sign of this feature in Linux 2.6.32 though.

I couldn't find it in 2.4.37 either.

Can 'loadkeys' help you any?

Quoted 5 lines

Looking at the Sysrq handlers in the kernel I don't see any keystrokes that send SIGINT to PID 1 either.

So, I'm wondering if it makes sense to add a Sysrq key to send a signal to PID1 ?

Dmitry, any ideas?

---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

#2 lore raw
Quoted 11 lines · Randy Dunlap
Quoted 9 lines · On Fri, 25 Mar 2011 13:41:40 -0400 Jeremy Jackson wrote:

Hi,

Sent to linux-console with no reply for over a week...

I ran into a problem recently on a Linux server with a remote serial console. /sbin/init (actually Upstart) was in a state where nothing (useful) was running. I had to power cycle the machine to get back to the boot prompt. This has the side-effect of triggering raid rebuilds.

Quoted 7 lines
Quoted 3 lines

It would be nice to have what Ctrl-Alt-Del does at the VGA console with PS/2 or USB keyboard. This sends a SIGINT to PID 1, and most distros have this set to do "shutdown -r now" which attempts a clean reboot.

so C_A_D works at console via PS/2 or USB keyboard, but not on a remote serial console? Could it be an issue with whatever remote/serial software you are using?

I believe it is simply a matter of console keymap and assigning "boot" value to the desired combination.

Quoted 9 lines
Quoted 4 lines

Once upon a time there was KeyboardRequest, which would send a SIGWINCH to PID 1 (when pressing Alt-UP_arrow?). I don't see any sign of this feature in Linux 2.6.32 though.

I couldn't find it in 2.4.37 either.

Can 'loadkeys' help you any?

Quoted 7 lines
Quoted 5 lines

Looking at the Sysrq handlers in the kernel I don't see any keystrokes that send SIGINT to PID 1 either.

So, I'm wondering if it makes sense to add a Sysrq key to send a signal to PID1 ?

Dmitry, any ideas?

We have SysRq bindings to unmount filesystems and reboot, isn't that enough?

Signature · 1 line
Dmitry
#3 lore raw
Quoted 16 lines · Dmitry Torokhov
Quoted 15 lines · Randy Dunlap
Quoted 12 lines · On Fri, 25 Mar 2011 13:41:40 -0400 Jeremy Jackson wrote:

Hi,

Sent to linux-console with no reply for over a week...

I ran into a problem recently on a Linux server with a remote serial console. /sbin/init (actually Upstart) was in a state where nothing (useful) was running. I had to power cycle the machine to get back to the boot prompt. This has the side-effect of triggering raid rebuilds.

It would be nice to have what Ctrl-Alt-Del does at the VGA console with PS/2 or USB keyboard. This sends a SIGINT to PID 1, and most distros have this set to do "shutdown -r now" which attempts a clean reboot.

Quoted 6 lines
Quoted 3 lines

so C_A_D works at console via PS/2 or USB keyboard, but not on a remote serial console? Could it be an issue with whatever remote/serial software you are using?

I believe it is simply a matter of console keymap and assigning "boot" value to the desired combination.

The VGA console/keyboard isn't an issue here, C_A_D works great. The problem is, that functionality isn't available when using *serial* console.

Quoted 11 lines
Quoted 11 lines
Quoted 3 lines

Once upon a time there was KeyboardRequest, which would send a SIGWINCH to PID 1 (when pressing Alt-UP_arrow?). I don't see any sign of this feature in Linux 2.6.32 though.

I couldn't find it in 2.4.37 either.

Can 'loadkeys' help you any?

Quoted 3 lines

Looking at the Sysrq handlers in the kernel I don't see any keystrokes that send SIGINT to PID 1 either.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

So, I'm wondering if it makes sense to add a Sysrq key to send a signal to PID1 ?

Dmitry, any ideas?

We have SysRq bindings to unmount filesystems and reboot, isn't that enough?

Reboot isn't clean... it doesn't signal MD-raid to "unmount" does it? SysRq powerOff does cleanly shutdown md-raid, but who will drive to the datacenter to press the power button to turn it back on?

I guess there are two ways to achieve clean (md-raid) reboot when using serial console... a new SysRq to reboot "clean", or a new SysRq to signal init. Looking at ctrlaltdel(8), perhaps it could just one SysRq, and let userspace (/sbin/init) configure it as needed.

Signature · 3 lines
Coplanar Networks
http://www.coplanar.net
(519)489-4903
#4 lore raw
Quoted 21 lines · On Fri, 01 Apr 2011 11:39:28 -0400 Jeremy Jackson wrote:
Quoted 20 lines · Dmitry Torokhov
Quoted 18 lines · Randy Dunlap
Quoted 4 lines · On Fri, 25 Mar 2011 13:41:40 -0400 Jeremy Jackson wrote:

Hi,

Sent to linux-console with no reply for over a week...

Quoted 8 lines

I ran into a problem recently on a Linux server with a remote serial console. /sbin/init (actually Upstart) was in a state where nothing (useful) was running. I had to power cycle the machine to get back to the boot prompt. This has the side-effect of triggering raid rebuilds.

It would be nice to have what Ctrl-Alt-Del does at the VGA console with PS/2 or USB keyboard. This sends a SIGINT to PID 1, and most distros have this set to do "shutdown -r now" which attempts a clean reboot.

so C_A_D works at console via PS/2 or USB keyboard, but not on a remote serial console? Could it be an issue with whatever remote/serial software you are using?

Quoted 5 lines
Quoted 2 lines

I believe it is simply a matter of console keymap and assigning "boot" value to the desired combination.

The VGA console/keyboard isn't an issue here, C_A_D works great. The problem is, that functionality isn't available when using *serial* console.

That's why I asked whether it could be an issue with the serial interface software. E.g., minicom handles/processes certain keystrokes, other apps do things differently, etc...

Quoted 19 lines
Quoted 11 lines
Quoted 11 lines
Quoted 3 lines

Once upon a time there was KeyboardRequest, which would send a SIGWINCH to PID 1 (when pressing Alt-UP_arrow?). I don't see any sign of this feature in Linux 2.6.32 though.

I couldn't find it in 2.4.37 either.

Can 'loadkeys' help you any?

Quoted 3 lines

Looking at the Sysrq handlers in the kernel I don't see any keystrokes that send SIGINT to PID 1 either.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

So, I'm wondering if it makes sense to add a Sysrq key to send a signal to PID1 ?

Dmitry, any ideas?

We have SysRq bindings to unmount filesystems and reboot, isn't that enough?

Quoted 19 lines

Reboot isn't clean... it doesn't signal MD-raid to "unmount" does it? SysRq powerOff does cleanly shutdown md-raid, but who will drive to the datacenter to press the power button to turn it back on?

I guess there are two ways to achieve clean (md-raid) reboot when using serial console... a new SysRq to reboot "clean", or a new SysRq to signal init. Looking at ctrlaltdel(8), perhaps it could just one SysRq, and let userspace (/sbin/init) configure it as needed.

Signature · 8 lines
Coplanar Networks
http://www.coplanar.net
(519)489-4903
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

#5 lore raw
Quoted 26 lines · Randy Dunlap
Quoted 24 lines · On Fri, 01 Apr 2011 11:39:28 -0400 Jeremy Jackson wrote:
Quoted 22 lines · Dmitry Torokhov
Quoted 11 lines · Randy Dunlap
Quoted 9 lines · On Fri, 25 Mar 2011 13:41:40 -0400 Jeremy Jackson wrote:

Hi,

Sent to linux-console with no reply for over a week...

I ran into a problem recently on a Linux server with a remote serial console. /sbin/init (actually Upstart) was in a state where nothing (useful) was running. I had to power cycle the machine to get back to the boot prompt. This has the side-effect of triggering raid rebuilds.

Quoted 7 lines
Quoted 3 lines

It would be nice to have what Ctrl-Alt-Del does at the VGA console with PS/2 or USB keyboard. This sends a SIGINT to PID 1, and most distros have this set to do "shutdown -r now" which attempts a clean reboot.

so C_A_D works at console via PS/2 or USB keyboard, but not on a remote serial console? Could it be an issue with whatever remote/serial software you are using?

I believe it is simply a matter of console keymap and assigning "boot" value to the desired combination.

Quoted 6 lines
Quoted 2 lines

The VGA console/keyboard isn't an issue here, C_A_D works great. The problem is, that functionality isn't available when using *serial* console.

That's why I asked whether it could be an issue with the serial interface software. E.g., minicom handles/processes certain keystrokes, other apps do things differently, etc...

OK I guess I should clarify... when using Linux serial console, you can send BREAK <letter> to use SysRq functions. In minicom, META-F sends break. This works fine for all the existing functions linux offers, r = reboot immediate, i = kill all tasks, etc. But, there is no function available to reboot *clean*, or to signal PID 1 (/sbin/init) to do same.
So, minicom is working/configured properly, Linux just doesn't offer a
feature similar to C_A_D via serial.

Signature · 3 lines
Coplanar Networks
http://www.coplanar.net
(519)489-4903
#6 lore raw
Quoted 30 lines · Jeremy Jackson
Quoted 29 lines · Randy Dunlap
Quoted 26 lines · On Fri, 01 Apr 2011 11:39:28 -0400 Jeremy Jackson wrote:
Quoted 16 lines · Dmitry Torokhov
Quoted 15 lines · Randy Dunlap
Quoted 12 lines · On Fri, 25 Mar 2011 13:41:40 -0400 Jeremy Jackson wrote:

Hi,

Sent to linux-console with no reply for over a week...

I ran into a problem recently on a Linux server with a remote serial console. /sbin/init (actually Upstart) was in a state where nothing (useful) was running. I had to power cycle the machine to get back to the boot prompt. This has the side-effect of triggering raid rebuilds.

It would be nice to have what Ctrl-Alt-Del does at the VGA console with PS/2 or USB keyboard. This sends a SIGINT to PID 1, and most distros have this set to do "shutdown -r now" which attempts a clean reboot.

Quoted 6 lines
Quoted 3 lines

so C_A_D works at console via PS/2 or USB keyboard, but not on a remote serial console? Could it be an issue with whatever remote/serial software you are using?

I believe it is simply a matter of console keymap and assigning "boot" value to the desired combination.

The VGA console/keyboard isn't an issue here, C_A_D works great. The problem is, that functionality isn't available when using *serial* console.

Quoted 6 lines
Quoted 3 lines

That's why I asked whether it could be an issue with the serial interface software. E.g., minicom handles/processes certain keystrokes, other apps do things differently, etc...

OK I guess I should clarify... when using Linux serial console, you can send BREAK <letter> to use SysRq functions.

Ah, right, we hardwire BREAK to SysRq when using serial console...

Quoted 7 lines

In minicom, META-F
sends break. This works fine for all the existing functions linux offers, r = reboot immediate, i = kill all tasks, etc. But, there is no function available to reboot *clean*, or to signal PID 1 (/sbin/init) to do same. So, minicom is working/configured properly, Linux just doesn't offer a feature similar to C_A_D via serial.

SysRQ+REISUB should do it I think.

Signature · 1 line
Dmitry