Find the answer to your Linux question:
Results 1 to 8 of 8
I have installed Ubuntu 9.10 as a dual boot with 9.04. I would like to edit the grub config file to get rid of all the superfluous menu entries and ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Newbie scutiform's Avatar
    Join Date
    May 2007
    Location
    Halifax West Yorkshire
    Posts
    132

    grub.cfg read only


    I have installed Ubuntu 9.10 as a dual boot with 9.04. I would like to edit the grub config file to get rid of all the superfluous menu entries and put the 9.04 entry before the 9.10 one. With 9.04 I can edit menu.lst as sudo gedit menu.lst and save it. When I sudo gedit grub.cfg I am no allowed to save the file. I get "You are trying to save to a read only disk" error. How can I get the grub folder to be R/W just for the editing session?
    The world is run by educated idiots - you can't argue with idiots, they have had years of practice.

  2. #2
    Super Moderator devils casper's Avatar
    Join Date
    Jun 2006
    Location
    Chandigarh, India
    Posts
    24,729
    You should not edit grub.cfg file because it is a simple conf file generated by GRUB2 scripts. Whatever you change in it will be gone on next update.

    If you want to change Menu entries, edit /etc/grub.d/10_linux file. Make sure to execute update-grub2 file after editing it.
    It is amazing what you can accomplish if you do not care who gets the credit.
    New Users: Read This First

  3. #3
    Linux Guru jmadero's Avatar
    Join Date
    Jul 2007
    Location
    California
    Posts
    1,998
    thanks casper, I was curious about this one as well....I'm not too keen on this new Grub, I hear it's a lot better but I feel like they just did a massive change without giving people enough time to slowly adjust. This makes a lot of sense though
    Bodhi 1.3 & Bodhi 1.4 using E17
    Dell Studio 17, Intel Graphics card, 4 gigs of RAM, E17

    "The beauty in life can only be found by moving past the materialism which defines human nature and into the higher realm of thought and knowledge"

  4. #4
    Linux Newbie scutiform's Avatar
    Join Date
    May 2007
    Location
    Halifax West Yorkshire
    Posts
    132
    Had a look at /etc/grub.d/10-linux and it doesn't seem to be relevant to the menu list. I am sending part of the file as a sample (The original file is 3 pages long)

    grub.cfg looked the same as the old menu.lst

    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}"
    -------------------------------------------------------------
    The world is run by educated idiots - you can't argue with idiots, they have had years of practice.

  5. #5
    oz
    oz is offline
    forum.guy
    Join Date
    May 2004
    Location
    arch linux
    Posts
    18,733
    Hi, scutiforum

    I'm not sure that it will help any, but there is a nice wiki page on the Ubuntu website that might offer up some clues that can help:

    https://wiki.ubuntu.com/Grub2

    On my Arch box, I have to edit the grub.cfg file directly, but it's my understanding that it's done differently under Ubuntu. Hope the wiki page helps.
    oz

  6. #6
    Linux Newbie scutiform's Avatar
    Join Date
    May 2007
    Location
    Halifax West Yorkshire
    Posts
    132
    I followed the info from Outcast-Aussie and 9.04 is now the default version to load. Thanks for that. I would still like to find how to edit the list. I am transfering files, settings etc from 9.04 to 9.10, but the last time I ran 9.10, I had so many problems, I un-installed it and re-installed 9.04. I'm just giving 9.10 another chance. The Grub loader looks so messy. The old menu.lst file was easy to tidy up.
    The world is run by educated idiots - you can't argue with idiots, they have had years of practice.

  7. #7
    Linux Newbie scutiform's Avatar
    Join Date
    May 2007
    Location
    Halifax West Yorkshire
    Posts
    132
    Thanks, ozar. I read the wiki and have decided I'll keep the messy menu.

    Why fix something if it isn't broke? I love the fact that Linux is always evolving and improving, but I would like the chance to not install an update to a program, or roll-back to a previous version if I wanted to
    The world is run by educated idiots - you can't argue with idiots, they have had years of practice.

  8. #8
    oz
    oz is offline
    forum.guy
    Join Date
    May 2004
    Location
    arch linux
    Posts
    18,733
    Yup, GRUB2 definitely seems more complex than the legacy version was, but I'm hoping that it will be simplified as it matures a bit. For now, it's still rather experimental in nature although it has been working pretty well on my box for the last 12 months, or so.
    oz

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •