![“apt-get dist-upgrade”报告错误“depmod:错误:错误版本通过了 uname”和各种警告](https://linux22.com/image/155164/%E2%80%9Capt-get%20dist-upgrade%E2%80%9D%E6%8A%A5%E5%91%8A%E9%94%99%E8%AF%AF%E2%80%9Cdepmod%EF%BC%9A%E9%94%99%E8%AF%AF%EF%BC%9A%E9%94%99%E8%AF%AF%E7%89%88%E6%9C%AC%E9%80%9A%E8%BF%87%E4%BA%86%20uname%E2%80%9D%E5%92%8C%E5%90%84%E7%A7%8D%E8%AD%A6%E5%91%8A.png)
运行# apt-get dist-upgrade
产生以下警告/错误:
WARNING: missing /lib/modules/uname
depmod: ERROR: Bad version passed uname
(2次)
dpkg: warning: version 'uname' has bad syntax: version number does not start with digit
(4次)
一切都发生在打印出来后的 dist-upgrade 步骤中Processing triggers for initramfs-tools (0.130ubuntu3.8) ...
,所以我想这与此有关......
有谁知道出了什么问题以及我该如何解决它?谢谢!
这是完整的输出:
root:~# apt-get dist-upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
libelf1 libglib2.0-0 libglib2.0-data libnss-systemd libpam-systemd libpython3.6 libpython3.6-minimal libpython3.6-stdlib libssl1.1 libsystemd0 libudev1 openssl python3-cryptography python3-gdbm
python3.6 python3.6-minimal systemd systemd-sysv udev
19 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 13.3 MB of archives.
After this operation, 792 kB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 http://at.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libnss-systemd amd64 237-3ubuntu10.22 [105 kB]
Get:2 http://at.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libsystemd0 amd64 237-3ubuntu10.22 [204 kB]
Get:3 http://at.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libpam-systemd amd64 237-3ubuntu10.22 [108 kB]
Get:4 http://at.archive.ubuntu.com/ubuntu bionic-updates/main amd64 systemd amd64 237-3ubuntu10.22 [2,901 kB]
Get:5 http://at.archive.ubuntu.com/ubuntu bionic-updates/main amd64 udev amd64 237-3ubuntu10.22 [1,101 kB]
Get:6 http://at.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libudev1 amd64 237-3ubuntu10.22 [53.8 kB]
Get:7 http://at.archive.ubuntu.com/ubuntu bionic-updates/main amd64 systemd-sysv amd64 237-3ubuntu10.22 [11.7 kB]
Get:8 http://at.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libpython3.6 amd64 3.6.8-1~18.04.1 [1,418 kB]
Get:9 http://at.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libssl1.1 amd64 1.1.1-1ubuntu2.1~18.04.1 [1,295 kB]
Get:10 http://at.archive.ubuntu.com/ubuntu bionic-updates/main amd64 python3.6 amd64 3.6.8-1~18.04.1 [202 kB]
Get:11 http://at.archive.ubuntu.com/ubuntu bionic-updates/main amd64 python3.6-minimal amd64 3.6.8-1~18.04.1 [1,620 kB]
Get:12 http://at.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libpython3.6-stdlib amd64 3.6.8-1~18.04.1 [1,715 kB]
Get:13 http://at.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libpython3.6-minimal amd64 3.6.8-1~18.04.1 [533 kB]
Get:14 http://at.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libelf1 amd64 0.170-0.4ubuntu0.1 [44.8 kB]
Get:15 http://at.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libglib2.0-0 amd64 2.56.4-0ubuntu0.18.04.3 [1,169 kB]
Get:16 http://at.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libglib2.0-data all 2.56.4-0ubuntu0.18.04.3 [4,608 B]
Get:17 http://at.archive.ubuntu.com/ubuntu bionic-updates/main amd64 openssl amd64 1.1.1-1ubuntu2.1~18.04.1 [614 kB]
Get:18 http://at.archive.ubuntu.com/ubuntu bionic-updates/main amd64 python3-gdbm amd64 3.6.8-1~18.04 [13.3 kB]
Get:19 http://at.archive.ubuntu.com/ubuntu bionic-updates/main amd64 python3-cryptography amd64 2.1.4-1ubuntu1.3 [221 kB]
Fetched 13.3 MB in 2s (6,677 kB/s)
Preconfiguring packages ...
(Reading database ... 102639 files and directories currently installed.)
Preparing to unpack .../libnss-systemd_237-3ubuntu10.22_amd64.deb ...
Unpacking libnss-systemd:amd64 (237-3ubuntu10.22) over (237-3ubuntu10.21) ...
Preparing to unpack .../libsystemd0_237-3ubuntu10.22_amd64.deb ...
Unpacking libsystemd0:amd64 (237-3ubuntu10.22) over (237-3ubuntu10.21) ...
Setting up libsystemd0:amd64 (237-3ubuntu10.22) ...
(Reading database ... 102639 files and directories currently installed.)
Preparing to unpack .../libpam-systemd_237-3ubuntu10.22_amd64.deb ...
Unpacking libpam-systemd:amd64 (237-3ubuntu10.22) over (237-3ubuntu10.21) ...
Preparing to unpack .../systemd_237-3ubuntu10.22_amd64.deb ...
Unpacking systemd (237-3ubuntu10.22) over (237-3ubuntu10.21) ...
Preparing to unpack .../udev_237-3ubuntu10.22_amd64.deb ...
Unpacking udev (237-3ubuntu10.22) over (237-3ubuntu10.21) ...
Preparing to unpack .../libudev1_237-3ubuntu10.22_amd64.deb ...
Unpacking libudev1:amd64 (237-3ubuntu10.22) over (237-3ubuntu10.21) ...
Setting up libudev1:amd64 (237-3ubuntu10.22) ...
Setting up systemd (237-3ubuntu10.22) ...
(Reading database ... 102639 files and directories currently installed.)
Preparing to unpack .../00-systemd-sysv_237-3ubuntu10.22_amd64.deb ...
Unpacking systemd-sysv (237-3ubuntu10.22) over (237-3ubuntu10.21) ...
Preparing to unpack .../01-libpython3.6_3.6.8-1~18.04.1_amd64.deb ...
Unpacking libpython3.6:amd64 (3.6.8-1~18.04.1) over (3.6.7-1~18.04) ...
Preparing to unpack .../02-libssl1.1_1.1.1-1ubuntu2.1~18.04.1_amd64.deb ...
Unpacking libssl1.1:amd64 (1.1.1-1ubuntu2.1~18.04.1) over (1.1.0g-2ubuntu4.3) ...
Preparing to unpack .../03-python3.6_3.6.8-1~18.04.1_amd64.deb ...
Unpacking python3.6 (3.6.8-1~18.04.1) over (3.6.7-1~18.04) ...
Preparing to unpack .../04-python3.6-minimal_3.6.8-1~18.04.1_amd64.deb ...
Unpacking python3.6-minimal (3.6.8-1~18.04.1) over (3.6.7-1~18.04) ...
Preparing to unpack .../05-libpython3.6-stdlib_3.6.8-1~18.04.1_amd64.deb ...
Unpacking libpython3.6-stdlib:amd64 (3.6.8-1~18.04.1) over (3.6.7-1~18.04) ...
Preparing to unpack .../06-libpython3.6-minimal_3.6.8-1~18.04.1_amd64.deb ...
Unpacking libpython3.6-minimal:amd64 (3.6.8-1~18.04.1) over (3.6.7-1~18.04) ...
Preparing to unpack .../07-libelf1_0.170-0.4ubuntu0.1_amd64.deb ...
Unpacking libelf1:amd64 (0.170-0.4ubuntu0.1) over (0.170-0.4) ...
Preparing to unpack .../08-libglib2.0-0_2.56.4-0ubuntu0.18.04.3_amd64.deb ...
Unpacking libglib2.0-0:amd64 (2.56.4-0ubuntu0.18.04.3) over (2.56.4-0ubuntu0.18.04.2) ...
Preparing to unpack .../09-libglib2.0-data_2.56.4-0ubuntu0.18.04.3_all.deb ...
Unpacking libglib2.0-data (2.56.4-0ubuntu0.18.04.3) over (2.56.4-0ubuntu0.18.04.2) ...
Preparing to unpack .../10-openssl_1.1.1-1ubuntu2.1~18.04.1_amd64.deb ...
Unpacking openssl (1.1.1-1ubuntu2.1~18.04.1) over (1.1.0g-2ubuntu4.3) ...
Preparing to unpack .../11-python3-gdbm_3.6.8-1~18.04_amd64.deb ...
Unpacking python3-gdbm:amd64 (3.6.8-1~18.04) over (3.6.7-1~18.04) ...
Preparing to unpack .../12-python3-cryptography_2.1.4-1ubuntu1.3_amd64.deb ...
Unpacking python3-cryptography (2.1.4-1ubuntu1.3) over (2.1.4-1ubuntu1.2) ...
Setting up libnss-systemd:amd64 (237-3ubuntu10.22) ...
Processing triggers for mime-support (3.60ubuntu1) ...
Processing triggers for ureadahead (0.100.0-21) ...
ureadahead will be reprofiled on next reboot
Setting up systemd-sysv (237-3ubuntu10.22) ...
Setting up libelf1:amd64 (0.170-0.4ubuntu0.1) ...
Setting up libglib2.0-0:amd64 (2.56.4-0ubuntu0.18.04.3) ...
No schema files found: doing nothing.
Setting up libglib2.0-data (2.56.4-0ubuntu0.18.04.3) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Setting up udev (237-3ubuntu10.22) ...
update-initramfs: deferring update (trigger activated)
Setting up libssl1.1:amd64 (1.1.1-1ubuntu2.1~18.04.1) ...
Setting up openssl (1.1.1-1ubuntu2.1~18.04.1) ...
Installing new version of config file /etc/ssl/openssl.cnf ...
Setting up python3-gdbm:amd64 (3.6.8-1~18.04) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for dbus (1.12.2-1ubuntu1) ...
Setting up python3-cryptography (2.1.4-1ubuntu1.3) ...
Setting up libpam-systemd:amd64 (237-3ubuntu10.22) ...
Setting up libpython3.6-minimal:amd64 (3.6.8-1~18.04.1) ...
Setting up libpython3.6-stdlib:amd64 (3.6.8-1~18.04.1) ...
Setting up python3.6-minimal (3.6.8-1~18.04.1) ...
Setting up libpython3.6:amd64 (3.6.8-1~18.04.1) ...
Setting up python3.6 (3.6.8-1~18.04.1) ...
Processing triggers for initramfs-tools (0.130ubuntu3.8) ...
update-initramfs: Generating /boot/initrd.img-uname
WARNING: missing /lib/modules/uname
Ensure all necessary drivers are built into the linux image!
depmod: ERROR: Bad version passed uname
dpkg: warning: version 'uname' has bad syntax: version number does not start with digit
dpkg: warning: version 'uname' has bad syntax: version number does not start with digit
dpkg: warning: version 'uname' has bad syntax: version number does not start with digit
dpkg: warning: version 'uname' has bad syntax: version number does not start with digit
depmod: ERROR: Bad version passed uname
Processing triggers for libc-bin (2.27-3ubuntu1) ...
更新,回答评论中的问题“您的系统中 /var/lib/initramfs-tools 的内容是什么?”:
root:/var/lib/initramfs-tools# ll
total 24
drwxr-xr-x 2 root root 4096 Jun 5 13:47 ./
drwxr-xr-x 35 root root 4096 May 15 19:30 ../
-rw-r--r-- 1 root root 77 Jun 4 10:52 4.15.0-50-generic
-rw-r--r-- 1 root root 77 Jun 11 12:43 4.15.0-51-generic
-rw-r--r-- 1 root root 65 Jun 11 12:06 uname
-rw-r--r-- 1 root root 68 Jun 3 15:54 'uname -r'
root:/var/lib/initramfs-tools# cat 4.15.0-50-generic
acaea6c0d9c90f8bf83318577512b41aaa5f0ad8 /boot/initrd.img-4.15.0-50-generic
root:/var/lib/initramfs-tools# cat 4.15.0-51-generic
bd7c14ffe0b4389131448c3049b3530e05dad256 /boot/initrd.img-4.15.0-51-generic
root:/var/lib/initramfs-tools# cat uname
0a84ae4e46f9e3495fa7c7303692e405e61ebaf0 /boot/initrd.img-uname
root:/var/lib/initramfs-tools# cat 'uname -r'
053fe3e77f0f235dc9a1f8e327ab362e302cd459 /boot/initrd.img-uname -r
答案1
在 apt-get dist-upgrade 问题出现之前的几天里,我运行了update-initramfs -k <version> -c
好几次。
在一种情况下,我记得我错误地使用了 justuname
作为参数(而不是`uname -r`
)。我不知道虽然这个命令会产生警告和错误消息,但它仍然uname
在/var/lib/initramfs-tools
.在随后apt-get dist-upgrade
触发 initramfs-tools 的事件中,错误的 update-initramfs 命令再次运行。
所以我认为解决方案只是删除 2 个错误的 uname 相关条目/var/lib/initramfs-tools
。