OS 업그레이드 후 패키지 업그레이드 실패

OS 업그레이드 후 패키지 업그레이드 실패

패키지를 더 이상 업그레이드할 수 없기 때문에 Ubuntu 16.04.6을 실행하여 OS를 업그레이드하면 do-release-upgrade어느 시점에서 오류가 발생한 것 같습니다. 다양한 명령을 실행할 때 이 오류가 표시됩니다.

update-initramfs: Generating /boot/initrd.img-3.13.0-170-generic
sync: invalid option -- 'f'

예: 실행중 sudo apt-get upgrade:

$ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages will be REMOVED:
  linux-image-extra-3.13.0-101-generic
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
3 not fully installed or removed.
After this operation, 152 MB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 39291 files and directories currently installed.)
Removing linux-image-extra-3.13.0-101-generic (3.13.0-101.148) ...
depmod: FATAL: could not load /boot/System.map-3.13.0-101-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 3.13.0-101-generic /boot/vmlinuz-3.13.0-101-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.13.0-101-generic /boot/vmlinuz-3.13.0-101-generic
update-initramfs: Generating /boot/initrd.img-3.13.0-101-generic
WARNING: missing /lib/modules/3.13.0-101-generic
Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/3.13.0-101-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_82eRAE/lib/modules/3.13.0-101-generic/modules.order: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_82eRAE/lib/modules/3.13.0-101-generic/modules.builtin: No such file or directory
sync: invalid option -- 'f'
Try 'sync --help' for more information.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-extra-3.13.0-101-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
Errors were encountered while processing:
 linux-image-extra-3.13.0-101-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)

자동 제거도 같은 방식으로 실패합니다.

$ sudo apt-get autoremove
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  linux-image-extra-3.13.0-101-generic
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
3 not fully installed or removed.
After this operation, 152 MB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 39291 files and directories currently installed.)
Removing linux-image-extra-3.13.0-101-generic (3.13.0-101.148) ...
depmod: FATAL: could not load /boot/System.map-3.13.0-101-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 3.13.0-101-generic /boot/vmlinuz-3.13.0-101-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.13.0-101-generic /boot/vmlinuz-3.13.0-101-generic
update-initramfs: Generating /boot/initrd.img-3.13.0-101-generic
WARNING: missing /lib/modules/3.13.0-101-generic
Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/3.13.0-101-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_6lLSTG/lib/modules/3.13.0-101-generic/modules.order: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_6lLSTG/lib/modules/3.13.0-101-generic/modules.builtin: No such file or directory
sync: invalid option -- 'f'
Try 'sync --help' for more information.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-extra-3.13.0-101-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
Errors were encountered while processing:
 linux-image-extra-3.13.0-101-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)

dpkg에도 문제가 있습니다.

$ sudo dpkg --configure -a
Setting up linux-firmware (1.157.21) ...
update-initramfs: Generating /boot/initrd.img-3.13.0-170-generic
sync: invalid option -- 'f'
Try 'sync --help' for more information.
dpkg: error processing package linux-firmware (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 linux-firmware

디스크 공간은 괜찮은 것 같습니다.

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            388M  4.0K  388M   1% /dev
tmpfs            81M  532K   81M   1% /run
/dev/xvda1      8.8G  4.7G  3.6G  57% /
none            4.0K     0  4.0K   0% /sys/fs/cgroup
none            5.0M     0  5.0M   0% /run/lock
none            404M     0  404M   0% /run/shm
none            100M     0  100M   0% /run/user
cgmfs           100K     0  100K   0% /run/cgmanager/fs
tmpfs            81M     0   81M   0% /run/user/1000

Clean이 작업을 완료했습니다.

$ sudo apt-get autoclean
Reading package lists... Done
Building dependency tree       
Reading state information... Done

운영체제는

$ cat /etc/os-release
NAME="Ubuntu"
VERSION="16.04.6 LTS (Xenial Xerus)"

이것이 커널의 손상입니까? 서버를 복구하기 위해 취할 수 있는 조치가 있습니까?

업데이트

제안한 대로 sudo dpkg --remove --force-remove-reinstreq linux-image-extra-3.13.0-101-generic다음 결과를 얻었습니다.

$ sudo dpkg --remove --force-remove-reinstreq linux-image-extra-3.13.0-101-generic
(Reading database ... 39291 files and directories currently installed.)
Removing linux-image-extra-3.13.0-101-generic (3.13.0-101.148) ...
depmod: FATAL: could not load /boot/System.map-3.13.0-101-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 3.13.0-101-generic /boot/vmlinuz-3.13.0-101-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.13.0-101-generic /boot/vmlinuz-3.13.0-101-generic
update-initramfs: Generating /boot/initrd.img-3.13.0-101-generic
WARNING: missing /lib/modules/3.13.0-101-generic
Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/3.13.0-101-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_9Tbcam/lib/modules/3.13.0-101-generic/modules.order: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_9Tbcam/lib/modules/3.13.0-101-generic/modules.builtin: No such file or directory
sync: invalid option -- 'f'
Try 'sync --help' for more information.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-extra-3.13.0-101-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
Errors were encountered while processing:
 linux-image-extra-3.13.0-101-generic

관련 정보