Page 13 of 24 FirstFirst ... 3111213141523 ... LastLast
Results 121 to 130 of 236

Thread: Grub 2 Title Tweaks Thread

  1. #121
    Join Date
    Jun 2006
    Beans
    140
    Distro
    Kubuntu 12.04 Precise Pangolin

    Re: Grub 2 Title Tweaks Thread

    If you want to to figure out what LONGNAME is for changing a menu entry, and if it's being changed try something like this:

    edit /etc/grub.d/30_os-prober like this, probably around line 139 ish
    Code:
    #/etc/grub.d/30_os-prober
    #http://ubuntuforums.org/showthread.php?t=1287602
    #  if [ -z "${LONGNAME}" ] ; then
    #    LONGNAME="${LABEL}"
    #  fi
    #see /boot/grub/grub.cfg for the output of these lines after a sudo update-grub2, if not commented out
    #the '#' in the echo is so that this doesn't give an error if you accidentally(or decide to) leave it
    echo '#${LONGNAME} was'
    echo "#${LONGNAME}"
     if [ "${LONGNAME}" = "LONGNAME text to be replaced" ] ; then
       LONGNAME="LONGNAME replacement text"
     elif [ -z "${LONGNAME}" ] ; then
       LONGNAME="${LABEL}"
     fi
    echo '#${LONGNAME} is now'
    echo "#${LONGNAME}"

    then run sudo update-grub2 and see the output in /boot/grub/grub.cfg
    One of my most wanted bugs [in K/Ubuntu, ...] I'd like fixed is that
    GNOME save as / open dialogs don't have a way to copy paths to the clipboard.
    p.s.
    Recovery console should be renamed performance gaming console

  2. #122
    Join Date
    Jan 2007
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: Grub 2 Title Tweaks Thread

    Since I often try to provide solutions in this thread and use the "cut" command, I like to know the format of the basic variables in 10_linux and 30_os-prober. Here is a list I keep of the standard output formats:

    VARIABLES:

    10_linux:
    linux: /boot/vmlinuz-2.6.32-22-generic
    basename: vmlinuz-2.6.32-22-generic
    dirname: /boot
    version: 2.6.32-22-generic
    alt_version: 2.6.32-22-generic
    linux_root_device_thisversion: UUID=c5163c70-4f7-4034-a218-5dae03b07eed

    30_os-prober:
    DEVICE: /dev/sda9
    LONGNAME: Ubuntu 8.10 (8.10)
    OS: /dev/sda9:Ubuntu^8.10^(8.10):Ubuntu:linux
    LABEL: Ubuntu
    BOOT: linux
    LROOT: /dev/sda9
    LINUX: /dev/sda9:/dev/sda9:Ubuntu^8.10,^kernel^2.6.27-9-generic:/boot/vmlinuz-2.6.27-9-generic:/boot/initrd.img-2.6.27-9-generic:root=UUID=ba83d184-705e-4115-9d42-0823c698a77^ro^splash^quiet
    LLABEL: Ubuntu 8.10, kernel 2.6.27-9-generic
    LKERNEL: /boot/vmlinuz-2.6.27-9-generic
    LINITRD: /boot/initrd.img-2.6.27-9-generic
    LPARAMS: root=UUID=ba83d184-705e-4115-9d42-0823c698a77 ro splash quiet
    GRUB2

    Retired.

  3. #123
    Join Date
    Jul 2010
    Beans
    8

    Re: Grub 2 Title Tweaks Thread

    Quote Originally Posted by CharlesA View Post
    Yeah, you should remove "false"

    It should looks like this:

    Code:
      linux_entry "${OS} ${version_no_generic}" \
    The problem I had was if I updated the variable with the name I wanted, it would leave off "recovery mode" so I did a quick and dirty workaround:

    I had to edit /boot/grub/menu.lst on the BT4 install and then running "update-grub" from Ubuntu 9.10.

    Original menu.lst:

    Code:
    title        Ubuntu 8.10, kernel 2.6.30.9
    uuid        a76c7835-eb6f-459f-a891-496f16bc00eb
    kernel        /boot/vmlinuz-2.6.30.9 root=UUID=a76c7835-eb6f-459f-a891-496f16bc00eb ro vga=0x317 
    initrd        /boot/initrd.img-2.6.30.9
    quiet
    
    title        Ubuntu 8.10, kernel 2.6.30.9 (recovery mode)
    uuid        a76c7835-eb6f-459f-a891-496f16bc00eb
    kernel        /boot/vmlinuz-2.6.30.9 root=UUID=a76c7835-eb6f-459f-a891-496f16bc00eb ro  single
    initrd        /boot/initrd.img-2.6.30.9
    
    title        Ubuntu 8.10, memtest86+
    uuid        a76c7835-eb6f-459f-a891-496f16bc00eb
    kernel        /boot/memtest86+.bin
    quiet
    Edited menu.lst:

    Code:
    title        Backtrack 4 Final (2.6.30.9)
    uuid        8ce79a61-7653-4799-950e-bca17e0b5b77
    kernel        /boot/vmlinuz-2.6.30.9 root=UUID=8ce79a61-7653-4799-950e-bca17e0b5b77 ro quiet splash 
    initrd        /boot/initrd.img-2.6.30.9
    quiet
    
    title        Backtrack 4 Final (.6.30.92) (recovery mode)
    uuid        8ce79a61-7653-4799-950e-bca17e0b5b77
    kernel        /boot/vmlinuz-2.6.30.9 root=UUID=8ce79a61-7653-4799-950e-bca17e0b5b77 ro  single
    initrd        /boot/initrd.img-2.6.30.9
    
    #title        Ubuntu 8.10, memtest86+
    #uuid        8ce79a61-7653-4799-950e-bca17e0b5b77
    kernel        /boot/memtest86+.bin
    quiet
    Here is what my Grub2 menu looks like now:

    Code:
    Karmic (2.6.31-20)
    Karmic (2.6.31-20) (recovery mode)
    Karmic (2.6.31-14)
    Karmic (2.6.31-14) (recovery mode)
    Windows 7 Professional
    Backtrack 4 Final (2.6.30.9)
    Backtrack 4 Final (2.6.30.9) (recovery mode)
    Much, much cleaner.
    Thank you so much for sharing that!

    I was able to rename BT4 through that simple edit. No needing to miss with Grub 2 files on Ubuntu .

  4. #124
    Join Date
    Jun 2010
    Location
    Tennessee, USA
    Beans
    672
    Distro
    Ubuntu 13.04 Raring Ringtail

    Re: Grub 2 Title Tweaks Thread

    Works great, and the link to a custom menu is great too! Thanks
    --Corrytonapple----
    [Toshiba L455-S5008] [Intel Pentium 2.4GHz Procesor]
    [250GB HDD;4GB RAM] [Debian Wheezy 7.0 with GNOME 3][Fedora 16]

  5. #125
    Join Date
    Oct 2010
    Beans
    6

    Re: Grub 2 Title Tweaks Thread

    help, I got a huge problem with this tweaking.

    I was following the instruction in post 112. However, I think I've missed some lines so I'm encountering a huge problem. After restarting to see the result, I didnt see the Ubuntu entry anymore, only the recovery mode and the windows left. Now I couldn't log on to Ubuntu.

    How can I log on to ubuntu in recovery mode to change back the files I just edited? Or should I reinstall Ubuntu ?

  6. #126
    Join Date
    Mar 2009
    Location
    Madras, India
    Beans
    103
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Grub 2 Title Tweaks Thread

    Quote Originally Posted by alababi View Post
    help, I got a huge problem with this tweaking.

    I was following the instruction in post 112. However, I think I've missed some lines so I'm encountering a huge problem. After restarting to see the result, I didnt see the Ubuntu entry anymore, only the recovery mode and the windows left. Now I couldn't log on to Ubuntu.

    How can I log on to ubuntu in recovery mode to change back the files I just edited? Or should I reinstall Ubuntu ?
    You could boot in recovery mode and edit the grub file using nano. It has a very friendly interface and it is one of the easiest command line text editing programs out there. Or, if you had made a backup of your grub configuration before you started editing it, you can restore it from recovery mode. You don't have to go to the trouble of reinstalling Ubuntu, it's probably just a small error and easily fixable. Just post the contents of your configuration file here so we could see what went wrong (use a usb stick to copy the contents of the grub configuration file, then boot into Windows to post it here).
    "There is nothing wrong in quoting yourself." - Agent.Logic_

  7. #127
    Join Date
    Oct 2010
    Beans
    6

    Re: Grub 2 Title Tweaks Thread

    Quote Originally Posted by Agent.Logic_ View Post
    You could boot in recovery mode and edit the grub file using nano. It has a very friendly interface and it is one of the easiest command line text editing programs out there. Or, if you had made a backup of your grub configuration before you started editing it, you can restore it from recovery mode. You don't have to go to the trouble of reinstalling Ubuntu, it's probably just a small error and easily fixable. Just post the contents of your configuration file here so we could see what went wrong (use a usb stick to copy the contents of the grub configuration file, then boot into Windows to post it here).
    Please elucidate the nano stuff for me. As you can see, I'm just a newbie to ubuntu. When I chose the recovery mode entry, all I saw was black screen with commands, similar to a full screen size terminal.
    I just need to be able to log on to Ubuntu to set everything as default, I saved the original commands which I changed as comments.

  8. #128
    Join Date
    Mar 2009
    Location
    Madras, India
    Beans
    103
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Grub 2 Title Tweaks Thread

    Quote Originally Posted by alababi View Post
    Please elucidate the nano stuff for me. As you can see, I'm just a newbie to ubuntu. When I chose the recovery mode entry, all I saw was black screen with commands, similar to a full screen size terminal.
    I just need to be able to log on to Ubuntu to set everything as default, I saved the original commands which I changed as comments.
    Okay, I'll walk you through.

    When you boot into recovery mode, a lot of lines will fly by you (don't get bogged down, it is impossible to keep up with and most of it is just information about what is loading currently, ignorable warnings etc.) After everything has finished loading, you will be a few options, just scroll down with your down arrow key and choose "drop to root shell prompt."

    1. Type
      Code:
      nano /etc/grub.d/10_linux
      seeing that you edited that file according to post #112. Please do tell if you edited any other grub related configuration file.
    2. Just remove the edits on post #112 and uncomment the lines you commented out originally.
    3. Save it by pressing ctrl + O (Write Out) and exit by pressing ctrl + X.
    4. Type in
      Code:
      update-grub
      and when it is done, type in
      Code:
      update-initramfs -u
    5. Reboot by typing
      Code:
      reboot


    Hopefully, this should fix it. If you are not sure anymore that the 10_linux file was restored to its original self, here is the untouched version of the 10_linux file:

    Code:
    #! /bin/sh -e
    
    # grub-mkconfig helper script.
    # Copyright (C) 2006,2007,2008,2009,2010  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}
    bindir=${exec_prefix}/bin
    libdir=${exec_prefix}/lib
    . ${libdir}/grub/grub-mkconfig_lib
    
    export TEXTDOMAIN=grub
    export TEXTDOMAINDIR=@LOCALEDIR@
    
    CLASS="--class gnu-linux --class gnu --class os"
    
    if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
      OS=GNU/Linux
    else
      OS="${GRUB_DISTRIBUTOR}"
      CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr '[A-Z]' '[a-z]' | cut -d' ' -f1) ${CLASS}"
    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 ()
    {
      os="$1"
      version="$2"
      recovery="$3"
      args="$4"
      if ${recovery} ; then
        title="$(gettext_quoted "%s, with Linux %s (recovery mode)")"
      else
        title="$(gettext_quoted "%s, with Linux %s")"
      fi
      printf "menuentry '${title}' ${CLASS} {\n" "${os}" "${version}"
      cat << EOF
    	recordfail
    EOF
      save_default_entry | sed -e "s/^/\t/"
    
      if [ "x$GRUB_GFXPAYLOAD_LINUX" != x ]; then
    	  cat << EOF
    	set gfxpayload=$GRUB_GFXPAYLOAD_LINUX
    EOF
      fi
    
      if [ -z "${prepare_boot_cache}" ]; then
        prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/")"
      fi
      printf '%s\n' "${prepare_boot_cache}"
      if [ "x$5" != "xquiet" ]; then
        cat << EOF
    	echo	'$(printf "$(gettext_quoted "Loading Linux %s ...")" ${version})'
    EOF
      fi
      cat << EOF
    	linux	${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
    EOF
      if [ "x$5" != "xquiet" ]; then
        cat << EOF
    	echo	'$(gettext_quoted "Loading initial ramdisk ...")'
    EOF
      fi
      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`
    prepare_boot_cache=
    
    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}" "${version}" false \
          "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_EXTRA} ${GRUB_CMDLINE_LINUX_DEFAULT}" \
          quiet
      if [ "x${GRUB_DISABLE_LINUX_RECOVERY}" != "xtrue" ]; then
        linux_entry "${OS}" "${version}" true \
    	"single ${GRUB_CMDLINE_LINUX}"
      fi
    
      list=`echo $list | tr ' ' '\n' | grep -vx $linux | tr '\n' ' '`
    done
    Last edited by Agent.Logic_; October 31st, 2010 at 01:51 PM. Reason: corrected typo
    "There is nothing wrong in quoting yourself." - Agent.Logic_

  9. #129
    Join Date
    Oct 2010
    Beans
    6

    Re: Grub 2 Title Tweaks Thread

    @Agent Logic:

    I just did as what you wrote but I stuck in step 3. After I changed the code, it didnt allow me to save the file. How can I overcome this ?

  10. #130
    Join Date
    Mar 2009
    Location
    Madras, India
    Beans
    103
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Grub 2 Title Tweaks Thread

    That's strange... you are logged in as root and that means you have complete access to the system. Nothing should stop you. Does it give you any error messages? When you press ctrl + O, a little dialog appears in the bottom of the screen asking "File name to write:" and you just have to press enter (to save it in the current file). Is this where you are stuck?
    "There is nothing wrong in quoting yourself." - Agent.Logic_

Page 13 of 24 FirstFirst ... 3111213141523 ... LastLast

Tags for this Thread

Bookmarks

Posting Permissions

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