sudo apt-get install --reinstall initramfs-tools
Reading package lists... Done Building dependency tree Reading state information... Done The following package was automatically installed and is no longer required: libpcre2-32-0 Use 'sudo apt autoremove' to remove it. The following NEW packages will be installed: initramfs-tools 0 upgraded, 1 newly installed, 0 to remove and 242 not upgraded. Need to get 9,248 B of archives. After this operation, 148 kB of additional disk space will be used. Get:1 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 initramfs-tools all 0.136ubuntu6.7 [9,248 B] Fetched 9,248 B in 1s (15.9 kB/s) Selecting previously unselected package initramfs-tools. (Reading database ... 194862 files and directories currently installed.) Preparing to unpack .../initramfs-tools_0.136ubuntu6.7_all.deb ... Unpacking initramfs-tools (0.136ubuntu6.7) ... Setting up initramfs-tools (0.136ubuntu6.7) ... update-initramfs: deferring update (trigger activated) Processing triggers for man-db (2.9.1-1) ... Processing triggers for initramfs-tools (0.136ubuntu6.7) ... update-initramfs: Generating /boot/initrd.img-5.15.0-78-generic /usr/sbin/mkinitramfs: 97: .: Can't open /etc/initramfs-tools/initramfs.conf update-initramfs: failed for /boot/initrd.img-5.15.0-78-generic with 127. dpkg: error processing package initramfs-tools (--configure): installed initramfs-tools package post-installation script subprocess returned error exit status 127 Errors were encountered while processing: initramfs-tools E: Sub-process /usr/bin/dpkg returned an error code (1)
参考https://askubuntu.com/questions/1136480/initramfs-error-when-installing-updating
(base) spai@spai-WS-E900-G4-WS980T:~/code/github$ sudo apt-get auto-remove && apt-get clean && apt-get update && apt-get upgrade Reading package lists... Done Building dependency tree Reading state information... Done The following packages will be REMOVED: libpcre2-32-0 0 upgraded, 0 newly installed, 1 to remove and 242 not upgraded. 1 not fully installed or removed. After this operation, 523 kB disk space will be freed. Do you want to continue? [Y/n] y (Reading database ... 194877 files and directories currently installed.) Removing libpcre2-32-0:amd64 (10.34-7ubuntu0.1) ... Setting up initramfs-tools (0.136ubuntu6.7) ... update-initramfs: deferring update (trigger activated) Processing triggers for libc-bin (2.31-0ubuntu9.9) ... Processing triggers for initramfs-tools (0.136ubuntu6.7) ... update-initramfs: Generating /boot/initrd.img-5.15.0-78-generic /usr/sbin/mkinitramfs: 97: .: Can't open /etc/initramfs-tools/initramfs.conf update-initramfs: failed for /boot/initrd.img-5.15.0-78-generic with 127. dpkg: error processing package initramfs-tools (--configure): installed initramfs-tools package post-installation script subprocess returned error exit status 127 Errors were encountered while processing: initramfs-tools E: Sub-process /usr/bin/dpkg returned an error code (1)
sudo apt remove initramfs-tools sudo apt clean sudo apt install initramfs-tools
报错
update-initramfs: failed for /boot/initrd.img-5.15.0-78-generic with 127. dpkg: error processing package initramfs-tools (--configure): installed initramfs-tools package post-installation script subprocess returned error exit statu s 127 Errors were encountered while processing: initramfs-tools E: Sub-process /usr/bin/dpkg returned an error code (1)
sudo apt autoremove 报错
sudo apt autoremove Reading package lists... Done Building dependency tree Reading state information... Done 0 upgraded, 0 newly installed, 0 to remove and 242 not upgraded. 1 not fully installed or removed. After this operation, 0 B of additional disk space will be used. Setting up initramfs-tools (0.136ubuntu6.7) ... update-initramfs: deferring update (trigger activated) Processing triggers for initramfs-tools (0.136ubuntu6.7) ... update-initramfs: Generating /boot/initrd.img-5.15.0-78-generic /usr/sbin/mkinitramfs: 97: .: Can't open /etc/initramfs-tools/initramfs.conf update-initramfs: failed for /boot/initrd.img-5.15.0-78-generic with 127. dpkg: error processing package initramfs-tools (--configure): installed initramfs-tools package post-installation script subprocess returned error exit statu s 127 Errors were encountered while processing: initramfs-tools E: Sub-process /usr/bin/dpkg returned an error code (1)
清理后重新安装
(base) spai@spai-WS-E900-G4-WS980T:~/code/github$ sudo apt install initramfs-tools Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: busybox-initramfs initramfs-tools-bin initramfs-tools-core klibc-utils libklibc lz4 The following NEW packages will be installed: busybox-initramfs initramfs-tools initramfs-tools-bin initramfs-tools-core klibc-utils libklibc lz4 0 upgraded, 7 newly installed, 0 to remove and 242 not upgraded. Need to get 458 kB of archives. After this operation, 1,842 kB of additional disk space will be used. Do you want to continue? [Y/n] y Get:1 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 busybox-initramfs amd64 1:1.30.1-4ubuntu6.4 [169 kB] Get:2 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 initramfs-tools-bin amd64 0.136ubuntu6.7 [10.8 kB] Get:3 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 libklibc amd64 2.0.7-1ubuntu5.1 [43.1 kB] Get:4 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 klibc-utils amd64 2.0.7-1ubuntu5.1 [95.2 kB] Get:5 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 lz4 amd64 1.9.2-2ubuntu0.20.04.1 [82.7 kB] Get:6 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 initramfs-tools-core all 0.136ubuntu6.7 [47.8 kB] Get:7 http://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 initramfs-tools all 0.136ubuntu6.7 [9,248 B] Fetched 458 kB in 0s (931 kB/s) Selecting previously unselected package busybox-initramfs. (Reading database ... 194734 files and directories currently installed.) Preparing to unpack .../0-busybox-initramfs_1%3a1.30.1-4ubuntu6.4_amd64.deb ... Unpacking busybox-initramfs (1:1.30.1-4ubuntu6.4) ... Selecting previously unselected package initramfs-tools-bin. Preparing to unpack .../1-initramfs-tools-bin_0.136ubuntu6.7_amd64.deb ... Unpacking initramfs-tools-bin (0.136ubuntu6.7) ... Selecting previously unselected package libklibc:amd64. Preparing to unpack .../2-libklibc_2.0.7-1ubuntu5.1_amd64.deb ... Unpacking libklibc:amd64 (2.0.7-1ubuntu5.1) ... Selecting previously unselected package klibc-utils. Preparing to unpack .../3-klibc-utils_2.0.7-1ubuntu5.1_amd64.deb ... Unpacking klibc-utils (2.0.7-1ubuntu5.1) ... Selecting previously unselected package lz4. Preparing to unpack .../4-lz4_1.9.2-2ubuntu0.20.04.1_amd64.deb ... Unpacking lz4 (1.9.2-2ubuntu0.20.04.1) ... Selecting previously unselected package initramfs-tools-core. Preparing to unpack .../5-initramfs-tools-core_0.136ubuntu6.7_all.deb ... Unpacking initramfs-tools-core (0.136ubuntu6.7) ... Selecting previously unselected package initramfs-tools. Preparing to unpack .../6-initramfs-tools_0.136ubuntu6.7_all.deb ... Unpacking initramfs-tools (0.136ubuntu6.7) ... Setting up libklibc:amd64 (2.0.7-1ubuntu5.1) ... Setting up busybox-initramfs (1:1.30.1-4ubuntu6.4) ... Setting up lz4 (1.9.2-2ubuntu0.20.04.1) ... Setting up klibc-utils (2.0.7-1ubuntu5.1) ... No diversion 'diversion of /usr/share/initramfs-tools/hooks/klibc to /usr/share/initramfs-tools/ hooks/klibc^i-t by klibc-utils', none removed. Setting up initramfs-tools-bin (0.136ubuntu6.7) ... Setting up initramfs-tools-core (0.136ubuntu6.7) ... Setting up initramfs-tools (0.136ubuntu6.7) ... update-initramfs: deferring update (trigger activated) Processing triggers for man-db (2.9.1-1) ... Processing triggers for initramfs-tools (0.136ubuntu6.7) ... update-initramfs: Generating /boot/initrd.img-5.15.0-78-generic /usr/sbin/mkinitramfs: 97: .: Can't open /etc/initramfs-tools/initramfs.conf update-initramfs: failed for /boot/initrd.img-5.15.0-78-generic with 127. dpkg: error processing package initramfs-tools (--configure): installed initramfs-tools package post-installation script subprocess returned error exit statu s 127 Errors were encountered while processing: initramfs-tools E: Sub-process /usr/bin/dpkg returned an error code (1)
dpkg: error processing package initramfs-tools (–configure):
检查内核版本sudo dpkg --get-selections | grep linux
binutils-x86-64-linux-gnu install console-setup-linux install libselinux1:amd64 install linux-base install linux-firmware install linux-generic-hwe-20.04 install linux-headers-5.15.0-73-generic install linux-headers-5.15.0-78-generic install linux-headers-generic-hwe-20.04 install linux-hwe-5.15-headers-5.15.0-73 install linux-hwe-5.15-headers-5.15.0-78 install linux-image-5.15.0-46-generic deinstall linux-image-5.15.0-67-generic deinstall linux-image-5.15.0-69-generic deinstall linux-image-5.15.0-72-generic deinstall linux-image-5.15.0-73-generic install linux-image-5.15.0-78-generic install linux-image-generic-hwe-20.04 install linux-libc-dev:amd64 install linux-modules-5.15.0-46-generic deinstall linux-modules-5.15.0-67-generic deinstall linux-modules-5.15.0-69-generic deinstall linux-modules-5.15.0-72-generic deinstall linux-modules-5.15.0-73-generic install linux-modules-5.15.0-78-generic install linux-modules-extra-5.15.0-46-generic deinstall linux-modules-extra-5.15.0-67-generic deinstall linux-modules-extra-5.15.0-69-generic deinstall linux-modules-extra-5.15.0-72-generic deinstall linux-modules-extra-5.15.0-73-generic install linux-modules-extra-5.15.0-78-generic install linux-sound-base install pptp-linux install syslinux install syslinux-common install syslinux-legacy install util-linux install
空间
(base) spai@spai-WS-E900-G4-WS980T:~/code/github$ df -h Filesystem Size Used Avail Use% Mounted on udev 63G 0 63G 0% /dev tmpfs 13G 3.5M 13G 1% /run /dev/nvme0n1p6 351G 18G 316G 6% / tmpfs 63G 37M 63G 1% /dev/shm tmpfs 5.0M 4.0K 5.0M 1% /run/lock tmpfs 63G 0 63G 0% /sys/fs/cgroup /dev/loop0 128K 128K 0 100% /snap/bare/5 /dev/loop2 92M 92M 0 100% /snap/gtk-common-themes/1535 /dev/loop1 303M 303M 0 100% /snap/code/148 /dev/loop5 497M 497M 0 100% /snap/gnome-42-2204/132 /dev/loop3 41M 41M 0 100% /snap/snapd/20671 /dev/loop4 64M 64M 0 100% /snap/core20/2105 /dev/loop7 64M 64M 0 100% /snap/core20/2015 /dev/loop6 13M 13M 0 100% /snap/snap-store/959 /dev/loop10 74M 74M 0 100% /snap/core22/864 /dev/loop8 46M 46M 0 100% /snap/snap-store/638 /dev/loop12 497M 497M 0 100% /snap/gnome-42-2204/141 /dev/loop14 350M 350M 0 100% /snap/gnome-3-38-2004/143 /dev/loop9 41M 41M 0 100% /snap/snapd/20290 /dev/loop13 350M 350M 0 100% /snap/gnome-3-38-2004/140 /dev/loop11 75M 75M 0 100% /snap/core22/1033 /dev/nvme0n1p4 261M 185M 57M 77% /boot /dev/nvme0n1p1 300M 32M 268M 11% /boot/efi /dev/sda3 3.6T 183G 3.3T 6% /home tmpfs 13G 108K 13G 1% /run/user/1000 /dev/sdb4 96G 58G 38G 61% /media/spai/新加卷1 /dev/sdb2 137G 118G 20G 86% /media/spai/新加卷 /dev/loop15 303M 303M 0 100% /snap/code/149
df -h /boot
df -h /boot Filesystem Size Used Avail Use% Mounted on /dev/nvme0n1p4 261M 185M 57M 77% /boot