Page 5 of 24 FirstFirst ... 3456715 ... LastLast
Results 41 to 50 of 236

Thread: Grub 2 Title Tweaks Thread

  1. #41
    Join Date
    Dec 2009
    Beans
    1

    Re: Grub 2 Title Tweaks Thread

    for capitalize the first letter of codename

    Code:
    codename=`lsb_release -cs | sed "s/^./\u&/"`

  2. #42
    Join Date
    Oct 2009
    Beans
    88

    Re: Grub 2 Title Tweaks Thread

    Hey all,

    This thread helped me customize my grub2 menu and I thank you all for that. I just thought I'd share with you guys something that is not found here. I mentioned it in the thread I created here, but I think it's more useful if I post it here.

    Okay so first, note that this is for the system partition (i.e. the 10_linux file). I wanted the version number of Ubuntu to show up. Using lsb_release in a different way from the codename variable this thread already introduces, I instead introduced the following variable
    Code:
      ## User-added variables
      description="`lsb_release -ds`"
      ##
    which in my case evaluates to the string "Ubuntu 9.10".

    Cheers.

  3. #43
    Join Date
    Nov 2007
    Beans
    6

    Re: Grub 2 Title Tweaks Thread

    first, thx for the great tutorial, used many parts of it and it worked like a charm

    i`m just breaking my head while trying to hide a kernel version from showing

    this is what grub is currently displying

    Ubuntu 9.10 (Karmic) 2.6.31-16-generic
    Ubuntu 9.10 (Karmic) 2.6.31-14-generic
    Windows 7 Professional

    And i want to hide Ubuntu 9.10 (Karmic) 2.6.31-14-generic

    the following code was extrated from the linux part of 30_os-prober, where i made the sugested changes to hide it

    Code:
          for LINUX in ${LINUXPROBED} ; do
            LROOT="`echo ${LINUX} | cut -d ':' -f 1`"
            LBOOT="`echo ${LINUX} | cut -d ':' -f 2`"
            LLABEL="`echo ${LINUX} | cut -d ':' -f 3 | tr '^' ' '`"
            LKERNEL="`echo ${LINUX} | cut -d ':' -f 4`"
            LINITRD="`echo ${LINUX} | cut -d ':' -f 5`"
            LPARAMS="`echo ${LINUX} | cut -d ':' -f 6- | tr '^' ' '`"
    	hidekernel="`echo ${LKERNEL} | cut -d'-' -f2-3`"
    
            if [ -z "${LLABEL}" ] ; then
              LLABEL="${LONGNAME}"
            fi
    
     	if [ ${hidekernel} = "2.6.31-14" ]; then
           continue
        	fi
    
             if [ "${LROOT}" != "${LBOOT}" ]; then
               LKERNEL="${LKERNEL#/boot}"
               LINITRD="${LINITRD#/boot}"
             fi
    
            cat << EOF
    but its not working

    tried if [ ${hidekernel} = "2.6.31-14-generic" ] and still no good

    any suggestions??

    thank you very much

  4. #44
    Join Date
    Jan 2007
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: Grub 2 Title Tweaks Thread

    Quote Originally Posted by LaZaNha View Post
    first, thx for the great tutorial, used many parts of it and it worked like a charm

    i`m just breaking my head while trying to hide a kernel version from showing

    this is what grub is currently displying

    Ubuntu 9.10 (Karmic) 2.6.31-16-generic
    Ubuntu 9.10 (Karmic) 2.6.31-14-generic
    Windows 7 Professional

    And i want to hide Ubuntu 9.10 (Karmic) 2.6.31-14-generic

    the following code was extrated from the linux part of 30_os-prober, where i made the sugested changes to hide it


    tried if [ ${hidekernel} = "2.6.31-14-generic" ] and still no good

    any suggestions??

    thank you very much
    Are the kernels you want to hide on a different partition? It appears these are part of your normal installation. If you want to hide 2.6.31-14-generic on your normal install you would modify the 10_linux file and not the 30_os-prober file, which looks for OS's on other partitions.

    One thing I do when I experiment with these tweaks and they don't work is to take a step back to see what the result of the "uncut" variable is, such as "hidekernel" and "LKERNEL" to make sure I am working with the correct starting point. In this case, I would add the following lines just after the variable definitions and on a line just put "echo ${LKERNEL}" and on the next "echo $hidekernel" (without the quotes). Then run the update-grub command and check the 30_os-prober section of /boot/grub/grub.cfg to see what those two variables are producing. Of course, remove these lines and run the update again before rebooting.

    If you still are having problems hiding the kernel come back and let us know.
    GRUB2

    Retired.

  5. #45
    Join Date
    Nov 2007
    Beans
    6

    Re: Grub 2 Title Tweaks Thread

    drs305, you were right!

    i didn`t realize that i was messing with the wrong file.

    but even after that i struggled a little bit to get it to work.

    finally, the following code inserted after variable version was declared in 10_linux made it work

    Code:
        if [ ${version} = "2.6.31-14-generic" ]; then
           break
        fi
    thanks for the help!! i promise im gonna study shell script from now on hahahaa

  6. #46
    Join Date
    Jan 2007
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: Grub 2 Title Tweaks Thread

    Quote Originally Posted by LaZaNha View Post
    drs305, you were right!

    i didn`t realize that i was messing with the wrong file.

    but even after that i struggled a little bit to get it to work.

    finally, the following code inserted after variable version was declared in 10_linux made it work

    Code:
        if [ ${version} = "2.6.31-14-generic" ]; then
           break
        fi
    thanks for the help!! i promise im gonna study shell script from now on hahahaa
    I just reviewed the opening post and realized that my examples didn't include one for hiding specific kernels on the main partition. Thanks for your input.

    Below is an alternate method of hiding -14. Your entry will hide the -14 kernel, but it would also prevent any kernel number lower than -14 from displaying because the script would stop as soon as it found -14. So if you wanted to see -12, it wouldn't end up in the menu.

    A different approach would be to alter the 10_linux script in this manner. The dark green lines are added to the script.
    if [ ${version} != "2.6.31-14-generic" ]; then
    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
    fi
    The first line tells the script that if the kernel is not -14, continue. If it is -14, entry into the menu will be skipped. This way the -12 kernel, if present, would still show up on the menu.

    Of course, if you didn't want to display -14 or earlier, your way would work. Or you can always remove the -14 kernel via Synaptic and be done with it! There are many ways to do things in Linux, which is one of the reasons I like it so much.

    Again, thanks for your contribution.
    Last edited by drs305; December 29th, 2009 at 05:45 PM.
    GRUB2

    Retired.

  7. #47
    Join Date
    Dec 2009
    Beans
    5

    Re: Grub 2 Title Tweaks Thread

    I am trying to hide/remove the entry in my GRUB 2 loader menu that is for the Windows Vista recovery partition. I did see the instructions on how to do this in the initial post of this thread, but it's not working for some reason. As far as the "exact" name and location of the partition, mine is precisely identical to what was described in the instructions, so I did not mess with this because I do not believe it's the problem.

    What I suspect the problem "is", is that the sample code in the instructions was not properly formatted to demonstrate "exactly" how the code should be written, "including" the amount of tab space from the left. Here is the code I have in my "30_os-prober" file, starting at line 83:

    Code:
    for OS in ${OSPROBED} ; do
      DEVICE="`echo ${OS} | cut -d ':' -f 1`"
      LONGNAME="`echo ${OS} | cut -d ':' -f 2 | tr '^' ' '`"
      LABEL="`echo ${OS} | cut -d ':' -f 3 | tr '^' ' '`"
      BOOT="`echo ${OS} | cut -d ':' -f 4`"
    
      if [ -z "${LONGNAME}" ] ; then
        LONGNAME="${LABEL}"
      fi
    
      if [ "$LONGNAME" = "Windows Vista (loader)" ] && [ "${DEVICE}" = "/dev/sda1" ] ; then
        continue 
      fi
    Now, in the last "if" statement loop described that was specified in the instructions, is where the problem is. When I go to run the "update-grub" command from command line prompt, I get the following error message:

    : not found/30_os-prober: 217: continue

    I have played around with the specific line of code you wrote to hide the windows recovery partition, and what I have found is that whatever text string I type in on the same line as "continue" will reflect the same in the end of the error code listed above.

    Please let me know what I need to do to get this windows recovery partition mod working.

  8. #48
    Join Date
    Jan 2007
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: Grub 2 Title Tweaks Thread

    jmine83,

    Welcome to Ubuntu and the Ubuntu forums. I'd be glad to help you out but we'll need to see the full /etc/grub.d/30_os-prober and /boot/grub/grub.cfg files so I can compare line numbers, titles, etc. You can just attach them to your previous post if you like. To ensure we have everything, you could also attach the results of the ever-popular "boot info script". Here are the instructions.

    Added:
    I just cut/pasted the text in the original post, changing only the title since I don't have Vista. It worked as depicted, hiding the partition. Note I don't have tabs/spaces before or after "continue".

    If you would like to experiment a bit further, you can hide the recovery partition by just designating the device.
    if [ "${DEVICE}" = "/dev/sda1" ] ; then
    continue
    fi
    Last edited by drs305; January 24th, 2010 at 06:05 AM.
    GRUB2

    Retired.

  9. #49
    Join Date
    Dec 2009
    Beans
    5

    Re: Grub 2 Title Tweaks Thread

    drs305,

    Thank you kindly for your response and input to my prior post. Attached to this post, you will find a .tar file which has three files enclosed within it as per your instructions requested. Again, I am simply trying to hide the Windows Vista recovery partition so that in the end, my GRUB menu only shows two choices: Windows 7 and Ubuntu.
    Attached Files Attached Files

  10. #50
    Join Date
    Jan 2007
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: Grub 2 Title Tweaks Thread

    Quote Originally Posted by jmine83 View Post
    drs305,

    Thank you kindly for your response and input to my prior post. Attached to this post, you will find a .tar file which has three files enclosed within it as per your instructions requested. Again, I am simply trying to hide the Windows Vista recovery partition so that in the end, my GRUB menu only shows two choices: Windows 7 and Ubuntu.
    Do you have your original grub files? It appears you renamed some standard files with non-standard names. While you can certainly have a these filenames and they will work, it may confuse things.

    I will set up a 30_os-prober file for you later today and post it in this thread. I'll be using the 1.97beta standard version of Grub 2 which is what you should see in the Grub 2 menu when you boot. In the meantime, if you created them by what you thought were instructions in my guide, delete 10_os-prober and 20_linux. The standard files in /etc/grub.d are 00_header, 05_debian_theme, 10_linux, 20_memtest86+, 30_os-prober, 40_custom and README.
    Last edited by drs305; January 28th, 2010 at 12:42 AM.
    GRUB2

    Retired.

Page 5 of 24 FirstFirst ... 3456715 ... 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
  •