Page 24 of 24 FirstFirst ... 14222324
Results 231 to 236 of 236

Thread: Grub 2 Title Tweaks Thread

  1. #231
    Join Date
    Jan 2007
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: Grub 2 Title Tweaks Thread

    After much experimenting I think I found a way to display the splash menu without having to press a key first, and then displaying with the SHIFT or ESC key (any other key displays the countdown time remaining).

    Dareus, if you are still interested let me know and I'll purge/reinstall GRUB so I know I'm working with the default scripts and not my variations. I'll try to figure out a script modification rather than a straight hack of the grub.cfg file so it can be done automatically.

    It's been a giant puzzle but I won't pursue it unless someone wants to use this functionality.
    Back to Xorg...

    Retired.

  2. #232
    Join Date
    May 2008
    Location
    near Milan, Italy
    Beans
    35
    Distro
    Ubuntu

    Re: Grub 2 Title Tweaks Thread

    Quote Originally Posted by drs305 View Post
    After much experimenting I think I found a way to display the splash menu without having to press a key first, and then displaying with the SHIFT or ESC key (any other key displays the countdown time remaining).

    Dareus, if you are still interested let me know and I'll purge/reinstall GRUB so I know I'm working with the default scripts and not my variations. I'll try to figure out a script modification rather than a straight hack of the grub.cfg file so it can be done automatically.

    It's been a giant puzzle but I won't pursue it unless someone wants to use this functionality.
    Absolutely, I'm still interested and many others are, too! I found many people on the internet asking how to do that!

    Still, I can't tell you "thank you" enough

  3. #233
    Join Date
    Jan 2007
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: Grub 2 Title Tweaks Thread

    Quote Originally Posted by Dareus View Post
    Absolutely, I'm still interested and many others are, too! I found many people on the internet asking how to do that!
    Ok. Deep breath - I don't know how much I'll relate as to my tests or how much detail I'll go into here. The disclaimer is that this works on two of my machines - it probably will work on yours but there could be differences. Also - this post deals with the GRUB splash image and doesn't address/solve the blank screen after GRUB passes control and before unity-greeter/pymouth displays it's splash screen.

    I started by purging and reinstalling Grub so I was working with a fresh version of Grub 1.99. You don't need to do this, but I haven't tried to incorporate it with what we have already done.

    Overview:
    1. The following should allow the system to boot to a splash screen. The screen should appear without the necessity of pressing any key. A welcome message can be included on the splash screen if desired (with an annoying cursor underneath, which I haven't figured out how to hide). Of course, you could also include a welcome message embedded on the screen by editing the image with a graphics program. The timeout counter won't be displayed for some reason (although there is a workaround method not discussed here).

    2. Pressing either the SHIFT or ESC key will display the menu (if GRUB_TIMEOUT is greater than 0, or boot immediately if it is 0. If the menu is displayed, it will boot after the GRUB_TIMEOUT value. Pressing the key again if the menu is displayed will stop the counter.

    3. Pressing any other key will display the time remaining until the system automatically boots or displays the menu.

    Setup:

    Create a custom script. I've called it 06_splash. The name should start with "06" so it is placed in grub.cfg after the 05_debian_theme script but before the menuentries.

    Code:
    sudo touch /etc/grub.d/06_splash
    sudo chmod +x /etc/grub.d/06_splash
    gksu gedit /etc/grub.d/06_splash /etc/default/grub

    In /etc/default/grub, set these values:

    GRUB_TIMEOUT # 0 for automatic booting without ever seeing the menu or the number of seconds to wait after it displays before booting.
    GRUB_HIDDEN_TIMEOUT # Seconds to press SHIFT or ESC before the menu displays or system boots.
    GRUB_BACKGROUND # Optional. Place a graphic image in /boot/grub or designate an image here (GRUB_BACKGROUND=/path/imagename.png)
    Samples:
    GRUB_TIMEOUT=0 # I use a small positive value during testing so I know when the transfer occurs and I can stop it if necessary.
    GRUB_HIDDEN_TIMEOUT=10 # Use an odd number such as 23 if you plan on reviewing what happens in grub.cfg. Doing a search for 23 is much easier than a search for 10. Set to desired value once you know it works.
    GRUB_BACKGROUND=/images/mygrubimage.png # Or just put the image in /boot/grub and this line isn't necessary. If you use this line, remove images from /boot/grub folder.
    Content:
    The script is pretty straightforward. It took me dozens of boots to come up with the following for a variety of reasons - mostly because I'm not a scripter/programmer. There are probably better ways of doing things, but here is what I came up with. Paste the contents into the script.

    #!/bin/sh
    echo 1>&2 "Adding 06_splash"

    cat << EOF
    # This file allows a GRUB 2 splash screen to appear w/o keystrokes.
    # Press the ESC or SHIFT key to display the GRUB menu.
    # If no action is taken, the menu will display for GRUB_TIMEOUT before booting.
    EOF

    # Make sure no recordfail event has occurred, then run the script.
    cat << EOF
    if [ "x\${timeout}" != "x-1" ]; then

    # GRUB colors available in the menu: color1/color2
    # black, blue, brown, cyan, dark-gray, green, light-cyan, light-blue, light-green,
    # light-gray, light-magenta, light-red, magenta, red, white, yellow
    # /black is transparency code for second value
    # Samples text/background combinations
    # menu_color_normal=light-gray/dark-gray
    # menu_color_highlight=yellow/dark-gray
    # color_normal=light-gray/dark-gray

    # Display splash background. If no welcome message, comment the 'echo' line.
    clear
    echo "Welcome to Ubuntu - Press the ESC or SHIFT Key to Continue"
    sleep --verbose --interruptible $GRUB_HIDDEN_TIMEOUT
    fi
    EOF

    cat << EOF
    # Determine if the user interrupted the splash countdown, then boot or display the menu.
    if [ \$? = "0" ]; then
    set timeout=$GRUB_TIMEOUT
    else
    set timeout=-1
    fi
    EOF
    Save the file and update-grub.

    NOTE: Rather than edit GRUB's 'official' scripts, this script places information after the 00_header and 05_debian_theme inputs. Some of these may duplicate entries in the previous sections of grub.cfg, but since they come later they will be used. Additionally, this script will not be changed if 00 or 05 is updated via a GRUB package update.

    Explanations and elaborations:
    echo 1>&2 "Adding 06_splash"
    Not required; it shows the script being added in the terminal output when update-grub is run.

    cat << EOF
    Copies input to grub.cfg until "EOF" marker is found.

    Comments
    The colors listed in the remarks are the ones recognized by GRUB. You can use them for the menu text, highlight bars, etc. Black used as the second value is treated as "transparent". More on that later (maybe).

    if [ "x\${timeout}" != "x-1" ]; then
    The remainder will take effect if the timeout is -1. This value means the menu will display and await user input. The most common way the value becomes -1 is after a failed boot. The \ is necessary for proper importation when using 'cat'

    # menu_color_normal=light-gray/dark-gray
    # menu_color_highlight=yellow/dark-gray
    # color_normal=light-gray/dark-gray
    These values set the text (and background) colors. You don't need these unless the automatic text color selection isn't working with your image or you want something different. I may elaborate on these later, but the color_normal would be the color of the Welcome message and the text outside the menu borders. Additionally, if you are not using a background image you can set the text and solid background colors (except a black background) by using these settings.

    The menu_color_highlight are the colors of the highlighted menuentry and the color of the background bar.

    The menu_color_normal is the text color of the non-selected menu item and the background color.

    Remember /black means 'transparent' - i.e. you will see the background image. The available colors are in the script comments. See the links at the end of this post for some links with fuller explanations.


    clear
    It took me a long time, and many variations, before I stumbled on this line. This is the command which will display the background image automatically without having to press a key.

    echo "Welcome to Ubuntu - Press the ESC or SHIFT Key to Continue"
    Optional. You'll have the annoying _ underneath it. You could embed your message in your graphic as an alternative. If you want to change the message color, uncomment the "color_normal" setting above and choose your color. The second color should be /black if you are using a background image. If you don't want a message, comment (#) the line or remove it completely.

    sleep --verbose --interruptible $GRUB_HIDDEN_TIMEOUT
    This will import the /etc/default/grub GRUB_HIDDEN_TIMEOUT value. The menu will remain hidden for this many seconds, then either boot or display based on the GRUB_TIMEOUT setting. Even though it's verbose and should display the timer, it doesn't for me when using a graphic. NOTE: The switches are preceded by two - , it's not a single long dash.

    if [ \$? = "0" ]; then
    Another line that took me way longer than it should have to figure out. It is a conditional which determines whether you have pressed a key to interrupt the hidden timeout countdown.

    set timeout=$GRUB_TIMEOUT
    else
    set timeout=-1
    If you don't press any key, it will immediately boot if GRUB_TIMEOUT is 0 or display the menu for GRUB_TIMEOUT seconds. If you do press the SHIFT or ESC key during the countdown, the menu will display. At that point, the menu will display for the GRUB_TIMEOUT number of seconds before booting. If it is set at 0, you will not see the menu before it boots.

    A bit about the menu colors
    If you don't include a background image, you can use the commented section (by uncommenting one or more) to set the background color.

    If the second value is /black, your image will appear behind the menu. If the second value is an approved color, it will be opaque.

    If you leave them commented and don't use an image, I believe Ubuntu is going to use the purple/aubergine background.

    One final note about solid colors. I like clean black backgrounds but it's a bit tricky in Grub. Since the background color is designated by /xxxxxx, but /black is used as "transparency", I don't think you can set it with the color designations. What I did to achieve a black screen with a small image on it was to create a solid black image and used that as my background.

    As I was testing there were all sorts of things I thought I could relate, but the ones above are the major ones.

    Don't forget to update-grub for the changes to take affect.

    I've written a couple of tutorials and ubuntu.help pages that might help if you don't understand the color selections:

    https://help.ubuntu.com/community/Grub2/Displays

    Grub 2 Drop-In Backgrounds & Font Selection
    Last edited by drs305; July 12th, 2012 at 04:44 PM.
    Back to Xorg...

    Retired.

  4. #234
    Join Date
    May 2008
    Location
    near Milan, Italy
    Beans
    35
    Distro
    Ubuntu

    Re: Grub 2 Title Tweaks Thread

    Tank you so much! Everything works fine now! It would have been impossible without your help! Again, thank you!

  5. #235
    Join Date
    Jul 2012
    Beans
    2

    Re: Grub 2 Title Tweaks Thread

    What i essentially want to accomplish is to hide my ubuntu install and have the system automatically boot to windows 7.

    I can make it boot to windows 7 automatically, that was simple.

    I followed each different way of hiding the bootloader screen on section 11 but when i do and update grub, the windows 7 option is not available.

    how can i set this up to automatically boot to windows 7, and hide the boot loader prompt, but allow me to hit shift to access the bootloader screen?

    Thanks,

    -Tony

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

    Re: Grub 2 Title Tweaks Thread

    #235
    skellobissis,

    Welcome to the Ubuntu Forums.

    I'd probably have to see the contents of RESULTS.txt to see what is happening with your system but an easier option for you may be to try Grub Customizer. It probably has a way of doing what you wish. (See BIS and Customizer links in my sig line)

    If it can't do what you want just post back and we can probably add something to a custom file to make sure the SHIFT option is available.
    Back to Xorg...

    Retired.

Page 24 of 24 FirstFirst ... 14222324

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
  •