Exibir menu e opções do grub sem reiniciar?

12

Eu gostaria de exibir o grubmenu na linha de comando. Também para selecionar uma opção de menu de inicialização do grub e pressione Enterpara ver quais drivers do pré-kernel estão carregados e os parâmetros de inicialização passados ​​ao carregar o kernel.

Os motivos para fazer isso na linha de comando:

  • Reiniciar para ver o grubmenu leva tempo.
  • É estranho tirar uma foto do grubmenu e postar a imagem em sites. É mais fácil capturar uma captura de tela quando o Ubuntu está em funcionamento.
  • Para editgrub a opção de menu ee tirar uma foto, muitas vezes é difícil porque a tela é difícil de ler. Com esta função, você pode copiar e colar.
  • Pode ser mais fácil usar esta função para revelar todas as versões do kernel em vez de apt list --installed | grep linux-imageou ls /boot/vml*.
  • Ver rapidamente o número do menu grub é valioso para grub-reboote grub-set-defaultcomandos.

Como posso pintar o menu grub a partir da linha de comando, ver os números de entrada internos do menu grub e exibir os parâmetros de inicialização para uma determinada opção?

WinEunuuchs2Unix
fonte

Respostas:

12

Atualizado 7 de maio de 2018

Desenvolvendo o script: Script Bash para clonar o Ubuntu em uma nova partição para testar a atualização 18.04 LTS . Descobri que você tem algumas opções de menu ridiculamente longas que fazem com que o menu seja maligno:

4>8  Ubuntu, with Linux 4.14.30-041430-generic (recovery mode) (on /dev/nvme0n1p8)

Isso foi corrigido hoje por truncamento de linhas com mais de 68 caracteres.

Atualizado 5 de abril de 2018

Esta atualização apresenta grub-menu.shuma versão muito superior à resposta anterior (ainda disponível abaixo). O novo menu do grub apresenta:

  • Exibe os números de entrada do menu do grub 2. ou seja 0, 1, 1>0, 1>1... 2,3
  • A versão curta padrão sem (upstart)e as (recover mode)opções do submenu podem ser definidas.
  • O parâmetro 1 pode ser passado como shortou longpara substituir o padrão.
  • cabeçalhos de coluna formatados dinamicamente com base shortou longconfiguração.

Captura de tela colorida (versão curta)

grub-menu.sh

Texto Captura de tela (versão longa)

Grub Version: 2.02~beta2-36ubuntu3.15


        ┌─────────┤ Use arrow, page, home & end keys. Tab toggle option ├──────────┐
        │ Menu No. --------------- Menu Name ---------------                       │ 
        │                                                                          │ 
        │     0    Ubuntu                                                     ↑    │ 
        │     1    Advanced options for Ubuntu                                ▮    │ 
        │     1>0  Ubuntu, with Linux 4.14.31-041431-generic                  ▒    │ 
        │     1>1  Ubuntu, with Linux 4.14.31-041431-generic (upstart)        ▒    │ 
        │     1>2  Ubuntu, with Linux 4.14.31-041431-generic (recovery mode)  ▒    │ 
        │     1>3  Ubuntu, with Linux 4.14.30-041430-generic                  ▒    │ 
        │     1>4  Ubuntu, with Linux 4.14.30-041430-generic (upstart)        ▒    │ 
        │     1>5  Ubuntu, with Linux 4.14.30-041430-generic (recovery mode)  ▒    │ 
        │     1>6  Ubuntu, with Linux 4.14.27-041427-generic                  ▒    │ 
        │     1>7  Ubuntu, with Linux 4.14.27-041427-generic (upstart)        ▒    │ 
        │     1>8  Ubuntu, with Linux 4.14.27-041427-generic (recovery mode)  ▒    │ 
        │     1>9  Ubuntu, with Linux 4.14.24-041424-generic                  ▒    │ 
        │     1>10 Ubuntu, with Linux 4.14.24-041424-generic (upstart)        ▒    │ 
        │     1>11 Ubuntu, with Linux 4.14.24-041424-generic (recovery mode)  ▒    │ 
        │     1>12 Ubuntu, with Linux 4.14.23-041423-generic                  ▒    │ 
        │     1>13 Ubuntu, with Linux 4.14.23-041423-generic (upstart)        ↓    │ 
        │                                                                          │ 
        │                                                                          │ 
        │                   <Display Grub Boot>        <Exit>                      │ 
        │                                                                          │ 
        └──────────────────────────────────────────────────────────────────────────┘ 

