GRUB
Ubuntu 10.04 uses version 1.98 of GRUB (the GRand Unified Bootloader). For more information on bootloaders and the bootstrapping process, start here.
Reboot the computer, and either during or just after its POST (where a small blinking cursor like this _
will appear in the upper left hand corner of the screen) press and hold down a Shift key. After a few moments, the text Grub loading...
should flash and you'll be presented with a menu with options similar to this:
Ubuntu, with Linux 2.6.32-33-generic Ubuntu, with Linux 2.6.32-33-generic (recovery mode) Memory test (memtest86+) Memory test (memtest86+, serial console 115200)
Here you can move up and down the list of images to boot from, edit their boot parameters, open the GRUB command-line for advanced trickery, and more.
Sometimes, especially when installing Ubuntu from an optical disk, GRUB will default to showing a boot menu before booting to the operating system.
To bypass this:
- Open a terminal and run
$ sudo gedit /etc/default/grub
- find the GRUB_TIMEOUT= line and change the number value to 0
- save your changes
- run
$ sudo update-grub
- restart and verify that the boot menu is no longer showing
Rooting a system
In order to root a system, you need only pass a single parameter to the kernel!
From the GRUB menu:
- Highlight the standard kernel and press '
e
'. - Scroll down to the line that starts with
linux
then scroll to end of the line aftersplash
- Enter '
init=/bin/sh
' - Hit Ctrl+x to boot the image with modified parameters.
- You should almost immediately be dropped to a root shell. Bear in mind that replacing
init
with a shell prevents it from loading any modules or applying any standard configurations or settings. That is to say, this environment is fragile and you should tread lightly! - The next step is to modify the root password. In general, it's a good idea to back up the old password. In order to do either of these things, we need to mount the filesystem as writable. Run the following command:
# mount /dev/sda1/ -o remount,rw /
Where/dev/sda1
is your root partition. - Now, run:
# cp /etc/shadow /root/shadow.bak
This creates a backup of the current root password - Finally, run
# passwd root
You will be prompted to enter a new password for the root account. Once this is done, reboot the computer and log in as root at your leisure!
Adding rootdelay
The feature in this section has been implemented into Free Geek's standard Debian and Ubuntu images, and should not need to be implemented to troubleshoot internal machines. |
Occasionally a system will fail to boot from a known good, imaged hard drive. Sometimes it's because of defective hardware, and all we can do is replace the parts. But sometimes it's because the bootloader doesn't wait long enough for the drive to respond, and all we need to do is tell the bootloader to wait for just a little longer!
From the GRUB menu:
- Highlight the standard kernel (usually something like
Ubuntu, with Linux 2.6.32-33-generic
), and press 'e
'. You should see something similar to this:
recordfail insmod part_msdos insmod ext2 set root='(hd0,msdos1)' search --no-floppy --fs-uuid --set 732c5f94-8dcb-4622-96ea-797dd2431f90 linux /boot/vmlinuz-2.6.35-30-generic root=UUID=732c5f94-8dcb-4622-96ea-797dd2431f90 ro quiet splash initrd /boot/initrd.img-2.6.35-30-generic
- Scroll down to the line that starts with
linux
then scroll to end of the line aftersplash
- Enter '
rootdelay=60
' - Hit Ctrl+x to boot the image with modified parameters.
The argument for rootdelay is in seconds, though it almost never times out. Most things that would happen with a drive, whether it was working or not, happen relatively quickly.
In order to make this a permanent boot parameter, you can edit the file /etc/default/grub and add rootdelay=60
to the list of arguments assigned to the variable GRUB_CMDLINE_LINUX_DEFAULT
.