Joe*_*ley 12 boot mount pxe uefi 18.04
以前,我通过将 ISO 解压缩到 NFS 挂载并使用一些 iPXE 脚本魔法将 vmlinuz.efi 和 initrd.gz 从 casper 复制到 tftpboot 目录来设置 Ubuntu LiveCD 的 PXE 引导。
这在 16.04、16.10 和 17.10 (Artful) 中完美无缺。
在 18.04 中,我首先发现 vmlinuz.efi 不再存在于 casper 中,但 vmlinuz 存在。所以,我再次尝试更改一些名称...
现在它仍然没有完成启动。我得到了“紧急模式”。输入“journalctl -xb”(根据紧急模式提示的建议)并浏览会导致以下结果:
Unit sys-fs-fuse-connections has begun starting up.
ubuntu systemd[1]: Failed to set up mount unit: Device or resource busy
ubuntu systemd[1]: Failed to set up mount unit: Device or resource busy
sys-kernel-config.mount: Mount process finished, but there is no mount.
sys-kernel-config.mount: Failed with result 'protocol'.
Failed to mount Kernel Configuration File System.
Run Code Online (Sandbox Code Playgroud)
帮助!
2018-04-30 添加:
用于为 PXE 安装提取 ISO 的脚本代码(目标设置为图像名称,例如仿生):
set -e
# Look for bionic.iso as the ISO I am going to extract.
TARGET=invalid.iso
[ -f bionic.iso ] && TARGET=bionic
echo TARGET=$TARGET
# Mount the ISO to the /tmp directory
sudo rm -rf /var/nfs/$TARGET/*
sudo rm -rf /tmp/$TARGET
mkdir /tmp/$TARGET
sudo mount -o loop ~/$TARGET.iso /tmp/$TARGET
# Clear up the NFS directory where things will be copied (and copy them)
sudo rm -rf /var/nfs/$TARGET
sudo mkdir /var/nfs/$TARGET
sudo rsync -avH /tmp/$TARGET/ /var/nfs/$TARGET
# I've not had luck with iPXE changing filesystems to find
# vmlinuz, vmlinuz.efi, or initrd.gz... so I copy those files
# specifically to the tftp directory structure so the boot loader
# can load them.
sudo rm -rf /var/lib/tftpboot/$TARGET
sudo mkdir /var/lib/tftpboot/$TARGET
sudo cp /tmp/$TARGET/casper/vmlinuz* /var/lib/tftpboot/$TARGET/.
sudo cp /tmp/$TARGET/casper/initrd.lz /var/lib/tftpboot/$TARGET/.
# Cleanup: unmount the ISO and remove the temp directory
sudo umount /tmp/$TARGET/
sudo rm -rf /tmp/$TARGET/
echo Done.
Run Code Online (Sandbox Code Playgroud)
我按照Launchpad bug tracker上“Woodrow Shen”的建议在 iPXE 中解决了这个问题。
基本上,我为 ubuntu 16.04.3 修改了我们的旧条目:
:deployUbuntu-x64-16.04.3
set server_ip 123.123.123.123
set nfs_path /opt/nfs-exports/ubuntu-x64-16.04.3
kernel nfs://${server_ip}${nfs_path}/casper/vmlinuz.efi || read void
initrd nfs://${server_ip}${nfs_path}/casper/initrd.lz || read void
imgargs vmlinuz.efi initrd=initrd.lz root=/dev/nfs boot=casper netboot=nfs nfsroot=${server_ip}:${nfs_path} ip=dhcp splash quiet -- || read void
boot || read void
Run Code Online (Sandbox Code Playgroud)
对于 ubuntu 18.04,看起来像这样:
:deployUbuntu-x64-18.04
set server_ip 123.123.123.123
set nfs_path /opt/nfs-exports/ubuntu-x64-18.04
kernel nfs://${server_ip}${nfs_path}/casper/vmlinuz || read void
initrd nfs://${server_ip}${nfs_path}/casper/initrd.lz || read void
imgargs vmlinuz initrd=initrd.lz root=/dev/nfs boot=casper netboot=nfs nfsroot=${server_ip}:${nfs_path} ip=dhcp splash quiet toram -- || read void
boot || read void
Run Code Online (Sandbox Code Playgroud)
请注意以下更改:
vmlinuz.efi为vmlinux第 4 行和第 6 行toram选项添加到第 6 行nfs_path以匹配新的提取 ISO 的位置请注意,正如 Launchpad 上指出的那样,此toram选项需要额外的 RAM。在我的测试中,我需要确保我的虚拟机分配了 4GB 的 RAM
请注意,这也适用于我们的 EFI 和传统 BIOS 系统。