Messages in this thread | | | Date | Tue, 15 Jul 1997 12:14:50 +0200 (MEST) | From | Hubert Mantel <> | Subject | Re: What to do on ctrl-alt-del? |
| |
On 14 Jul 1997, Miquel van Smoorenburg wrote:
> In article <Pine.LNX.3.95.970714145503.21268i-100000@Galois.fs100.suse.de>, > Hubert Mantel <mantel@suse.de> wrote: > >Hi, > > > >if you call reboot(2) to disable ctrl-alt-del, SIGINT will be sent to > >process 1 if the user presses ctrl-alt-del. This has been ok in the past > >but since Linux has the unique initrd feature there is not always a > >process with pid 1. > > Why? Init is special in more ways then that one. For example, there should > always be a process with pid 1, that adopts the processes without a parent > and does a wait() to clean up after they die. Also, you can't kill process > #1 with -STOP or -KILL.
I know about the jobs init has to do. But I'm talking about the time before init gets started.
Several modern distributions do an install this way: Boot the system and load an initrd. linuxrc is started, loads modules and does/starts the installation. After the installation is completed, the new root device is written to /proc/sys/kernel/real-root-dev and linuxrc terminates. After that, the freshly installed system is started. This is the moment when init is started. Before that there is no process with pid 1. If the user presses ctrl-alt-del the system will reboot immediately and may trash your filesystems (for example when performing an update of the system).
> >As initrd is intended and used for installation > >purposes it might be necessary to allow linuxrc to intercept ctr-alt-del; > >otherwise the system immediately reboots upon that key combination without > >a clean shutdown. Wouldn't it be correct to send SIGINT to the process > >that disabled ctrl-alt-del? > > I don't think so since that makes the "ctrlaltdel" utility pretty useless.
ctrl-alt-del is just another special key combination. Immediate reboot is only possible before init is started. init does disable ctrl-alt-del. After that, ctrl-alt-del is dedicated to init but every other process is able to enable or disable ctrl-alt-del. Maybe we should modify the behaviour so that interception of ctrl-alt-del is only possible while the system is not yet completely booted, but there needs to be a way for linuxrc to make sure it can perform a clean reboot when the user presses ctrl-alt-del before init is started.
> How do you manage to end up without a process #1 anyway?
As I stated above the current behaviour was ok in the past because there was always the init process with pid 1. With initrd this is not longer true.
> Mike.
Hubert mantel@suse.de --- RC5 contest: 87 zillion CPU cycles, and all I got was this shirt.
| |