KVM 启动错误:未找到设备“UUID=xxxx-51fb”。挂载:/new_root:找不到 UUID=xxxx-51fb

KVM 启动错误:未找到设备“UUID=xxxx-51fb”。挂载:/new_root:找不到 UUID=xxxx-51fb

我正在 KVM VPS 上安装 Arch。几天前,我在一家 VPS 提供商处做到了这一点,并且我能够顺利启动并运行 Arch。然而,我今天尝试另一个 VPS 提供商,但遇到了一个无法解决的问题。

我通过将 ISO 映像安装为 CD ROM 来安装 Arch,启动到 Arch ISO 并进行手动安装。一切似乎都很顺利,但是当我卸载“CD Rom”并重新启动时,错误是:

错误:找不到设备“UUID=fd92f3e7-f092-48c7-9f16-d94ba3de51fb”。跳过 fsck。
安装:/new_root:找不到 UUID=fd92f3e7-f092-48c7-9f16-d94ba3de51fb。
您现在被放入紧急外壳中。
sh: 无法访问 tty: 作业控制已关闭
[rootfs ]#

我使用 GTP 和 BIOS 引导分区,如以下分区步骤所示:

gdisk /dev/sda

Number  Start (sector)    End (sector)  Size       Code  Name
1            2048            4095   1024.0 KiB  EF02  BIOS boot partition
2            4096        25169919   12.0 GiB    8300  Linux filesystem
3        25169920        41943006   8.0 GiB     8200  Linux swap

以下是我使用 pacstrap 的步骤:

mkfs.btrfsk /dev/sda2
mkswap /dev/sda3
swapon /dev/sda3

mount /dev/sda2 /mnt
pacstrap -i /mnt <my list of packages includes grub>
pacstrap -i /mnt base base-devel linux-lts.... btrfs-progs grub ...
genfstab -U -p /mnt >> /mnt/etc/fstab

这是生成的 fstab:

# /dev/sda2
UUID=fd92f3e7-f092-48c7-9f16-d94ba3de51fb       /               btrfs           rw,relatime,space_cache,subvolid=5,subvol=/     0 0

# /dev/sda3
UUID=b1388b5c-0bd1-444b-9b2e-d1b39537326d       none            swap            defaults        0 0

我通常将安装选项更改为以下内容:

UUID=fd92f3e7-f092-48c7-9f16-d94ba3de51fb       /               btrfs           rw,noatime,nodiratime,compress=lzo,space_cache,defaults,subvol=/        0 0

(顺便说一句,两个 fstab 版本在重新启动时都会出现上面显示的相同错误。)

接下来我会执行arch-chroot /mnt,然后是正常的安装步骤...我将这些详细信息保持简短,以便我可以显示与 grub 相关的步骤,这就是我认为问题所在的地方。

在 /etc/mkinitcpio.conf 中,我添加了以下二进制文件:

BINARIES=(/usr/bin/btrfs)

然后我运行接下来的两个标准 grub 命令(显示输出):

grub 安装 /dev/sda

Installing for i386-pc platform.
Installation finished. No error reported.

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

Generating grub configuration file ...
Found linux image: /boot/vmlinuz-linux-lts
Found initrd image: /boot/initramfs-linux-lts.img
Found fallback initrd image(s) in /boot: initramfs-linux-lts-fallback.img
Found linux image: /boot/vmlinuz-linux
Found initrd image: /boot/initramfs-linux.img
Found fallback initrd image(s) in /boot: initramfs-linux-fallback.img
done

网络准备好等之后,我重新启动并取出CD Rom。但系统无法启动并出现上述错误。

以下是我认为可能相关的所有配置文件和输出:

root@archiso ~ # cat /mnt/boot/grub/grub.cfg

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
insmod part_gpt
insmod part_msdos
if [ -s $prefix/grubenv ]; then
load_env
fi
if [ "${next_entry}" ] ; then
set default="${next_entry}"
set next_entry=
save_env next_entry
set boot_once=true
else
set default="0"
fi

if [ x"${feature_menuentry_id}" = xy ]; then
menuentry_id_option="--id"
else
menuentry_id_option=""
fi

export menuentry_id_option

if [ "${prev_saved_entry}" ]; then
set saved_entry="${prev_saved_entry}"
save_env saved_entry
set prev_saved_entry=
save_env prev_saved_entry
set boot_once=true
fi

function savedefault {
if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
fi
}

function load_video {
if [ x$feature_all_video_module = xy ]; then
    insmod all_video
else
    insmod efi_gop
    insmod efi_uga
    insmod ieee1275_fb
    insmod vbe
    insmod vga
    insmod video_bochs
    insmod video_cirrus
fi
}

if [ x$feature_default_font_path = xy ] ; then
font=unicode
else
insmod part_gpt
insmod btrfs
set root='hd0,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  fd92f3e7-f092-48c7-9f16-d94ba3de51fb
else
search --no-floppy --fs-uuid --set=root fd92f3e7-f092-48c7-9f16-d94ba3de51fb
fi
    font="/usr/share/grub/unicode.pf2"
