Grub

johnw's picture

grub not to be confused with grub2 which is completely different !

Some extracts from the mailing list that need tidying up or pointing to good places that give this same info:

> Later I did an update and the boot order got altered again, so I > had to fix it a second time. It's not a big deal, but I'd like to > know what I'm doing wrong. Windows should stay as the default (top) option if you move it to above the line:

      1. BEGIN AUTOMAGIC KERNELS LIST

All of the Ubuntu kernels should be listed beneath it then. Otherwise it will be reordered.

> > Later I did an update and the boot order got altered again, so I > > had to fix it a second time. It's not a big deal, but I'd like to > > know what I'm doing wrong. > > I also have a similar grub issue on Debian, since I customise all the > kernel lines to add options for serial console boot, but when you then > install new packaged kernels and it auto-updates the menu.lst you lose > those additions. Annoyingly, the hooks (kopt=) that are supposedly > there for adding default options, don't seem to do anything, at > least on Debian 3.1 anyway.. I've had this before and it was when I had a syntax error in the text following the option, which I didn't really understand becasue I didn't think it was doing any checking of syntax but there you go - I fixed it and didn't look into it further. Anyway, yeah, the menu.lst is a template file and what you need to look for are the lines like:

  1. kopt=root=/dev/md1 ro
  1. altoptions=(recovery mode) single

You edit these (leave them commented!) and then run update-grub.conf and it parses them to construct stanzas that have these options on all of them. Installing a new kernel runs update-grub.conf as well, which is why you see your changes being overwritten. If you don't like this behaviour then simply do what the file says!:

  1.  
  2. Put static boot stanzas before and/or after AUTOMAGIC KERNEL LIST

[...]

      1. BEGIN AUTOMAGIC KERNELS LIST
    1. lines between the AUTOMAGIC KERNELS LIST markers will be modified
    2. by the debian update-grub script except for the default options below

Stanzas you put between these two sections will not be touched by update-grub.conf.

> I also have a similar grub issue on Debian, since I customise all the > kernel lines to add options for serial console boot, but when you then > install new packaged kernels and it auto-updates the menu.lst you lose > those additions. Annoyingly, the hooks (kopt=) that are supposedly > there for adding default options, don't seem to do anything, at > least on Debian 3.1 anyway.. I've never had any problem with these - remember to keep them commented using a single # symbol though. They're not actual GRUB options, but just read by the update-grub script. The comments for these options have a double # symbol, presumably so that update-grub doesn't try to interpret them. For instance:

  1. kopt=root=/dev/hda6 ro console=tty0 console=ttyS0,9600n8
  2. altoptions=(recovery mode) single console=tty0 console=ttyS0,9600n8

Then run update-grub and you'll get the full entries, such as: kernel /vmlinuz-2.6.8-2-686 root=/dev/hda6 ro console=tty0 console=ttyS0,9600n8

> My problem is that when Synaptic downloads a new kernel it adds it to the > menu.lst file with the same options I used when I installed and not the running > ones. Where can I find the list of default grub options that are added for new > kernels please? On Ubuntu, it's update-grub which changes the menu.lst file. If yours is anything like mine, it's set out so:

  1. menu.list - blah
  2.  

... some options...

      1. BEGIN AUTOMAGIC KERNELS LIST
    1. More blah
    2. ## Start Default Options ##
  1. kopt=root=/dev/hda5 ro
  2. other commented out default options
    1. ## End Default Options ##

... list of configured kernels on the system ..

      1. END DEBIAN AUTOMAGIC KERNELS LIST

... static configuration, other OSes, etc ... What you want to do is edit the stuff in between ".. Default Options" - you don't need to uncomment them, just edit them. Try backing up your menu.lst, make some changes and then run update-grub and see what happens. You might also want to look at the update-grub manpage.