Grub“从上次启动启动”设置不起作用

Grub“从上次启动启动”设置不起作用

我目前正在运行 Ubuntu 21.10 和 Windows 10。我总是使用 grub-customizer 工具按照我想要的方式设置 grub。除了其他更改(所有更改都有效)之外,我将其设置为从上次启动的分区启动。此设置在 20.04 中有效,但现在无效。相反,它总是尝试启动到 Windows。

编辑:这是 /etc/default/grub 的内容:

# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
#   info -f grub -n 'Simple configuration'

GRUB_DEFAULT=saved
GRUB_TIMEOUT_STYLE="hidden"
GRUB_TIMEOUT="10"
GRUB_DISTRIBUTOR="`lsb_release -i -s 2> /dev/null || echo Debian`"
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=UUID=920a469a-eee8-4841-b43a-e96694ac485b"
GRUB_CMDLINE_LINUX=""

# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"

# 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="640x480"

# 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"

# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"

GRUB_SAVEDEFAULT=true

编辑 2:这是 /etc/default/grub.d 中文件的内容:init-select.cfg

# Work around a bug in the obsolete init-select package which broke
# grub-mkconfig when init-select was removed but not purged.  This file does
# nothing and will be removed in a later release. 
#
# See:
#   https://bugs.debian.org/858528
#   https://bugs.debian.org/863801

编辑 3:这是 /etc/grub.d 的内容:

