为什么我需要在 KVM 内指定两个 init 映像(initrd 和 boot)才能启动 bash?

为什么我需要在 KVM 内指定两个 init 映像(initrd 和 boot)才能启动 bash?

我的机器在 KVM 虚拟机 (Parallels Desktop v8) 中运行,具有 BIOS(不是 UEFI),连接了一个 SATA 驱动器,该磁盘上有一个 GPT 分区,分区为 ext4 格式,引导加载程序为 extlinux v.4.05,内核是 Ubuntu 13.10 软件包 linux-image-3.11.0-18-generic。

initrd仅当指定且未指定参数时,系统引导至 (initramfs) 提示符boot

(initramfs) cat /proc/cmdline
initrd=/boot/initrd.img-3.11.0-18-generic ro quiet BOOT_IMAGE=/boot/vmlinuz-3.11.0-18-generic

仅在插入boot=/dev/sda1系统后才会启动到 bash 提示符,如问题答案中所指出的如何修复启动进入 initramfs 提示符和“安装:无法读取'/etc/fstab':没有这样的文件或目录”和“找不到 init”?

我读到内核通常能够找到其引导分区而无需额外配置。

环境:

$ sudo efibootmgr
Fatal: Couldn't open either sysfs or procfs directories for accessing EFI variables.
$ sudo modprobe efivars
(no result)

错误(initramfs)提示:

mount: can't read '/etc/fstab': No such file or directory
mount: mounting /dev on /root/dev failed: No such file or directory
mount: mounting /sys on /root/sys failed: No such file or directory
mount: mounting /proc on /root/proc failed: No such file or directory
The filesystem doesn't have requested /sbin/init.
No init found. Try passing init= bootarg.

(initramfs) cd /root || mkdir /root
(initramfs)

更新 #1 - (initramfs) echo $(pwd) 输出

(initramfs) cd /root && echo $(pwd) || mkdir /root?
/root
(initramfs)

更新 #2 - (initramfs) ls /dev 输出

(initramfs) ls /dev
vga_arbiter rfkill mem null port zero full random urandom kmsg tty console
tty0-tty63 vcs vcsa vcs1 vcsa1 snapshot ecryptfs fuse ptmx ttyS0-ttyS31
ttyprintk hpet ram0-ram15 loop-control loop0-loop7 net ppp bus input psaux
uinput rtc0 mapper mcelog cpu_dma_latency network_latency network_throughput
pts core fd stdin stdout stderr btrfs-control char rtc sg0 bsg sda sda1

更新 #3 - (initramfs) ls / && ls /*/ 输出

(initramfs) ls /
dev root conf bin etc sbin run init lib64 scripts lib sys proc tmp var
(initramfs) ls /*/
/var/:
lock

/tmp/:

/sys/:
hypervisor kernel power block dev fs module firmware class devices bus

/scripts/:
panic init-bottom local-premount nfs functions local init-top

/sbin/:
blkid wait-for-root rmmod hwclock udevadm dumpe2fs modprobe

/run/:

/root/:

/proc/:
1-130 142-148 167-169 219-231 233 243-245 248 self ounts net sysvipc fs
driver tty bus sys cgroups irq mtrr fb acpi misc scsi mdstat execdomains
ioports imem schedstat sched_debug timer_list timer_stats dma modules
kallsyms latency_stats buddyinfo pagetypeinfo vmstat zoneinfo slabinfo
vmallocinfo swaps filesystems locks cmdline consoles cpuinfo devices 
interrupts loadavg meminfo stat uptime version softirqs kcore kmsg 
kpagecount kpageflags version_signature key-users crypto diskstats
partitions sysrq-trigger

/lib64/:
ld-linux-x86-64.so.2

/lib/:
udev klibc-dev6iJxsMLkI8yu6xMVSFDIuVsJk.so x86_64-linux-gnu modules firmware systemd

/etc/:
modprobe.d ld.so.conf.d udev ld.so.conf ls.so.cache mtab

/dev/:
...see above...

/conf/:
initramfs.conf arch.conf conf.d

/bin/:
kmod udevadm dmesg busybox poweroff fstype losetup ipconfig reboot halt sh
run-init pivot-root date dd insmod nfsmount sleep mount cpio resume

更新 #4 - ls /scripts/* /conf/* /sys/firmware/*/ 输出

(initramfs) ls /scripts/* /conf/* /sys/firmware/*/
/scripts/functions /scripts/local /scripts/nfs /conf/initramfs.conf /conf/arch.conf  

/sys/firmware/memmap/:
9 8 7 6 5 4 3 2 1 0

/sys/firmware/acpi/:
hotplug tables pm_profiles interrupts

/conf/conf.d:

/scripts/panic:
ORDER keymap

/scripts/local-premount:
ORDER fixrtc resume

/scripts/init-top:
ORDER all_generic_ide blacklist udev

/scripts/init-bottom:
ORDER udev

为什么在这种情况下内核无法找到引导分区?

相关内容