Page 23 of 24 FirstFirst ... 1321222324 LastLast
Results 221 to 230 of 236

Thread: Grub 2 Title Tweaks Thread

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

    Re: Grub 2 Title Tweaks Thread

    Quote Originally Posted by Dareus View Post
    First of all let me thank you again for your help in solving my problem.

    I did what you said but I still wasn't able to get the menu.

    But please, take a look at my script (posted a few messages above): after the make_timeout function declaration there's the block you made me add (now updated to the latest version you suggested), but a few lines down, 12 to be precise, BANG! those lines were already there! And unfortunately didn't work...
    The reason it appears twice is the second is within a conditional (regarding GRUB_HIDDEN_TIMEOUT_QUIET). So we are manually forcing the timeout check into the final product, but it also may appear if conditions are met later on. By placing it at the start of the section you guarantee it's going to be in the final product (even if it may appear twice under certain conditions). Since you are forcing it to appear in the final product under any conditions, you could remove it from the conditional section, but I'd rather not.

    We'll give this one more shot and if it doesn't work I'll tell you how I set it up a bit differently. I'd rather get it working this way first.

    Finding mistakes in scripts can be difficult to do, especially if they have been modified multiple times. Rather, rename your current file, remove the executable bit, and then save the attached file as your /etc/grub.d/30_os-prober file. Make it executable, then update grub. I've placed the timeout check at the end of the file.

    Code:
    sudo cp /etc/grub.d/30_os-prober /etc/grub.d/30_os-prober.old
    sudo chmod -x /etc/grub.d/30_os-prober.old
    Copy the entire contents below into /etc/grub.d/30_os-prober, save the file, then
    Code:
    sudo chmod +x /etc/grub.d/30_os-prober
    sudo update-grub
    Here is the entire Grub 1.99 script
    Code:
    #! /bin/sh
    set -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}"
    datarootdir="${prefix}/share"
    
    . "${datarootdir}/grub/grub-mkconfig_lib"
    
    found_other_os=
    
    make_timeout () {
     	
      if [ "x${found_other_os}" = "x" ] || [ "x${GRUB_FORCE_HIDDEN_MENU}" = "xtrue" ] ; then 
        if [ "x${1}" != "x" ] ; then
          if [ "x${GRUB_HIDDEN_TIMEOUT_QUIET}" = "xtrue" ] ; then
    	verbose=
          else
    	verbose=" --verbose"
          fi
    
          if [ "x${1}" = "x0" ] ; then
    	cat <<EOF
    if [ "x\${timeout}" != "x-1" ]; then
      if keystatus; then
        if keystatus --shift; then
          set timeout=-1
        else
          set timeout=0
        fi
      else
        if sleep$verbose --interruptible 3 ; then
          set timeout=0
        fi
      fi
    fi
    EOF
          else
    	cat << EOF
    if [ "x\${timeout}" != "x-1" ]; then
      if sleep$verbose --interruptible ${GRUB_HIDDEN_TIMEOUT} ; then
        set timeout=0
      fi
    fi
    EOF
          fi
        fi
      fi
    }
    
    adjust_timeout () {
      if [ "x$GRUB_BUTTON_CMOS_ADDRESS" != "x" ]; then
        cat <<EOF
    if cmostest $GRUB_BUTTON_CMOS_ADDRESS ; then
    EOF
        make_timeout "${GRUB_HIDDEN_TIMEOUT_BUTTON}" "${GRUB_TIMEOUT_BUTTON}"
        echo else
        make_timeout "${GRUB_HIDDEN_TIMEOUT}" "${GRUB_TIMEOUT}"
        echo fi
      else
        make_timeout "${GRUB_HIDDEN_TIMEOUT}" "${GRUB_TIMEOUT}"
      fi
    }
    
    if [ "x${GRUB_DISABLE_OS_PROBER}" = "xtrue" ]; then
      adjust_timeout
      exit 0
    fi
    
    if [ -z "`which os-prober 2> /dev/null`" -o -z "`which linux-boot-prober 2> /dev/null`" ] ; then
      # missing os-prober and/or linux-boot-prober
      adjust_timeout
      exit 0
    fi
    
    OSPROBED="`os-prober | tr ' ' '^' | paste -s -d ' '`"
    if [ -z "${OSPROBED}" ] ; then
      # empty os-prober output, nothing doing
      adjust_timeout
      exit 0
    fi
    
    osx_entry() {
    	found_other_os=1
            cat << EOF
    menuentry "${LONGNAME} (${2}-bit) (on ${DEVICE})" --class osx --class darwin --class os {
    EOF
    	save_default_entry | sed -e "s/^/\t/"
    	prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/"
    	cat << EOF
            load_video
            set do_resume=0
            if [ /var/vm/sleepimage -nt10 / ]; then
               if xnu_resume /var/vm/sleepimage; then
                 set do_resume=1
               fi
            fi
            if [ \$do_resume = 0 ]; then
               xnu_uuid ${OSXUUID} uuid
               if [ -f /Extra/DSDT.aml ]; then
                  acpi -e /Extra/DSDT.aml
               fi
               $1 /mach_kernel boot-uuid=\${uuid} rd=*uuid
               if [ /System/Library/Extensions.mkext -nt /System/Library/Extensions ]; then
                  xnu_mkext /System/Library/Extensions.mkext
               else
                  xnu_kextdir /System/Library/Extensions
               fi
               if [ -f /Extra/Extensions.mkext ]; then
                  xnu_mkext /Extra/Extensions.mkext
               fi
               if [ -d /Extra/Extensions ]; then
                  xnu_kextdir /Extra/Extensions
               fi
               if [ -f /Extra/devprop.bin ]; then
                  xnu_devprop_load /Extra/devprop.bin
               fi
               if [ -f /Extra/splash.jpg ]; then
                  insmod jpeg
                  xnu_splash /Extra/splash.jpg
               fi
               if [ -f /Extra/splash.png ]; then
                  insmod png
                  xnu_splash /Extra/splash.png
               fi
               if [ -f /Extra/splash.tga ]; then
                  insmod tga
                  xnu_splash /Extra/splash.tga
               fi
            fi
    }
    EOF
    }
    
    wubi=
    
    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
    
      echo "Found ${LONGNAME} on ${DEVICE}" >&2
    
      case ${BOOT} in
        chain)
    
          case ${LONGNAME} in
    	Windows*)
    	  if [ -z "$wubi" ]; then
    	    if [ -x /usr/share/lupin-support/grub-mkimage ] && \
    	       /usr/share/lupin-support/grub-mkimage --test; then
    	      wubi=yes
    	    else
    	      wubi=no
    	    fi
    	  fi
    	  if [ "$wubi" = yes ]; then
    	    echo "Skipping ${LONGNAME} on Wubi system" >&2
    	    continue
    	  fi
    	  ;;
          esac
    
          found_other_os=1
          cat << EOF
    menuentry "${LONGNAME} (on ${DEVICE})" --class windows --class os {
    EOF
          save_default_entry | sed -e "s/^/\t/"
          prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/"
    
          case ${LONGNAME} in
    	Windows\ Vista*|Windows\ 7*|Windows\ Server\ 2008*)
    	;;
    	*)
    	  cat << EOF
    	drivemap -s (hd0) \${root}
    EOF
    	;;
          esac
    
          cat <<EOF
    	chainloader +1
    }
    EOF
        ;;
        linux)
          LINUXPROBED="`linux-boot-prober ${DEVICE} 2> /dev/null | tr ' ' '^' | paste -s -d ' '`"
          prepare_boot_cache=
    
          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 '^' ' '`"
    
            if [ -z "${LLABEL}" ] ; then
              LLABEL="${LONGNAME}"
            fi
    
    	if [ "${LROOT}" != "${LBOOT}" ]; then
    	  LKERNEL="${LKERNEL#/boot}"
    	  LINITRD="${LINITRD#/boot}"
    	fi
    
    	if [ -z "${prepare_boot_cache}" ]; then
    	  prepare_boot_cache="$(prepare_grub_to_access_device ${LBOOT} | sed -e "s/^/\t/")"
    	  [ "${prepare_boot_cache}" ] || continue
    	fi
    	found_other_os=1
            cat << EOF
    menuentry "${LLABEL} (on ${DEVICE})" --class gnu-linux --class gnu --class os {
    EOF
    	save_default_entry | sed -e "s/^/\t/"
    	printf '%s\n' "${prepare_boot_cache}"
    	cat <<  EOF
    	linux ${LKERNEL} ${LPARAMS}
    EOF
            if [ -n "${LINITRD}" ] ; then
              cat << EOF
    	initrd ${LINITRD}
    EOF
            fi
            cat << EOF
    }
    EOF
          done
        ;;
        macosx)
          OSXUUID="`grub-probe --target=fs_uuid --device ${DEVICE} 2> /dev/null`"
          osx_entry xnu_kernel 32
          osx_entry xnu_kernel64 64
        ;;
        hurd)
          found_other_os=1
          cat << EOF
    menuentry "${LONGNAME} (on ${DEVICE})" --class hurd --class gnu --class os {
    EOF
          save_default_entry | sed -e "s/^/\t/"
          prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/"
          grub_device="`${grub_probe} --device ${DEVICE} --target=drive`"
          mach_device="`echo "${grub_device}" | sed -e 's/(\(hd.*\),msdos\(.*\))/\1s\2/'`"
          grub_fs="`${grub_probe} --device ${DEVICE} --target=fs`"
          case "${grub_fs}" in
    	*fs)	hurd_fs="${grub_fs}" ;;
    	*)	hurd_fs="${grub_fs}fs" ;;
          esac
          cat << EOF
    	multiboot /boot/gnumach.gz root=device:${mach_device}
    	module /hurd/${hurd_fs}.static ${hurd_fs} --readonly \\
    			--multiboot-command-line='\${kernel-command-line}' \\
    			--host-priv-port='\${host-port}' \\
    			--device-master-port='\${device-port}' \\
    			--exec-server-task='\${exec-task}' -T typed '\${root}' \\
    			'\$(task-create)' '\$(task-resume)'
    	module /lib/ld.so.1 exec /hurd/exec '\$(exec-task=task-create)'
    }
    EOF
        ;;
        *)
          echo "  ${LONGNAME} is not yet supported by grub-mkconfig." >&2
        ;;
      esac
    done
    
    adjust_timeout
    
    
    	cat <<EOF
    if [ "x\${timeout}" != "x-1" ]; then
      if keystatus; then
        if keystatus --shift; then
          set timeout=-1
        else
          set timeout=0
        fi
      else
        if sleep$verbose --interruptible 3 ; then
          set timeout=0
        fi
      fi
    fi
    EOF
    Save the file and update-grub.
    Back to Xorg...

    Retired.

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

    Re: Grub 2 Title Tweaks Thread

    YAY! Thank you it worked! Thank you very much!

    I'm still not getting exactly what was wrong, with diff I didn't see anything strange. I think it was mostly about all those nested conditional switches

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

    Re: Grub 2 Title Tweaks Thread

    Quote Originally Posted by Dareus View Post
    YAY! Thank you it worked! Thank you very much!
    Now for the rest of the story...

    Rather than put the keystatus check at the end of 30..., I keep a copy in /etc/grub.d/40_custom. The reason is that if the GRUB package is updated the 30_os-prober file may change as well and you will lose the keystatus check. Of course, you will also lose the additional modification, but being able to stop the boot is much more important for me. I can always re-apply other modifications after booting.

    So I don't have the extra keystatus check in 30, but in 40_custom. The only difference is that you don't include the CAT/EOF lines in the custom file, since it's assumed everything below the intro lines is to be imported. GRUB package updates won't alter your 40_custom file without asking you. Even more safe, you could make a 50_custom file since that one doesn't exist in Grub and would never be touched by Grub.
    Back to Xorg...

    Retired.

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

    Re: Grub 2 Title Tweaks Thread

    Ok, I'd try what you suggest because "Best practices" means something

    I actually have two things to look into to have the boot-experience I'm trying to achieve.
    The fist one is to set a splash image to show during the
    Code:
    GRUB_HIDDEN_TIMEOUT
    phase.
    The second one is that I wonder if it is possible to show the menu pressing any key, not just the SHIFT key.

    About the splash image I already took the image (RGB non-indexed) and 640x480, put it in
    Code:
    /boot/grub
    and have it recognized from
    Code:
    update-grub
    but it doesn't show up. I was wondering if there's a way to know which is the resolution GRUB2 is actually running at; I like how it looks and I'm not interested in modifying it, so I'm not very interested in what are the supported resolution other than that.

  5. #225
    Join Date
    Jan 2007
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: Grub 2 Title Tweaks Thread

    Quote Originally Posted by Dareus View Post
    About the splash image I already took the image (RGB non-indexed) and 640x480, put it in
    Code:
    /boot/grub
    and have it recognized from
    Code:
    update-grub
    but it doesn't show up. I was wondering if there's a way to know which is the resolution GRUB2 is actually running at; I like how it looks and I'm not interested in modifying it, so I'm not very interested in what are the supported resolution other than that.
    I'll tackle this one first since it's the easier of the two questions.
    During boot, if you display the menu and then press 'c' you will get to the Grub prompt. Type "vbeinfo" and it will show the resolutions available to Grub. At the bottom of the screen should be a "Preferred mode" which is the resolution being used if you haven't manually selected one in /etc/default/grub.

    You can force Grub to use a supported resolution in /etc/default/grub's GRUB_GFXMODE= setting. Just remove the # symbol and use a supported resolution.

    Quote Originally Posted by Dareus View Post
    I actually have two things to look into to have the boot-experience I'm trying to achieve.
    The fist one is to set a splash image to show during the
    Code:
    GRUB_HIDDEN_TIMEOUT
    phase.
    The second one is that I wonder if it is possible to show the menu pressing any key, not just the SHIFT key.
    I'll have to get back to you on this one. There was once documentation from the GNU GRUB folks that indicated the GRUB splash image should show as the hidden timeout counted down. The results were very sporadic but I haven't tried it lately. I'll experiment and see what happens and post when I have something. There is a very convoluted workaround I came up with originally but hopefully I won't have to go there again.

    The countdown should also stop with the ESC key, and I've had some systems that stop the countdown when any key is pressed. I'll look at this again as well.
    Back to Xorg...

    Retired.

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

    Re: Grub 2 Title Tweaks Thread

    Here is part 2 of the answer - well, part 2 of the question, as I'm not sure I have the answer...

    To show the splash only (no menu) during a timeout:
    In /etc/default/grub:
    Code:
    GRUB_HIDDEN_TIMEOUT=15  # No menu for given time, splash only *
    GRUB_HIDDEN_TIMEOUT_QUIET=true  # or false, either way
    GRUB_TIMEOUT=10 # Once displayed, 10 seconds later it will boot.
    In /etc/grub.d/30_os-prober:
    If you still have the previous hack you shouldn't have to do anything;
    or Line 29:
    if [ ! "x${found_other_os}" = "x" ] ; then
    or Line 29:
    if [ "x${found_other_os}" = "x" ] || [ "x${GRUB_COUNTER}" = "xtrue" ] ; then
    WITH this in /etc/default/grub
    GRUB_COUNTER="true"
    export GRUB_COUNTER
    Now the rub. On my machine, the system will be completely blank until I press any key once. This should not be necessary. At that time on my machine the boot splash image appears and the system counts down until the hidden timeout expires or the ESC or SHIFT key is pressed.

    The 'any key' works to display the splash key on my machine, but only the ESC or SHIFT key reveal the menu. I don't know how to get the 'any key' effect you seek.

    The extra key press necessary on my machine pretty much negates the effect you want IMO. Perhaps it's a quirk on my machine and the preliminary key press isn't necessary for anyone else.
    Back to Xorg...

    Retired.

  7. #227
    Join Date
    Feb 2007
    Location
    The Netherlands
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: Grub 2 Title Tweaks Thread

    -edit-

    My mistake. I didn't see 2 pages of replies.
    Last edited by Redsandro; July 10th, 2012 at 03:00 PM.
    📻 Amp.lol. No bloat, just radio. 🤘

  8. #228
    Join Date
    Feb 2007
    Location
    The Netherlands
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: Grub 2 Title Tweaks Thread

    My original post for archival purposes since I accidentally the whole post anyway:

    Quote Originally Posted by Dareus View Post
    Just BUMPING Redsandro's request ;P
    Actually it works for me now. I remember vividly that both methods did not work so I cannot remember what changed or needed to change.

    But in the end I used point 11 method 2 as described by drs305, and for practical purposes in case I changed the config, here's my /etc/default/grub:
    Code:
    # If you change this file, run 'update-grub' afterwards to update.
    
    GRUB_DEFAULT=0
    GRUB_HIDDEN_TIMEOUT=0
    GRUB_HIDDEN_TIMEOUT_QUIET=false
    GRUB_TIMEOUT=3
    GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
    GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
    GRUB_CMDLINE_LINUX=""
    
    # RED FIX hold control for menu?
    GRUB_FORCE_HIDDEN_MENU="true"
    export GRUB_FORCE_HIDDEN_MENU
    Last edited by Redsandro; July 10th, 2012 at 03:11 PM.
    📻 Amp.lol. No bloat, just radio. 🤘

  9. #229
    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
    I'll tackle this one first since it's the easier of the two questions.
    During boot, if you display the menu and then press 'c' you will get to the Grub prompt. Type "vbeinfo" and it will show the resolutions available to Grub. At the bottom of the screen should be a "Preferred mode" which is the resolution being used if you haven't manually selected one in /etc/default/grub.

    You can force Grub to use a supported resolution in /etc/default/grub's GRUB_GFXMODE= setting. Just remove the # symbol and use a supported resolution.
    Ok, thank you! I found out GRUB was running at a higher resolutions than what I was expecting.

    Quote Originally Posted by drs305 View Post
    Here is part 2 of the answer - well, part 2 of the question, as I'm not sure I have the answer...

    To show the splash only (no menu) during a timeout:
    In /etc/default/grub:
    Code:
    GRUB_HIDDEN_TIMEOUT=15  # No menu for given time, splash only *
    GRUB_HIDDEN_TIMEOUT_QUIET=true  # or false, either way
    GRUB_TIMEOUT=10 # Once displayed, 10 seconds later it will boot.
    Not that I don't believe you, which would be impossible now , but why show I change those values? I have

    Code:
    GRUB_HIDDEN_TIMEOUT=5  
    GRUB_HIDDEN_TIMEOUT_QUIET=true
    GRUB_TIMEOUT=0
    Somewhere (I suppose on the community doc) I read that after GRUB_HIDDEN_TIMEOUT seconds, the menu is shown for GRUB_TIMEOUT seconds; so I'd better keep the latter to 0.
    Please correct me if I'm wrong

    Quote Originally Posted by drs305 View Post
    In /etc/grub.d/30_os-prober:
    If you still have the previous hack you shouldn't have to do anything;
    or Line 29:
    Quote Originally Posted by drs305 View Post
    if [ ! "x${found_other_os}" = "x" ] ; then
    or Line 29:
    Quote Originally Posted by drs305 View Post
    if [ "x${found_other_os}" = "x" ] || [ "x${GRUB_COUNTER}" = "xtrue" ] ; then
    WITH this in /etc/default/grub
    Quote Originally Posted by drs305 View Post
    GRUB_COUNTER="true"
    export GRUB_COUNTER
    I changed the script you provided me to move the last few lines to a custom script. This way line 29 should already be like that but it isn't actually (to be honest if [ ! "x${found_other_os}" = "x" ] ; then appears on line 30). I suppose I have to change that as you suggested.

    Quote Originally Posted by drs305 View Post
    Now the rub. On my machine, the system will be completely blank until I press any key once. This should not be necessary. At that time on my machine the boot splash image appears and the system counts down until the hidden timeout expires or the ESC or SHIFT key is pressed.

    The 'any key' works to display the splash key on my machine, but only the ESC or SHIFT key reveal the menu. I don't know how to get the 'any key' effect you seek.

    The extra key press necessary on my machine pretty much negates the effect you want IMO. Perhaps it's a quirk on my machine and the preliminary key press isn't necessary for anyone else.
    I read about this behaviour earlier, so I suppose you're not the only one with this issue. I tried pressing the ESC key to reveal the menu, but it didn't work, only SHIFT works reliably.

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

    Re: Grub 2 Title Tweaks Thread

    You would leave the GRUB_TIMEOUT at 0 for no menu display. I use a value for troubleshooting purposes only. Even then, I normally keep a value of 1 so I can always interrupt the boot. But that would negate your desire, if only for a second.

    I'm on a business trip and when I have time I've been playing with custom menus which would act the way GRUB should work (without having to press a key to display the timeout splash screen). If I come up with something I'll post.
    Back to Xorg...

    Retired.

Page 23 of 24 FirstFirst ... 1321222324 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
  •