Как восстановить поврежденное изображение в dpkg?

У меня огромная проблема с сервером (21.04). Я не могу установить какой-либо пакет apt. Что бы я ни делал, он застревает на "update-initramfs: Удаление /boot/initrd.img-5.11.0-41-generic" навсегда. Какие-то решения этой проблемы?

Заранее спасибо!

tech@vs777:~$ sudo apt install timeshift
[sudo] password for tech:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 linux-modules-5.11.0-41-generic : Depends: linux-image-5.11.0-41-generic but it is not going to be installed or
                                            linux-image-unsigned-5.11.0-41-generic but it is not going to be installed
 timeshift : Depends: libcairo2 (>= 1.2.4) but it is not going to be installed
             Depends: libgdk-pixbuf-2.0-0 (>= 2.22.0) but it is not going to be installed
             Depends: libgee-0.8-2 (>= 0.8.3) but it is not going to be installed
             Depends: libgtk-3-0 (>= 3.16.2) but it is not going to be installed
             Depends: libjson-glib-1.0-0 (>= 1.5.2) but it is not going to be installed
             Depends: libvte-2.91-0 but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
tech@vs777:~$ apt --fix-broken install
E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?
tech@vs777:~$ sudo apt --fix-broken install
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
  amd64-microcode intel-microcode iucode-tool
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  linux-image-unsigned-5.11.0-41-generic
Suggested packages:
  fdutils linux-doc | linux-source-5.11.0 linux-tools linux-modules-extra-5.11.0-41-generic
The following packages will be REMOVED:
  linux-image-5.11.0-41-generic linux-image-5.4.0-89-generic
The following NEW packages will be installed:
  linux-image-unsigned-5.11.0-41-generic
0 upgraded, 1 newly installed, 2 to remove and 1 not upgraded.
2 not fully installed or removed.
Need to get 0 B/11.6 MB of archives.
After this operation, 11.5 MB disk space will be freed.
Do you want to continue? [Y/n] y
dpkg: linux-image-5.11.0-41-generic: dependency problems, but removing anyway as you requested:
 linux-modules-5.11.0-41-generic depends on linux-image-5.11.0-41-generic | linux-image-unsigned-5.11.0-41-generic; however:
  Package linux-image-5.11.0-41-generic is to be removed.
  Package linux-image-unsigned-5.11.0-41-generic is not installed.

(Reading database ... 121324 files and directories currently installed.)
Removing linux-image-5.11.0-41-generic (5.11.0-41.45) ...
/etc/kernel/postrm.d/initramfs-tools:
update-initramfs: Deleting /boot/initrd.img-5.11.0-41-generic

Правка: добавлена запрашиваемая информация:

