Difference between revisions of "GRUB"
m (fixed typo) |
|||
(7 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
− | Ubuntu | + | {{migrated}} |
+ | |||
+ | [https://docs.google.com/a/freegeek.org/document/d/1baAFRGqdXEzF58VkTOY21qrrzO55kaKo0xhHrxBk_2k/edit?usp=sharing Link] | ||
+ | |||
+ | Ubuntu 12.04 uses GRUB (the '''GR'''and '''U'''nified '''B'''ootloader). For more information on bootloaders and the bootstrapping process, start [http://en.wikipedia.org/wiki/Bootloader#Boot_loader here]. | ||
==Opening the GRUB menu== | ==Opening the GRUB menu== | ||
Line 10: | Line 14: | ||
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. | 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 '<code>e</code>'. | ||
+ | * Scroll down to the line that starts with <code>linux</code> then scroll to end of the line after <code>splash</code> | ||
+ | * Enter '<code>init=/bin/sh</code>' | ||
+ | * 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 <code>init</code> 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:<br /><code># mount /dev/sda1/ -o remount,rw /</code><br /> Where <code>/dev/sda1</code> is your root partition. | ||
+ | * Now, run:<br /><code># cp /etc/shadow /root/shadow.bak</code><br />This creates a backup of the current root password | ||
+ | * Finally, run <br /><code># passwd root</code><br />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== | ==Adding rootdelay== | ||
+ | {| style="color: white; width: 60%; border: 1px solid #aaaaaa; text-align: center;" align="center" | ||
+ | |- bgcolor=#FF4040 valign=center | ||
+ | | [[Image:Diamond-caution.png|left]] The feature in this section has been implemented into Free Geek's<br />standard Debian and Ubuntu images, and should not need to be<br />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! | 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! | ||
Line 32: | Line 65: | ||
In order to make this a permanent boot parameter, you can edit the file '''/etc/default/grub''' and add <code>rootdelay=60</code> to the list of arguments assigned to the variable <code>GRUB_CMDLINE_LINUX_DEFAULT</code>. | In order to make this a permanent boot parameter, you can edit the file '''/etc/default/grub''' and add <code>rootdelay=60</code> to the list of arguments assigned to the variable <code>GRUB_CMDLINE_LINUX_DEFAULT</code>. | ||
+ | |||
+ | ==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. | ||
+ | <code>$ sudo nano /etc/default/grub</code> | ||
+ | *Locate the line that reads <code>'#GRUB_GFXMODE=640x480'</code> and uncomment it by removing the the preceding hashtag. | ||
+ | *Update grub | ||
+ | <code>$ sudo update-grub</code> | ||
+ | |||
+ | The resolution can be customized by changing '640x480' to a resolution supported by the monitor. e.g. '1024x768' | ||
+ | |||
+ | |||
+ | [[Category:Howto]] [[Category:Tech support]] |
Latest revision as of 14:28, 18 April 2014
This page has been migrated to a document on Free Geek's Google Drive. Information remaining behind may no longer be relevant. MIGRATOR: When you have tagged this page as migrated, (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.
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
.
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'