每当我升级 Ubuntu 16.04 并且有内核升级时,更新过程在运行(os-prober)时需要很长时间,并且还会多次生成 grub 配置。
而且由于某些我无法解释的原因,它运行了多次......
Setting up openssh-client (1:7.2p2-4ubuntu1) ...
Setting up linux-image-4.4.0-22-generic (4.4.0-22.39) ...
Running depmod.
update-initramfs: deferring update (hook will be called later)
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-22-generic /boot/vmlinuz-4.4.0-22-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.4.0-22-generic /boot/vmlinuz-4.4.0-22-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-22-generic /boot/vmlinuz-4.4.0-22-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-22-generic
run-parts: executing /etc/kernel/postinst.d/pm-utils 4.4.0-22-generic /boot/vmlinuz-4.4.0-22-generic
run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 4.4.0-22-generic /boot/vmlinuz-4.4.0-22-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 4.4.0-22-generic /boot/vmlinuz-4.4.0-22-generic
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.4.0-22-generic /boot/vmlinuz-4.4.0-22-generic
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.4.0-22-generic
Found initrd image: /boot/initrd.img-4.4.0-22-generic
Found linux image: /boot/vmlinuz-4.4.0-21-generic
Found initrd image: /boot/initrd.img-4.4.0-21-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
grub-probe: error: cannot find a GRUB drive for /dev/sdf1. Check your device.map.
Found Windows 10 (loader) on /dev/sda1
Found Arch on /dev/sdb2
Found Ubuntu 14.04.4 LTS (14.04) on /dev/sdd2
done
Setting up linux-image-extra-4.4.0-22-generic (4.4.0-22.39) ...
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-22-generic /boot/vmlinuz-4.4.0-22-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.4.0-22-generic /boot/vmlinuz-4.4.0-22-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-22-generic /boot/vmlinuz-4.4.0-22-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-22-generic
run-parts: executing /etc/kernel/postinst.d/pm-utils 4.4.0-22-generic /boot/vmlinuz-4.4.0-22-generic
run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 4.4.0-22-generic /boot/vmlinuz-4.4.0-22-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 4.4.0-22-generic /boot/vmlinuz-4.4.0-22-generic
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.4.0-22-generic /boot/vmlinuz-4.4.0-22-generic
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.4.0-22-generic
Found initrd image: /boot/initrd.img-4.4.0-22-generic
Found linux image: /boot/vmlinuz-4.4.0-21-generic
Found initrd image: /boot/initrd.img-4.4.0-21-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
注意:/dev/sdf 是 USB 拇指驱动器
有什么方法可以停止这种行为,或者完全绕过运行 grub2,因为它实际上并没有使用或需要?
答案1
os-prober
用于查找您可能已安装在驱动器上的其他操作系统,并在启动期间将其添加到 grub 菜单中。
如果您想禁用 os-prober,您可以编辑/etc/default/grub
(使用 root 权限)并添加此行:
GRUB_DISABLE_OS_PROBER=true
答案2
我使用一款名为 Grub-Customizer 的应用程序,它允许您禁用对其他操作系统等的搜索。软件中心有 64 位和 32 位版本。
在“列表配置”选项卡中,您可以删除备用内核版本*,在“常规设置”选项卡中,您可以取消选中“查找其他操作系统”复选框。您还可以在同一选项卡上更改屏幕在自动继续启动过程之前等待的时间。将其设置得足够低,以便您仍有时间在需要时选择内存测试选项。
该应用程序还允许您为启动菜单选择其他背景屏幕和字体;不过,请确保在执行此操作之前阅读警告。
我不会删除 grub 屏幕,因为您可能有一天希望能够快速访问内存测试和诸如此类的东西。
我希望这有帮助。
坦率
- 但这不会从您的机器中删除旧内核版本;它只是在启动菜单显示期间不考虑它们。