tech@vs777:~$ uname -r
5.4.0-91-generic
tech@vs777:~$ dpkg -l | egrep 'linux-[i|m|g|h]'
ii  binutils-x86-64-linux-gnu              2.36.1-6ubuntu1                                                      amd64        GNU binary utilities, for x86-64-linux-gnu target
ii  linux-headers-5.11.0-41                5.11.0-41.45                                                         all          Header files related to Linux kernel version 5.11.0
ii  linux-headers-5.11.0-41-generic        5.11.0-41.45                                                         amd64        Linux kernel headers for version 5.11.0 on 64 bit x86 SMP
ii  linux-headers-5.4.0-91                 5.4.0-91.102                                                         all          Header files related to Linux kernel version 5.4.0
ii  linux-headers-5.4.0-91-generic         5.4.0-91.102                                                         amd64        Linux kernel headers for version 5.4.0 on 64 bit x86 SMP
ii  linux-headers-generic                  5.11.0.41.42                                                         amd64        Generic Linux kernel headers
rc  linux-image-3.16.0-25-generic          3.16.0-25.33                                                         amd64        Linux kernel image for version 3.16.0 on 64 bit x86 SMP
rc  linux-image-3.19.0-16-generic          3.19.0-16.16                                                         amd64        Linux kernel image for version 3.19.0 on 64 bit x86 SMP
rc  linux-image-3.19.0-58-generic          3.19.0-58.64                                                         amd64        Linux kernel image for version 3.19.0 on 64 bit x86 SMP
rc  linux-image-4.15.0-141-generic         4.15.0-141.145                                                       amd64        Signed kernel image generic
rc  linux-image-4.2.0-35-generic           4.2.0-35.40                                                          amd64        Linux kernel image for version 4.2.0 on 64 bit x86 SMP
rc  linux-image-4.4.0-104-generic          4.4.0-104.127                                                        amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-4.4.0-108-generic          4.4.0-108.131                                                        amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-4.4.0-134-generic          4.4.0-134.160                                                        amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-4.4.0-148-generic          4.4.0-148.174                                                        amd64        Signed kernel image generic
rc  linux-image-4.4.0-159-generic          4.4.0-159.187                                                        amd64        Signed kernel image generic
rc  linux-image-4.4.0-177-generic          4.4.0-177.207                                                        amd64        Signed kernel image generic
rc  linux-image-4.4.0-208-generic          4.4.0-208.240                                                        amd64        Signed kernel image generic
rc  linux-image-4.4.0-21-generic           4.4.0-21.37                                                          amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-4.4.0-81-generic           4.4.0-81.104                                                         amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rH  linux-image-5.11.0-41-generic          5.11.0-41.45                                                         amd64        Signed kernel image generic
rc  linux-image-5.4.0-71-generic           5.4.0-71.79                                                          amd64        Signed kernel image generic
rc  linux-image-5.4.0-72-generic           5.4.0-72.80                                                          amd64        Signed kernel image generic
rc  linux-image-5.4.0-77-generic           5.4.0-77.86                                                          amd64        Signed kernel image generic
rc  linux-image-5.4.0-80-generic           5.4.0-80.90                                                          amd64        Signed kernel image generic
rc  linux-image-5.4.0-81-generic           5.4.0-81.91                                                          amd64        Signed kernel image generic
rc  linux-image-5.4.0-86-generic           5.4.0-86.97                                                          amd64        Signed kernel image generic
rH  linux-image-5.4.0-89-generic           5.4.0-89.100                                                         amd64        Signed kernel image generic
ii  linux-image-5.4.0-91-generic           5.4.0-91.102                                                         amd64        Signed kernel image generic
rc  linux-image-extra-3.16.0-25-generic    3.16.0-25.33                                                         amd64        Linux kernel extra modules for version 3.16.0 on 64 bit x86 SMP
rc  linux-image-extra-3.19.0-16-generic    3.19.0-16.16                                                         amd64        Linux kernel extra modules for version 3.19.0 on 64 bit x86 SMP
rc  linux-image-extra-3.19.0-58-generic    3.19.0-58.64                                                         amd64        Linux kernel extra modules for version 3.19.0 on 64 bit x86 SMP
rc  linux-image-extra-4.2.0-35-generic     4.2.0-35.40                                                          amd64        Linux kernel extra modules for version 4.2.0 on 64 bit x86 SMP
rc  linux-image-extra-4.4.0-104-generic    4.4.0-104.127                                                        amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-extra-4.4.0-108-generic    4.4.0-108.131                                                        amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-extra-4.4.0-134-generic    4.4.0-134.160                                                        amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-extra-4.4.0-21-generic     4.4.0-21.37                                                          amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-extra-4.4.0-81-generic     4.4.0-81.104                                                         amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc  linux-modules-4.15.0-141-generic       4.15.0-141.145                                                       amd64        Linux kernel extra modules for version 4.15.0 on 64 bit x86 SMP
rc  linux-modules-4.4.0-148-generic        4.4.0-148.174                                                        amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc  linux-modules-4.4.0-159-generic        4.4.0-159.187                                                        amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc  linux-modules-4.4.0-177-generic        4.4.0-177.207                                                        amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc  linux-modules-4.4.0-208-generic        4.4.0-208.240                                                        amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  linux-modules-5.11.0-41-generic        5.11.0-41.45                                                         amd64        Linux kernel extra modules for version 5.11.0 on 64 bit x86 SMP
rc  linux-modules-5.4.0-71-generic         5.4.0-71.79                                                          amd64        Linux kernel extra modules for version 5.4.0 on 64 bit x86 SMP
rc  linux-modules-5.4.0-72-generic         5.4.0-72.80                                                          amd64        Linux kernel extra modules for version 5.4.0 on 64 bit x86 SMP
rc  linux-modules-5.4.0-77-generic         5.4.0-77.86                                                          amd64        Linux kernel extra modules for version 5.4.0 on 64 bit x86 SMP
rc  linux-modules-5.4.0-80-generic         5.4.0-80.90                                                          amd64        Linux kernel extra modules for version 5.4.0 on 64 bit x86 SMP
rc  linux-modules-5.4.0-81-generic         5.4.0-81.91                                                          amd64        Linux kernel extra modules for version 5.4.0 on 64 bit x86 SMP
rc  linux-modules-5.4.0-86-generic         5.4.0-86.97                                                          amd64        Linux kernel extra modules for version 5.4.0 on 64 bit x86 SMP
ii  linux-modules-5.4.0-89-generic         5.4.0-89.100                                                         amd64        Linux kernel extra modules for version 5.4.0 on 64 bit x86 SMP
ii  linux-modules-5.4.0-91-generic         5.4.0-91.102                                                         amd64        Linux kernel extra modules for version 5.4.0 on 64 bit x86 SMP
rc  linux-modules-extra-4.15.0-141-generic 4.15.0-141.145                                                       amd64        Linux kernel extra modules for version 4.15.0 on 64 bit x86 SMP
rc  linux-modules-extra-4.4.0-148-generic  4.4.0-148.174                                                        amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc  linux-modules-extra-4.4.0-159-generic  4.4.0-159.187                                                        amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc  linux-modules-extra-4.4.0-177-generic  4.4.0-177.207                                                        amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc  linux-modules-extra-4.4.0-208-generic  4.4.0-208.240                                                        amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rc  linux-modules-extra-5.11.0-41-generic  5.11.0-41.45                                                         amd64        Linux kernel extra modules for version 5.11.0 on 64 bit x86 SMP
rc  linux-modules-extra-5.4.0-71-generic   5.4.0-71.79                                                          amd64        Linux kernel extra modules for version 5.4.0 on 64 bit x86 SMP
rc  linux-modules-extra-5.4.0-72-generic   5.4.0-72.80                                                          amd64        Linux kernel extra modules for version 5.4.0 on 64 bit x86 SMP
rc  linux-modules-extra-5.4.0-77-generic   5.4.0-77.86                                                          amd64        Linux kernel extra modules for version 5.4.0 on 64 bit x86 SMP
rc  linux-modules-extra-5.4.0-80-generic   5.4.0-80.90                                                          amd64        Linux kernel extra modules for version 5.4.0 on 64 bit x86 SMP
rc  linux-modules-extra-5.4.0-81-generic   5.4.0-81.91                                                          amd64        Linux kernel extra modules for version 5.4.0 on 64 bit x86 SMP
rc  linux-modules-extra-5.4.0-86-generic   5.4.0-86.97                                                          amd64        Linux kernel extra modules for version 5.4.0 on 64 bit x86 SMP
rc  linux-modules-extra-5.4.0-89-generic   5.4.0-89.100                                                         amd64        Linux kernel extra modules for version 5.4.0 on 64 bit x86 SMP
ii  linux-modules-extra-5.4.0-91-generic   5.4.0-91.102                                                         amd64        Linux kernel extra modules for version 5.4.0 on 64 bit x86 SMP

