Ubuntu 20.04 LTS 在启动 PXE 时不挂载 NFS

Ubuntu 20.04 LTS 在启动 PXE 时不挂载 NFS

我一直在尝试让 Ubuntu 20.04 进行 PXE 启动,并遇到了与这里其他人类似的问题。我找到了一些解决方案,包括在文件ip=dhcp中添加附加行pxelinux.cfg/default,但它仍然拒绝启动。我已将错误和我的菜单都包含在内以供参考。非常感谢任何帮助。

(initramfs) DHCPOFFER of 10.0.0.25 from 10.0.0.1
DHCPREQUEST for 10.0.0.25 on enp0s3 to 255.255.255.255 port 67 (xid=0x6cb408a3)
DHCPACK of 10.0.0.25 from 10.0.0.1 (xid=0xa308b46c)
bound to 10.0.0.25 -- renewal in 2557 seconds.
Begin: Running /scripts/casper-premount ... done
done.
Begin: Trying to netboot from 10.0.0.9:/netboot/ubuntu/20.04/server ... Begin: Trying nfsmount -o nolock -o ro 10.0.0.9:/netboot/ubuntu/20.04/server /cdrom ... done.
Unable to find a live file system on the network.

菜单如下:

default vesamenu.c32
prompt 0
timeout 300
ONTIMEOUT 1

menu title ########## OS Deploy ##########
label 1
       menu label ^1) Ubuntu 20.04 Server
       kernel ubuntu/20.04/server/casper/vmlinuz
       initrd ubuntu/20.04/server/casper/initrd
       append ip=dhcp boot=nfs nfsroot=10.0.0.9:/netboot/ubuntu/20.04/server ro nosplash ---

一切似乎都正常工作,直到 initramfs 需要挂载 nfs 共享(已导出并可通过网络使用)时,它会尝试挂载但失败。

此外,我可以键入 nfsmount 命令,它会打印到 stdout,并且可以正常挂载 nfs 共享,让我可以像我期望的那样浏览共享。

编辑:我取得了一些进展。设置 nfsboot=nfs 和 boot=casper 是不正确的。nfsboot不应该存在,boot=casper应该是。我已经在我的这里和我的 pxe 启动服务器上boot=nfs编辑了这两者。pxelinux.cfg/default

我现在遇到了一个单独的问题,其中 squashfs 无法挂载,如下所示:

[    6.596619] /root/cdrom/casper/extras/modules.squashfs-generic: Can't open blockdev
mount: mounting /root/cdrom/casper/extras/modules.squashfs-generic on /root/usr/lib/modules failed: Invalid argument
mount: mounting /dev on /root/dev failed: no such file or directory
mount: mounting /dev on /root/dev failed: No such file or directory
done.
mount: mounting /run on /root/run failed: No such file or directory
run-init: can't execute '/sbin/init': No such file or directory
Target filesystem doesn't have requested /sbin/init.
run-init: can't execute '/sbin/init': No such file or directory
run-init: can't execute '/etc/init': No such file or directory
run-init: can't execute '/bin/init': No such file or directory
run-init: can't execute '/bin/sh': No such file or directory
run-init: can't execute '': No such file or directory
No init found. Try passing init= bootarg

从此日志输出中,我认为根本原因如下:[ 6.596619] /root/cdrom/casper/extras/modules.squashfs-generic: Can't open blockdev

这行代码告诉我 squashfs 未正确安装,这导致了所有其他问题。所以我现在的问题是如何让 squashfs 正确安装?

答案1

我遇到了类似的问题,这是由于源文件复制不完整造成的,特别是.disk缺少一个隐藏目录 - 请参阅https://bugs.launchpad.net/ubuntu/+source/ubiquity/+bug/1877618并在此处注明https://ubuntuforums.org/showthread.php?t=2444371&p=13963012#post13963012- 通过在复制时使用点代替 * 通配符解决了这个问题:sudo cp -a /mnt/. /srv/nfs/ubu-20.04-mint-20-cinnamon。我的pxelinux.cfg/default文件如下所示:

default vesamenu.c32

label 2004
    menu label ^Ubuntu 20.04 Linux Mint 20 Cinnamon
    menu default
    kernel ubu-20.04-mint-20-cinnamon/vmlinuz
    append initrd=ubu-20.04-mint-20-cinnamon/initrd.lz nfsroot=192.168.178.100:/srv/nfs/ubu-20.04-mint-20-cinnamon ro netboot=nfs file=/cdrom/preseed/linuxmint.seed boot=casper ip=dhcp ---

答案2

我认为它应该在指令中vmlinuz引用捆绑的vlinuzKERNEL虚拟内存内核,假设您使用的是 ubuntu-20.04-live-server-amd64.iso。

相关内容