Ubuntu
‘apt-get dist-upgrade’ 報告錯誤 ‘depmod: ERROR: Bad version passed uname’ 和各種警告
執行
# 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
在出現 apt-get dist-upgrade 問題之前的幾天裡,我執行
update-initramfs -k <version> -c
了幾次。在一種情況下,我記得我錯誤地將
uname
其用作參數(而不是uname -r
)。我不知道儘管此命令會產生警告和錯誤消息,但它仍會uname
在/var/lib/initramfs-tools
. 在隨後apt-get dist-upgrade
觸發的 initramfs-tools 中,錯誤的 update-initramfs 命令再次執行。所以我認為解決方案只是刪除 2 個錯誤的 uname 相關條目
/var/lib/initramfs-tools
。