grub-menu.sh script bash

Versões anteriores grub-display.she grub-display-lite.shexigia muitas opções de ajustes no código. grub-menu.shsó tem uma opção para ajustar:

# Default for hide duplicate and triplicate options with (upstart) and (recovery mode)?
HideUpstartRecovery=false

Defina o valor para trueou false.

O formato padrão pode ser substituído ao chamar o script usando:

grub-menu.sh short

ou:

grub-menu.sh long

O código:

#!/bin/bash

# NAME: grub-menu.sh
# PATH: $HOME/bin
# DESC: Written for AU Q&A: /ubuntu//q/1019213/307523
# DATE: Apr 5, 2018. Modified: May 7, 2018.

# $TERM variable may be missing when called via desktop shortcut
CurrentTERM=$(env | grep TERM)
if [[ $CurrentTERM == "" ]] ; then
    notify-send --urgency=critical "$0 cannot be run from GUI without TERM environment variable."
    exit 1
fi

AllMenusArr=()      # All menu options.
# Default for hide duplicate and triplicate options with (upstart) and (recovery mode)?
HideUpstartRecovery=false
if [[ $1 == short ]] ; then
    HideUpstartRecovery=true    # override default with first passed parameter "short"
elif [[ $1 == long ]] ; then
    HideUpstartRecovery=false   # override default with first passed parameter "long"
fi
SkippedMenuEntry=false  # Don't change this value, automatically maintained
InSubMenu=false     # Within a line beginning with `submenu`?
InMenuEntry=false   # Within a line beginning with `menuentry` and ending in `{`?
NextMenuEntryNo=0   # Next grub internal menu entry number to assign
# Major / Minor internal grub submenu numbers, ie `1>0`, `1>1`, `1>2`, etc.
ThisSubMenuMajorNo=0
NextSubMenuMinorNo=0
CurrTag=""          # Current grub internal menu number, zero based
CurrText=""         # Current grub menu option text, ie "Ubuntu", "Windows...", etc.
SubMenuList=""      # Only supports 10 submenus! Numbered 0 to 9. Future use.

while read -r line; do
    # Example: "           }"
    BlackLine="${line//[[:blank:]]/}" # Remove all whitespace
    if [[ $BlackLine == "}" ]] ; then
        # Add menu option in buffer
        if [[ $SkippedMenuEntry == true ]] ; then
            NextSubMenuMinorNo=$(( $NextSubMenuMinorNo + 1 ))
            SkippedMenuEntry=false
            continue
        fi
        if [[ $InMenuEntry == true ]] ; then
            InMenuEntry=false
            if [[ $InSubMenu == true ]] ; then
                NextSubMenuMinorNo=$(( $NextSubMenuMinorNo + 1 ))
            else
                NextMenuEntryNo=$(( $NextMenuEntryNo + 1 ))
            fi
        elif [[ $InSubMenu == true ]] ; then
            InSubMenu=false
            NextMenuEntryNo=$(( $NextMenuEntryNo + 1 ))
        else
            continue # Future error message?
        fi
        # Set maximum CurrText size to 68 characters.
        CurrText="${CurrText:0:67}"
        AllMenusArr+=($CurrTag "$CurrText")
    fi

    # Example: "menuentry 'Ubuntu' --class ubuntu --class gnu-linux --class gnu" ...
    #          "submenu 'Advanced options for Ubuntu' $menuentry_id_option" ...
    if [[ $line == submenu* ]] ; then
        # line starts with `submenu`
        InSubMenu=true
        ThisSubMenuMajorNo=$NextMenuEntryNo
        NextSubMenuMinorNo=0
        SubMenuList=$SubMenuList$ThisSubMenuMajorNo
        CurrTag=$NextMenuEntryNo
        CurrText="${line#*\'}"
        CurrText="${CurrText%%\'*}"
        AllMenusArr+=($CurrTag "$CurrText") # ie "1 Advanced options for Ubuntu"

    elif [[ $line == menuentry* ]] && [[ $line == *"{"* ]] ; then
        # line starts with `menuentry` and ends with `{`
        if [[ $HideUpstartRecovery == true ]] ; then
            if [[ $line == *"(upstart)"* ]] || [[ $line == *"(recovery mode)"* ]] ; then
                SkippedMenuEntry=true
                continue
            fi
        fi
        InMenuEntry=true
        if [[ $InSubMenu == true ]] ; then
            : # In a submenu, increment minor instead of major which is "sticky" now.
            CurrTag=$ThisSubMenuMajorNo">"$NextSubMenuMinorNo
        else
            CurrTag=$NextMenuEntryNo
        fi
        CurrText="${line#*\'}"
        CurrText="${CurrText%%\'*}"

    else
        continue    # Other stuff - Ignore it.
    fi

