From FreekiWiki
Jump to navigation Jump to search

This page has been migrated to a document on Free Geek's Google Drive.

Information remaining behind may no longer be relevant.


When you have tagged this page as migrated,
please add a link to the new document on Google Drive.

(Link to new page immediately below.)


Ubuntu 12.04 uses GRUB (the GRand Unified Bootloader). For more information on bootloaders and the bootstrapping process, start here.

Opening the GRUB menu

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.

Bypassing GRUB boot menu

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 after splash
  • 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:
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 after splash
  • 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.

GRUB fails to detect proper resolution

Sometimes GRUB fails to detect the correct resolution for a monitor or graphics card. This issue is characterized by an "Input Not Supported" error from the monitor. Pressing enter should boot the system normally.

To permanently set the resolution modify the /etc/default/grub file.

  • Use your favorite text editor to open the config file.
$ sudo nano /etc/default/grub
  • Locate the line that reads '#GRUB_GFXMODE=640x480' and uncomment it by removing the the preceding hashtag.
  • Update grub
$ sudo update-grub

The resolution can be customized by changing '640x480' to a resolution supported by the monitor. e.g. '1024x768'