LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Grub2 boot entries don't change (https://www.linuxquestions.org/questions/linux-software-2/grub2-boot-entries-dont-change-787414/)

adunamia 02-06-2010 10:36 AM

Grub2 boot entries don't change
 
My grub2 boot entries never change. I have run sudo update-grub and it finds all the proper kernels and such and says that it has updated. I check with the menu.lst and grub.cfg and they both look to be correct, however, when I go to boot I am stuck with my old boot entries. Any ideas?

tredegar 02-06-2010 10:46 AM

menu.lst is not used by grub2 which is very different from grub
Here is a good grub2 tutorial.

adunamia 02-06-2010 11:02 AM

I am aware of that, but it is chainloading from legacy grub which does use the menu.lst. I have read many a tutorial and even changed boot entries, removed them, edited header, etc. in grub2, so it isn't a simple lack of understanding. everything is giving the correct output and looks as it should, but it doesn't update when I actually boot.

tredegar 02-06-2010 11:12 AM

Quote:

everything is giving the correct output and looks as it should, but it doesn't update when I actually boot.
You are not explaining anything very clearly.

Presumably you have grub installed on your MBR - Am I right?
Where did you install grub2 to?
How many OSs are you trying to boot?
On what partitions are their /boot directories?
Which OS are you running when you update grub?
Which OS are you running when you update grub2?

Edit: This thread may help
/Edit

adunamia 02-06-2010 11:23 AM

Right, sorry about the lack of information.

I'm running Ubuntu 9.10
output of sudo update-grub:
Searching for GRUB installation directory ... found: /boot/grub
Searching for default file ... found: /boot/grub/default
Testing for an existing GRUB menu.lst file ... found: /boot/grub/menu.lst
Searching for splash image ... none found, skipping ...
Found kernel: /boot/vmlinuz-2.6.31-19-generic
Found kernel: /boot/vmlinuz-2.6.31-17-generic
Found kernel: /boot/vmlinuz-2.6.31-16-generic
Found kernel: /boot/vmlinuz-2.6.31-14-generic
Found GRUB 2: /boot/grub/core.img
Found kernel: /boot/memtest86+.bin
Updating /boot/grub/menu.lst ... done

I have it installed to the MBR and I have vista installed also (I realize that output is not detecting vista but that is easily remedied).

output of fdisk -l:
/dev/sda1 * 1 24807 199262196 7 HPFS/NTFS
/dev/sda2 24808 30401 44933805 5 Extended
/dev/sda5 24808 30166 43046136 83 Linux
/dev/sda6 30167 30401 1887606 82 Linux swap / Solaris

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x8827dbfe

Device Boot Start End Blocks Id System
/dev/sdb1 * 1 121601 976757760 7 HPFS/NTFS

the boot directory is located on /dev/sda5 with all the other ubuntu files, I created no separate partitions. /dev/sdb1 is a 1TB backup drive that is used as backup primarily.


hope that helps enough

tredegar 02-06-2010 11:38 AM

Quote:

I have it installed to the MBR
I am assuming "it" refers to grub2, and if that is on the MBR, then grub cannot be, and should reallly be ignored.

If you only have ubuntu9.10, memtest86 and vista then why are you bothering to use grub legacy at all?
Just use grub2, installed to the MBR. If you rename /boot/grub/menu.lst to something else grub2 should just ignore "legacy grub" the next time you do sudo update-grub

And if you are not using ext4, you can still use grub legacy to boot 91.0

How did you get into this mess? I am guessing that you "upgraded" from a previous 'buntu installation, and did not do a "clean install".

Did you see the link I added to post #4?

adunamia 02-06-2010 11:45 AM

I did look at that and did not find it helpful. This was a clean install and I have not tampered with anything grub on this install (built a separate pc in the mean time). I am using ext4 and I was not aware I was chainloading legacy until I found the menu.lst (which was odd) and noticed it was set to chainload grub2. I've had nightmares with manually reinstalling grub2 mostly with it not finding any boot entries, so I'm trying to avoid that.

tredegar 02-06-2010 11:59 AM

I did a clean install of 9.10 and do not have grub legacy at all, just grub2, which does work.

Take a look at /etc/default/grub and make sure the defaults are sensible for what you want (Eg, I never want a hidden menu).

Check the scripts on /etc/grub.d

Then try renaming /boot/grub/menu.lst to something else, and do sudo update-grub

adunamia 02-06-2010 12:15 PM

no hidden menu entries (just checked) grub.d 10_linux looks right, but maybe you'll see something I'm missing. I've tried sudo update-grub (it prompts me to make a menu.lst) I've tried passing both no and yes, makes no difference. same goes for sudo update-grub 2

My 10_linux file:

#! /bin/sh -e