./44_memtest86+
./.script_sources.txt
./43_linux_xen
./41_linux_proxy
./45_os-prober
./47_custom_proxy
./00_header
./46_uefi-firmware
./10_linux_proxy
./bin
./bin/grubcfg_proxy
./proxifiedScripts
./proxifiedScripts/custom
./proxifiedScripts/linux
./42_linux_zfs
./README
./05_debian_theme
./40_custom_proxy
./48_custom
./backup
./backup/default_grub
./backup/boot_grub
./backup/boot_grub/unicode.pf2
./backup/boot_grub/grubenv
./backup/boot_grub/grub.cfg
./backup/boot_grub/gfxblacklist.txt
./backup/boot_grub/x86_64-efi
./backup/boot_grub/x86_64-efi/newc.mod
./backup/boot_grub/x86_64-efi/part_sun.mod
./backup/boot_grub/x86_64-efi/mul_test.mod
./backup/boot_grub/x86_64-efi/boot.mod
./backup/boot_grub/x86_64-efi/linux.mod
./backup/boot_grub/x86_64-efi/usb_keyboard.mod
./backup/boot_grub/x86_64-efi/scsi.mod
./backup/boot_grub/x86_64-efi/search_fs_file.mod
./backup/boot_grub/x86_64-efi/pbkdf2.mod
./backup/boot_grub/x86_64-efi/div.mod
./backup/boot_grub/x86_64-efi/video.lst
./backup/boot_grub/x86_64-efi/part_acorn.mod
./backup/boot_grub/x86_64-efi/nilfs2.mod
./backup/boot_grub/x86_64-efi/usbtest.mod
./backup/boot_grub/x86_64-efi/f2fs.mod
./backup/boot_grub/x86_64-efi/pbkdf2_test.mod
./backup/boot_grub/x86_64-efi/blocklist.mod
./backup/boot_grub/x86_64-efi/datetime.mod
./backup/boot_grub/x86_64-efi/shift_test.mod
./backup/boot_grub/x86_64-efi/mmap.mod
./backup/boot_grub/x86_64-efi/chain.mod
./backup/boot_grub/x86_64-efi/core.efi
./backup/boot_grub/x86_64-efi/macho.mod
./backup/boot_grub/x86_64-efi/cbmemc.mod
./backup/boot_grub/x86_64-efi/ext2.mod
./backup/boot_grub/x86_64-efi/xnu_uuid.mod
./backup/boot_grub/x86_64-efi/part_gpt.mod
./backup/boot_grub/x86_64-efi/morse.mod
./backup/boot_grub/x86_64-efi/fat.mod
./backup/boot_grub/x86_64-efi/dm_nv.mod
./backup/boot_grub/x86_64-efi/minix_be.mod
./backup/boot_grub/x86_64-efi/part_amiga.mod
./backup/boot_grub/x86_64-efi/setpci.mod
./backup/boot_grub/x86_64-efi/datehook.mod
./backup/boot_grub/x86_64-efi/ehci.mod
./backup/boot_grub/x86_64-efi/part_plan.mod
./backup/boot_grub/x86_64-efi/part_apple.mod
./backup/boot_grub/x86_64-efi/ahci.mod
./backup/boot_grub/x86_64-efi/bsd.mod
./backup/boot_grub/x86_64-efi/cmp.mod
./backup/boot_grub/x86_64-efi/cpio.mod
./backup/boot_grub/x86_64-efi/luks.mod
./backup/boot_grub/x86_64-efi/video_cirrus.mod
./backup/boot_grub/x86_64-efi/reboot.mod
./backup/boot_grub/x86_64-efi/smbios.mod
./backup/boot_grub/x86_64-efi/ls.mod
./backup/boot_grub/x86_64-efi/random.mod
./backup/boot_grub/x86_64-efi/hexdump.mod
./backup/boot_grub/x86_64-efi/video_colors.mod
./backup/boot_grub/x86_64-efi/keylayouts.mod
./backup/boot_grub/x86_64-efi/bufio.mod
./backup/boot_grub/x86_64-efi/nativedisk.mod
./backup/boot_grub/x86_64-efi/usbserial_usbdebug.mod
./backup/boot_grub/x86_64-efi/modinfo.sh
./backup/boot_grub/x86_64-efi/affs.mod
./backup/boot_grub/x86_64-efi/reiserfs.mod
./backup/boot_grub/x86_64-efi/lsefimmap.mod
./backup/boot_grub/x86_64-efi/verifiers.mod
./backup/boot_grub/x86_64-efi/video_bochs.mod
./backup/boot_grub/x86_64-efi/videotest_checksum.mod
./backup/boot_grub/x86_64-efi/usbms.mod
./backup/boot_grub/x86_64-efi/date.mod
./backup/boot_grub/x86_64-efi/mdraid09.mod
./backup/boot_grub/x86_64-efi/trig.mod
./backup/boot_grub/x86_64-efi/normal.mod
./backup/boot_grub/x86_64-efi/xnu.mod
./backup/boot_grub/x86_64-efi/pgp.mod
./backup/boot_grub/x86_64-efi/ufs1.mod
./backup/boot_grub/x86_64-efi/xfs.mod
./backup/boot_grub/x86_64-efi/cs5536.mod
./backup/boot_grub/x86_64-efi/gcry_rsa.mod
./backup/boot_grub/x86_64-efi/parttool.mod
./backup/boot_grub/x86_64-efi/gcry_sha512.mod
./backup/boot_grub/x86_64-efi/raid5rec.mod
./backup/boot_grub/x86_64-efi/zfs.mod
./backup/boot_grub/x86_64-efi/gcry_md5.mod
./backup/boot_grub/x86_64-efi/priority_queue.mod
./backup/boot_grub/x86_64-efi/multiboot.mod
./backup/boot_grub/x86_64-efi/font.mod
./backup/boot_grub/x86_64-efi/test.mod
./backup/boot_grub/x86_64-efi/diskfilter.mod
./backup/boot_grub/x86_64-efi/bitmap_scale.mod
./backup/boot_grub/x86_64-efi/backtrace.mod
./backup/boot_grub/x86_64-efi/raid6rec.mod
./backup/boot_grub/x86_64-efi/fshelp.mod
./backup/boot_grub/x86_64-efi/true.mod
./backup/boot_grub/x86_64-efi/test_blockarg.mod
./backup/boot_grub/x86_64-efi/odc.mod
./backup/boot_grub/x86_64-efi/ohci.mod
./backup/boot_grub/x86_64-efi/mpi.mod
./backup/boot_grub/x86_64-efi/hfsplus.mod
./backup/boot_grub/x86_64-efi/efifwsetup.mod
./backup/boot_grub/x86_64-efi/procfs.mod
./backup/boot_grub/x86_64-efi/cbls.mod
./backup/boot_grub/x86_64-efi/testload.mod
./backup/boot_grub/x86_64-efi/ctz_test.mod
./backup/boot_grub/x86_64-efi/wrmsr.mod
./backup/boot_grub/x86_64-efi/fixvideo.mod
./backup/boot_grub/x86_64-efi/iso9660.mod
./backup/boot_grub/x86_64-efi/gcry_des.mod
./backup/boot_grub/x86_64-efi/multiboot2.mod
./backup/boot_grub/x86_64-efi/crc64.mod
./backup/boot_grub/x86_64-efi/exfat.mod
./backup/boot_grub/x86_64-efi/tr.mod
./backup/boot_grub/x86_64-efi/lspci.mod
./backup/boot_grub/x86_64-efi/memrw.mod
./backup/boot_grub/x86_64-efi/part_bsd.mod
./backup/boot_grub/x86_64-efi/signature_test.mod
./backup/boot_grub/x86_64-efi/ufs2.mod
./backup/boot_grub/x86_64-efi/ntfscomp.mod
./backup/boot_grub/x86_64-efi/load.cfg
./backup/boot_grub/x86_64-efi/at_keyboard.mod
./backup/boot_grub/x86_64-efi/msdospart.mod
./backup/boot_grub/x86_64-efi/gcry_rfc2268.mod
./backup/boot_grub/x86_64-efi/hfs.mod
./backup/boot_grub/x86_64-efi/video_fb.mod
./backup/boot_grub/x86_64-efi/bswap_test.mod
./backup/boot_grub/x86_64-efi/zfscrypt.mod
./backup/boot_grub/x86_64-efi/ata.mod
./backup/boot_grub/x86_64-efi/relocator.mod
./backup/boot_grub/x86_64-efi/progress.mod
./backup/boot_grub/x86_64-efi/gettext.mod
./backup/boot_grub/x86_64-efi/cryptodisk.mod
./backup/boot_grub/x86_64-efi/halt.mod
./backup/boot_grub/x86_64-efi/gcry_crc.mod
./backup/boot_grub/x86_64-efi/tpm.mod
./backup/boot_grub/x86_64-efi/linux16.mod
./backup/boot_grub/x86_64-efi/parttool.lst
./backup/boot_grub/x86_64-efi/gcry_md4.mod
./backup/boot_grub/x86_64-efi/search_fs_uuid.mod
./backup/boot_grub/x86_64-efi/cbtable.mod
./backup/boot_grub/x86_64-efi/gcry_twofish.mod
./backup/boot_grub/x86_64-efi/jfs.mod
./backup/boot_grub/x86_64-efi/elf.mod
./backup/boot_grub/x86_64-efi/lzopio.mod
./backup/boot_grub/x86_64-efi/bitmap.mod
./backup/boot_grub/x86_64-efi/png.mod
./backup/boot_grub/x86_64-efi/bfs.mod
./backup/boot_grub/x86_64-efi/geli.mod
./backup/boot_grub/x86_64-efi/usbserial_ftdi.mod
./backup/boot_grub/x86_64-efi/cpuid.mod
./backup/boot_grub/x86_64-efi/div_test.mod
./backup/boot_grub/x86_64-efi/gcry_dsa.mod
./backup/boot_grub/x86_64-efi/efinet.mod
./backup/boot_grub/x86_64-efi/legacycfg.mod
./backup/boot_grub/x86_64-efi/efi_uga.mod
./backup/boot_grub/x86_64-efi/ufs1_be.mod
./backup/boot_grub/x86_64-efi/macbless.mod
./backup/boot_grub/x86_64-efi/aout.mod
./backup/boot_grub/x86_64-efi/cbfs.mod
./backup/boot_grub/x86_64-efi/gcry_rmd160.mod
./backup/boot_grub/x86_64-efi/tar.mod
./backup/boot_grub/x86_64-efi/cbtime.mod
./backup/boot_grub/x86_64-efi/terminal.lst
./backup/boot_grub/x86_64-efi/hfspluscomp.mod
./backup/boot_grub/x86_64-efi/rdmsr.mod
./backup/boot_grub/x86_64-efi/gcry_tiger.mod
./backup/boot_grub/x86_64-efi/offsetio.mod
./backup/boot_grub/x86_64-efi/usbserial_pl2303.mod
./backup/boot_grub/x86_64-efi/syslinuxcfg.mod
./backup/boot_grub/x86_64-efi/crypto.lst
./backup/boot_grub/x86_64-efi/loadenv.mod
./backup/boot_grub/x86_64-efi/mdraid1x.mod
./backup/boot_grub/x86_64-efi/lvm.mod
./backup/boot_grub/x86_64-efi/usb.mod
./backup/boot_grub/x86_64-efi/pata.mod
./backup/boot_grub/x86_64-efi/romfs.mod
./backup/boot_grub/x86_64-efi/minicmd.mod
./backup/boot_grub/x86_64-efi/gfxterm_background.mod
./backup/boot_grub/x86_64-efi/eval.mod
./backup/boot_grub/x86_64-efi/loopback.mod
./backup/boot_grub/x86_64-efi/play.mod
./backup/boot_grub/x86_64-efi/probe.mod
./backup/boot_grub/x86_64-efi/setjmp_test.mod
./backup/boot_grub/x86_64-efi/zfsinfo.mod
./backup/boot_grub/x86_64-efi/lsmmap.mod
./backup/boot_grub/x86_64-efi/partmap.lst
./backup/boot_grub/x86_64-efi/gcry_arcfour.mod
./backup/boot_grub/x86_64-efi/keystatus.mod
./backup/boot_grub/x86_64-efi/minix.mod
./backup/boot_grub/x86_64-efi/cmdline_cat_test.mod
./backup/boot_grub/x86_64-efi/part_dfly.mod
./backup/boot_grub/x86_64-efi/hello.mod
./backup/boot_grub/x86_64-efi/gcry_serpent.mod
./backup/boot_grub/x86_64-efi/lsefi.mod
./backup/boot_grub/x86_64-efi/search_label.mod
./backup/boot_grub/x86_64-efi/btrfs.mod
./backup/boot_grub/x86_64-efi/shim_lock.mod
./backup/boot_grub/x86_64-efi/gcry_rijndael.mod
./backup/boot_grub/x86_64-efi/uhci.mod
./backup/boot_grub/x86_64-efi/hdparm.mod
./backup/boot_grub/x86_64-efi/part_msdos.mod
./backup/boot_grub/x86_64-efi/terminal.mod
./backup/boot_grub/x86_64-efi/ldm.mod
./backup/boot_grub/x86_64-efi/xzio.mod
./backup/boot_grub/x86_64-efi/read.mod
./backup/boot_grub/x86_64-efi/loadbios.mod
./backup/boot_grub/x86_64-efi/iorw.mod
./backup/boot_grub/x86_64-efi/gcry_blowfish.mod
./backup/boot_grub/x86_64-efi/gcry_whirlpool.mod
./backup/boot_grub/x86_64-efi/memdisk.mod
./backup/boot_grub/x86_64-efi/sfs.mod
./backup/boot_grub/x86_64-efi/gzio.mod
./backup/boot_grub/x86_64-efi/udf.mod
./backup/boot_grub/x86_64-efi/gcry_sha256.mod
./backup/boot_grub/x86_64-efi/terminfo.mod
./backup/boot_grub/x86_64-efi/sleep.mod
./backup/boot_grub/x86_64-efi/jpeg.mod
./backup/boot_grub/x86_64-efi/serial.mod
./backup/boot_grub/x86_64-efi/cat.mod
./backup/boot_grub/x86_64-efi/all_video.mod
./backup/boot_grub/x86_64-efi/efi_gop.mod
./backup/boot_grub/x86_64-efi/testspeed.mod
./backup/boot_grub/x86_64-efi/crypto.mod
./backup/boot_grub/x86_64-efi/lsacpi.mod
./backup/boot_grub/x86_64-efi/xnu_uuid_test.mod
./backup/boot_grub/x86_64-efi/videotest.mod
./backup/boot_grub/x86_64-efi/configfile.mod
./backup/boot_grub/x86_64-efi/spkmodem.mod
./backup/boot_grub/x86_64-efi/gcry_camellia.mod
./backup/boot_grub/x86_64-efi/password.mod
./backup/boot_grub/x86_64-efi/disk.mod
./backup/boot_grub/x86_64-efi/minix3.mod
./backup/boot_grub/x86_64-efi/gcry_seed.mod
./backup/boot_grub/x86_64-efi/gcry_sha1.mod
./backup/boot_grub/x86_64-efi/time.mod
./backup/boot_grub/x86_64-efi/gfxterm_menu.mod
./backup/boot_grub/x86_64-efi/file.mod
./backup/boot_grub/x86_64-efi/echo.mod
./backup/boot_grub/x86_64-efi/regexp.mod
./backup/boot_grub/x86_64-efi/search.mod
./backup/boot_grub/x86_64-efi/minix2.mod
./backup/boot_grub/x86_64-efi/net.mod
./backup/boot_grub/x86_64-efi/moddep.lst
./backup/boot_grub/x86_64-efi/tga.mod
./backup/boot_grub/x86_64-efi/tftp.mod
./backup/boot_grub/x86_64-efi/squash4.mod
./backup/boot_grub/x86_64-efi/lsefisystab.mod
./backup/boot_grub/x86_64-efi/mdraid09_be.mod
./backup/boot_grub/x86_64-efi/ntfs.mod
./backup/boot_grub/x86_64-efi/hashsum.mod
./backup/boot_grub/x86_64-efi/lssal.mod
./backup/boot_grub/x86_64-efi/videoinfo.mod
./backup/boot_grub/x86_64-efi/part_dvh.mod
./backup/boot_grub/x86_64-efi/linuxefi.mod
./backup/boot_grub/x86_64-efi/usbserial_common.mod
./backup/boot_grub/x86_64-efi/help.mod
./backup/boot_grub/x86_64-efi/gptsync.mod
./backup/boot_grub/x86_64-efi/zstd.mod
./backup/boot_grub/x86_64-efi/gcry_idea.mod
./backup/boot_grub/x86_64-efi/functional_test.mod
./backup/boot_grub/x86_64-efi/adler32.mod
./backup/boot_grub/x86_64-efi/minix2_be.mod
./backup/boot_grub/x86_64-efi/part_sunpc.mod
./backup/boot_grub/x86_64-efi/cmp_test.mod
./backup/boot_grub/x86_64-efi/gfxmenu.mod
./backup/boot_grub/x86_64-efi/acpi.mod
./backup/boot_grub/x86_64-efi/setjmp.mod
./backup/boot_grub/x86_64-efi/password_pbkdf2.mod
./backup/boot_grub/x86_64-efi/grub.efi
./backup/boot_grub/x86_64-efi/sleep_test.mod
./backup/boot_grub/x86_64-efi/strtoull_test.mod
./backup/boot_grub/x86_64-efi/appleldr.mod
./backup/boot_grub/x86_64-efi/exfctest.mod
./backup/boot_grub/x86_64-efi/fs.lst
./backup/boot_grub/x86_64-efi/http.mod
./backup/boot_grub/x86_64-efi/gcry_cast5.mod
./backup/boot_grub/x86_64-efi/video.mod
./backup/boot_grub/x86_64-efi/gfxterm.mod
./backup/boot_grub/x86_64-efi/legacy_password_test.mod
./backup/boot_grub/x86_64-efi/afs.mod
./backup/boot_grub/x86_64-efi/extcmd.mod
./backup/boot_grub/x86_64-efi/cpio_be.mod
./backup/boot_grub/x86_64-efi/minix3_be.mod
./backup/boot_grub/x86_64-efi/command.lst
./backup/boot_grub/x86_64-efi/archelp.mod
./backup/boot_grub/x86_64-efi/pcidump.mod
./backup/boot_grub/fonts
./backup/boot_grub/fonts/unicode.pf2
./backup/etc_grub_d
./backup/etc_grub_d/20_linux_xen
./backup/etc_grub_d/40_custom
./backup/etc_grub_d/41_custom
./backup/etc_grub_d/30_os-prober
./backup/etc_grub_d/00_header
./backup/etc_grub_d/10_linux_zfs
./backup/etc_grub_d/30_uefi-firmware
./backup/etc_grub_d/README
./backup/etc_grub_d/20_memtest86+
./backup/etc_grub_d/05_debian_theme
./backup/etc_grub_d/10_linux
 ./backup/RESTORE_INSTRUCTIONS

