每次我有内核更新并安装它们时,我都会发现GRUB_CMDLINE_LINUX="ipv6.disable=1"
添加到我的/etc/default/grub
。我每次都需要手动删除它,update-grub
然后重新启动。
我如何才能找到添加它的原因?更重要的是,我如何才能让它停止这样做?
编辑2021-02-27:
我今天更新了系统,但又出现了这种情况。我检查了/etc/default/grub
升级前后的情况,我 100% 确定这是在这次升级过程中发生的 - 这是唯一发生的事情,并且有东西添加了这一行。以下是整个升级执行的控制台输出:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages were automatically installed and are no longer required:
libpciaccess0 linux-headers-5.4.0-62 linux-headers-5.4.0-62-generic linux-image-5.4.0-62-generic linux-modules-5.4.0-62-generic linux-modules-extra-5.4.0-62-generic python3-xkit ubuntu-drivers-common
Use 'apt autoremove' to remove them.
The following NEW packages will be installed:
linux-headers-5.4.0-66 linux-headers-5.4.0-66-generic linux-image-5.4.0-66-generic linux-modules-5.4.0-66-generic linux-modules-extra-5.4.0-66-generic
The following packages will be upgraded:
dnsmasq-base gir1.2-gdkpixbuf-2.0 grub-common grub-pc grub-pc-bin grub2-common libgdk-pixbuf2.0-0 libgdk-pixbuf2.0-common libldap-2.4-2 libldap-common libpython3.8 libpython3.8-minimal libpython3.8-stdlib libtiff5 linux-generic
linux-headers-generic linux-image-generic linux-image-virtual linux-libc-dev pollinate python3.8 python3.8-minimal qemu-guest-agent screen
24 upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
Need to get 86.8 MB of archives.
After this operation, 361 MB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libpython3.8 amd64 3.8.5-1~20.04.2 [1,624 kB]
Get:2 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 python3.8 amd64 3.8.5-1~20.04.2 [373 kB]
Get:3 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libpython3.8-stdlib amd64 3.8.5-1~20.04.2 [1,671 kB]
Get:4 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 python3.8-minimal amd64 3.8.5-1~20.04.2 [1,899 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libpython3.8-minimal amd64 3.8.5-1~20.04.2 [715 kB]
Get:6 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 qemu-guest-agent amd64 1:4.2-3ubuntu6.14 [193 kB]
Get:7 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 dnsmasq-base amd64 2.80-1.1ubuntu1.3 [314 kB]
Get:8 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libtiff5 amd64 4.1.0+git191117-2ubuntu0.20.04.1 [162 kB]
Get:9 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libgdk-pixbuf2.0-0 amd64 2.40.0+dfsg-3ubuntu0.2 [168 kB]
Get:10 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libgdk-pixbuf2.0-common all 2.40.0+dfsg-3ubuntu0.2 [4,652 B]
Get:11 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 gir1.2-gdkpixbuf-2.0 amd64 2.40.0+dfsg-3ubuntu0.2 [8,268 B]
Get:12 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 grub-pc amd64 2.04-1ubuntu26.9 [125 kB]
Get:13 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 grub2-common amd64 2.04-1ubuntu26.9 [592 kB]
Get:14 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 grub-pc-bin amd64 2.04-1ubuntu26.9 [971 kB]
Get:15 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 grub-common amd64 2.04-1ubuntu26.9 [1,877 kB]
Get:16 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libldap-common all 2.4.49+dfsg-2ubuntu1.7 [17.1 kB]
Get:17 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libldap-2.4-2 amd64 2.4.49+dfsg-2ubuntu1.7 [155 kB]
Get:18 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 linux-modules-5.4.0-66-generic amd64 5.4.0-66.74 [14.5 MB]
Get:19 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 linux-image-5.4.0-66-generic amd64 5.4.0-66.74 [8,891 kB]
Get:20 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 linux-modules-extra-5.4.0-66-generic amd64 5.4.0-66.74 [38.6 MB]
Get:21 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 linux-generic amd64 5.4.0.66.69 [1,896 B]
Get:22 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 linux-image-generic amd64 5.4.0.66.69 [2,636 B]
Get:23 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 linux-headers-5.4.0-66 all 5.4.0-66.74 [11.0 MB]
Get:24 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 linux-headers-5.4.0-66-generic amd64 5.4.0-66.74 [1,256 kB]
Get:25 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 linux-headers-generic amd64 5.4.0.66.69 [2,496 B]
Get:26 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 linux-image-virtual amd64 5.4.0.66.69 [2,604 B]
Get:27 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 linux-libc-dev amd64 5.4.0-66.74 [1,139 kB]
Get:28 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 pollinate all 4.33-3ubuntu1.20.04.1 [22.6 kB]
Get:29 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 screen amd64 4.8.0-1ubuntu0.1 [577 kB]
Fetched 86.8 MB in 2s (41.6 MB/s)
Preconfiguring packages ...
(Reading database ... 189380 files and directories currently installed.)
Preparing to unpack .../00-libpython3.8_3.8.5-1~20.04.2_amd64.deb ...
Unpacking libpython3.8:amd64 (3.8.5-1~20.04.2) over (3.8.5-1~20.04) ...
Preparing to unpack .../01-python3.8_3.8.5-1~20.04.2_amd64.deb ...
Unpacking python3.8 (3.8.5-1~20.04.2) over (3.8.5-1~20.04) ...
Preparing to unpack .../02-libpython3.8-stdlib_3.8.5-1~20.04.2_amd64.deb ...
Unpacking libpython3.8-stdlib:amd64 (3.8.5-1~20.04.2) over (3.8.5-1~20.04) ...
Preparing to unpack .../03-python3.8-minimal_3.8.5-1~20.04.2_amd64.deb ...
Unpacking python3.8-minimal (3.8.5-1~20.04.2) over (3.8.5-1~20.04) ...
Preparing to unpack .../04-libpython3.8-minimal_3.8.5-1~20.04.2_amd64.deb ...
Unpacking libpython3.8-minimal:amd64 (3.8.5-1~20.04.2) over (3.8.5-1~20.04) ...
Preparing to unpack .../05-qemu-guest-agent_1%3a4.2-3ubuntu6.14_amd64.deb ...
Unpacking qemu-guest-agent (1:4.2-3ubuntu6.14) over (1:4.2-3ubuntu6.12) ...
Preparing to unpack .../06-dnsmasq-base_2.80-1.1ubuntu1.3_amd64.deb ...
Unpacking dnsmasq-base (2.80-1.1ubuntu1.3) over (2.80-1.1ubuntu1.2) ...
Preparing to unpack .../07-libtiff5_4.1.0+git191117-2ubuntu0.20.04.1_amd64.deb ...
Unpacking libtiff5:amd64 (4.1.0+git191117-2ubuntu0.20.04.1) over (4.1.0+git191117-2build1) ...
Preparing to unpack .../08-libgdk-pixbuf2.0-0_2.40.0+dfsg-3ubuntu0.2_amd64.deb ...
Unpacking libgdk-pixbuf2.0-0:amd64 (2.40.0+dfsg-3ubuntu0.2) over (2.40.0+dfsg-3ubuntu0.1) ...
Preparing to unpack .../09-libgdk-pixbuf2.0-common_2.40.0+dfsg-3ubuntu0.2_all.deb ...
Unpacking libgdk-pixbuf2.0-common (2.40.0+dfsg-3ubuntu0.2) over (2.40.0+dfsg-3ubuntu0.1) ...
Preparing to unpack .../10-gir1.2-gdkpixbuf-2.0_2.40.0+dfsg-3ubuntu0.2_amd64.deb ...
Unpacking gir1.2-gdkpixbuf-2.0:amd64 (2.40.0+dfsg-3ubuntu0.2) over (2.40.0+dfsg-3ubuntu0.1) ...
Preparing to unpack .../11-grub-pc_2.04-1ubuntu26.9_amd64.deb ...
Unpacking grub-pc (2.04-1ubuntu26.9) over (2.04-1ubuntu26.8) ...
Preparing to unpack .../12-grub2-common_2.04-1ubuntu26.9_amd64.deb ...
Unpacking grub2-common (2.04-1ubuntu26.9) over (2.04-1ubuntu26.8) ...
Preparing to unpack .../13-grub-pc-bin_2.04-1ubuntu26.9_amd64.deb ...
Unpacking grub-pc-bin (2.04-1ubuntu26.9) over (2.04-1ubuntu26.8) ...
Preparing to unpack .../14-grub-common_2.04-1ubuntu26.9_amd64.deb ...
Unpacking grub-common (2.04-1ubuntu26.9) over (2.04-1ubuntu26.8) ...
Preparing to unpack .../15-libldap-common_2.4.49+dfsg-2ubuntu1.7_all.deb ...
Unpacking libldap-common (2.4.49+dfsg-2ubuntu1.7) over (2.4.49+dfsg-2ubuntu1.6) ...
Preparing to unpack .../16-libldap-2.4-2_2.4.49+dfsg-2ubuntu1.7_amd64.deb ...
Unpacking libldap-2.4-2:amd64 (2.4.49+dfsg-2ubuntu1.7) over (2.4.49+dfsg-2ubuntu1.6) ...
Selecting previously unselected package linux-modules-5.4.0-66-generic.
Preparing to unpack .../17-linux-modules-5.4.0-66-generic_5.4.0-66.74_amd64.deb ...
Unpacking linux-modules-5.4.0-66-generic (5.4.0-66.74) ...
Selecting previously unselected package linux-image-5.4.0-66-generic.
Preparing to unpack .../18-linux-image-5.4.0-66-generic_5.4.0-66.74_amd64.deb ...
Unpacking linux-image-5.4.0-66-generic (5.4.0-66.74) ...
Selecting previously unselected package linux-modules-extra-5.4.0-66-generic.
Preparing to unpack .../19-linux-modules-extra-5.4.0-66-generic_5.4.0-66.74_amd64.deb ...
Unpacking linux-modules-extra-5.4.0-66-generic (5.4.0-66.74) ...
Preparing to unpack .../20-linux-generic_5.4.0.66.69_amd64.deb ...
Unpacking linux-generic (5.4.0.66.69) over (5.4.0.65.68) ...
Preparing to unpack .../21-linux-image-generic_5.4.0.66.69_amd64.deb ...
Unpacking linux-image-generic (5.4.0.66.69) over (5.4.0.65.68) ...
Selecting previously unselected package linux-headers-5.4.0-66.
Preparing to unpack .../22-linux-headers-5.4.0-66_5.4.0-66.74_all.deb ...
Unpacking linux-headers-5.4.0-66 (5.4.0-66.74) ...
Selecting previously unselected package linux-headers-5.4.0-66-generic.
Preparing to unpack .../23-linux-headers-5.4.0-66-generic_5.4.0-66.74_amd64.deb ...
Unpacking linux-headers-5.4.0-66-generic (5.4.0-66.74) ...
Preparing to unpack .../24-linux-headers-generic_5.4.0.66.69_amd64.deb ...
Unpacking linux-headers-generic (5.4.0.66.69) over (5.4.0.65.68) ...
Preparing to unpack .../25-linux-image-virtual_5.4.0.66.69_amd64.deb ...
Unpacking linux-image-virtual (5.4.0.66.69) over (5.4.0.65.68) ...
Preparing to unpack .../26-linux-libc-dev_5.4.0-66.74_amd64.deb ...
Unpacking linux-libc-dev:amd64 (5.4.0-66.74) over (5.4.0-65.73) ...
Preparing to unpack .../27-pollinate_4.33-3ubuntu1.20.04.1_all.deb ...
Unpacking pollinate (4.33-3ubuntu1.20.04.1) over (4.33-3ubuntu1) ...
Preparing to unpack .../28-screen_4.8.0-1ubuntu0.1_amd64.deb ...
Unpacking screen (4.8.0-1ubuntu0.1) over (4.8.0-1) ...
Setting up libpython3.8-minimal:amd64 (3.8.5-1~20.04.2) ...
Setting up libgdk-pixbuf2.0-common (2.40.0+dfsg-3ubuntu0.2) ...
Setting up qemu-guest-agent (1:4.2-3ubuntu6.14) ...
Setting up linux-libc-dev:amd64 (5.4.0-66.74) ...
Setting up screen (4.8.0-1ubuntu0.1) ...
Setting up linux-headers-5.4.0-66 (5.4.0-66.74) ...
Setting up dnsmasq-base (2.80-1.1ubuntu1.3) ...
Setting up libldap-common (2.4.49+dfsg-2ubuntu1.7) ...
Setting up linux-modules-5.4.0-66-generic (5.4.0-66.74) ...
Setting up grub-common (2.04-1ubuntu26.9) ...
update-rc.d: warning: start and stop actions are no longer supported; falling back to defaults
Setting up pollinate (4.33-3ubuntu1.20.04.1) ...
Setting up python3.8-minimal (3.8.5-1~20.04.2) ...
Setting up libtiff5:amd64 (4.1.0+git191117-2ubuntu0.20.04.1) ...
Setting up libpython3.8-stdlib:amd64 (3.8.5-1~20.04.2) ...
Setting up python3.8 (3.8.5-1~20.04.2) ...
Setting up linux-image-5.4.0-66-generic (5.4.0-66.74) ...
I: /vmlinuz.old is now a symlink to boot/vmlinuz-5.4.0-65-generic
I: /initrd.img.old is now a symlink to boot/initrd.img-5.4.0-65-generic
I: /vmlinuz is now a symlink to boot/vmlinuz-5.4.0-66-generic
I: /initrd.img is now a symlink to boot/initrd.img-5.4.0-66-generic
Setting up grub2-common (2.04-1ubuntu26.9) ...
Setting up linux-headers-5.4.0-66-generic (5.4.0-66.74) ...
/etc/kernel/header_postinst.d/dkms:
* dkms: running auto installation service for kernel 5.4.0-66-generic
Kernel preparation unnecessary for this kernel. Skipping...
Building module:
cleaning build area...
make -j2 KERNELRELEASE=5.4.0-66-generic -C /lib/modules/5.4.0-66-generic/build M=/var/lib/dkms/wireguard/1.0.20201112/build.......
cleaning build area...
DKMS: build completed.
wireguard.ko:
Running module version sanity check.
Good news! Module version 1.0.20201112 for wireguard.ko
exactly matches what is already found in kernel 5.4.0-66-generic.
DKMS will not replace this module.
You may override by specifying --force.
depmod...
DKMS: install completed.
...done.
Setting up libldap-2.4-2:amd64 (2.4.49+dfsg-2ubuntu1.7) ...
Setting up linux-headers-generic (5.4.0.66.69) ...
Setting up linux-modules-extra-5.4.0-66-generic (5.4.0-66.74) ...
Setting up grub-pc-bin (2.04-1ubuntu26.9) ...
Setting up grub-pc (2.04-1ubuntu26.9) ...
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.4.0-66-generic
Found linux image: /boot/vmlinuz-5.4.0-65-generic
Found initrd image: /boot/initrd.img-5.4.0-65-generic
Found linux image: /boot/vmlinuz-5.4.0-64-generic
Found initrd image: /boot/initrd.img-5.4.0-64-generic
Found linux image: /boot/vmlinuz-5.4.0-62-generic
Found initrd image: /boot/initrd.img-5.4.0-62-generic
done
Setting up libpython3.8:amd64 (3.8.5-1~20.04.2) ...
Setting up libgdk-pixbuf2.0-0:amd64 (2.40.0+dfsg-3ubuntu0.2) ...
Setting up linux-image-virtual (5.4.0.66.69) ...
Setting up linux-image-generic (5.4.0.66.69) ...
Setting up linux-generic (5.4.0.66.69) ...
Setting up gir1.2-gdkpixbuf-2.0:amd64 (2.40.0+dfsg-3ubuntu0.2) ...
Processing triggers for systemd (245.4-4ubuntu3.4) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for dbus (1.12.16-2ubuntu2.1) ...
Processing triggers for install-info (6.7.0.dfsg.2-5) ...
Processing triggers for mime-support (3.64ubuntu1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.2) ...
Processing triggers for linux-image-5.4.0-66-generic (5.4.0-66.74) ...
/etc/kernel/postinst.d/dkms:
* dkms: running auto installation service for kernel 5.4.0-66-generic
...done.
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-5.4.0-66-generic
/etc/kernel/postinst.d/x-grub-legacy-ec2:
Searching for GRUB installation directory ... found: /boot/grub
Searching for default file ... found: /boot/grub/default
Testing for an existing GRUB menu.lst file ... found: /boot/grub/menu.lst
Searching for splash image ... none found, skipping ...
Found kernel: /boot/vmlinuz-5.4.0-65-generic
Found kernel: /boot/vmlinuz-5.4.0-64-generic
Found kernel: /boot/vmlinuz-5.4.0-62-generic
Found kernel: /boot/vmlinuz-5.4.0-66-generic
Found kernel: /boot/vmlinuz-5.4.0-65-generic
Found kernel: /boot/vmlinuz-5.4.0-64-generic
Found kernel: /boot/vmlinuz-5.4.0-62-generic
Replacing config file /run/grub/menu.lst with new version
Updating /boot/grub/menu.lst ... done
/etc/kernel/postinst.d/zz-update-grub:
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.4.0-66-generic
Found initrd image: /boot/initrd.img-5.4.0-66-generic
Found linux image: /boot/vmlinuz-5.4.0-65-generic
Found initrd image: /boot/initrd.img-5.4.0-65-generic
Found linux image: /boot/vmlinuz-5.4.0-64-generic
Found initrd image: /boot/initrd.img-5.4.0-64-generic
Found linux image: /boot/vmlinuz-5.4.0-62-generic
Found initrd image: /boot/initrd.img-5.4.0-62-generic
done
在软件包中,引起我注意的是wireguard
和grub-pc
。我不确定重新安装它们是否安全(出于测试目的)——是否有丢失其当前配置的风险?我还应该检查什么?
编辑2021-04-29:
还有一次尝试进行更改/etc/default/grub
,这次我确实在其上设置了不可变标志,因此我在升级期间看到了这个错误:
Setting up grub-pc (2.04-1ubuntu26.11) ...
/var/lib/dpkg/info/grub-pc.postinst: line 28: /etc/default/grub: Operation not permitted
dpkg: error processing package grub-pc (--configure):
installed grub-pc package post-installation script subprocess returned error exit status 1
我查看了文件/var/lib/dpkg/info/grub-pc.postinst
,但这是一个相当大且复杂的脚本。尽管如此,我发现它经常引用不同的文件,所以/var/lib/....
我这样做了:grep -R ipv6.disable /var/lib/
这是我发现的一行有趣的代码:
/var/lib/ucf/cache/:etc:default:grub:GRUB_CMDLINE_LINUX="ipv6.disable=1"
这是唯一发现的情况。我查看了整个文件,它基本上是某个旧版(?)的 grub 文件,其中已禁用此 ipv6。
- 它为什么在那里?它有什么用途?
- 需要吗?可以删除吗?
- 永远保持
/etc/default/grub
不可变是否安全?(这是在云中运行的 VPS,因此我担心云提供商是否偶尔需要对此文件进行一些更新以使其与基础设施保持一致)。一方面,我更愿意恢复正常(删除不可变标志),但另一方面,我担心一段时间后再次遇到此问题,我忘记在升级后进行验证。