Legacy GRUB Page
(GNU-GRUB 'Legacy' - meaning versions 0.97 and earlier)This web page is about GNU GRUB 'Legacy', and in particular how it can be used in Ubuntu Linux. GNU GRUB 'Legacy' is the 'old GRUB' , used in versions of Ubuntu earlier than 9.10 Karmic Koala. Information in this web page mainly applies to Ubuntu Hardy Heron, Intrepid Ibex and Jaunty Jackalope users. Users of Ubuntu 9.10 'Karmic Koala' and later will be booting with the 'new' GNU GRUB, popularly called 'GRUB 2', (actually GRUB 1.97). The 'new' GRUB is quite a lot different from the 'old' GRUB. Ubuntu Karmic Koala users should got to this website's GRUB2 pages, GRUB2 Pages. This web-page is part of a larger site giving examples of how to install Windows+Ubuntu Linux operating systems 'dual boot' in a computer. Illustrated Dual Boot HomePage |
The grub menu is very simple to use, even for beginners. All that is necessary for most people to do is press your 'Enter' key. If you don't press 'Enter', your favorite operating system will boot anyway after a number of seconds. If you want more time you can press any key to stop the count-down timer while you think it over and make a decision. When you're ready, just use your up or down arrow keys to highlight the line representing the operating system you want to boot and then press your 'Enter' key to boot your selected operating system. Most of the time those are the only things you need to know to be able to boot with GRUB. However, GRUB, (GRand Unified Bootloader), is much more than just an ordinary boot loader. If you ever want to do something special, or if you have trouble booting, there are a lot of options available in GRUB to help you,
1) GRUB can load a wide variety of operating systems directly by loading their kernels into the computer's memory. 2) GRUB can load 'proprietary' operating systems (unsupported operating systems like Windows) by a process called 'chainloading'. 3) When you are installing a new Ubuntu operating system, the Ubuntu installer runs programs to detect other operating systems in your computer and it sets up GRUB automatically for you. Most of the time the installation scripts work perfectly and all of their other operating systems will boot. Due to various computer technical difficulties, some computers give the wrong information and a small correction will be needed to an operating system's entry in the menu.lst file. This doesn't happen all that often when it does happen the computer users who are affected tend to make a lot of noise in web forums about it. At least they should be thankful that GRUB was set almost perfectly for them automatically. Other operating systems have boot loaders that need to be set up manually every time if you want to dual boot. 4) The GRUB Menu is completely customizable to suit different computers and individual preferences. The GRUB menu and much of GRUB's behavior is controlled by our /boot/grub/menu.lst (menu list) text files. I'll show you how to find that and some of the things you can do with it further down this page. |
| PAGE INDEX Orientation. - a guided tour of some of the most important files needed for booting Linux. GRUB's Main Menu. - the GRUB menu that you normally see at boot time. GRUB's Command Line Interface. - GRUB can function as a miniature operating system. Temporarily Edit the GRUB Menu. - how to edit your GRUB menu commands 'on the fly'. Using the GNU/GRUB shell. - GRUB as a program when the operating system is running. memtest86+. -it isn't really part of GRUB but it's accessed from the GRUB menu and I like it. Customizing Your GRUB Menu. - Edit your /boot/grub/menu.lst file, personalize your GRUB. How to make a dedicated GRUB partition.- contains only GRUB, no other files are required. How to make a separate /boot partition.-contains the Linux kernel, initrd.img and GRUB files. How to add GRUB to your USB thumb drive. - GRUB in a USB stick makes a great pet. How to make your own personalized GRUB Floppy Disk. - you can play with it and have fun. How to make your own personalized GRUB CD-RW. - portable - boots in almost any computer. Re-install GRUB with a GRUB shell. - re-install GRUB from anywhere to anywhere with anything. Re-install GRUB....................................with the Alternate CD in Rescue mode. How to back up and restore your MBR. - with a dd command from a live CD.
|
| LINKS The Linux Boot Process - a summary of what is supposed to happen before the login prompt Here's the link to GNU GRUB's homepage. Here's a link to the GNU/GRUB manual, it has lots of good information in it you can refer to. Also, here is GNU GRUB FAQ Here are some more links to some other great websites about GNU/GRUB, GNU GRUB Wikipedia, Grub Grotto by Steve Litt, GRUB tips and tricks by Jeremy Turner, Boot with GRUB by Wayne Marshall, Linux Journal. |
Orientation Here's where to find some important files to do with booting.I'm assuming you have Ubuntu or a similar Linux operating system up and running and you're just sitting there staring at your desktop. To start this tour, you go 'Places'-->'Home Folder', and then look for the 'Up' arrow two times to go up two levels in the file system, to the top of our directory tree. This what we call the 'root' of our file system. It's the big main directory (folder) that contains all the rest of them. Very often the forward slash: / , is used for short, to indicate the root file system, instead of typing out the word 'root' every time. Besides, there's also a directory there called: /root , and we don't want to confuse anybody.
In the top row of folders there's the /boot directory, we'll look inside that in a minute. While we're here, notice the two files in the bottom row? Those are 'symlinks', (shortcuts), to the Linux kernel and initrd.img files. Sometimes we use those for booting with when we don't know the exact name and location of the kernel and initrd.img. When, you open the /boot directory it should look something like the illustration below. ![]() The files called vmlinuz-2.6.12-9-386 and initrd.img-2.6.12-9-386 are the Linux kernel and the matching initrd.img that belongs with it. The Linux kernel is the nucleus of the operating system. GRUB needs to be able to load this kernel into the computer's memory to boot the system. Read more about the Linux kernel: The Linux Kernel (tldp.org, David A Rusling). The initrd.img helps the kernel get started, it's something like a road map of the file system or maybe more like a miniature model of it that the kernel loads until it is able to load the real file system. Read more: initrd (Wikipedia). The initrd and the kernel are a matched pair, we always have an initrd with the same numbers after it's name as the kernel it belongs to. /sbin/init - very important, (but not shown here), init is a program that is vital for booting. It's the first thing the kernel runs, init runs other scripts needed for booting including /etc/rc scripts. Here are two links about init, Replacing init with Upstart - linux.com, and Ubuntu's Upstart event-based init daemon - linux.com See the folder named 'grub'? Open that one now... ![]() And here's a look at what you should see inside your /boot/grub directory. These files are your important GRUB files needed for booting your Linux kernel. GRUB's stage1 file is a copy of the one that gets installed in the MBR, (sector 0 of any hard disk). This file is 512 bytes in size, the size of one sector. I don't know why it's 512 bytes. The MBR is 512 bytes in size, but 64 bytes are reserved for the partition table, 2 bytes for the 55 aa bootable disk flag, plus there's the 'Disk signature', which GRUB preserves, and possibly some other bits and pieces of code that has to avoid being trampled. The bootloader code has to be far less than 446 bytes to fit in the MBR. There are six of the stage1_5 files to choose from. Those are the files that GRUB installs to the next twenty-one sectors of the first track of the hard disk, right after the MBR. The jobs of GRUB's stage1 and (optional) stage 1_5 files are just to 'point to' GRUB's stage2 file in a file system somewhere in a hard disk partition, or if they can't, print an error message. GRUB's stage1 can also (or instead), be installed to the first sector of a partition, (called a boot sector). In that case the stage1_5 doesn't go with it, (except if the partition is formatted with ReiserFS). GRUB's stage2 file can be seen in the above screencap. The stage2 file is the main part of GRUB. That's the big GRUB file that does all the heavy lifting to get the kernel loaded into the computer's memory and boot it. The stage2 file I have is 108 KB, according to the output from the command 'ls -lhS /boot/grub', in my terminal. That's by far the largest file in this directory. Please read this brief and excellent link about GRUB's stage1, stage1_5 and stage2 files: Grub's stage2 file refers to our /boot/grub/menu.lst file for instructions to bring up our GRUB Menu for us at boot-up which offers us a list of operating systems to choose from. NOTE: That's 'menu.lst', with an 'L', not a '1', it's short for 'menu.list', not 'menu.first', (a common newbie mistake, I got caught with that one myself when I was new here, (LOL)). When we select an operating system we want to boot from our GRUB menu, we're really selecting the list of commands in our menu.lst file pertaining to that operating system. The stage2 file then uses those commands and goes into action to boot it. That's why the /boot/grub/menu.lst file is the most interesting of GRUB's files for most of us. It's GRUB's 'configuration file'. That's the one that we can edit to change our GRUB settings order to get your computer booting exactly the way we want. Another file in there that's interesting to people whose computers have more than one hard disk, is the /boot/grub/device.map file. That one shows us which hard disk GRUB thinks is our first hard disk and which hard disk GRUB thinks is our second hard disk and so on. You can't just open your /boot/grub/menu.lst file and change it and expect to be able to save the changes. That won't work in Ubuntu because of the Linux file permissions (security settings). We can edit our /boot/grub/menu.lst file if we open it from the command line. Open your terminal, go 'Applications'-->'Accessories'-->'Terminal' and either copy the command I used out of the code box below and paste it in yours or type it yourself if you prefer. Don't include the 'herman@bookpc:~$' part though, only the command after it. If you're typing your own command out by hand, make sure you realize that's an 'L' for 'list', not a '1' in the filename: menu.lst. New users often find that a little confusing. Actually, you can use 'tab completion' instead of typing entire commands. Just type the first two or three letters of the file name or command, then press your 'tab' key. Most of the time the terminal will guess correctly what it is you want to type and finish it for you. Code:
We always make a backup copy, especially the first time we edit any important configuration file. If you ever need to restore your /boot/grub/menu.lst file, just reverse the command, Code:
Now we'll open the file, Code:
After typing your password in, the menu.lst text file will open in your monitor. |
Customizing your GRUB Menu by editing GRUB's menu.lst fileYou can make your computer temporarily unbootable if you make a mistake editing your /boot/grub/menu.lst file. Don't let that scare you though, editing your /boot/grub/menu.lst file is fun. It's a bit like learning how to ride a bicycle though, you might 'fall off' a few times at first. It's interesting and educational to play with the commands in GRUB's menu.lst file. For some people it will be their first introduction to computer programming. Don't worry, it's easy. I'll show you what to do.
Below here is an example /boot/grub/menu.lst file. It contains most of GRUB's commands in roughly the order you'll see them appearing in your own /boot/grub/menu.lst files. I have hyperlinked each command so that you can click on each one to take you to an explanation about what each command does and how to use it. |
| # menu.lst - See: grub(8), info grub, update-grub(8) # grub-install(8), grub-floppy(8), # grub-md5-crypt, /usr/share/doc/grub # and /usr/share/doc/grub-doc/. ## default num # Set the default entry to the entry number NUM. Numbering starts from 0, and # the entry number 0 is the default if the command is not used. # # You can specify 'saved' instead of a number. In this case, the default entry # is the entry saved with the command 'savedefault'. # WARNING: If you are using dmraid do not change this entry to 'saved' or your # array will desync and will not let you boot your system. default 0 #fallback 5 6 7 8## timeout sec # Set a timeout, in SEC seconds, before automatically booting the default entry # (normally the first entry defined). timeout 10 ## hiddenmenu # Hides the menu by default (press ESC to see the menu) #hiddenmenu # Pretty colours #color cyan/blue white/blue splashimage=(hd0,1)/boot/grub/Ubuntusplash.xpm.gz foreground ffe4b5 background f4a460 ## password ['--md5'] passwd # If used in the first section of a menu file, disable all interactive editing # control (menu entry editor and command-line) and entries protected by the # command 'lock' # e.g. password topsecret # password --md5 $1$gLhU0/$aW78kHK1QfV3P2b2znUoe/ # password topsecret # # examples # # title Windows 95/98/NT/2000 # root (hd0,0) # makeactive # chainloader +1 # # title Linux # root (hd0,1) # kernel /vmlinuz root=/dev/hda2 ro # # # Put static boot stanzas before and/or after AUTOMAGIC KERNEL LIST ### BEGIN AUTOMAGIC KERNELS LIST ## lines between the AUTOMAGIC KERNELS LIST markers will be modified ## by the debian update-grub script except for the default options below ## DO NOT UNCOMMENT THEM, Just edit them to your needs ## ## Start Default Options ## ## default kernel options ## default kernel options for automagic boot options ## If you want special options for specific kernels use kopt_x_y_z ## where x.y.z is kernel version. Minor versions can be omitted. ## e.g. kopt=root=/dev/hda1 ro ## kopt_2_6_8=root=/dev/hdc1 ro ## kopt_2_6_8_2_686=root=/dev/hdc2 ro # kopt=root=UUID=fe7bf845-7ce9-4733-b6de-f70f2b62076d ro ## default grub root device ## e.g. groot=(hd0,0) # groot=fe7bf845-7ce9-4733-b6de-f70f2b62076d ## should update-grub create alternative automagic boot options ## e.g. alternative=true ## alternative=false # alternative=true ## should update-grub lock alternative automagic boot options ## e.g. lockalternative=true ## lockalternative=false # lockalternative=false ## additional options to use with the default boot option, but not with the ## alternatives ## e.g. defoptions=vga=791 resume=/dev/hda5 # defoptions=quiet splash ## should update-grub lock old automagic boot options ## e.g. lockold=false ## lockold=true # lockold=false ## Xen hypervisor options to use with the default Xen boot option # xenhopt= ## Xen Linux kernel options to use with the default Xen boot option # xenkopt=console=tty0 ## altoption boot targets option ## multiple altoptions lines are allowed ## e.g. altoptions=(extra menu suffix) extra boot options ## altoptions=(recovery) single # altoptions=(recovery mode) single ## controls how many kernels should be put into the menu.lst ## only counts the first occurence of a kernel, not the ## alternative kernel options ## e.g. howmany=all ## howmany=7 # howmany=all ## should update-grub create memtest86 boot option ## e.g. memtest86=true ## memtest86=false # memtest86=true ## should update-grub adjust the value of the default booted system ## can be true or false # updatedefaultentry=false ## ## End Default Options ## title Ubuntu, kernel 2.6.20-15-generic uuid fe7bf845-7ce9-4733-b6de-f70f2b62076d kernel /boot/vmlinuz-2.6.20-15-generic root=UUID=fe7bf845-7ce9-4733-b6de-f70f2b62076d ro quiet splash initrd /boot/initrd.img-2.6.20-15-generic quiet savedefault title Ubuntu, kernel 2.6.20-15-generic (recovery mode) uuid fe7bf845-7ce9-4733-b6de-f70f2b62076d kernel /boot/vmlinuz-2.6.20-15-generic root=UUID=fe7bf845-7ce9-4733-b6de-f70f2b62076d ro single initrd /boot/initrd.img-2.6.20-15-generic title Ubuntu, memtest86+ uuid fe7bf845-7ce9-4733-b6de-f70f2b62076d kernel /boot/memtest86+.bin quiet ### END DEBIAN AUTOMAGIC KERNELS LIST # This is a divider, added to separate the menu items below from the Debian # ones. title Other operating systems: root # This entry automatically added by the Debian installer for a non-linux OS # on /dev/sda1 title Microsoft Windows XP Home Edition root (hd0,0) savedefault makeactive chainloader +1 # This entry automatically added by the Debian installer for a non-linux OS # on /dev/sdb1 title Windows 95/98/Me root (hd1,0) savedefault makeactive map (hd0) (hd1) map (hd1) (hd0) chainloader +1 ############################################################### # Additional GRUB tricks for fun, security, and convenience # below here are some lesser known commands some (silly)? ideas # added by me - these are not part of your stardard menu.lst # (you can try them out if you like) ############################################################### title Pretty colours color cyan/blue white/blue title Matrix color green/black blink-light-green/green title Green and Gold color black/green yellow/black title Leonardo Watermelon color black/magenta white/red title Your Boot Message Title Here cat (hd0,1)/boot/grub/bootmessage pause End of Boot Message, Press any key. title Windows Security Check root (hd0) cmp 63+1 24306344+1 title Reboot reboot title HALT! halt |
fig 7 grub
Above here is an example of a /boot/grub/menu.lst file. It should be fairly typical for a dual boot computer with one hard disk. (Except for a few lines I added at the bottom for fun). It might look a little scary to a new user when you see it all in one big piece like this. Below here I will be showing snippets of this beginning from the top and working our way down. I will point out the parts that can be edited by the user and comment on how to do so. How to Change the Default - set which operating system you want booted by the timer
The number after the default command sets which operating boots by default when the countdown timer reaches 0 if no keys are pressed on the keyboard. For dual booting with certain operating systems that seem to require rebooting very often, it can be a real pain in the neck after a while to have to be there and manually intervene every time the computer reboots. There are three possible ways to set this, choose the one you like best,
You can cut the entire Windows entry from where it is under the end of the automagic kernels list and paste it above the beginning of the automagic kernels list. Above this line: ### BEGIN AUTOMAGIC KERNELS LIST
What NOT to do- don't
paste your Windows entry anywhere inside the automagic kernels list
because it will be deleted when you have a kernel update in Ubuntu.2) edit the number for the operating system entry to be booted (by the timer) This little line controls which operating system boots by default, Ubuntu or some other operating system entry like another Linux, or Windows. If you really want to have some other operating system booting first by default, you need to have a look at the bottom section of your menu.lst file at the operating system entries. Ubuntu is entry number 0 because the GRUB numbering system begins counting from 0. (From the top of the list,counting down). To see the area I'm referring to, look at either, Count down from the top, (from just below where it says '## End Default Options ##'). Begin counting with the number 0, the number of entries containing the word 'title'. You don't count the entries the are 'hashed out' (with a # in front of them, skip those). Stop counting when you reach the Windows entry, and that number you end up with will be the right number to replace the number 0 with after the word 'default'. In this example, it will be the number 4 which you would use in place of the 0 after the word 'default' to cause Windows to boot by default. That would most likely be true for the majority of standard dual boot installations. Windows is behind the fifth appearance of the word 'title'. Don't forget, you start counting from the number 0. So it's not 1,2,3..., it's 0,1,2,3..., okay? Count each time the word 'title' appears and in this example you will see that Windows is number 4 (counting from 0). Don't be afraid to experiment if you aren't sure, this won't hurt anything if you don't get it right. All this setting does is make the highlight rectangle in the GRUB menu appear on a different line, that's all. You can easily change that again if it turns out wrong. It's a safe line to edit. 3) Edit the number and type 'saved' there instead. Use this method if you want to avoid having to re-edit menu.lst when you have a new kernel added to the list during an update. (Thus changing the number that your default operating system is on the list). Rather than just replacing the number '0' in the line, 'default 0' with another number, you can type the word saved in place of the '0'. For example:
The highlight (selection) rectangle in your GRUB Menu will appear on that line again next time you reboot. The way this works is by use of the command 'savedefault', included in most GRUB operating system boot entries at the bottom of menu.lst. When we type 'saved' rather than a number here, after 'default', it causes GRUB to save that information to the /boot/grub/default file and refer to it next time we boot. Most people would be content with that, however, if even this isn't good enough for you, it is possible to take the idea one step further and make GRUB boot only one operating system by default. Here is how to trick GRUB to only remember one particular operating system entry. Just place a # (hash mark) in front of the 'savedefault' command in the other operating system entries (at the bottom of your menu.lst), that you do not want GRUB to remember. Then GRUB will only be able to remember (save) the operating system entry that does not have the # mark in front of the 'savedefault' command. 4) fallback
For this fallback command to work, you would need to delete the '#' (hash symbol). You would probably need to make up your own numbers to put after it too. The numbering protocol for the fallback command is the same as the 'default' command uses, (already explained above), (scroll up). When the fallback command is used, if the first booting entry, (number 5 in this example), fails for some reason, GRUB will read stanza number 6, (the seventh stanza), and run those commands instead. If that boot entry fails, GRUB will try the next boot entry, and so on. When the 'fallback' command is used, GRUB goes into 'unattended boot mode'. If GRUB encounter an error it wait for the user to do something, it just skips right ahead to the next boot entry. The trouble with that is, you aren't given an error message, so it's not a command that we would want to use all the time for every-day booting. The fallback command can be very useful if you are having problems booting some other operating system, (Windows or a different Linux), and you already know your GRUB Error message, but you're not quite sure of the exact solution to your problem. You can make a whole series of trial boot entries at the bottom of your menu.lst, each with different (hdx,y) numbers in them say for example. Using the fallback command, GRUB will run through the whole list, trying each boot entry until it finds the one that works and then boot the operating system. That can save you a lot of time. This avoids the need to keep rebooting a live CD or something and re-editing your menu.lst file, possibly numerous times. That can be a very time consuming process. How will you know which boot entry worked? You could insert the 'pause' command in each of your boot entries with a short message to inform you of which entry is which. That will stop GRUB at each entry until you read the message and press 'enter'. The 'pause' command puts GRUB back into 'interactive mode' again and that means you'll see any error messages too! The way I have it set up here, this command will only work for GRUB errors. Once operating system begins to boot it's out of GRUB's hands if anything goes wrong after that and it's too late for the fallback command to do anything. Instead, you can put the 'fallback' command in your individual operating system entries, see: Booting fallback systems - GNU GRUB Manual. Then the fallback command will even work when you have booting problems in the operating system. 4) Setting the timer for the boot loader is the next subject.
Following the word timeout above, you'll see the number 10. This sets the timer for the boot loader to boot the default operating system if no-one presses any buttons on the keyboard. We can delete the number 10, and in its place type in any number of seconds we'd prefer the timer to be set to. If we want the computer to boot without waiting so long we can set it to a lower number of seconds like maybe 3, 2 or even down to 1second. If you are also 'hiding' the GRUB menu, you will have 3, 2, or 1 second to press 'Esc' to show the menu. To make the GRUB menu wait longer, type a larger number in place of the 10. If we want to turn off the timer, so that we will have an infinite amount of time to admire our GRUB menu and ponder which operating system we might want to boot today, we just 'hash out' the whole line for the timer. To 'hash out' the line, we insert a # mark before the commands and this will cause the program to ignore the whole line. Then the GRUB menu will theoretically wait forever until you make a decision, select an operating system, and press enter. (Or until there's a power failure).
Hiding the GRUB menu during bootup
The word: hiddenmenu is a grub command. In computer programming, it is often a good idea to add a comment to advise people reading the program what is going on at certain points in the program. There are special symbols in various programming languages that are used to denote a comment. In the case of GRUB's menu.lst and many other files that we edit in Ubuntu, the # symbol is a sign that tells the computer that the words after it are to be treated as comment, and not a command. In other words, they are to be ignored (skipped) by the computer. # - Hides the menu by default (press ESC to see menu' is a good example of a comment. # hiddenmenu - is an example of a command that will be treated as a comment (ignored) for now. If we want the computer to pay attention to the hiddenmenu command and to hide the GRUB menu on start-up, we could 'uncomment' the line with the hiddenmenu command on it by deleting the # symbol. Then we will not see the GRUB menu when the computer boots from now on. Example:
With 'hiddenmenu' activated, they will just see a black screen with a small timer on it. If you want to make a good job of it, set the timer down to 1 or 2 seconds and set the grub menu to boot Windows by default. The black screen will be there and gone again before anyone has time to notice it. No-one would even guess that GRUB and Ubuntu were in the computer at all. When you want to boot into Ubuntu, press your 'esc' key during this 1 or 2 second count-down, to show the GRUB menu and select Ubuntu. Add some color to your GRUB menu
GRUB's color command changes the menu colors. The line for color can be uncommented ( delete the # ) and that will cause the GRUB menu that we see when the computer is starting up to appear in pretty colors, instead of just plain old black and white. The colors cyan/blue white/blue are only the defaults, (example colors). There are quite a few other colors you can use, and you can make up your own combinations. To do that, just delete the colors given there as an example and type or type or copy-paste in your own color combinations. An easy way to experiment with the different color combinations for your GRUB menu is to use GRUB's freindly Command Line. That's a lot easier than editing your menu.lst file and rebooting every time Press 'c' from the GRUB menu when your computer is booting to get GRUB's Command Line Interface. Type the word color as a command, followed by some colors you want to try. Syntax for the color command is : color normal [highlight] and the format of each heading is: foreground/background For example,
Press 'Enter', then press 'Esc' to go back to your menu and see what your GRUB menu looks like with the colors you're testing. Then press 'c' again and try some different colors, and so on until you decide on the colors you want. When you have decided on a combination you like, boot Ubuntu and edit your /boot/grub/menu.lst with your chosen colors.
Some of the color combinations I have tried are listed below. command font&border/panel hilited font/cursor (selection bar) color black/brown blink-yellow/black color black/green yellow/black color light-green/green blink-yellow/red color black/magenta white/red color white/red light-gray/black color light-gray/blue black/light-gray
NOTE: We cannot have a pretty color grub menu and also a splashimage simultaneously, we need to choose one or the other. Add a splashimage to the GRUB menu
You can customize your GRUB with a nice splashimage (picture) for your GRUB Menu. You can either find one you like that someone else has already made and downloading it from the internet, or even make your very own unique one with GIMP! If you want to have fun making your own splashimages, I have help on how to do that further down this page. Link: Making your own splashimage If you like any of my splashimages (below) and if you trust this site, you are welcome to download any of my splashimages shown here for free. Do so at your own risk. I am sure they are safe, I made these myself. (But I copied the canonical logos and colors, I hope that's okay).
When you have downloaded your splashimage and moved it or pasted it into your /home/username directory, you will need a 'sudo' command to copy it to your /boot/grub directory. Code:
Then you need to open your /boot/grub/menu.lst file with your text editor (gedit), also using a 'sudo' command, Code:
and insert a line similar to the following, Code:
Note: If you make a mistake in the splashimage line in menu.lst, it can cause you some temporary booting problems until you correct your mistake. You might need to boot with Grub's Command Line Interface or a Super GRUB Disk to get access to the menu.lst file again so you can correct it. Another way to get out of difficulty is to run a live cd such as Ubuntu Desktop, Knoppix, Puppy Linux or the like, and mount the Ubuntu partition and edit the file that way. Mount a Ubuntu ext3 or reiserfs filesystem rescue your Linux system with a Live CD It is not unusual for inexperienced new users or even careless old experienced users to have a few hiccups with getting the command right, but once you get it all done correctly you will have a nice splashimage showing behind your GRUB menu. Making your own splashimage The excellent instructions in the following link, http://ruslug.rutgers.edu/%7Emcgrof/grub-images/, will tell you how to do everything with splashimages. That's the original and best GRUB splashimage site. That's the one I got all my information from, and is well worth reading. The only problem with that site is that the instructions were written for Red Hat Linux and need to be altered a little bit to work for Ubuntu users. Experienced users will have no problems, but for the sake of new users I'll explain some it again here in Ubuntuese to make it easier. Overview: Due to the fact that the operating system will not have started yet at the time the GRUB splashimage will be displayed, the operating system's graphics drivers will not be in operation yet. Therefore we are just relying on the simpler video capabilities of the BIOS. Since most computer's BIOSes can't handle fancy, high quality images, we are limited to an image size of 640x480 pixels and a 14 color display, (unless your PC has some kind of special new BIOS). The file type used for the image file is .xpm, and it is then compressed. This used to be done by applying a gzip command. An easier way to gzip a file in Ubuntu nowadays is to right-click on it, and click 'Create Archive', from your right-click menu. Step 1: Pick out an image to turn into a GRUBsplash. Any image file you might have will do, it can be a digital art work you made yourself, or even a picture taken with your own digital camera. NOTE: Your picture will lose quality when you follow these steps. Some pictures (photos) and digital art works that look great beforehand will look horribly ugly after they are converted into GRUB splashes. Only a few actually look better, so you can expect to produce a lot of rejects. You will need to use trial and error, patience, luck and good judgment until you learn how to choose images that can be turned into good GRUBsplashes. I think the simplest images turn out looking the best, such as cartoons, cartoon characters on a plain solid background, or other kinds of digital art with sharp edges. Even just one or two words in a nice font on a plain or colored background will do fine. Because of the pixelation, scaley creatures like lizards and dragons or fish look good. Black and white photos can be good, and can even be color- tinted for extra effect. Step 2: Make a copy of the image and work on the copy, preserving the original in good condition so you can make another copy of it and try again if things go wrong. Never use your original image file. Step 3: Open the copy of your image with GIMP in Ubuntu, and scale and/or crop the copy of your image until it's 640x480 pixels. Step 4:Carefully examine your new image to see if it needs any editing, use GIMP to touch up any faults or flaws in your image.HINT: If you want to put some words in your splashimage in fancy text using GIMP, you should first look at 300+ Easily Installed Free Fonts for Ubuntu - Ubuntu Blog by Carthik Sharma, and follow the instructions there to install some beautiful fonts for your splashimage.Step 5:Go 'Image'-->'Mode'-->'Indexed', and set 14 colors as the Maximum number of colors, and set the 'color dithering' spinbox to 'None', and click 'OK'. Then go 'File'--> 'Save as' and make up your own filename. Be sure to add an .xpm filename extension after it, click 'save', and you're all done. It's that easy! For example, you might name it something like: bestgrubsplash.xpm Any name will do as long as it has .xpm after it. Step 6: gzip your 640x480 pixel, 14 color .xpm image made with GIMP, here's the command I used to use to gzip mine, you should be able to use a similar command for yours, whatever it's name is, code:
Actually, nowadays you don't really need to use the command line for this job anymore. An easier way to gzip a file in Ubuntu these days is to right-click on it, and click 'Create Archive', from your right-click menu, then select .gz in the right-hand spinbox, and click 'create'. Step 7: Copy your .xpm.gz file to your /boot/grub directory. You can actually leave your splashimage anywhere, even in your /home/username directory, as long as you type the correct file path for it into your menu.lst file. If you do leave it in your /home/username directory just remember not to accidentally delete, move or rename it. To avoid the chances of that happening it is probably best to copy it to your /boot/grub directory. You definitely do need to use the command line for that, code:
Step 8: Edit your operating system's /boot/grub/menu.lst file with a line to make your GRUB open and display your splashimage at boot time. I already showed you how to do that at the start of this topic, go back. EXTRA TIPS: To look at your splashimages without taking the time and effort to edit your menu.lst file with each one and re-boot each time, you can load them with CLI mode GRUB when you are booting up. Just press your 'c' key for GRUB's Command Line. Then, type something similar to the following, Code:
Then press 'esc' to return to your GRUB menu to see how it looks. When finished, press 'c' again to return to the command line interface. Type the path and filename of another GRUBsplash you want to look at and press 'Enter'. Then press 'esc' to return to your GRUB menu to see how it looks. And so on... NOTE: pretty color must be disabled (hashed out) in your GRUB menu or your splashimage will refuse to display. If you have problems, check and make sure you have your color lines all hashed out in your /boot/grub/menu.lst file. We can however, change the colors of the foreground, background and border for the splashimage. This can be very effective to compliment and show off an already good splashimage and make the finished job look superb! I highly recommend reading and trying out the instructions in the next article right below here on setting the foreground, background and border colors! Setting the foreground, background and border colors for your GRUB menu. The following several commands only work in graphics mode GRUB (when you are using a splashimage). See 'pretty color' if you aren't using a splashimage. We can use the commands 'foreground', 'background' and 'border' to specify the colors of the parts of our GRUB display that show up along with our splashimage. 'foreground' means the color of the main upper left faces of all letters and the big text rectangle that has all our operating system titles in it in our GRUB menu. 'background' sets the colors used in the lower-right 'shadowing' for all the letters and the big rectangle around our operating system titles and most importantly the hilite (selection) bar that we shift up or down with our arrow keys to select an operating system to boot. 'border' gives us a chance to set a color for any parts of the screen not used by the GRUB menu. In my computer I'm using 640x480 GRUB splashes that nearly fill the entire screen. There is a column on the left that shows up and a thin line across the bottom of the monitor that shows up if I set a 'border' color that is different from my splashimage. I could leave the border color black or pick a color that will blend in with the splashimage or one that will show up if I want that effect. I imagine if I use a smaller sized splashimage the border will show more. You can pick any colors out of the sixteen color chart here in this sixteen color chart to begin with, but probably you'll want to use a 256 color chart instead ,that would be even better,
For example these can be applied something like this,
That gives me 'moccasin' lettering with 'sandy brown' shadowing and selection bar over my nice chocolate and tan Ubuntusplash. I chose yellow, ffff00 and maroon 800000 with my Aboriginal flag splashimage. The 'shade' command toggles the shadows to the right-lower side of the rectangle and font. shade 0 turns off the shadow effect shade 1 turns on the font shadows So with this command you can now choose whether you want to see the font shadows or not. You can also use these commands from GRUB's Command Line Interface (CLI) while you are booting up to try out all the colors you like and see what they look like. Just press 'c' from your GRUB menu for a command line and use the same commands to change the colors as you please, then press 'Esc' to go back to your GRUB menu to see how it looks. You can do that as many times as you like until you have a combination you are happy with. viewport If you have a nice splashimage but the rectangle in the GRUB menu that the operating system titles are printed in happens to be in the way of an important part of the picture, you can either make a new splashimage with the subject of the picture in a different spot, or you can move that rectangle. The rectangle can be moved around somewhat and made larger or smaller too. GRUB's viewport command is for controlling the position and size of the rectangle that the text fits inside in the GRUB Menu when we use a splashimage. (only available in Graphics mode). for example, viewport 0 0 66 16 gives a small rectangle in the upper left of the screen. for example, viewport 3 3 80 30 means you will have the largest rectangle in the middle of the screen for example, viewport 11 6 80 30 gives you a large rectangle in the lower right of the screen I couldn't get it to accept any numbers for a small rectangle in the lower right though, sorry. You may be able to experiment at the command line like I did until you get the results you want. The syntax for viewport is like this, viewport x0 y0 x1 y1 The numbers seem to range between, viewport 0-11 0-6 66-80 16-30 x0 sets the left-right positioning for the left side of the rectangle. In my tests the smallest number I could set for this parameter was 0 and the largest was 11, although sometimes a number less than 11 had to be settled for, depending on the other parameters. y0 sets the up and down position for the rectangle. 0 entered here makes the rectangle appear as close as possible to the top of the monitor. The number 6 was the largest number I could get it to accept, which made the rectangle lower. x1 can be in the range from 66-80 and sets the width of the rectangle. y1 can be a number in the range between 16 and 30 and sets the height for the rectangle. This command can also be run from GRUB's Command Line Interface to experiment with it until you get your viewport right for your splashimage. After that you can add it to your /boot/grub/menu.lst somewhere around your splashimage command. You should experiment with these commands at GRUB's Command Line Interface (CLI) while you are booting up to try out all the parameters until you get the viewport how you like it before adding it to your menu.lst file. Just press 'c' from your GRUB menu for a command line and use the viewport command to change the rectangle as you please, then press 'Esc' to go back to your GRUB menu to see how it looks. You can do that as many times as you like until you have a combination you are happy with. Set a GRUB password
Here's a Ubuntu Web Forums link by HungSquirrel, HOWTO: Password protect your GRUB entries. Here is a link to the Feisty Starter Guide too, 1.19.2 How to disable all interactive editing control for GRUB menu. So, if you have read those links, you probably understand that you should:
It will help to keep casual 'snoops' out, and it will probably be enough to slow down an ordinary spy. Sometimes if you can slow someone down, that's enough to deter them, they may be afraid of being seen by surveilance cameras or being caught by someone enexpectedly entering the room. If you're up against a more determined type of spy though, or if you have information that's valuable or confidential, you should look into some better security arrangements, such as an encrypted file system at least. For further reading see: Ubuntu Security - by bodhi.zazen Examples
It's just to show you a couple of examples of how an operating system entry should look. The line at the bottom of this table is to let people know that they should put operating system entries that are 'static' (in other words, ones that are not to be automagically updated), either above the start of the automagic kernels list or after it, but not in it. You can paste your Windows entry here if you want Windows to be first in the list and boot by default. Your Windows entry to be automagically deleted every time Ubuntu is updated with a new kernel if you paste it anywhere between the beginning and the end of the debian automagic kernels list. (Well, it shouldn't have been there in the first place). Many users don't understand that and blame GRUB or Ubuntu for their problems.
Other Operating System Entries
Other operating system entries are normally added here, below the end of the Debian Automagic Kernels list, or else above the start of the Debian Automagic Kernels list. These can include boot entries for foreign operating systems such as certain 'proprietary' systems and/or additional installations of Ubuntu and other GNU/Linux distros.
|
Ubuntu Operating System Entries title
uuid
Your /boot partition is defined as the partition your linux kernel resides in. The uuid command replaced the old 'root' command, which used to need a partition number after it, such as (hd0,1) or something like that. Sometimes if there was more than one kind of disk it could be confusing which kind of disks should be numbered first. Some computers number the IDE drives first, followed by the SATA drives, and if there's a USB drive plugged in, it will be numbered last. Unfortunately for GRUB, not all computers are made the same when it comes to numbering different kinds of discs, and they don't always send a clear signal to GRUB about their intentions. The uuid command solves a lot of problems, now GRUB is much better at finding the right device. You can also use the 'uuid' command from GRUB's Command Line Interface to get a list of file system UUID numbers 'on the fly' and then boot, For example,
kernel
The path and name of the linux kernel must be in the line following the kernel command. There must be no spelling mistakes or syntax errors. One miniscule mistake and your operating system won't boot. In times of olde, this had to be typed in by hand after every kernel update. Now we have the debian automagic kernels list and the update-grub script to write our new menu.lst when we are given a new linux kernel. If you do ever need to edit this line for any reason, just be careful. (It's easy to fix again though). The 'root=' command is followed by the UUID number for your operating system's 'root' partition. The 'root' partition is defined as the partition which contains the operating system's /sbin/init file. After that come 'kernel options', where you tell GRUB how to handle the kernel if you want it loaded a special way. Another way to get a list of these UUID numbers in case you ever need to know that to edit your menu.lst file is to boot your Ubuntu 'Desktop' Install/LiveCD and run the command 'blkid', or 'sudo blkid', For example: You may need to use the numbers listed by the 'blkid' command to edit your /boot/grub/menu.lst file.
You can easily set your own file system labels with Parted Magic or GParted LiveCD, or Gnome Partition Editor in your Ubuntu Live CD. You may also want to refer to this website's File Systems and Mounting Page for more info on setting file system labels. initrd
In the line following the initrd command, you need to have the exact path and filename of the initrd.img that matches the kernel you're going to boot. savedefault
The 'savedefault' command isn't important, you can boot just as well without it. It's only used if you type the word 'saved', after the 'default' command, up around the top of your menu.lst file, default. recovery mode
When you boot into recovery mode your computer will boot up without the splash screen that hides all the text the kernel prints out us as it is booting. If it stops booting half way somewhere and gets stuck, you can at least see what stage it stopped at, and that might help you diagnose the problem. Hopefully it'll boot all the way though, and when it does, you'll be offered a menu. You can,
Hide items in the GRUB Menu
Here's an example thread about that, Grub menu.lst shows 2 Linux kernels Sometimes, we end up with a big long list of old kernel entries that we're never going to use. You probably don't need to see all of those entries every time your computer boots. They can get in the way of other boot options at the bottom of the list that we might want to see without scrolling, and our menu.lst file will get messy.
I'm more adventurous, and I normally just delete the lines for them from my menu.lst file completely, I can always find them again by searching for them with GRUB's Command Line Interface if I ever need any of them. If you don't like having old kernel entries left in your boot menu at all in the first place, you can limit the number of kernel entries that show up here by using the # howmany=all setting in the automagic kernels default options section. That's all most people need to do, especially if you have enough room on your hard disk. It's easiest and probably best to just leave old retired kernels and initrd.img files alone and let them remain in the file system just in case we might ever need them again for any reason. If you have Ubuntu installed in a very small hard disk or a USB flash memory drive and you're cramped for disk space though, you can remove old kernels by uninstalling them with Synaptic Package Manager. Sometimes people with a separate /boot partition run out of room in their /boot partition and might need to uninstall a few old kernels. Old kernels don't take up very much hard disk space, when you add on the initrd.img files that are supplied with them do take up some. A typical kernel for Ubuntu is a little too big to fit on a floppy disk, but the initrd.img file is a quite a bit larger. You can use ' ls -lhS /boot ' if you want to see for yourself. For example,
Here are a few links about how to uninstall old kernels, if you have to, Remove Ubuntu Kernels You Don't Need - Tombuntu, Removing Those Extra Kernels in Ubuntu -Alter Ego, How to: Linux delete or remove kernel - Nixcraft, and, Remove Old Kernel From Ubuntu - Lahiru Sandakith’s Web Log. Once again, it is probably not worth the time and effort for most people who have normal sized hard disks to bother uninstalling old kernels. Only someone running Ubuntu in a flash memory device or very in a very small hard disk would probably feel the need to do that. memtest86+
We can run the memory test when a computer behaves strangely and won't boot. A memory test can be very useful to find out if a memory module could be faulty, memtest 86 + |
Windows Operating System Entries
Windows normally has its entry placed at the bottom, it should not be
included in the automagic list. The divider at the bottom of the
automagic kernels list is there to protect the Windows entry from being
automagically deleted when the automagic kernels list updates itself.
These commands are: title The title command means the words on the line after it will be displayed as a boot option in your GRUB menu. You can replace the words on that line with anything you like and your computer will still boot up okay. You'll just see a different message in your GRUB menu. root or rootnoverify I'm not being rude, (LOL) . The 'root' command tells GRUB what hard disk and partition it is supposed to find for you. The numbers ands letters following the 'root' command describe your hard drive and partition location in GRUB notation, like '(hd0,0)' for example. That's H D zero zero. There's no such thing as a 'drive C:\' to GRUB, or to Linux either for that matter. You might as well pin a tail on a donkey as talk about drive C:\ because the term is completely devoid of meaning except to describe partitions relative to the particular Windows installation you're getting the description from. If you have several Windows installations in in primary partitions the same hard disk, every one of them will think that it is the one that's in 'drive C:\'. Don't bother trying to describe your booting problem in a Linux forum by using Windows terms like drive letters. (LOL). We need to know in Linuxese, like: '/dev/sda1', or in GRUB-speak, like: '(hd0,0)'. Here's a link to a table for converting between Linux and GRUB notation, A Quick Guide to GRUB's Numbering System. If you have your Windows partition formatted with the FAT32 file system, it is recognized by GRUB and GRUB can 'read' it, so you can use the 'root' command. If you have your Windows partition formatted with the NTFS file system, you might still be able to use the 'root' command, but it has been known to cause error messages. The NTFS file system is not supported by GRUB. If you have NTFS, it's more proper to use the 'rootnoverify' command instead. That still tells GRUB which partition you want to find, but tells GRUB not to bother to looking at the file system. GRUB really only needs the location of the boot sector anyway, which is the first sector of the partition, and that comes before the beginning of the file system controlled area. savedefault The 'savedefault' command is an important command for Windows users who are dual booting with Linux. Windows is an operating system that has the annoying habit of wanting to be rebooted all the time, at every little hiccup. Gah! (I hate that!). Anyway, if you must use Windows, you can ease your pain a little bit by editing the 'default' setting, which is up near the top of the /boot/grub/menu.lst file. Here's a link, default. The presence of the 'savedefault' command here enables the setting 'saved' to be useful after the 'default' command, and that's a very good way to set your GRUB menu up for Windows users. That way, GRUB will remember which operating system you booted last time and will automatically keep on booting the same one until told otherwise. makeactive Most Windows operating systems can't boot without the 'boot flag'. (I am told that some can). The 'makeactive' command will try to set the 'boot flag' or 'active flag' in the partition table on the Windows partition that you want to boot. The 'makeactive' command is mainly needed when there are two or Windows installations in primary partitions in the same hard disk. If you only have one Windows installation, the 'makeactive' command is just there to make sure, but it really shouldn't be needed. GRUB's 'makeactive' command only works for primary partitions, so if you have Windows in a logical partition, you need to delete the 'makeactive' command and set the 'boot flag' on the partition with a partition editor instead. If GRUB tries to do it, it will error out and fail to boot your operating system. chainloader +1 GRUB's 'chainloader' command is special because it loads whichever boot sector the earlier 'root' command directed GRUB's attention to. In simple words, GRUB boots the Windows boot loader by its boot sector, which then boots Windows. Windows calls the first sector of it's partition a 'boot sector', and it cannot be booted (easily) without it . The boot sector contains Windows boot loader code which leads to the Windows boot loader, and thus hands over the task of booting to Windows's own boot loader. GRUB doesn't actually boot Windows at all, it only acts as a 'boot manager', and relays the signal to boot up. Trouble booting Windows If you run into trouble booting Windows caused by GRUB and you need Windows in an emergency, you can use Super Grub Disk to help you boot Windows. Super Grub Disk Page. If you run into trouble booting Windows and you need Windows in an emergency, and GRUB is booting your Windows boot loader but your Windows boot loader can't boot Windows, the best thing to do first is run a file system check. You can do that by booting your the Windows XP Recovery Console, and running CHKDSK /R. If you still can't boot, Microsoft has a link that might help you. It tells you how to make your own Windows NTLDR boot floppy disk for Windows XP or earlier, with NTLDR, NTdetect.com, and an editable copy of boot.ini in it. How to create your own boot disk for Windows XP. That will bypass both your MBR and boot sector, (in case those are damaged or misconfigured), and boot your Windows XP regardless of whether the three vital boot files are missing or corrupted. So it's a very powerful tool! Unfortunately, it's only good if your computer has a floppy drive though. Here's a better link, How to fix: NTLDR is missing, press any key to restart. - Tiney Empire, from that site you can download an NTLDR CD, floppy or USB files already made for you with a generic version of boot.ini that will boot your Windows almost no matter what!Vista users, here is another useful link: Windows Vista Recovery Disc Download - Neosmart.net, thanks lswest for the link. Thanks for the download to Computer Guru, of NeoSmart Technologies (the developer of EasyBCD). When you have time, take note of the error message you had and go to the Trouble Shooting section of this web page. There, you can look for your error message and hopefully learn how to fix it. You can also go and get help at Ubuntu Web Forums, especially if your problem is somehow related to your having installed Ubuntu in your computer. Entries that sometimes need to be corrected for grub to boot Windows. Chainloading Windows on a non-first hard disk code:
GRUB's 'map' commands make it easier when you have Windows in a non-first hard disk, (the second, third, or fourth ... hard disk, and you want to boot Windows from GRUB without the need to go and edit boot.ini, or whatever configuration file your Windows system uses. Since GRUB numbers everything by counting up from zero, (hd0) means your first hard disk and (hd1) is short for your second hard disk, (hd2) is for third hard disk, and so on ...
The 'map' commands mean GRUB will confuse Windows with a quick 'pea and shell' game, and then tell Windows it's in the first hard disk. Windows will believe that and will behave itself and boot up properly then. People wanting to dual boot with two (or more) hard disks should read this great thread and links provided from it on the subject in Ubuntu Web Forums. Thanks confused57 and lha,catlett and all participants for the information in these threads. Dualboot Two Hard Drives Here is is a post by lha about how to install Ubuntu with Windows in a computer with two hard disks without overwriting the IPL for the Windows boot loader in the first hard disk's MBR. If you feel comfortable with reaching inside your computer and unplugging your hard disks physically and changing jumper settings around then possibly this idea would suit you. This is a very good method if there is an extra hard disk available. Particularly note post #6. More than one Windows on the same disk
The hide commands don't work for Vista, but they work well for all other Windows: Windows XP, Windows 2000, WIndows 98, Windows 95, and so on. Windows has a big problem with setting up a dual boot. If you have a Windows operating system already on your hard disk, and you add another Windows, the older installation will become the 'boot partition' for the newer installation. What that means is, the vital boot loader files, NTLDR, NTdetect.com, and boot.ini will be copied out of the new installation, and into the old installation. The new installation will be installed in a logical partition instead of a primary partition. Crazy! That's called a 'Microsoft default dual boot' setup. The first big problem with that is you we not warned about it. Secondly, the vital boot loader files are in the older, and weaker, operating system. Quite often people delete their old Windows 98 say for example, to install Ubuntu dual boot with Windows XP and XP won't boot. WHY? Because they weren't aware that they deleted their boot loader files when they deleted Windows 98! The same thing still happens with Windows XP and Vista. If you want to install more than one Windows in the same hard disk, do it the right way, use GRUB. You use GRUB's 'hide' command to change your partition table so the new Windows won't recognize your previous, existing Window installation. The new installation will go in as per normal, and it will retain it's vital boot loader files. Now when you want to boot your old Windows, you 'unhide' it, and 'hide' the new one. When you want to boot your new Windows, you 'hide' your old one, and 'unhide the new installation. This makes your two Windows installations independent of one another. That's a much smarter way to do things, the last thing you want is to have both of operating systems go at once because one was Dependant on the other to boot through. There's a nice website explaining all this much better then I can, read this link, Understanding MultiBooting and Booting Windows from an Extended Partition. The hide commands don't work for Vista, so you'll need to unplug the other hard disk(s) and install Vista by itself. If you did make a mistake and delete your Microsoft 'boot partition', you might need a special boot CD or floppy disk to boot Windows with for now until you can fix the problem. Microsoft has a link that might help you, it tells you how to make your own Windows NTLDR boot floppy disk for Windows XP or earlier, with NTLDR, NTdetect.com, and an editable copy of boot.ini in it. How to create your own boot disk for Windows XP. That will bypass both your MBR and boot sector, (in case those are damaged or misconfigured), and boot your Windows XP regardless of whether the three vital boot files are missing or corrupted. So it's a very powerful tool! Unfortunately, it's only good if your computer has a floppy drive though. Here's a better link, How to fix: NTLDR is missing, press any key to restart. - Tiney Empire, from that site you can download an NTLDR CD, floppy or USB files already made for you with a generic version of boot.ini that will boot your Windows almost no matter what!Vista users, here is another useful link: Windows Vista Recovery Disc Download - Neosmart.net, thanks lswest for the link. Thanks for the download to Computer Guru, of NeoSmart Technologies (the developer of EasyBCD). Consult the GNU GRUB manual or get help at Ubuntu Web Forums if you still have problems. |
| Operating System Entries for Multiple Booting Linux Systems Here are some tips about the best way to use Ubuntu's GRUB menu for booting more Linux distributions in the same computer if you want to multiple-boot. A few people like to do that so they can test the latest pre-release version of Ubuntu or to try out other Linux distros just for fun. We can use the GRUB Menu from our Ubuntu operating systems to boot as many other Ubuntu or other Linux systems as we like. If there are already other operating systems in the computer when Ubuntu is installed they will be automatically added to the GRUB menu of the new Ubuntu installation. That suits most people fine, and works well enough for a while. The only problem is the type of commands Ubuntu uses in it's GRUB menu for booting other Linuxes, or even other Ubuntus. Ubuntu's GRUB boots other Linux operating systems by their specific kernels. When Ubuntu itself receives an updated kernel, it automagically updates it's own menu.lst file to boot the latest Ubuntu kernel. When your other Ubuntu system or other Linux distro receives a kernel update though, these are not able to be updated automagically. You have be aware of this and remember to update your menu.lst in Ubuntu manually or you will be booting your other systems by their old obsolete kernels. There are three possible solutions to this minor problem. 1. Chainloader boot entry GRUB's 'chainloader' command is the King of multi-booting commands. The chainloader command is used to boot another boot loader. The chainloader command hands over control to the other other operating system's boot loader at the other operating system's partition boot sector. The other boot loader can then boot whatever operating system it belongs to, (or any others listed in it's menu). Since the other boot loader's menu is kept up to date by it's own operating system, it should always automatically boot the most recent kernel. In order for this to work, the IPL or stage1 file for a boot loader needs to be installed in the boot sector of the other operating system's partition. Normally, Linux Operating Systems don't have anything installed it their boot sectors unless we install it there ourselves.
Here's an example of a typical chainloader booting command, code:
It is also possible to chainload the MBR in another (non-first) hard disk or even in an external USB drive or a pen drive, as long as there is some bootloader or boot manager with its IPL installed to the MBR you plan to chainload. code:
Here's an extreme example of the use of GRUB's chainloader command, by saikee, a moderator in JustLinux Web Forums, A grub menu booting 100+ systems of Dos, Windows, Linux, BSD and Solaris. Also by saikee, How to install and boot 145 operating systems in a PC. - JustLinux Web Forums. I highly recommend the above links for anyone interested in multi booting. 2. Symlink boot entry A third method that works very well would be to make an boot entry that will boot the other Linux by it's symlinks, and not refer to it's kernel or ramdisk specifically. Almost all Linux operating systems have symlinks to the kernel and initrd.img files in the root of their filesystems. A few might not. Obviously you will only be able to use this method if there are such symlinks provided, or if you can make them yourself. The advantage of symlink booting is that it is very reliable. Even if there is a problem with the GRUB menu in the other operating system and you cannot boot that OS any other way, symlink booting will almost always work. Here's an example of a symlink boot entry, code:
Can you see that I have altered the 'kernel' line to refer simply to to /vmlinuz, which is a symlink, rather than a specific kernel like '/boot/vmlinuz-2.6.15-23-386'? Also, the initrd line has been simplified to '/initrd.img' rather than a specific file like '/boot/initrd.img-2.6.15-23-386'. The symlinks always point to the most up to date kernel and initrd.img files, so there is no need to worry about updating your GRUB menu after a kernel update in your other system when you are using symlink booting. 3. Configfile Boot Entry The 'configfile' command can be used sometimes, but only when the other system you want to boot uses the same version of GRUB boot loader as the one you're currently using. Some other Linux Distros, such as OpenSuse and Linux Mint and a few others, use modified versions of GRUB with 'gfxboot' (fancy graphics) feature, which might not be compatible with our GRUB, I'm not sure. On the other hand, Ubuntu's GRUB is has the more advanced uuid support feature. Some other operating systems will choke on the uuid command, because their GRUB might not be updated with the ability to handle that command yet. And then there are a few people already experimenting with GRUB2, even though it's nowhere near ready yet, (at least not at the time of writing this). I used to like the configfile command best, but now I'm forced to derate it to the third place in my choice of multi-booting commands. The configfile command will tell GRUB to find the other Linux's menu.lst or grub.conf and run the commands it contains to boot any operating system with. Since that will be maintained by the OS it belongs to, it should always be up to date. An advantage of using the configfile command is, all other operating systems listed in the other GRUB menu can be subsequently booted. You can use as many different GRUB menus as you like. The stage 2 file that will be used will be from the first operating system's GRUB. Following is an example. code:
Where: /boot/grub/menu.lst is the exact file path and filename of the configfile for GRUB to load. You may need to check what directory path other distros use for keeping their grub menu.lst in, it could be /GRUB , for example, (no /boot folder, and /GRUB with capital letters). Also, the filename might not always be 'menu.lst, it could be something else, like 'grub.config' or the like. You will need to find out somehow, and alter the details following your configfile command accordingly. To speed up booting, you can turn down it's timer and hide it's GRUB menu if you like. Or, the opposite, take advantage of the opportunity to display another nice GRUB splashimage instead. You can have a lot of fun with the configfile command and make entries in the other GRUB menus that refer back to the first GRUB menu. You can also make more menu.lst files of your own and call them 'menu.2nd' or some other name and use them for experimenting with other GRUB commands, for example different splashimages or pretty colors. NOTE: Sometimes when we try to use an older version of GRUB to boot using the menu.lst of a more modern version of GRUB, the older GRUB can't understand the new GRUB's commands. For example, WinGrub can't handle Ubuntu Grub's 'savedefault' commands, and give it boots to grub error 26: Disk read error if it encounters the 'savedefault command. WinGRUB Page. GRUB from Ubuntu versions earlier than Intrepid Ibex can't cope with the uuid line in Ubuntu's booting stanza, and give Grub error 15 if the configfile command is used to boot with a newer menu.lst from an older GRUB. Try using the chainloader command instead. |
| ############################################# Additional GRUB Menu commands for fun, security and convenience. color_
We can change the colors from a title in our GRUB menus to some other color if we use a title command to give our color scheme a name. For more colr ideas, See: 'Add some color to your GRUB menu'. Colors won't work if we already have a splashimage enabled because that over rides the color command and puts GRUB in graphics mode. cat and pause
The 'cat' command is probably named after Linux's 'cat' command. According to my information, the word 'cat' in this instance is short for 'concatenate', which means something like hitching things up in a series, like making a train or a chain, or a string of beads. I guess they mean gathering up bits and bytes that are scattered around the hard disk and assembling those into a file that we can read in the computer screen. The cat command is for displaying a message in the computer screen. It can be inserted anywhere in your menu.lst file, as long as it's somewhere under a line that begins with the word 'title'. You can insert a message in any operating system entry or anywhere you like. In this example, the message has it's own title, just for demostration purposes. The 'pause' command follows the 'cat' command to make the message stop on the screen long enough to read it. Any words or characters you type after the pause command will also be displayed on the computer screen. When you press any key you'll be back in your GRUB Menu again. You can use the 'pause' command by itself if your message is 80 characters or less, (short enough to fit in one line). Following the word 'cat', we need to put in the path and file name to whatever file we want to be diplayed on the screen. It can be an 'absolute path name' to a file, or a 'block list'. An 'absolute path name is like: (hd0,1)/boot/grub/bootmessage A 'block list' is the location of a file in sectors from the beginning of a hard drive or a partition. (More about that later). GRUB can see any file in any hard disk, and it doesn't even need to be inside a formatted partition, GRUB can even read raw areas of the hard disk, such as the MBR, the first track of the hard disk, and boot sectors. In this example, I have a text file that I made with a message on it, which I coped to my /boot/grub/ directory in the second partition of my first hard disk. Below is an example boot message,
The only important thing about the message is, it will be limited to 80 characters per line and the maximum number of lines will be 23. You can copy mine (above) and use it for a template if you like. You can use more cat and pause commands if you need a longer message. You can have fun with the cat and pause commands and I'm sure you will be able to come up with all kinds of novel ideas is soon as you play with it a bit and get the hang of it. cmp
Windows viruses often write to the Windows boot sector so the virus will load at startup and take over control of the operating system before the antivirus program has a chance to wake up. There's a backup of the boot sector in the sixth sector of a Windows partition formatted with the FAT file system. In the NTFS file system, the backup bootsector is in the last sector of the partition. We can find out what sectors are the first and last sectors with 'sudo fdisk -lu' command in Ubuntu. The boot sector is almost always number 63 because the first partition never starts until the end of the first track of the hard disk. If you compare your boot sector with the backup and find they are both identical then that's fine. If you do the same thing another day and there's a difference, and you can't remember doing anything to your boot sector yourself, beware! The numbers after the word 'cmp' in this example, tell GRUB to start counting from (hd0), which is the MBR of the first hard disk. The MBR is in sector zero. It counts to 63 then reads one sector. Then, (starting from zero again), it counts up to 24306344 and reads one sector and compares both sectors. If they match, nothing happens. If there's any difference, GRUB will display what the differences are. The output is unintelligible human beings, but it will certainly be enough make you aware that something might be wrong.
There's always the chance that files could be changed during an update though. If you're serious about security, you probably have Ubuntu installed in an encrypted file system and therefore you'd have a separate /boot partition. In that case you can't use the cmp command from the GRUB menu, but you would be able to from a GRUB Shell, after the operating system has booted. The kernel will be in the /boot partition, so GRUB would be able to compare your kernel with a backup of itself in some other partition. I haven't finished testing that yet. More experimening will be needed before I would say that will work for sure. reboot and halt
I find it convenient to have those two commands at the bottom of my menu.lst file. |
A Quick Guide to GRUB's Numbering System
The GNU GRUB manual contains a lot more information than can be put on this page. |
Getting Help
If you aren't sure how to edit your GRUB menu.lst to get an operating
system to boot, you can usually get help from other users at Ubuntu forums.You should provide a copy of the bottom section of your menu.lst file, (all the operating system entries), along with a copy of the output from sudo fdisk -l or sudo fdisk -lu to enable someone to help you.
The output from 'sudo blkid' might also be useful,
The Grub manual contains a lot more information than can be put on this page. |
Editing GRUB's device.map Here is what the GNU GRUB Manual has to say on the device.map file, 15.3 The map between BIOS drives and OS devices. That was written quite a long time ago. Nowadays we have the uuid command in GRUB and use UUID= (file system Universally Unique IDentifiers) to direct GRUB to our /boot and / (root) partitions. Hardly anyone gets GRUB error 17 anymore. See Operating System Entries for more on UUID numbers. GRUB Error 17 used to occur frequently when people's computers had more than one hard disk, especially if one or some were SATA and others were IDE. Not all BIOSes sent the same signal to GRUB to tell GRUB what the hard disk numbering should be, and sometimes GRUB used to get it wrong. Some people used to think that editing our /boot/grub/device,map files might be a way of curing GRUB Error 17. Apparently that worked in some older versions of GRUB, or so I'm told. This didn't work in Ubuntu, at least not for me when I tested it. It doesn't seem to me as if GRUB pays any attention to the device.map file at all during booting. As far as I have been able to determine, it looks like it would be better to try Changing the hard Disk Boot Priority instead. NavyRSt, in this thread, HOW-TO install bootloader from Ubuntu, just changed the hard Disk Boot Priority and says that worked fine! The only purpose I can think of for the device.map file was to show what order GRUB thought our hard drives were numbered in. (Obsolete information below here) (Obsolete information below here) Running grub-install --recheck after adding or removing a hard drive Some modern computer case designs make it easy and quick to add and remove or swap hard drives. When grub is getting the device.map right in our computers, which will probably be the case for most of us, and after removing or exchanging hard drives, it is easier to run a command something like 'sudo grub-install --recheck /dev/hda2', which will cause GRUB to re-check our devices (hard disks) and update our device.map file and re-install GRUB. For example, (after you've managed to boot with either GRUB's Command Line Interface or with Super Grub Disk), Code: After editing your device.map file, you need to re-install GRUB in a special way for the changes to be effective. First, open a GRUB shell with the device.map file specified in the grub command. For example:
Then we install GRUB,
...and then,
It gives you GRUB's own natural device.map again. If it's not correct then we might need to edit it by hand and re-run grub-install, as the message already tells us. |
| GRUB's Command Line Interface (CLI)
This is GRUB's 'Command Line Interface', you get this by pressing your 'c' key from the GRUB menu. You can return to the GRUB menu by pressing your 'Esc' key. Another way to return to the GRUB menu is to type the command 'reboot' after the GRUB prompt to reboot the computer. The command line interface is not necessary to use everyday, but can be extremely useful for getting an operating system to boot which GRUB isn't automatically set up for. You can experiment with commands at the command line interface until you succeed in getting it to boot. Once you find the right commands then you can add those to your /boot/grub/menu.lst file to make it boot from the GRUB menu after that. The GNU GRUB manual contains a complete list of commands you can use.
This Section's Menu
How to use GRUB's Command Line - to investigate a computer GRUB
is almost a miniature operating on it's own, it can take quite a few
commands and perform some useful tricks. It's well worth a little of
anyone's time to learn how to work with GRUB at the command line.We'll see how to boot operating systems in a few minutes. First, here are a few useful tricks to help you learn to use GRUB interactively if your computer's BIOS supports that. This is how to use GRUB to take a look around inside a computer. Tab completion is a very useful feature of GRUB. In the example shown below I want to use Tab completion to find out what hard disks and partitions ane in my computer,
Find Hard Disks Here's another way to get GRUB to list all hard disks and partitions and give information on what filesystems are in a computer,
Find PartitionsNow I want to find out what partitions are in the first hard disk,
I use these commands often to determine one hard disk from another before installing GRUB to a hard disk's MBR, to make sure I install the right GRUB to the right MBR. NOTE: In Ubuntu Intrepid Ibex and later, there is an added 'uuid' command which can also do this job. Just type 'uuid' (without the inverted commas), and press your 'enter' key.
Find out which partitions contain a Linux kernel To find more information we can use the 'find' command, for example:
The feedback from the above command should give you one or more answers like:
Well, really, to be accurate, they are partitions which contain a symlink to a Linux kernel. These partitions could be /boot partitions if an installation has separate /boot and / (root) partitions. Find out which partition is your '/' or 'root' partition
The results from the above command might appear as shown below,
There are ways to have GRUB find out even more interesting information for us if it might help. We can open plain text files in any of those partitions we may be interested in with the 'cat' command. For a few examples,
and,
and also:
By the time you have tried out some of those extra commands you will be getting the idea that you can find out almost anything about any computer with GRUB's CLI. That's probably all the information we need for getting GRUB to boot any Linux system. How To Boot Linux from GRUB's CLI (Ubuntu) First method: 'direct boot'. This procedure is the most reliable method for booting any Linux operating system that is bootable. We directly boot the Linux kernel and initrd.img, or boot then via their symlinks in the root of the file system. This bypasses the MBR, menu.lst or a non functional boot loader.
A GRUB entry or a series of commands to boot from a GRUB command line includes the following four essential commands:
If you don't know those things, don't worry, because GRUB has commands you can use to find out. 1) The first command is 'root (hdx,y)' to set GRUB's root device to the partition that contains a Linux kernel. Our kernel is normally found in our /boot directory. This is usually the same partition as the rest of our operating system, but if we made a separate /boot partition, our kernel will be there instead. For example,
and in some computers Grub might reply by identifying the file system and partition type:
2) The second command is 'kernel /vmlinuz' to load the kernel image, and 'root=/dev/hda2' to specify the '/' (root partition, which contains the matching /sbin/init file. How to use GRUB to find out if you aren't sure
3)The third command will be 'initrd'
4)The fourth and final command is 'boot',
Right after this we should see a lot of white print appearing and scrolling up our monitor too quickly to be read, it's always very exciting! After a minute or so we should see our Linux operating system's login screen. Second method, 'configfile boot' This series of commands brings up the GRUB menu of an operating system that has GRUB installed in it by having the GRUB you are using read it's /boot/grub/menu.lst file. This is an quick and easy way to boot. It will work as long as the entries in the menu.lst file are correct. You can easily use this to boot any other operating system that happens to have a valid entry in that menu as well, so this can be a handy trick to know about. First, use GRUB's 'find' command to look for a menu.lst file in the computer,
GRUB tells me I have four partitions with a /boot/grub/menu.lst file that I can use for booting with.
When we're using the 'configfile method' for booting with GRUB, it's interesting to know that the GRUB we're using does not hand over control to the operating system's GRUB. So if you're using an older GRUB version such as the one used in GRUB for DOS (WinGRUB), it might not be able to handle some of the new commands that might be found in the menu.lst file for GRUB version 0.97, like the 'savedefault' command. WinGRUB Page. Of course, it's a waste of time to even bother thinking about trying to boot some other boot loader's configuration file with a configfile command. That would just be stupid. ...well, unless you know some special circumstances. Third method, 'chainloader boot'. GRUB's 'chain loader' command is special because it hands over the job of booting to another boot loader. The other boot loader can be another GRUB, or it can be LiLo, Syslinux, or whatever boot loader is installed inside the operating system to be booted. Normally, the chainloader command is used to boot another boot loader via the other boot loader's code installed in a 'boot sector'. (The first sector of that operating system's partition). Linux doesn't necessarily need to use it's first sector for booting. Installing boot loader code there is optional. This method requires that your have a boot loader; GRUB, LiLo, Syslinux or some other boot loader installed to the first sector of your partition, otherwise nothing will happen, you'll get Grub error 13. It's also possible to point the chainloader command at the MBR of any hard disk, or a USB flash memory device. If it has code for a boot loader installed in it, GRUB's chainloader command will boot it. For this example, I'll pretend we already know what hard disk and partition we want to boot. If you don't know what hard disk or partition you want to boot, go back to How to use GRUB's Command Line - to investigate a computer, and start there, then come back here when you know.
...but what do we do if we get: Error 13? If the operating system has GRUB files in it, we can use the install the operating system's GRUB to the first sector of the operating system's partition and then chainload it. The 'find' command is a test to remind me what partitions contain GRUB files.
Okay, I decided I want to install the GRUB in (hd0,5) somewhere,
If (hd0,6 has Kubuntu in it and we did 'root (hd0,6), that would install Kubuntu's GRUB somewhere. If (hd0,5) has Ubuntu in it and we do 'root (hd0,5), that will mean we're installing Ubuntu's GRUB somewhere.
It's telling us it has failed to install stage1_5 but don't worry about it. It says that when it installs to most partitions because there's no place for the stage1_5 file to go. The stage1_5 file is instalable in a ReiserFS partition or when we install to the MBR of a hard disk.
How To boot Windows using GRUB's 'CLI': Sometimes after a new install when Windows won't boot this might come in handy. Sometimes menu.lst gets written with an error in it. I don't know how that can be caused.
Chainloading Windows the simple way, for a single Windows installed on a first hard disk,
It is most common to expect Windows to be allocated the partition number 1, and remain that way, even if you 'move' it with partitioning software to the other end of your disk. If you aren't sure, it won't hurt anything if you try guessing it, and, if you still have trouble, an easy way to find out where all your partition are is to boot up a GParted LiveCD and take a peek. Use the command 'root' if you are booting a Windows version with the FAT32 filesystem such as Windows 95, Windows 98, Windows ME, or Windows XP Home Edition. Use the command 'rootnoverify if you aren't sure, or if you are booting a Windows system that has the NTFS filesystem. Windows XP Home Edition, Windows XP Professional, WIndows NT and Windows 2000.
If Windows is allocated a different partition number, either accidentally or on purpose, you may need to edit boot.ini with the changes and it will usually boot up fine. TIP: You should make your own Windows XP boot floppy disk with ntldr, ntdetect, and boot.ini on it if you have Windows XP and you are playing around with partitioning software. That way you can always access boot.ini on the floppy disk and edit that if required, and boot Windows when you cannot access your regular boot.ini because you can't boot Windows because you can't edit boot.ini because... (especially if you have the NTFS filesystem). How to make your own Windows Xp boot floppy, Click Here. (Microsoft). EVEN BETTER TIP: Go to http://tinyempire.com/notes/ntldr by Miles Comer and read 'How to fix: NTLDR is missing, press any key to restart', and download yourself a copy of Miles Comer's Super NTLDR Disk, burn one of those to a CD, or make a floppy disk out of it. Read that web page by Miles Comer, that should help you boot Windows sooner or later if you keep trying. Chainloading Windows using map commands when it is installed on a non-first hard disk. If you have Windows installed on a second or third hard disk, you will need to trick Windows into thinking it is on the first hard disk, or it will sulk and refuse to boot. To do that you can use the map command (twice). map (hd0) (hd1)
map (hd1) (hd0)
(Where (hd1,0) is the partition Windows is in.)
GRUB and MultiWindows GNU/GRUB is actually a far better boot loader to use for setting up a Windows multiboot than Windows own bootloader. Windows is the operating system that insists on being the only one on the hard disk, but ironically it still doesn't have any 'hide' feature of it's own. The default Windows method for multibooting is to copy the new installation's vital files needed for booting into an older, existing Windows installation in a primary partition. Then the newer Windows install will be made in a logical partition without any bootloader file of its own. Needless to say, if the user ever has a problem with the older operating system it means the newer operating system will be ruined too. For more info read this link, Understanding MultiBooting and Booting Windows from an Extended Partition Dan Goodall You use GRUB for booting Windows with rather than Windows own bootloader, especially if you want to set up a Windows multi boot. You install the first Windows, then use GRUB to 'hide' it, then you install the other Windows. When more than one Windows is installed on the same hard disk, you can use GRUB's 'hide' and 'unhide' commands to hide one Windows install from another, and boot. For example if one Windows installation is is the first partition and another Windows installation is added to the fourth partition, you would boot the first partition this way,
Now when I want to boot the other one, I just do the reverse,
A Quick Guide to GRUB's Numbering System
The Gnu Grub manual contains a lot more information than can be put on this page. |
Temporarily Edit the GRUB Menu
You can press any key to stop the timer when you're at the GRUB menu. If you read the text underneath the GRUB menu it says you can press 'e' to edit the commands before booting. You can make non-persistent changes to the GRUB menu by pressing your 'e' key, and editing commands and options in your GRUB menu. So press your 'e' key. Now you should see a different Grub menu,
You can move the highlight bar over any line you need to and press 'e' to edit it. Booting problems are often caused by just one wrong number in a line in your /boot/grub/menu.lst file. Normally you just need to edit that one hard disk or partition number and you can boot. If you already know what you're doing it's often quicker to use this 'e' for edit method to temporarily correct the error and boot than using the 'c' key for GRUB's Command Line Interface. With the 'e' for edit menu, your boot-up commands are displayed already complete, so you don't need to type each command out again from scratch. This way you can just edit what you need. That often saves time and effort. For another example, you might need edit your kernel line and add kernel options. Press your down arrow key to go down to the second line, the one beginning with the word 'kernel' and press 'e' again. Scroll across to the end of that line and it should say 'ro quiet splash_', those are kernel options that are passed from GRUB to your kernel during boot-up. You may need to add some more kernel options to the end of the kernel line because of some hardware issue, perhaps. Probably the most frequently needed kernel parameter would be: xforcevesa , which essentially means you'll be able to boot into 'safe graphics mode', in case your monitor went blank at the login screen due to a video driver problem. Here's a link to 'The Linux BootPrompt-HowTo' - by Paul Gortmaker. Here's a more Ubuntu-specific link: Ubuntu - How To Edit Grub Boot Parameters - grumpymole. When the computer is first booting, the display functions in 'VGA' mode, which is run by a simple video driver from the BIOS. GRUB uses the BIOS's VGA driver too. As soon as a Linux kernel begins to boot, we can use the vesa video driver, that's used to give a slightly better resolution during the starting up phase of booting. During this period of time, the 'usplash' screen is normally displayed. Usplash - Wikipedia, the free encyclopedia Then when Ubuntu boots, it loads the operating system's hardware specific video card drivers and you have much nicer graphics by the time you get to your login screen. Sometimes we don't see the usplash, but instead we see the kernel's rantings and ravings about the hardware as it's booting. That information is strored in log files in /var/log as well. The kernel's feedback is sometimes useful for troubleshooting purposes. Usually, the kernel drops the usplash as we can see what's wrong if it encounters an error and cannot completely boot up. Sometimes it'll drop you to a shell prompt instread of booting. In some rare cases, the vesa driver isn't working during the middle phase of the boot-up. What would happen if you can't see anything at all? Normally, even if you had a blank screen during boot-up, there would be no harm in that. You just wouldn't see anything for a while and then when it gets to the part where the video driver kicks in and Ubuntu comes up, you'd get your display back. That's okay if your computer does boot eventually, but what happens when the computer fails to boot, and just sits there with a black screen? The main concern is, it could be stopping at some error and you can't read the error message because you have no display whatsoever at that stage. You could first try simply waiting a while in case it's just doing a file system check. Maybe try pressing 'Enter', followed by 'Ctrl'+ 'D', in case it's hanging at the file system check. That would get you over that. You'd still need to wait a minute for it to finish booting..... Okay, so you tried waiting for ages already and still nothing.... The answer is to reboot and add 'vga=ask' as a kernel option. Here is a link to an excellent howto which explains all we need to know about the vga= option, HOWTO: Change bootup resolution, by Indras At the end of the 'kernel' line, make a space and then type: vga=ask Then press the 'Enter' key. Press 'b' to boot. On the next screen, it should say,
It should give you a choice of vga settings you can try in an effort to get some display during boot-up.
Then, there's a choice of numbers between 1 and 6 that correspond with different capabilities of your display. Hopefully that will sooner or later let you to be able to see the text messages that normally run behind the boot splash screen during a regular boot-up, but show up to tell you what's wrong when there are errors. Then whatever the problem is that's holding up the booting procedure can be solved, depending on what the exact problem turned out to be. That was just one example of how to use the 'e' for edit feature to temporarily edit the GRUB menu for one boot-up. This way it's possible to make any changes to the GRUB menu you need in order to boot your operating system. Once the operating system is booted then it will be easy to edit the /boot/grub/menu.lst file and make more permanent changes. |
Re-install GRUB The following thread is the most popular about this subject in Ubuntu Web Forums, How to install Grub from a live Ubuntu cd. - catlett.The two most popular methods are,
The advantage of the grub-install command is that it can be used to install or refresh grub files in the /boot/grub directory, at the same time as it installs the IPL for GRUB to a hard disk's MBR or to a partition's boot sector. (i) If you can boot your Linux operating system somehow, the command is simple,
(ii) If you need to run the grub-install command from a Live CD, Contrary to what many people think, there's no need to chroot from a live CD into a hard disk installed Linux operating system to re-install GRUB. When we're in a Live CD or a different operating system (such as a USB disk or a different hard-disk installed Linux), to install some other operating system's GRUB somewhere you just need to do something like the following command, Example:
Where: /media/disc is the file path for the directory where you want the GRUB files to be installed. If you're looking for an example about how to chroot, look in my LiLo Page, it is necessary to chroot to install LiLo. LiLo Page. 2) GRUB's setup command The grub shell method explained below here for re-installing GRUB is very flexible. It can just as easily be used from a live CD or DVD, from a GRUB floppy disk, from GRUB's Command Line Interface or a hard disk installed operating system or just about anywhere there is already a GRUB installation present with the necessary GRUB files. That often makes it much more convenient than running the grub-install command. The GRUB shell method is for re-installing GRUB's IPL to a hard disk's MBR or the boot sector of a Linux partition, most of the time that's all we need to do. It doesn't actually refresh the grub files in /boot/grub. The most common use for this operation is to fix your MBR after another operating system has been installed and it has taken over your MBR, or if your partition numbers have been accidentally changed and you're getting GRUB Error 17. Here's how to use the GRUB shell to re-install GRUB. The first step is to open a terminal and open a grub shell with root priveleges, Code:
In Ubuntu, it is important to use 'sudo' before the 'grub' command. If you forget, you will get a GRUB shell okay, but you won't have root priveleges. You won't be able to do very much with a grub shell without root priveleges. If you try, you will probably just get some confusing error messages. Output:
This gives me a clue as to exactly where the necessary GRUB files may be located that I can install GRUB from. (In case I have more than one Linux operating system).
It has to be one of the ones listed by the 'find' command (above). If I know I have Ubuntu in partition 2 and Debian in partition 4 and I want Ubuntu's GRUB installed to MBR, I set (hd0,1) as GRUB's root device here. If I chose (hd0,3) that would install Debain's GRUB somewhere. Quick Guide to GRUB's Numbering System. GRUB should recognize the filesystem, and will reply with an output similar to the one shown above. If not, then check to make sure you didn't make a mistake.
Installing GRUB to MBR: 'setup (hd0)' is the command to install Grub's stage1 to MBR in the first hard disk. Stage1_5 will also be installed to the 15 sectors following the MBR in the first track of the hard disk. Installing GRUB to a partition: To install GRUB to a partition, you would use a command like, 'setup (hd0,1), or 'setup (hd0,3)', where (hd0,1) and (hd0,3) are Linux partitions. If you do that, you'll be able to boot your operating system using the 'chainloader' command. Installing GRUB to a non-first MBR: The BIOS normally only boots the MBR of whichever disk is set in the BIOS as the first hard disk. If you have more than one hard disk in your computer, you can install GRUB to the MBR of some other hard disks instead. You can then use a chainloader command from your first hard disk's GRUB to boot GRUB or any other boot loader in any other hard disk. This is useful for people who have a lot of operating systems and they want to spread them over several GRUB menus. To install GRUB to a second hard disk, you would use 'setup (hd1)', and for a third hard disk 'setup (hd2)', and so on. Installing GRUB to a floppy disk: That's a seperate subject, covered further down this page. How to make your own personalized GRUB Floppy Disk........................................ GO Installing GRUB to a usbdisk: That's another seperate subject, also covered further down this page. How to add GRUB to your USB thumb drive...........................................................GO
|
Memtest86+ ![]() In Ubuntu, one of the options GRUB can load is called 'Memtest86+', a series of tests to check your computer's memory and make sure it is okay. This results in a very impressive blue display, as pictured above , with hashes '#' progressing across the monitor and strange numbers and letters appearing and disappearing again. It will continue unattended as long as you like until you press the 'Esc' key There are eight tests in the series. (Just highlight 'Ubuntu, kernel memtest86+ on the GRUB Menu). It took about 25 minutes to run through one complete cycle of eight tests with my 400 Mhz computer. My 3.0 Gz computer (3000 Mhz) took 25 minutes to run through all these test twice. Memtest 86+ will keep on cycling through these tests for as long as you let it run, in case you're checking for intermittent errors. Normally, one cycle of eight tests is enough to find out if you have a memory problem or not. The tests are: #1 [address test, own address] #2 [moving inversions, ones and zeros] #3 [ moving inversions, 8 bit pattern] #4 [moving inversions, random pattern] #5 [block move, 64 moves] #6 [moving inversions, 32 bit pattern] #7 [random number sequence] #8 [modulo 20, ones and zeros] These tests could be very useful for troubleshooting purposes, especially if your computer freezes up or crashes now and again. Error messages that might possibly (but not necessarily) be associated with faulty RAM modules include 'parity errors', 'general or global protection faults', 'fatal exception errors', and 'divide errors'. I have read that memtest 86+ tests not only the RAM modules, but the machine's CPU caches as well. If you want to make sure you're only testing the computer's memory modules, before you run memtest86+ you can go into the machine's CMOS (BIOS) settings and disable all caching, such as 'L1' and 'L2' or 'CPU Internal Cache' and 'External Cache'. Save the changes and reboot. Then run memtest86+. If you find any errors and you have more than one RAM module, remove all but one RAM module and test one RAM module at a time to determine which one is faulty. Be sure to unplug the power cable from your PC, and wait for the motherboard LED light to go out before touching anything. If it's a laptop, make sure you remove the battery too. Be aware of ESD, wear an ESD wrist strap if you have one, or touch the computer's frame first. Often just removing and reseating the RAM modules can cure the problem if it is caused by dirt or a bad fit in the socket. (That has worked for me before). When you're finished, don't forget to go back into your CMOS (BIOS setup), and re-enable caching, and save the changes and reboot, otherwise your computer might run very slowly. For more information on memtest86+, Memtest86+, Memtest forums, memtest86.com. |
How to make a GRUB CD-RW (with an optional splashimage)
This works for CD-R or CD-RW disks, but I prefer to use CD-RWs for this. 1) I made a new empty directory named iso, then I made another directory inside it called boot with another one inside boot called grub. code:
2) I copied my /boot/grub/menu.lst to my new /iso/boot/grub directory,
3) and also I copied a file called 'stage2_eltorito' to my new /iso/boot/grub directory. NOTE: The exact location of this file may not be the same for all versions of Ubuntu, so I recommend you find it first, with the 'locate' command, like this, code:
Now that Linux has found the file for me, I copied it to my /grub directory inside my /boot directory in my new iso directory,
Where: '/usr/lib/i386-pc/stage2_eltorito' is the correct path and file name, found with the 'locate' command in your own computer. (It may be different in your compared with mine). 3 (a) This part is optional, I added a nice splashimage. My splashimage is called Ubuntusplash. To add this all I did was open my iso/boot/grub directory in my /home/herman folder and copy and paste it in there. If you don't have your own splashimage, you can make your own, or download one from the internet via the link already given under splashimages on this page, ........................Go Back Or, if you want, you can just download any of the ones I made from here, Splashimages. 4) I opened my menu.lst with my text editor and edited the file to make sure everything will work properly from the CD. Some modifications need to be made to the menu.lst since things will not work the same from a CD as from a hard disk. 4 i) THIS IS IMPORTANT. We need to delete all instances of the savedefault command. The 'savedefault' commands in each operating system's boot entry will cause GRUB to fail to work from a CD. That's because the 'savedefault' command tells GRUB to run a program called grub-set-default, which tries to write to a file called /boot/grub/default, and record which menu entry was booted last time GRUB was used. That works great in a hard disk, USB or floppy disc, or any media GRUB can write to. Unfortunately, the only way to write to a CD is to burn a new CD. GRUB can't write to the file in the CD. That stops GRUB from completing it's tasks and GRUB will return an error message instead. So, for our GRUB CD to work we need to: open the new copy of menu.lst with 'gedit' text editor, and delete all instances of the command 'savedefault' from the boot entries. 4 ii) Another (recommended) idea would be to edit your Ubuntu entries so that the CD-RW will boot Ubuntu via the symlinks to the Linux kernel and initrd.img rather than the actual files specifically. That avoids the need to make a new CD-RW after each kernel update. (Well, it will probably still boot as long as you still have the out-of-date kernel and initrd.img, but it's best to always be booting with the most advanced kernel and initrd.img, for lots of reasons). For example, change this,
To something like this,
The savedefault command has been deleted. References to a specific kernel and initrd.img have been deleted and the paths have been changed to point to the symlinks (shortcuts to the current kernel and initrd.img) instead, (by deleting the word '/boot'). That avoids the need to make a new GRUB CD-RW after each kernel update. Intrepid Ibex's GRUB replaced the command 'root', (the command in the second line, under 'title'), with the 'uuid' command. You have the option of leaving that alone. If you leave it that way, your GRUB CD will look for the Ubuntu installation with the designated file system (with the UUID number you specified), and boot it no matter what disk it might happen to be in. Even if you want to boot Ubuntu in a USB flash memory stick and if it's plugged into a hub with a lot of other USB devices, and GRUB will find the right disc for you and boot it. Earlier versions of Ubuntu, or other Linux distributions's GRUBs might not feature the uuid command yet. 4 iii) Add another operating system entry which will be more generic.
I added another boot entry by copying and pasting my first one and then I edited the words after the title command, you can type in whatever you like there, I typed in 'Symlink Boot on Ubuntu in (hd0,1)'. I reverted from the uuid command to the old root command, and replaced the UUID number with '(hd0,1), (you may need to type in something else here as appropriate for your own needs). I also changed the 'root=UUID' part in the kernel line to be non-specific by replacing the exact UUID number with '/dev/sda2' instead, so the CD will boot whatever is in the second partition, regardless of the exact file system UUID. It's up to you, you don't have to do that, but now it can still boot Ubuntu again if Ubuntu has been re-installed, or replaced with a newer version. (Or whatever Linux installation is in the first hard disk, second partition). 4 iv) You can also add a third boot entry something like this instead if you like,
You could add more of these to boot any operating system in more different hard disks and other partitions if you want. and/or, you might find a boot entry like this one useful someday,
You could add more of these to boot Linux installations in more different partitions if you want. It would do no harm and possibly some good to have all kinds of different boot entries. Don't forget you will still have the options of
If you're doing it for fun though, feel free to as as many different kinds of boot entries as you like. You can probably think of lots more possibilities, let your imagination run wild! Also, do a last minute check to see if there is anything else you might want to edit in your menu.lst file and do that now. If you are not using a splashimage, you can enable pretty colours instead if you like. 4 v ) This is optional, you need to do this for the splashimage if you are using one. The name of my splashimage in this example is Ubuntusplash.xpm.gz You need add a line in your menu.lst file for the splashimage you are going to use. For example, splashimage=(cd)/boot/grub/yourgrubsplash.xpm.gz as shown in my example menu.lst snippet shown below. (Where 'yourgrubsplash' is the name of your splashimage. Replace 'yourgrubsplash' with the name of the splashimage you will be using. It does not necessarily need to be between #hiddenmenu and #Pretty colours like mine, but that's where I always put mine and it seems to work okay. For example, Code:
End of OPTIONAL section. 5) The next command is to make the new grub directory into an .iso file. Note: Copy and paste this command into your terminal, don't try to type it. Code:
Here's what it should reply:
6) After that I just exited the terminal and put my CD-RW in the drive, went through my /home/herman directory, right-clicked on the newly made grub.iso file and clicked 'write to disk'. 7) Test your new GRUB boot CD-RW disk. It should boot all your operating systems from the GRUB menu or from the GRUB command line interface. 8) If you do any work with a partition editor that causes your file system UUID number to be changed then your GRUB CD won't work any more and you'll need to make a new one. That's one of the reasons I prefer to use a CD-RW for this rather than a CD-R disk. GRUB's Command Line Interface is available from the CD though, so if you can use CLI GRUB, you'll still be able to use the CD, (to boot any computer). Only use 'Parted based partition editors, it is not advisable to touch your hard disk with any partition editors designed only for Windows. Just opening one of those to take a look at your partitions can make your Linux installs unbootable, as they might change your file system UUID numbers without your knowledge or permission. 'Parted based partitioners like GParted, QTParted, Partman and Parted are okay for both Windows and Linux. |
| NOTE: You can use Super GRUB Disk to make your own bootable CD with, and add your favorite live operating systems to it, like Knoppix, Puppy linux, or GParted LiveCD, and combine it with your own personal GRUB CD that you just learned how to make. Build a CD/DVD with SGD on it.............................................Build a CD/DVD with SGD on it |
How to make your own personalized GRUB Floppy Disk.
This will make you a GRUB boot floppy with your own GRUB menu in it, so it that suits your computer already. You can also play with it and personalize it even more after it has been made. It's a safe way to experiment and learn how edit the GRUB Menu without interfering with your hard disk install's everyday booting. You can try out all the tricks on this web page, add a splashimage to your GRUB floppy, and anything you like. Conduct weird experiments, have fun! First, of course, you need to insert your new, blank floppy disk in your computer's floppy disk drive. Check to make sure it is not 'write protected' at the moment. (The little plastic slider should be covering (closing) the hole in the left rear corner). How to Write-Protect a Floppy Diskette - HelpDesk (external link). Code:
Code:
An icon can be expected to appear on your desktop that looks like a floppy disk.
This command makes an empty directory (folder), in your floppy disk named /boot
This 'setup (fd0) command installs GRUB's IPL or stage1 in our floppy disk's first sector. The rest of the text you see here is the feedback from the system, so we can see what happened.
If you want to edit the menu.lst in the floppy disk, so you can customise it, play with it, update it or correct it, use this code:
It is good practice to remove any boot floppies before shutting a computer down, and to 'write protect' the disk unless you are working on it. Never share a floppy disk between computers. In the old days, bootsector viruses used to spread that way, at least between Windows computers. I'm not sure about linux computers and boot sector viruses. It is best to 'keep our guard up' anyway. How to Write-Protect a Floppy Diskette - HelpDesk (external link). |
How to make a dedicated GRUB Partition
The only thing I'm trying to do here is make a quick how-to for it that's more 'Ubuntu-specific'. There are a few other small difference that come down to personal preferences. I would like to encourage everyone to go and explore Steve Litt's site. A dedicated GRUB partition is a special partition just for GRUB, it just has GRUB files in it. This will mean GRUB will be 'operating system independant'. In other words, even if you delete your Linux operating system, you'll still have your GRUB bootloader. A 'dedicated GRUB partition' is not the same things as a 'separate /boot partition' because a separate /boot partition contains the operating system's kernel as well as the bootloader files and is mounted in the /etc/fstab file as /boot in a particular operating system. A 'separate /boot' partition is only useful for curing GRUB error 18 in older computers, by forcing the kernel to be located close the the beginning of the hard disk. A separate /boot might not necessarily have GRUB files in it, it could have LiLo instead. How to make a separate /boot partition. A 'dedicated GRUB' partition,
The rest of this article is about how to make a dedicated GRUB partition. 1) Just make a small partition anywhere on your hard drive with any 'parted based partition editor you like. LibParted base hard disk partitioners include Parted, GParted, Parted Magic, Gnome Partition Editor, QTParted, Partman and others. Probably a 100 MiB partition would be way more than large enough. GRUB by itself takes up very little space on your hard drive. Format it with any file system that GRUB supports. GRUB supports FAT32, Ext2, Ext3, ReiserFS and others as well. GRUB does NOT support NTFS. Most Linux tutorials show the ext2 file system being used for GRUB, without explaining why. I think it's just to save hard disk space. Some of those tutorials are very old, from way back when a typical hard drive was smaller than 5 or 8 GB. The ext3 journal does occupy a tiny wee bit of room on the hard disk, but most of us would never notice it with the hard disk sizes that are common today. Just in case someone is installing in a small hard disk or a flash memory stick, I'm going to use ReiserFS for this how-to, but you can use whatever file system you like. The Reiser File System takes up even less room than ext2 and works particularly well in flash memory. For the rest of this how-to you will need to remember the Linux term for your new partition. Make a note of what Linux calls your new partition, (like '/dev/sda8' or something like that), before you close your partition editing program. 2) Label your file system. You can call it anything you like, but I'm going to name mine 'GRUB'. With the Reiser File System, we use the reiserfstune command, like this,
Yours will most likely have a different partition number than mine. Look with your partition editor or use the 'sudo fdisk -lu' command to check. Replace the '/dev/sda8' part of this command with whatever partition numbers apply to you and your own unique partition numbering. The reason for setting a file system label is to get our file systems to be automatically mounted in our /media directories with a nice descriptive name for the mount points. That's a good idea now that Hardy Heron and newer version of Ubuntu feature the new automated mounting method. Just go ' Places'-->'Removable Media'-->'GRUB', to mount your new file system. If you made an ext2, ext3 or a FAT32 file system for your dedicated GRUB partition, see: Make a label for your ext3 file system - give your ext3 file systems descriptive names. FAT32 usbdisk volume label give your FAT32 usbdisk a pet name or How-to get your removable device mounted under an explicit and persistent name - Debian/Ubuntu Tips & Tricks. If you are using an older versionof Ubuntu, or if you are using some other Linux distro, you should be able to make your own mount point and mount your file system manually. If you're not sure how to do that, refer to the following link, Mounting Filesystems with the mount command - Traditional olde reliable method. 2) Reboot your computer, and mount the new GRUB partition. Click-Icon Mounting - The new easy way to mount file systems in Hardy Heron and Intrepid Ibex. If you use the 'ls' command to check the names of your mount points in your /media directory, you should find that your new dedicated GRUB partition will be automatically mounted as 'GRUB' ,
3) Make a directory named /boot in your new GRUB partition, (in /media/GRUB),
This is just done for the sake of uniformity. 4) Copy your /boot/grub directory to the new partition,
5) Get the new GRUB partition's menu.lst file with,
You can also delete the entire Debian Automagic Kernels List too. Since the menu.lst file isn't in an operating system anymore, the Debian Automagic Kernels List won't be needed. 7) Re-install Grub from your new GRUB partition to MBR.
8) Give all your operating systems a test boot-up to make sure everything's working fine and dandy. If everything's good, you can (when you are ready) delete or hash out your extra operating system entries in your other menu.lst files if you won't use them any more. (Or just leave them there if they look neat and tidy enough and they don't bother you). If you have a complex multi-boot set-up, with several hard disks and lots of operating systems, you might not want all of your operating systems to be squeezed into one GRUB menu, (if they're all in one menu it might become too congested). Instead you could have several dedicated GRUB partitions, one for each hard disk. Make entries in your first hard hard disk's GRUB menu to boot only the operating systems in the first hard disk and chainload the MBR of each of the other hard disks. Each hard disk's GRUB can list just the operating systems in it's own disk and chainload the first hard disk's MBR. It would be kind of like going up and down in an elevator. That would be a nice way to spread the number of operating system entries out over a number of GRUB menus because if they're all in |