因此,我一直在努力创建自定义 Ubuntu 16.04.5 映像。我按照说明进行操作这里将 chroot 放入计算机上的文件系统并执行apt update && apt full-upgrade
。之后,我将所有内容打包成 ISO,并使用它来对计算机进行映像处理。我在 VirtualBox 中进行了大部分测试,当我告诉 VM 使用 UEFI 启动时,Ubuntu 安装会给我一个错误:
The 'grub-efi-amd64-signed' package failed to install into /target/.
Without the GRUB boot loader, the installed system will not boot.
所以我回到 chroot 环境,安装了“grub-efi-amd64-signed”包(安装过程中没有互联网连接),一切正常。直到最近,这对我来说都运行良好。现在,安装完成后,我现在进入 Grub 命令提示符。
现在似乎 Grub2 有一个更新;从 2.02~beta2-36ubuntu3.18 到 3.19。如果我不安装该更新,我将无法使用 UEFI,因为我会收到该错误。如果我安装“grub-efi-amd64-signed”,则会强制更新其他 Grub 包。如果我确实安装了该包和所有更新,则计算机将启动到 Grub 命令提示符。我真的不知道从哪里开始修复这个问题。我该怎么做才能更新 Grub 并修复该问题?
这可能是因为 ISO 使用的是以前版本的 Grub 吗?
编辑:我还注意到了其他一些事情。如果我使用 apt-mark 标记以下软件包,我就能正确安装(和启动)所有内容:
linux-generic-hwe-16.04
linux-image-generic-hwe-16.04
linux-headers-generic-hwe-16.04
linux-signed-generic-hwe-16.04
grub-common
grub2-common
之后,我可以apt full-upgrade
创建 ISO 并进行安装...那么为什么当我更新内核和 Grub 时它会中断?
仅供参考,这是我的预置文件:
### Localization
d-i debian-installer/locale string en_US
d-i console-setup/ask_detect boolean false
d-i console-setup/layoutcode string us
### Network Configuration
d-i netcfg/dhcp_timeout string 300
d-i netcfg/dhcp_failed note
d-i netcfg/dhcp_options select Do not configure the network at this time
d-i netcfg/get_hostname string dev
d-i netcfg/get_domain string example.com
### Account Setup
d-i passwd/user-fullname string User
d-i passwd/username string user
d-i passwd/user-password-crypted password $6$...
d-i user-setup/allow-password-weak boolean true
d-i user-setup/encrypt-home boolean false
### Clock and Time Zone Setup
d-i clock-setup/utc boolean true
d-i time/zone string US/Eastern
d-i clock-setup/ntp boolean true
### Partitioning and Encryption
# Use LVM for encryption
d-i partman-auto/method string crypto
# Suppress LVM and RAID warnings about previous configurations
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-md/device_remove_md boolean true
# Confirm writing on existing partitions
d-i partman-lvm/confirm boolean true
# Use the entire logical volume
d-i partman-auto-lvm/guided_size string max
# Have all files on this partition only
d-i partman-auto/choose_recipe select atomic
# Specify ext4 since the default is ext3
d-i partman/default_filesystem string ext4
# Begin the partitioning without user interaction
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true
# Use the encryption key to perform the encryption
partman-crypto partman-crypto/passphrase string password
partman-crypto partman-crypto/passphrase-again string password
# Agree to use weak passphrase and confirm if prompted
partman-crypto partman-crypto/weak_passphrase boolean true
partman-crypto partman-crypto/confirm boolean true
### Package Selection
tasksel tasksel/first multiselect standard
tasksel tasksel/first multiselect ubuntu-desktop
d-i pkgsel/updatedb boolean false
### Boot Loader Installation
d-i grub-installer/only_debian boolean true
### Finishing Up the Installation
ubiquity ubiquity/reboot boolean true
答案1
我相信您遇到了与此处相同的问题:16.04 新安装最后给出 grub-efi-amd64-signed 安装失败 /target/ ubuntu 16.04
我认为您需要手动创建 /boot/efi 分区并用启动标志标记它。我们最近遇到了这个问题,并使用如下所示的预置解决了这个问题,如果需要,请为您的驱动器进行编辑。这将创建正确的分区,使用整个磁盘(最多 1000 TB)和交换(8 GB 或 2xRAM):
d-i partman-auto/disk string /dev/sda
d-i partman-auto/method string crypto
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-lvm/device_remove_lvm_span boolean true
d-i partman-auto/purge_lvm_from_device boolean true
d-i partman-auto-lvm/new_vg_name string system
d-i partman-auto/expert_recipe string \
boot-crypto :: \
1 1 1 free \
$bios_boot{ } \
method{ biosgrub } . \
256 256 256 fat32 \
$primary{ } $lvmignore{ } \
method{ efi } format{ } . \
512 512 512 ext3 \
$primary{ } $bootable{ } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext3 } \
mountpoint{ /boot } . \
2000 10000 1000000000 ext4 \
$lvmok{ } \
method{ format } format{ } \
use_filesystem{ } filesystem{ ext4 } \
mountpoint{ / } . \
8000 8000 200% linux-swap \
$lvmok{ } \
method{ swap } format{ } .
d-i partman-lvm/confirm boolean true
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true