Slackware64 14.2 - GRUB2 - 如何设置默认值反而?

Slackware64 14.2 - GRUB2 - 如何设置默认值反而?

我正在尝试在内核行中使用 grub 配置文件“/boot/grub/grub.cfg”,设置“root=UUID=”而不是“root=/dev/”

例如当我跑时:

grub-mkconfig -o /boot/grub/grub.cfg

文件 /boot/grub/grub.cfg 包含:

menuentry 'Slackware-14.2 GNU/Linux' --class slackware-14.2 --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-1c07b419-4a08-4326-b4c4-fd9ac9cce46e' {
    load_video
    set gfxpayload=keep
    insmod gzio
    insmod part_msdos 
    insmod ext2
    set root='hd0,msdos1'
    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  59774ae4-7b95-4aee-a16f-40e9adc3c4db
    else
      search --no-floppy --fs-uuid --set=root 59774ae4-7b95-4aee-a16f-40e9adc3c4db
    fi
    echo    'Loading Linux 4.4.111 ...'
    linux   /vmlinuz-huge-4.4.111 root=/dev/sda3 ro splash quiet nomodeset video=uvesafb:mode_option=1024x768-24,mtrr=3,scroll=ywrap
}

我正在尝试 grub-mkconfig,在 /boot/grub/grub.cfg 中生成,以下包含(只需将 root=/dev/sda3 更改为 root=UUID=)

menuentry 'Slackware-14.2 GNU/Linux' --class slackware-14.2 --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-1c07b419-4a08-4326-b4c4-fd9ac9cce46e' {
    load_video
    set gfxpayload=keep
    insmod gzio
    insmod part_msdos 
    insmod ext2
    set root='hd0,msdos1'
    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  59774ae4-7b95-4aee-a16f-40e9adc3c4db
    else
      search --no-floppy --fs-uuid --set=root 59774ae4-7b95-4aee-a16f-40e9adc3c4db
    fi
    echo    'Loading Linux 4.4.111 ...'
    linux   /vmlinuz-huge-4.4.111 root=UUID=1c07b419-4a08-4326-b4c4-fd9ac9cce46e ro splash quiet nomodeset video=uvesafb:mode_option=1024x768-24,mtrr=3,scroll=ywrap
}

我从 blkid 得到信息

blkid | grep sda3
/dev/sda3: LABEL="2Slackware64" UUID="1c07b419-4a08-4326-b4c4-fd9ac9cce46e" UUID_SUB="3ec2cd19-212c-42e4-9630-8c5c2baa3250" TYPE="btrfs" PARTUUID="000cb1e8-03"

我尝试修改文件:

/etc/grub.d/10_linux
/usr/share/grub/grub-mkconfig_lib
/etc/default/grub

但当我使用 grub-mkconfig 工具生成 /boot/grub/grub.cfg 时,我找不到设置默认生成的方法

答案1

我的文件 /etc/default/grub 内容:

# If you change this file, run grub-mkconfig -o /boot/grub/grub.cfg
# afterwards to update /boot/grub/grub.cfg.

GRUB_DEFAULT=0
#GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=false
GRUB_TIMEOUT=15
GRUB_DISTRIBUTOR=$( sed 's/Slackware /Slackware-/' /etc/slackware-version )
GRUB_CMDLINE_LINUX_DEFAULT="video=uvesafb:mode_option=1024x768-24"
GRUB_CMDLINE_LINUX="quiet"

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
  GRUB_GFXMODE=1024x768x32
  GRUB_GFXPAYLOAD_LINUX=keep
  GRUB_BACKGROUND="/boot/images/tux.png"

# Font used on the graphical terminal:
GRUB_FONT=/usr/share/grub/dejavusansmono.pf2

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY="true"

相关内容