Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Initially, Ubuntu was installed on another partition (sda5 or sda4).

At some point I did manually move the root partition to sda2.

Now, the problem is that whenever a new kernel is installed, the automatic regeneration of the menu.lst is using the OLD Linux partition. So I have to manually change in menu.lst the lines :

root            (hd0,5)

into

root            (hd0,1)

How can I configure update-grub to automatically generate menu.lst with the current Linux root partition? I assume that the (hd0,5) was written somewhere at installation, but I couldn't find it.

share|improve this question

2 Answers 2

One possibility that I have chosen is to tell grub to install at the master boot partition with

sudo fdisk -l                # where you get the disk
sudo grub-install /dev/hda   # in my computer it is /dev/sda

and then you update everything with:

update-grub2

Hope you succeed, you better wait for an expert answer.

share|improve this answer

Ever since grub2, menu.lst is not really used any more, so chances are you need to look elsewhere if you're having a problem with grub.

However, menu.lst is still sometimes used with the Cloud version of Ubuntu. If that applies to you, read on.

The auto-generated root (hd0) entries are actually configured by modifying the /boot/grub/menu.lst file. You need to find the lines that look like:

## default grub root device   
## e.g. groot=(hd0)
# groot=(hd0)

And change the last line to point to the new root, for example:

## default grub root device   
## e.g. groot=(hd0)
# groot=(hd0,5)

Notice that the groot=… line still begins with a #. Do not uncomment the changed line! I don't know what genius thought of having configuration parameters in commented out lines, but that's how it works.

Once you've made the change, regenerate menu.lst by running:

sudo update-grub-legacy-ec2

All the root entries in menu.lst should now be updated to point to (hd0,5) (or whatever you configured it to).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.