Have you ever been in the position where your Linux system wouldn’t boot anymore? Maybe you tried to install the new NVIDIA drivers?
Well so have I.
In this guide I will describe the few possibilities how to get to a Linux Shell for your broken System so you can repair it.
If you have no idea what the TTY is, please read this really great article about the beginning and technical background of the TTY.(http://www.linusakesson.net/programming/tty/)
To open the TTY1 press Ctrl+Alt+F1. The screen will go black and a terminal login should appear. If this works, you can now fix the system from this terminal.
Just login with your normal user and you should be good to go. If you need more TTY’s you can switch to the others by pressing Ctrl+Alt+F[1-6]. You can also switch to the next/previous TTY by pressing Ctrl+Left/Right.
If this tip didn’t work out for you proceed to the next section.
To get to the recovery shell you have to first restart your computer. When restarting your pc after the BIOS loaded quickly hit the shift key to get to the GRUB menu.
Using the up/down arrows navigate to the point “Advanced Options”. Then select the line looking like this:
Ubuntu GNU/Linux, with Linux 3.8.0-26-generic (recovery mode)
To confirm press enter and the recovery shell will start loading.
In this menu select “Drop to root shell prompt” to start the root shell. Because the root partition is only mounted with read right you have to first remount it to write to the partition. You can do this with the following command:
mount -o remount,rw /
If you need network access you can enable it by typing “exit” and select “network” in the menu. After that just select “Drop to root shell prompt” and you should have network access.
All those tips didn’t help? Let’s try the next one.
If you don’t have a system with a recovery system the next choice is to boot from a live CD/USB to perform the repair.
A few distributions I used for this are:
Actually any distribution you have ready on a USB Drive or CD-ROM should be enough.
Thanks to JamoBox for this trick.
You can enter single user mode in RHEL family distros by selecting your distro in GRUB and pressing ‘a’ to append to the run command, and typing ‘single’. This will then boot you into a TTY where you can perform maintenance.
You know another method? Or none of those tips helped you?
Leave a comment and I will add your method or help you with your problem.
If you Linux System gets frozen you can use the sysrq key to shut the system down safely. You should check beforehand which functions of the sysrq key are enabled.
The configuration is in the file /etc/sysctl.d/10-magic-sysrq.conf In the last line you can find the value for your sysrq configuration.
kernel.sysrq = 1
To enable all options set kernel.sysrq to 1. You can find the other available options in the file. To enable options add the value of the option to the kernel.sysrq option.
Ex. You want to enable option 4 and 8 so you set the kernel.sysrq option to 12.
# 4 - enable control of keyboard (SAK, unraw)
# 8 – enable debugging dumps of processes etc.
This works because the option values double for every option (2,4,8,16 etc.). In binary this translates to (0000 0010, 0000 0100, 0000 1000, 0001 0000 etc.)
So if we add the options 4 (0000 0100) and 8 (0000 1000) we get 12 (0000 1100).
After you’ve set your options you can run them by pressing alt+sysrq+the appropriate letter which you can find on wikipedia.
If you’ve enabled all options (1) you can safely shut down your system by typing “busier” backwards while holding down the alt and sysrq key.