Правка 2:

tech@vs777:~$ sudo dpkg -P linux-modules-5.11.0-41-generic
[sudo] password for tech:
(Reading database ... 121324 files and directories currently installed.)
Removing linux-modules-5.11.0-41-generic (5.11.0-41.45) ...
Purging configuration files for linux-modules-5.11.0-41-generic (5.11.0-41.45) ...
tech@vs777:~$ sudo dpkg --configure -a
tech@vs777:~$ sudo apt -f install
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  amd64-microcode intel-microcode iucode-tool
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
  linux-image-5.11.0-41-generic linux-image-5.4.0-89-generic
0 upgraded, 0 newly installed, 2 to remove and 1 not upgraded.
2 not fully installed or removed.
After this operation, 26.7 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 120028 files and directories currently installed.)
Removing linux-image-5.11.0-41-generic (5.11.0-41.45) ...
/etc/kernel/postrm.d/initramfs-tools:
update-initramfs: Deleting /boot/initrd.img-5.11.0-41-generic

Правка 3:

tech@vs777:~$ dpkg -l | egrep -v '^ii|rc'
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
+++-======================================-====================================================================-============-===============================================================================
rH  linux-image-5.11.0-41-generic          5.11.0-41.45                                                         amd64        Signed kernel image generic
rH  linux-image-5.4.0-89-generic           5.4.0-89.100                                                         amd64        Signed kernel image generic