答案1

Grub Customizer...哦不...这通常会把事情弄得一团糟。

无论如何,编辑 /etc/default/grub 并确保存在以下几行...

GRUB_DEFAULT=saved    # edit existing line
GRUB_SAVEDEFAULT=true # add this line

然后sudo update-grub

更新#1:

将 /etc/grub.dOld 重命名为 /etc/grub.d。这就是您收到错误的原因。

以下是 21.04 系统上 /etc/grub.d 的目录内容。应该相当标准。请注意,所有修改日期都相同。在您的系统上,不同的修改日期表示某些东西或某些人更改了它们。GRUB Customizer 似乎有一个备份/恢复功能,可能有帮助...也可能没有。

-rwxr-xr-x   1 root root 10627 Mar 30  2021 00_header*
-rwxr-xr-x   1 root root  6258 Mar 30  2021 05_debian_theme*
-rwxr-xr-x   1 root root 18151 Mar 30  2021 10_linux*
-rwxr-xr-x   1 root root 43031 Mar 30  2021 10_linux_zfs*
-rwxr-xr-x   1 root root 12894 Mar 30  2021 20_linux_xen*
-rwxr-xr-x   1 root root 12059 Mar 30  2021 30_os-prober*
-rwxr-xr-x   1 root root  1424 Mar 30  2021 30_uefi-firmware*
-rwxr-xr-x   1 root root   214 Mar 30  2021 40_custom*
-rwxr-xr-x   1 root root   216 Mar 30  2021 41_custom*
-rw-r--r--   1 root root   483 Mar 30  2021 README

更新 #2:

好吧,我有权担心 Grub Customizer,它确实把事情搞砸了。

/etc/grub.d/backup/RESTORE_INSTRUCTIONS 中有一个文件详细说明了如何卸载 GC 所做的更改。

OP 手动取消了一些更改以使机器按预期启动。

相关内容