# grub-mkconfig helper script.
# Copyright (C) 2006,2007,2008,2009 Free Software Foundation, Inc.
#
# GRUB is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# GRUB is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GRUB. If not, see <http://www.gnu.org/licenses/>.

prefix=/usr
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
. ${libdir}/grub/grub-mkconfig_lib

if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
OS=GNU/Linux
else
OS="${GRUB_DISTRIBUTOR}"
fi

# loop-AES arranges things so that /dev/loop/X can be our root device, but
# the initrds that Linux uses don't like that.
case ${GRUB_DEVICE} in
/dev/loop/*|/dev/loop[0-9])
GRUB_DEVICE=`losetup ${GRUB_DEVICE} | sed -e "s/^[^(]*(\([^)]\+\)).*/\1/"`
# We can't cope with devices loop-mounted from files here.
case ${GRUB_DEVICE} in
/dev/*) ;;
*) exit 0 ;;
esac
;;
esac

if [ "x${GRUB_DEVICE_UUID}" = "x" ] || [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ] \
|| ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" \
|| [ "`grub-probe -t abstraction --device ${GRUB_DEVICE} | sed -e 's,.*\(lvm\).*,\1,'`" = "lvm" ] ; then
LINUX_ROOT_DEVICE=${GRUB_DEVICE}
else
LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID}
fi

# add crashkernel option if we have the required tools
if [ -x "/usr/bin/makedumpfile" ] && [ -x "/sbin/kexec" ]; then
GRUB_CMDLINE_EXTRA="$GRUB_CMDLINE_EXTRA crashkernel=384M-2G:64M,2G-:128M"
fi

linux_entry ()
{
cat << EOF
menuentry "$1" {
recordfail=1
if [ -n \${have_grubenv} ]; then save_env recordfail; fi
EOF
if [ "x$3" = "xquiet" ]; then
cat << EOF
set quiet=1
EOF
fi
save_default_entry | sed -e "s/^/\t/"
prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/"
cat << EOF
linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro $2
EOF
if test -n "${initrd}" ; then
cat << EOF
initrd ${rel_dirname}/${initrd}
EOF
fi
cat << EOF
}
EOF
}

list=`for i in /boot/vmlinu[xz]-* /vmlinu[xz]-* ; do
if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
done`

while [ "x$list" != "x" ] ; do
linux=`version_find_latest $list`
echo "Found linux image: $linux" >&2
basename=`basename $linux`
dirname=`dirname $linux`
rel_dirname=`make_system_path_relative_to_its_root $dirname`
version=`echo $basename | sed -e "s,^[^0-9]*-,,g"`
alt_version=`echo $version | sed -e "s,\.old$,,g"`
linux_root_device_thisversion="${LINUX_ROOT_DEVICE}"

initrd=
for i in "initrd.img-${version}" "initrd-${version}.img" \
"initrd-${version}" "initrd.img-${alt_version}" \
"initrd-${alt_version}.img" "initrd-${alt_version}"; do
if test -e "${dirname}/${i}" ; then
initrd="$i"
break
fi
done
if test -n "${initrd}" ; then
echo "Found initrd image: ${dirname}/${initrd}" >&2
else
# "UUID=" magic is parsed by initrds. Since there's no initrd, it can't work here.
linux_root_device_thisversion=${GRUB_DEVICE}
fi

linux_entry "${OS}, Linux ${version}" \
"${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_EXTRA} ${GRUB_CMDLINE_LINUX_DEFAULT}" \
quiet
if [ "x${GRUB_DISABLE_LINUX_RECOVERY}" != "xtrue" ]; then
linux_entry "${OS}, Linux ${version} (recovery mode)" \
"single ${GRUB_CMDLINE_LINUX}"
fi

list=`echo $list | tr ' ' '\n' | grep -vx $linux | tr '\n' ' '`
done

tredegar 02-06-2010 01:57 PM

Well, the transition from grub to grub2 doesn't seem to have been handled very well by ubuntu.
On 8.04 I have grub and the command update-grub updates grub legacy
On 9.10 I have grub2 and the command update-grub updates grub2
On 9.10 update-grub2 just runs update-grub (which updates grub2 anyway)

On 9.10 grub2 is 2 packages, grub-pc and grub-common
On 8.04 grub is one package called grub

So, on 9.10 I suggest you use your package manager to remove (and purge) the package called grub
Make sure you keep grub-pc and grub-common though

That way you should have got rid of grub legacy (which should not be there in the first place with a clean install) and all the files associated with it.

Then you can get grub2 working without the added complexities of grub legacy getting in the way

adunamia 02-09-2010 04:35 PM

That did the trick. I had grub-common and grub installed, but not grub-pc. I still don't know how that happened since it was a default installation, but oh well. Thanks!


All times are GMT -5. The time now is 03:21 PM.