done < /boot/grub/grub.cfg

LongVersion=$(grub-install --version)
ShortVersion=$(echo "${LongVersion:20}")
DefaultItem=0

if [[ $HideUpstartRecovery == true ]] ; then
    MenuText="Menu No.     ----------- Menu Name -----------"
else
    MenuText="Menu No. --------------- Menu Name ---------------"
fi

while true ; do

    Choice=$(whiptail \
        --title "Use arrow, page, home & end keys. Tab toggle option" \
        --backtitle "Grub Version: $ShortVersion" \
        --ok-button "Display Grub Boot" \
        --cancel-button "Exit" \
        --default-item "$DefaultItem" \
        --menu "$MenuText" 24 76 16 \
        "${AllMenusArr[@]}" \
        2>&1 >/dev/tty)

    clear
    if [[ $Choice == "" ]]; then break ; fi
    DefaultItem=$Choice

    for (( i=0; i < ${#AllMenusArr[@]}; i=i+2 )) ; do
        if [[ "${AllMenusArr[i]}" == $Choice ]] ; then
            i=$i+1
            MenuEntry="menuentry '"${AllMenusArr[i]}"'"
            break
        fi
    done

    TheGameIsAfoot=false
    while read -r line ; do
        if [[ $line = *"$MenuEntry"* ]]; then TheGameIsAfoot=true ; fi
        if [[ $TheGameIsAfoot == true ]]; then
            echo $line
            if [[ $line = *"}"* ]]; then break ; fi
        fi
    done < /boot/grub/grub.cfg

    read -p "Press <Enter> to continue"

done

exit 0

Versões anteriores (não recomendadas)

Abaixo está a resposta original, onde os números de entrada do menu seguiram o formato grub 1.

grub-display.sh exibe opções e parâmetros do menu grub

Sem depender de aplicativos de terceiros, você pode usar um script bash para exibir o grubmenu e os parâmetros de inicialização para qualquer opção. Os parâmetros de inicialização são mais do que apenas os cat /proc/cmdlinevalores. Eles também incluem os drivers carregados antes da inicialização do Linux.

grub-display.sh script bash

Aqui está a lista completa do programa que você pode copiar e colar:

#!/bin/bash

# NAME: grub-display.sh
# PATH: $HOME/bin
# DESC: Written for AU Q&A: /ubuntu//q/1019213/307523
# DATE: Mar 24, 2018. Modified: Mar 26, 2018.

# $TERM variable may be missing when called via desktop shortcut
CurrentTERM=$(env | grep TERM)
if [[ $CurrentTERM == "" ]] ; then
    notify-send --urgency=critical "$0 cannot be run from GUI without TERM environment variable."
    exit 1
fi

# Must have the dialog package. On Servers, not installed by default
command -v dialog >/dev/null 2>&1 || { echo >&2 "dialog package required but it is not installed.  Aborting."; exit 99; }

# Version without upstart and recovery options displayed
#awk -F\' '/menuentry / { print i++, $2}' /boot/grub/grub.cfg \
#        | grep -v upstart | grep -v recovery > ~/.grub-display-menu

# Version with upstart and recovery options displayed
awk -F\' '/menuentry / { print i++, $2}' /boot/grub/grub.cfg \
        > ~/.grub-display-menu

MenuArr=()

while read -r line; do 
    MenuNmbr=${line%% *}
    MenuName=${line#* }
    MenuArr+=($MenuNmbr "$MenuName")
done < ~/.grub-display-menu
rm ~/.grub-display-menu

LongVersion=$(grub-install --version)
ShortVersion=$(echo "${LongVersion:20}")
DefaultItem=0

while true ; do

    Choice=$(dialog \
        --title "Use arrow, page, home & end keys. Tab toggle option" \
        --backtitle "Grub Version: $ShortVersion" \
        --ok-label "Display Grub Boot" \
        --cancel-label "Exit" \
        --default-item "$DefaultItem" \
        --menu "Menu Number       ----------- Menu Name ----------" 24 76 16 \
        "${MenuArr[@]}" \
        >/dev/tty)

    clear
    if [[ $Choice == "" ]]; then break ; fi
    DefaultItem=$Choice

    for (( i=0; i < ${#MenuArr[@]}; i=i+2 )) ; do
        if [[ "${MenuArr[i]}" == $Choice ]] ; then
            i=$i+1
            MenuEntry="menuentry '"${MenuArr[i]}"'"
            break
        fi
    done

    TheGameIsAfoot=false
    while read -r line ; do
        if [[ $line = *"$MenuEntry"* ]]; then TheGameIsAfoot=true ; fi
        if [[ $TheGameIsAfoot == true ]]; then
            echo $line
            if [[ $line = *"}"* ]]; then break ; fi
        fi
    done < /boot/grub/grub.cfg

    read -p "Press <Enter> to continue"

done

exit 0

Nota para usuários do Ubuntu Server

Este script bash foi projetado para o Ubuntu Desktop. Para o Ubuntu Server e outras distribuições Linux que não possuem dialogpacote instalado por padrão, um script diferente chamado grub-display-lite.shé incluído abaixo. Essa versão usa em whiptailvez de dialog.

Reduzindo o tamanho do menu em 66%

Para encurtar a lista de opções do menu grub exibida, você pode remover as opções (upstart)e (recovery). Para fazer isso, remova o comentário destas linhas:

# Version without upstart and recovery options displayed
awk -F\' '/menuentry / { print i++, $2}' /boot/grub/grub.cfg \
        | grep -v upstart | grep -v recovery > ~/.grub-display-menu

Em seguida, aplique comentários a estas linhas:

# Version with upstart and recovery options displayed
#awk -F\' '/menuentry / { print i++, $2}' /boot/grub/grub.cfg \
#        > ~/.grub-display-menu

Screenshots

Aqui está o que parece quando chamado a partir da linha de comando. Infelizmente, não consegui copiar e colar o menu e tive que usar Print Screen:

grub-display.sh.png

Desative o suporte do mouse para copiar e colar

 Grub Version: 2.02~beta2-36ubuntu3.15
 ──────────────────────────────────────────────────────────────────────────────────────────
       ┌──────────Use arrow, page, home & end keys. Tab toggle option─────────────┐
        Menu Number  ----------- Menu Name ----------                              
        ┌──────────────────────────────────────────────────────────────────────┐   
            0   Ubuntu                                                           
            1   Ubuntu, with Linux 4.14.30-041430-generic                        
            2   Ubuntu, with Linux 4.14.30-041430-generic (upstart)              
            3   Ubuntu, with Linux 4.14.30-041430-generic (recovery mode)        
            4   Ubuntu, with Linux 4.14.27-041427-generic                        
            5   Ubuntu, with Linux 4.14.27-041427-generic (upstart)              
            6   Ubuntu, with Linux 4.14.27-041427-generic (recovery mode)        
            7   Ubuntu, with Linux 4.14.24-041424-generic                        
            8   Ubuntu, with Linux 4.14.24-041424-generic (upstart)              
            9   Ubuntu, with Linux 4.14.24-041424-generic (recovery mode)        
            10  Ubuntu, with Linux 4.14.23-041423-generic                        
            11  Ubuntu, with Linux 4.14.23-041423-generic (upstart)              
            12  Ubuntu, with Linux 4.14.23-041423-generic (recovery mode)        
            13  Ubuntu, with Linux 4.14.21-041421-generic                        
            14  Ubuntu, with Linux 4.14.21-041421-generic (upstart)              
            15  Ubuntu, with Linux 4.14.21-041421-generic (recovery mode)        
        └────↓(+)──────────────────────────────────────────────────────16%─────┘   
                                                                                   
       ├──────────────────────────────────────────────────────────────────────────┤  
                    <Display Grub Boot>       <      Exit       >                  
       └──────────────────────────────────────────────────────────────────────────┘  

Quando o suporte padrão do mouse está ativado, você não pode copiar a tela para a área de transferência, mas deve usá-la Print Screenpara obter uma captura instantânea da tela gráfica. Para oferecer suporte a copiar e colar, você precisa desativar o suporte ao mouse pesquisando estas linhas:

    --default-item "$DefaultItem" \
    --no-mouse \
    --menu "Menu Number       ----------- Menu Name ----------" 24 76 16 \

O argumento --no-mousefoi inserido abaixo --default-item. Isso significa que você perde o suporte do mouse, mas obtém melhor resolução e capacidade de copiar para a área de transferência realçando o texto e pressionando Ctrl+ C.

Exibir parâmetros de inicialização do grub

Use as teclas de navegação para realçar uma opção e pressione Enterpara ver os parâmetros de inicialização:

menuentry 'Ubuntu, with Linux 4.14.27-041427-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.14.27-041427-generic-advanced-f3f8e7bc-b337-4194-88b8-3a513f6be55b' {
recordfail
savedefault
load_video
gfxmode $linux_gfx_mode
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_gpt
insmod ext2
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root f3f8e7bc-b337-4194-88b8-3a513f6be55b
else
search --no-floppy --fs-uuid --set=root f3f8e7bc-b337-4194-88b8-3a513f6be55b
fi
echo 'Loading Linux 4.14.27-041427-generic ...'
linux /boot/vmlinuz-4.14.27-041427-generic root=UUID=f3f8e7bc-b337-4194-88b8-3a513f6be55b ro quiet splash loglevel=0 vga=current udev.log-priority=3 fastboot kaslr acpiphp.disable=1 crashkernel=384M-2G:128M,2G-:256M $vt_handoff
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-4.14.27-041427-generic
}
Press <Enter> to continue

Entrada no menu Grub # 94

menuentry 'Windows Boot Manager (on /dev/nvme0n1p2)' --class windows --class os $menuentry_id_option 'osprober-efi-D656-F2A8' {
savedefault
insmod part_gpt
insmod fat
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root D656-F2A8
else
search --no-floppy --fs-uuid --set=root D656-F2A8
fi
chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}
Press <Enter> to continue

Entrada no menu Grub # 96

menuentry 'System setup' $menuentry_id_option 'uefi-firmware' {
fwsetup
}
Press <Enter> to continue

grub-display-lite.sh para Ubuntu Server

O Ubuntu Server e o Lubuntu não possuem dialogpacote instalado por padrão, como o Ubuntu Desktop. Uma versão diferente foi escrita para esses usuários com base no whiptailpacote que é incluído por padrão na maioria das distribuições Linux.

A desvantagem whiptailé de menos funções, mas elas não são usadas neste caso. Outra desvantagem parece ser menos cores, mas isso pode facilitar a leitura para algumas pessoas. Existem vantagens em whiptailrelação a dialogcopiar para a área de transferência, suporte à roda de rolagem do mouse e processamento provavelmente mais rápido.

grub-display-lite.sh script bash

#!/bin/bash

# NAME: grub-display-lite.sh
# PATH: $HOME/bin
# DESC: Written for AU Q&A: /ubuntu//q/1019213/307523
# DATE: Mar 26, 2018.
# NOTE: "lite" version written for Ubuntu Server and Lubuntu which do
#       not have `dialog` installed by default. `whiptail` is used
#       instead. Nice consequences are better resolution, mouse scroll
#       wheel and copy to clipboard support.

# $TERM variable may be missing when called via desktop shortcut
CurrentTERM=$(env | grep TERM)
if [[ $CurrentTERM == "" ]] ; then
    notify-send --urgency=critical "$0 cannot be run from GUI without TERM environment variable."
    exit 1
fi

# Version without upstart and recovery options displayed
awk -F\' '/menuentry / { print i++, $2}' /boot/grub/grub.cfg \
        | grep -v upstart | grep -v recovery > ~/.grub-display-menu

# Version with upstart and recovery options displayed
#awk -F\' '/menuentry / { print i++, $2}' /boot/grub/grub.cfg \
#        > ~/.grub-display-menu

MenuArr=()

while read -r line; do 
    MenuNmbr=${line%% *}
    MenuName=${line#* }
    MenuArr+=($MenuNmbr "$MenuName")
done < ~/.grub-display-menu
rm ~/.grub-display-menu

LongVersion=$(grub-install --version)
ShortVersion=$(echo "${LongVersion:20}")
DefaultItem=0

while true ; do

    Choice=$(whiptail \
        --title "Use arrow, page, home & end keys. Tab toggle option" \
        --backtitle "Grub Version: $ShortVersion" \
        --ok-button "Display Grub Boot" \
        --cancel-button "Exit" \
        --default-item "$DefaultItem" \
        --menu "Menu Number       ----------- Menu Name ----------" 24 76 16 \
        "${MenuArr[@]}" \
       >/dev/tty)

    clear
    if [[ $Choice == "" ]]; then break ; fi
    DefaultItem=$Choice

    for (( i=0; i < ${#MenuArr[@]}; i=i+2 )) ; do
        if [[ "${MenuArr[i]}" == $Choice ]] ; then
            i=$i+1
            MenuEntry="menuentry '"${MenuArr[i]}"'"
            break
        fi
    done

    TheGameIsAfoot=false
    while read -r line ; do
        if [[ $line = *"$MenuEntry"* ]]; then TheGameIsAfoot=true ; fi
        if [[ $TheGameIsAfoot == true ]]; then
            echo $line
            if [[ $line = *"}"* ]]; then break ; fi
        fi
    done < /boot/grub/grub.cfg

    read -p "Press <Enter> to continue"

done

exit 0

O grub-display-lite.shscript bash é basicamente o mesmo que, grub-display.shexceto que não há mensagem de erro se dialognão estiver instalado. Além disso, alguns whiptailargumentos têm nomes diferentes.

grub-display-lite.sh screenshots

A tela colorida parece ser mais fácil de ler do grub-displayque a que usa o dialogpacote:

grub-display-lite.sh

Aqui está a imagem baseada em texto que não precisa de modificações para copiar para a área de transferência:

Grub Version: 2.02~beta2-36ubuntu3.15


        ┌─────────┤ Use arrow, page, home & end keys. Tab toggle option ├──────────┐
         Menu Number       ----------- Menu Name ----------                        
                                                                                   
                      55 Ubuntu, with Linux 4.13.9-041309-generic                 
                      58 Ubuntu, with Linux 4.10.0-42-generic                     
                      61 Ubuntu, with Linux 4.10.0-40-generic                     
                      64 Ubuntu, with Linux 4.10.0-38-generic                     
                      67 Ubuntu, with Linux 4.10.0-37-generic                     
                      70 Ubuntu, with Linux 4.10.0-28-generic                     
                      73 Ubuntu, with Linux 4.9.77-040977-generic                 
                      76 Ubuntu, with Linux 4.9.76-040976-generic                 
                      79 Ubuntu, with Linux 4.4.0-104-generic                     
                      82 Ubuntu, with Linux 4.4.0-103-generic                     
                      85 Ubuntu, with Linux 4.4.0-101-generic                     
                      88 Ubuntu, with Linux 4.4.0-98-generic                      
                      91 Ubuntu, with Linux 3.16.53-031653-generic                
                      94 Windows Boot Manager (on /dev/nvme0n1p2)                 
                      95 Windows Boot Manager (on /dev/sda1)                      
                      96 System setup                                             
                                                                                   
                                                                                   
                           <Display Grub Boot>        <Exit>                       
                                                                                   
        └──────────────────────────────────────────────────────────────────────────┘ 

Como mencionado acima, você pode reduzir o tamanho do menu do grub exibido aqui em 66% ao remover (upstart)e (recovery)opções do menu. É o caso aqui, mas, como conseqüência, as linhas de detalhes ficam mais estreitas e os títulos não se alinham perfeitamente. Você pode ajustar os títulos das colunas alterando esta linha:

    --menu "Menu Number       ----------- Menu Name ----------" 24 76 16 \

para algo como isto:

    --menu "      Menu Number ----------- Menu Name ----------" 24 76 16 \
WinEunuuchs2Unix
fonte
Para ver as informações atuais, basta usar cat /proc/cmdline. Para ver as opções, o grub usará na próxima vez que você atualizar o uso do menu grub grep GRUB_CMDLINE_LINUX /etc/default/grub. Esse segundo conjunto de configurações será usado pelo apt ou sempre que update-grubfor executado. Para ver todas as opções de forma simples less /boot/grub/grub.cfgou semelhante.
Panther
@ Panther Adicionei as entradas de menu grub # 94 e # 96 (do meu sistema) para mostrar mais utilidade. A outra coisa a considerar é que é mais fácil usar um menu do que lembrar cate greppara a maioria de nós.
WinEunuuchs2Unix 26/03
+1. Concordo que os menus em modo texto dialogpodem ser úteis.
sudodus 26/03
Bem, uma nota de rodapé para esta incrível resposta é que alguns sabores do ubuntu não incluem o diálogo lubuntu 16.04 não por padrão.
Ianorlin 26/03
@ianorlin acaba de ser postada uma versão muito melhor.
WinEunuuchs2Unix 06/04/19