Правка 4:

tech@vs777:~$ df -h;df -i
Filesystem      Size  Used Avail Use% Mounted on
tmpfs           795M  1.2M  794M   1% /run
/dev/vda1       138G   87G   45G  67% /
tmpfs           3.9G     0  3.9G   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           4.0M     0  4.0M   0% /sys/fs/cgroup
tmpfs           795M     0  795M   0% /run/user/1000
Filesystem      Inodes  IUsed   IFree IUse% Mounted on
tmpfs          1017593    762 1016831    1% /run
/dev/vda1      9175040 526689 8648351    6% /
tmpfs          1017593      1 1017592    1% /dev/shm
tmpfs          1017593      3 1017590    1% /run/lock
tmpfs             1024     18    1006    2% /sys/fs/cgroup
tmpfs           203518     19  203499    1% /run/user/1000
1
задан 28 December 2021 в 13:55

1 ответ

Попробуйте:

cd /boot
echo Files now in /boot:
ls
for i in initrd.img*
do
    mv -v $i $i.bak # Remove the images and back them up in case of trouble
done
sudo update-initramfs -cvk $(uname -r) | less # Attempt to recreate the initial ramdisk, press q to continue
echo These files are now present
ls

Убедитесь, что только что созданные initramfs присутствуют, и перезагрузите компьютер. Если что-то не удается, используйте приглашение grub (нажмите C в меню выбора параметров загрузки), чтобы восстановить и исправить это (возможно, вы захотите записать их!)

  • set pager=1- включить пейджер для длинных командных выходов, таких как help
  • ls- список доступных дисковых устройств. Должен возвращать список таких вещей, как (hdX,gptX) или (hdX,mbrX), где X - число
  • ls (устройство)/- Список файловой системы на данном устройстве.
  • set ROOT=(device)- Установите корень FS
  • linux /- загрузите ядро (обычно /boot/vmlinuz)
  • initrd /- загрузите initramfs (обычно /boot/initrd.img). Версии ядра и initrd должны совпадать.
  • boot- Запуск системы

Если вы используете RAID, LVM или LUKS, узнайте, какие модули вам нужно загрузить ( insmod ) заранее

После перезагрузки запустите sudo apt purge initramfs-tools, он удалит дополнительные пакеты, но не волнуйтесь, пусть он перезапустится. Затем sudo apt install initramfs-tool <Каковые пакеты были удалены без звездочки>. Сейчас все должно быть хорошо.

0
ответ дан 28 December 2021 в 19:46

Другие вопросы по тегам:

Похожие вопросы: