Emergency exit from X to tty1

Lennart Sorensen lsorense-1wCw9BSqJbv44Nm34jS7GywD8/FfD2ys at public.gmane.org
Thu Dec 20 15:06:41 UTC 2007


On Wed, Dec 19, 2007 at 06:14:56PM -0500, Walter Dnes wrote:
>   Here's a useful hint I picked up on the Gentoo mailing list.  This is
> for those occasions when you get stuck in X, with X hogging the
> keyboard, and refusing to let you exit to textmode.  With a bit of
> setup, you can use the big "Power" button (YES!!! the "ON/OFF" button)
> to force a jump to textmode tty1.  Here are the steps...
> 
> as root
> cd /usr/src/linux
> make menuconfig
>   Power management options (ACPI, APM)  --->
>     [*] Power Management support
>         ACPI (Advanced Configuration and Power Interface) Support
>           [*] ACPI Support
>           <*>   Button
> 
> Compile and re-boot into new kernel
> 
> emerge acpi
> (That's for Gentoo; other distros use apt-get/yum/rpm/whatever)
> 
> change the uncommented lines in /etc/acpi/events/default to read
> event=.*
> action=chvt 1
> 
> execute the two commands...
> /etc/init.d/acpid start     (to start acpid now)
> rc-update add acpid default (to automatically start acpid at future bootups)
> 
>   Notes:
>   - When testing, I suggest executing "sync" as a precaution, just
>     before pressing the "big" power button.
> 
>   - PCs also have a smaller power button which is hard-wired to shutdown
>     or re-boot.  Do *NOT* press that button.

Ehm, no they have one power button and one reset button.  The power
button will normally on a modern system send an acpi event notifying the
OS to shutdown and then poweroff, or if you hold it for 4 seconds it
will force power off anyhow.  The other button just resets the system
with no notice to the OS and hence not allowing for a clean shutdown at
all.  On some systems you can change what the power button does in the
BIOS, to make it shut off right away without notifying the OS, or a few
other choices.

>   - After editing /etc/acpi/events/default run the command
> /etc/init.d/acpid restart
>     to force acpid to read in the new config
> 
>   It was scarey at first, pressing the power button.  Just like the
> feeling I had a dozen years ago when I first pressed {CTL-ALT-DEL} in
> Windows95, not to reboot but to bring up the task manager.

acpi buttons can be made to do whatever you want.  laptops have multiple
buttons (lid switch, sleep buttons, etc) that you can have lots of fun
with.  Desktops often only have the power button, although a few have a
sleep button too.

--
Len Sorensen
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list