fi

if loadfont $font ; then
set gfxmode=auto
load_video
insmod gfxterm
set locale_dir=$prefix/locale
set lang=en_US
insmod gettext
fi
terminal_input console
terminal_output gfxterm
if [ x$feature_timeout_style = xy ] ; then
set timeout_style=menu
set timeout=5
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
set timeout=5
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Arch Linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-fd92f3e7-f092-48c7-9f16-d94ba3de51fb' {
        load_video
        set gfxpayload=keep
        insmod gzio
        insmod part_gpt
        insmod btrfs
        set root='hd0,gpt2'
        if [ x$feature_platform_search_hint = xy ]; then
        search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  fd92f3e7-f092-48c7-9f16-d94ba3de51fb
        else
        search --no-floppy --fs-uuid --set=root fd92f3e7-f092-48c7-9f16-d94ba3de51fb
        fi
        echo    'Loading Linux linux-lts ...'
        linux   /boot/vmlinuz-linux-lts root=UUID=fd92f3e7-f092-48c7-9f16-d94ba3de51fb rw  quiet
        echo    'Loading initial ramdisk ...'
        initrd  /boot/initramfs-linux-lts.img
}
submenu 'Advanced options for Arch Linux' $menuentry_id_option 'gnulinux-advanced-fd92f3e7-f092-48c7-9f16-d94ba3de51fb' {
        menuentry 'Arch Linux, with Linux linux-lts' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-lts-advanced-fd92f3e7-f092-48c7-9f16-d94ba3de51fb' {
                load_video
                set gfxpayload=keep
                insmod gzio
                insmod part_gpt
                insmod btrfs
                set root='hd0,gpt2'
                if [ x$feature_platform_search_hint = xy ]; then
                search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  fd92f3e7-f092-48c7-9f16-d94ba3de51fb
                else
                search --no-floppy --fs-uuid --set=root fd92f3e7-f092-48c7-9f16-d94ba3de51fb
                fi
                echo    'Loading Linux linux-lts ...'
                linux   /boot/vmlinuz-linux-lts root=UUID=fd92f3e7-f092-48c7-9f16-d94ba3de51fb rw  quiet
                echo    'Loading initial ramdisk ...'
                initrd  /boot/initramfs-linux-lts.img
        }
        menuentry 'Arch Linux, with Linux linux-lts (fallback initramfs)' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-lts-fallback-fd92f3e7-f092-48c7-9f16-d94ba3de51fb' {
                load_video
                set gfxpayload=keep
                insmod gzio
                insmod part_gpt
                insmod btrfs
                set root='hd0,gpt2'
                if [ x$feature_platform_search_hint = xy ]; then
                search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  fd92f3e7-f092-48c7-9f16-d94ba3de51fb
                else
                search --no-floppy --fs-uuid --set=root fd92f3e7-f092-48c7-9f16-d94ba3de51fb
                fi
                echo    'Loading Linux linux-lts ...'
                linux   /boot/vmlinuz-linux-lts root=UUID=fd92f3e7-f092-48c7-9f16-d94ba3de51fb rw  quiet
                echo    'Loading initial ramdisk ...'
                initrd  /boot/initramfs-linux-lts-fallback.img
        }
        menuentry 'Arch Linux, with Linux linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-advanced-fd92f3e7-f092-48c7-9f16-d94ba3de51fb' {
                load_video
                set gfxpayload=keep
                insmod gzio
                insmod part_gpt
                insmod btrfs
                set root='hd0,gpt2'
                if [ x$feature_platform_search_hint = xy ]; then
                search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  fd92f3e7-f092-48c7-9f16-d94ba3de51fb
                else
                search --no-floppy --fs-uuid --set=root fd92f3e7-f092-48c7-9f16-d94ba3de51fb
                fi
                echo    'Loading Linux linux ...'
                linux   /boot/vmlinuz-linux root=UUID=fd92f3e7-f092-48c7-9f16-d94ba3de51fb rw  quiet
                echo    'Loading initial ramdisk ...'
                initrd  /boot/initramfs-linux.img
        }
        menuentry 'Arch Linux, with Linux linux (fallback initramfs)' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-fallback-fd92f3e7-f092-48c7-9f16-d94ba3de51fb' {
                load_video
                set gfxpayload=keep
                insmod gzio
                insmod part_gpt
                insmod btrfs
                set root='hd0,gpt2'
                if [ x$feature_platform_search_hint = xy ]; then
                search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  fd92f3e7-f092-48c7-9f16-d94ba3de51fb
                else
                search --no-floppy --fs-uuid --set=root fd92f3e7-f092-48c7-9f16-d94ba3de51fb
                fi
                echo    'Loading Linux linux ...'
                linux   /boot/vmlinuz-linux root=UUID=fd92f3e7-f092-48c7-9f16-d94ba3de51fb rw  quiet
                echo    'Loading initial ramdisk ...'
                initrd  /boot/initramfs-linux-fallback.img
        }
}

### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f  ${config_directory}/custom.cfg ]; then
source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###

[root@archiso /]# cat /etc/default/grub

# GRUB boot loader configuration

GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="Arch"
GRUB_CMDLINE_LINUX_DEFAULT="quiet"
GRUB_CMDLINE_LINUX=""

# Preload both GPT and MBR modules so that they are not missed
GRUB_PRELOAD_MODULES="part_gpt part_msdos"

# Uncomment to enable booting from LUKS encrypted devices
#GRUB_ENABLE_CRYPTODISK=y

# Uncomment to enable Hidden Menu, and optionally hide the timeout count
#GRUB_HIDDEN_TIMEOUT=5
#GRUB_HIDDEN_TIMEOUT_QUIET=true

# Uncomment to use basic console
GRUB_TERMINAL_INPUT=console

# Uncomment to disable graphical terminal
#GRUB_TERMINAL_OUTPUT=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=auto

# Uncomment to allow the kernel use the same resolution used by grub
GRUB_GFXPAYLOAD_LINUX=keep

# Uncomment if you want GRUB to pass to the Linux kernel the old parameter
# format "root=/dev/xxx" instead of "root=/dev/disk/by-uuid/xxx"
#GRUB_DISABLE_LINUX_UUID=true

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

# Uncomment and set to the desired menu colors.  Used by normal and wallpaper
# modes only.  Entries specified as foreground/background.
#GRUB_COLOR_NORMAL="light-blue/black"
#GRUB_COLOR_HIGHLIGHT="light-cyan/blue"

# Uncomment one of them for the gfx desired, a image background or a gfxtheme
#GRUB_BACKGROUND="/path/to/wallpaper"
#GRUB_THEME="/path/to/gfxtheme"

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

# Uncomment to make GRUB remember the last selection. This requires to
# set 'GRUB_DEFAULT=saved' above.
#GRUB_SAVEDEFAULT="true"

[root@archiso /]# blkid

/dev/sr0: UUID="2017-04-01-11-29-57-00" LABEL="ARCH_201704" TYPE="iso9660" PTUUID="48d46635" PTTYPE="dos"
/dev/sda1: PARTLABEL="BIOS boot partition" PARTUUID="0102316e-d6ba-4896-b184-7d93bbd8fd1b"
/dev/sda2: LABEL="top_level" UUID="fd92f3e7-f092-48c7-9f16-d94ba3de51fb" UUID_SUB="9c7e449b-26f5-43d0-88a0-f7d01479cf82" TYPE="btrfs" PARTLABEL="Linux filesystem" PARTUUID="2758217d-bf0b-4036-aea0-26b68ae733f5"
/dev/sda3: UUID="b1388b5c-0bd1-444b-9b2e-d1b39537326d" TYPE="swap" PARTLABEL="Linux swap" PARTUUID="c48910f1-2483-4228-a0f4-952b2e9f101a"
/dev/loop0: TYPE="squashfs"

root@archiso ~ # lsblk -f

NAME   FSTYPE   LABEL       UUID                                 MOUNTPOINT
loop0  squashfs                                                  /run/archiso/sfs/airootfs
sda
├─sda1
├─sda2 btrfs    top_level   fd92f3e7-f092-48c7-9f16-d94ba3de51fb /mnt
└─sda3 swap                 b1388b5c-0bd1-444b-9b2e-d1b39537326d [SWAP]
sr0    iso9660  ARCH_201704 2017-04-01-11-29-57-00               /run/archiso/bootmnt

更新1:由于我没有更好的想法可以尝试,因此/etc/default/grub我启用了此选项:

GRUB_DISABLE_LINUX_UUID=true

我重新生成了 grub.cfg:

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

更改后,当我启动 VPS 时,出现类似的错误:

错误:找不到设备“/dev/sda2”。跳过 fsck。
:: 在真实根挂载 /new_root 上挂载“/dev/sda2”
:未指定文件系统类型

这是否提供了我所缺少的线索?

答案1

您好,此时您肯定已经意识到自己的错误,但对于犯同样错误的其他人来说,这里是根本问题和解决方案。

OP 您设置了 3 个分区,但无法挂载/dev/sda1到该/boot文件夹​​。如果其他人犯了这个错误,只需添加丢失的分区并再次重新运行必要的命令即可。

mount /dev/sda2 /mnt
mount /dev/sda1 /mnt/boot
genfstab -U -p /mnt >> /mnt/etc/fstab
arch-chroot /mnt
grub-mkconfig -o /boot/grub/grub.cfg

退出、卸载并重新启动。

我希望这是直接且有帮助的。最好的后卫。

相关内容