Thursday, July 27, 2006

 

Some Oddities of Shutdown

Some conclusions from studies of shutting down in Linux (Ubuntu).This is the second of two posts.

Thanks to Cucisan and Metalheart for their help on the Ubuntu forums.


Some shutdown oddities
shutdown can be run in terminal or on a console, as any other command:
sudo shutdown -h now

Yet, in some ways, it seems to be unlike any other command.

The incompatibility with metacity oddity
For some reason unknown to me, it is impossible to include the shutdown command in the metacity user-defined keyboard shortcuts.
Thus, while
sudo shutdown -h now
works fine from terminal, it won't respond when included in a metacity shortcut (as explained in the post about shutdown keyboard shortcuts).

The CTRL-ALT-DEL oddity
In the default Dapper install, CTRL-ALT-DEL, a key combination used to reboot or shutdown, works only from the console, not from the GUI or even a terminal emulator.

Although it is commented out in /etc/inittab

# What to do when CTRL-ALT-DEL is pressed.
ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now

CTRL-ALT-DEL has no effect when used in the usual desktop environment.

man shutdown explains that CTRL-ALT-DEL is only recognized by the console [CTRL-ALT (F1 to F6) launch six independent consoles]. It is a unique key combination.
Even after removing the -a switch (see below) from the shutdown command in /etc/inittab (see above), CTRL-ALT-DEL is still recognized exclusively from the console.

The -a switch goes hand in hand with CTRL-ALT-DEL
Furthermore,
the -a switch, as in the command in the /etc/inittab file above, points to a file, /etc/shutdown.allow, which lists the users authorized to use the CTRL-ALT-DEL combination.
The -a switch is part and parcel of the CTRL-ALT-DEL key combination management- it only affects who can use this key combination. So the -a switch, too, is irrelevant on the desktop...

Indeed, upon creation of the /etc/shutdown.allow file with my username, as Metalheart suggested, could make CTRL-ALT-DEL work from the console, but still not from the terminal emulator.

Thus, in the terminal:
jackn@Phoenix:~$ sudo shutdown -a -r now
Password:
jackn@Phoenix:~$

a shutdown with the -a switch is ignored.

This, even though the /etc/shutdown.allow file is there:
#list of users allowed to use CTRL-ALT-DEL, a key combination that *only* works from the console.
jackn

The above results obtained after logging out and back in, for changes to take effect (prior to that, with the same files, the shell didn't even prompt for the password with the above command, but went right away to the next prompt).


Why and to be studied
As explained in man shutdown, the stringent management of CTRL-ALT-DEL must have to do with the days in which people worked on terminals hookd up to a central computer. Without such strictly regulated access, any user could have brought down the system from any terminal. I don't know if the keeping up of this setup serves any purpose today.


One issue remains to be studied, then:
What is it that doesn't allow the shutdown command, effective on the terminal, to work with metacity shortcuts like any other terminal command?

Comments: Post a Comment

Links to this post:

Create a Link



<< Home

This page is powered by Blogger. Isn't yours?