我写了一个用于无人值守安装 Linux 的预置文件的路径。正如您在 grub 参数中看到的,我已经指定了,file=/preseed.cfg
内容包括一些d-i
命令。接下来,创建一个 ISO 文件。
u@n:u2$ cat ./boot/grub/grub.cfg
if loadfont /boot/grub/font.pf2 ; then
set gfxmode=auto
insmod efi_gop
insmod efi_uga
insmod gfxterm
terminal_output gfxterm
fi
set menu_color_normal=white/black
set menu_color_highlight=black/light-gray
set timeout=5
set default=0
menuentry "Install Ubuntu Server" {
set gfxpayload=keep
linux /install/vmlinuz --- auto=true file=/preseed.cfg quiet
initrd /install/initrd.gz
}
u@n:u2$ cat ./isolinux/txt.cfg
default install
label install
menu label ^Install Ubuntu Server
kernel /install/vmlinuz
append file=/preseed.cfg vga=788 initrd=/install/initrd.gz quiet ---
u@n:u2$ head ./preseed.cfg
#### Contents of the preconfiguration file (for Ubuntu 17.10)
### Localization
# Preseeding only locale sets language, country and locale.
d-i debian-installer/locale string en_US
# The values can also be preseeded individually for greater flexibility.
#d-i debian-installer/language string en
#d-i debian-installer/country string BE
#d-i debian-installer/locale string en_GB.UTF-8
# Optionally specify additional locales to be generated.
u@n:u2$ ls
boot dists doc EFI install isolinux md5sum.txt pics pool preseed preseed.cfg README.diskdefines ubuntu
u@n:u2$ sudo xorriso -as mkisofs -isohybrid-mbr isolinux/isohdpfx.bin -c isolinux/boot.cat -b isolinux/isolinux.bin -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot -e boot/grub/efi.img -no-emul-boot -isohybrid-gpt-basdat -o ../ubuntu-18.04.4-server-amd64-unattended.iso .
xorriso 1.5.2 : RockRidge filesystem manipulator, libburnia project.
Drive current: -outdev 'stdio:../ubuntu-18.04.4-server-amd64-unattended.iso'
Media current: stdio file, overwriteable
Media status : is blank
Media summary: 0 sessions, 0 data blocks, 0 data, 170g free
Added to ISO image: directory '/'='/home/u/Downloads/u2'
xorriso : UPDATE : 3230 files added in 1 seconds
xorriso : UPDATE : 3230 files added in 1 seconds
xorriso : NOTE : Copying to System Area: 512 bytes from file '/home/u/Downloads/u2/isolinux/isohdpfx.bin'
libisofs: NOTE : Aligned image size to cylinder size by 488 blocks
xorriso : UPDATE : 11.48% done
ISO image produced: 479232 sectors
Written to medium : 479232 sectors at LBA 0
Writing to 'stdio:../ubuntu-18.04.4-server-amd64-unattended.iso' completed successfully.
但是,当我使用 virtualbox 启动 ISO 时,它卡在键盘选择页面。
我猜 grub 没有检测到 preseed.cfg 文件。不是吗?我该如何修复?
答案1
尝试内核参数file=/cdrom/preseed.cfg
。从 CD 安装时,可以在目录下访问 CD 上的文件/cdrom
。
从https://help.ubuntu.com/lts/installation-guide/amd64/apbs02.html
- if you're booting a remastered CD or image:
preseed/file=/cdrom/preseed.cfg
...
- if you're installing from USB media (put the preconfiguration file in the
toplevel directory of the USB stick):
preseed/file=/hd-media/preseed.cfg