从 18.04 升级到 20.04 后无法安装应用程序,启动 dpkg 时 Grub 不再显示

从 18.04 升级到 20.04 后无法安装应用程序,启动 dpkg 时 Grub 不再显示

在连续从 17.xx 升级到 18.04 和 20.04 后,我无法从软件管理器安装应用程序,并且 grub 在启动时不再显示,因此我无法访问我的 Windows 安装。似乎存在无法删除旧内核的问题。请帮忙。

sudo apt autoremove 给出:

marco@marco-ThinkPad:~$ sudo apt autoremove
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  linux-image-4.10.0-37-generic linux-image-4.13.0-45-generic linux-image-4.13.0-46-generic
  linux-image-extra-4.13.0-45-generic linux-image-extra-4.13.0-46-generic
0 upgraded, 0 newly installed, 5 to remove and 0 not upgraded.
5 not fully installed or removed.
After this operation, 547 MB disk space will be freed.
Do you want to continue? [J/n] j
(Reading database ... 426584 files and directories currently installed.)
Removing linux-image-4.10.0-37-generic (4.10.0-37.41) ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 4.10.0-37-generic /boot/vmlinuz-4.10.0-37-g
eneric
update-initramfs: Deleting /boot/initrd.img-4.10.0-37-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 4.10.0-37-generic /boot/vmlinuz-4.10.0-37-ge
neric
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.4.0-58-generic
Found initrd image: /boot/initrd.img-5.4.0-58-generic
Found linux image: /boot/vmlinuz-4.15.0-128-generic
Found initrd image: /boot/initrd.img-4.15.0-128-generic
/etc/grub.d/bin/grubcfg_proxy: error while loading shared libraries: libcrypto.so.1.0.0: cannot open 
shared object file: No such file or directory
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 127
Failed to process /etc/kernel/postrm.d at /var/lib/dpkg/info/linux-image-4.10.0-37-generic.postrm lin
e 330.
dpkg: error processing package linux-image-4.10.0-37-generic (--remove):
 installed linux-image-4.10.0-37-generic package post-removal script subprocess returned error exit s
tatus 1
dpkg: too many errors, stopping
Errors were encountered while processing:
 linux-image-4.10.0-37-generic
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)

ls -al /etc/grub.d 给出:

marco@marco-ThinkPad:~$ ls -al /etc/grub.d
insgesamt 196
drwxr-xr-x   5 root root  4096 Dez 19 14:48 .
drwxr-xr-x 150 root root 12288 Dez 19 16:45 ..
-rwxr-xr-x   1 root root 10627 Nov 13 00:15 00_header
-rwxr-xr-x   1 root root  6258 Mär 15  2016 05_debian_theme
-rwxr-xr-x   1 root root 17622 Nov 13 00:15 10_linux
-rwxr-xr-x   1 root root   948 Jan 21  2017 10_linux_proxy
-rwxr-xr-x   1 root root 42359 Nov 13 00:15 10_linux_zfs
-rwxr-xr-x   1 root root 12894 Nov 13 00:15 20_linux_xen
-rwxr-xr-x   1 root root 12059 Jun 14  2017 30_os-prober.dpkg-dist
-rwxr-xr-x   1 root root   198 Jan 21  2017 30_os-prober_proxy
-rwxr-xr-x   1 root root  1424 Nov 13 00:15 30_uefi-firmware
-rwxr-xr-x   1 root root   948 Jan 21  2017 31_linux_proxy
-rwxr-xr-x   1 root root 11082 Jun 17  2016 32_linux_xen
-rwxr-xr-x   1 root root  1992 Jan 28  2016 33_memtest86+
-rwxr-xr-x   1 root root   198 Jan 21  2017 34_os-prober_proxy
-rwxr-xr-x   1 root root  1418 Jun 17  2016 35_uefi-firmware
-rwxr-xr-x   1 root root   214 Jun 17  2016 40_custom
-rwxr-xr-x   1 root root   216 Jun 17  2016 41_custom
drwxr-xr-x   4 root root  4096 Aug 10  2016 backup
drwxr-xr-x   2 root root  4096 Aug 10  2016 bin
drwxr-xr-x   2 root root  4096 Jan 21  2017 proxifiedScripts
-rw-r--r--   1 root root   483 Jun 17  2016 README
-rw-r--r--   1 root root   210 Jan 21  2017 .script_sources.txt
marco@marco-ThinkPad:

以下第一个答案中的所有命令均给出:

marco@marco-ThinkPad:~$ sudo chmod -x /etc/grub.d/30_os-prober_proxy
[sudo] Passwort für marco: 
marco@marco-ThinkPad:~$ sudo chmod -x /etc/grub.d/10_linux_proxy
marco@marco-ThinkPad:~$ sudo chmod -x /etc/grub.d/31_linux_proxy
marco@marco-ThinkPad:~$ sudo mv /etc/grub.d/proxifiedScripts $HOME
marco@marco-ThinkPad:~$ sudo mv /etc/grub.d/bin $HOME/bin.bak
marco@marco-ThinkPad:~$ sudo mv /etc/grub.d/backup  $HOME/backup.bak
marco@marco-ThinkPad:~$ sudo mv /etc/grub.d/30_os-prober.dpkg-dist  /etc/grub.d/30_os-prober
marco@marco-ThinkPad:~$ df -h;df -i
Dateisystem    Größe Benutzt Verf. Verw% Eingehängt auf
udev            3,9G       0  3,9G    0% /dev
tmpfs           785M    2,1M  783M    1% /run
/dev/sda7       106G     29G   72G   29% /
tmpfs           3,9G       0  3,9G    0% /dev/shm
tmpfs           5,0M    4,0K  5,0M    1% /run/lock
tmpfs           3,9G       0  3,9G    0% /sys/fs/cgroup
/dev/loop0      119M    119M     0  100% /snap/chromium/1424
/dev/loop2      144M    144M     0  100% /snap/firefox/372
/dev/loop3       62M     62M     0  100% /snap/core20/904
/dev/loop4       55M     55M     0  100% /snap/core18/1754
/dev/loop6      151M    151M     0  100% /snap/git-cola/136
/dev/loop5      147M    147M     0  100% /snap/git-cola/61
/dev/loop1       98M     98M     0  100% /snap/core/10577
/dev/loop7      147M    147M     0  100% /snap/firefox/469
/dev/loop8      163M    163M     0  100% /snap/gnome-3-28-1804/145
/dev/loop9      291M    291M     0  100% /snap/vlc/1620
/dev/loop10     261M    261M     0  100% /snap/kde-frameworks-5-core18/32
/dev/loop11     291M    291M     0  100% /snap/vlc/1700
/dev/loop12      65M     65M     0  100% /snap/gtk-common-themes/1514
/dev/loop13      63M     63M     0  100% /snap/gtk-common-themes/1506
/dev/loop14      98M     98M     0  100% /snap/core/9289
/dev/loop15     173M    173M     0  100% /snap/spotify/43
/dev/loop16     256M    256M     0  100% /snap/gnome-3-34-1804/36
/dev/loop17      56M     56M     0  100% /snap/core18/1944
/dev/loop18      52M     52M     0  100% /snap/snap-store/518
/dev/loop19     164M    164M     0  100% /snap/spotify/41
/dev/loop20     234M    234M     0  100% /snap/gimp/322
/dev/loop21     162M    162M     0  100% /snap/gnome-3-28-1804/128
/dev/loop22     218M    218M     0  100% /snap/gnome-3-34-1804/60
/dev/loop23     2,3M    2,3M     0  100% /snap/gnome-system-monitor/148
/dev/loop24     141M    141M     0  100% /snap/gnome-3-26-1604/100
/dev/sda2       256M     62M  195M   24% /boot/efi
tmpfs           785M     48K  785M    1% /run/user/1000
Dateisystem     Inodes IBenutzt   IFrei IUse% Eingehängt auf
udev            996636      644  995992    1% /dev
tmpfs          1003741     1314 1002427    1% /run
/dev/sda7      7061504   517323 6544181    8% /
tmpfs          1003741        1 1003740    1% /dev/shm
tmpfs          1003741        5 1003736    1% /run/lock
tmpfs          1003741       18 1003723    1% /sys/fs/cgroup
/dev/loop0        1330     1330       0  100% /snap/chromium/1424
/dev/loop2        2700     2700       0  100% /snap/firefox/372
/dev/loop3       11713    11713       0  100% /snap/core20/904
/dev/loop4       10764    10764       0  100% /snap/core18/1754
/dev/loop6       30231    30231       0  100% /snap/git-cola/136
/dev/loop5       30131    30131       0  100% /snap/git-cola/61
/dev/loop1       12867    12867       0  100% /snap/core/10577
/dev/loop7        2701     2701       0  100% /snap/firefox/469
/dev/loop8       27807    27807       0  100% /snap/gnome-3-28-1804/145
/dev/loop9       51065    51065       0  100% /snap/vlc/1620
/dev/loop10      35005    35005       0  100% /snap/kde-frameworks-5-core18/32
/dev/loop11      51155    51155       0  100% /snap/vlc/1700
/dev/loop12      63978    63978       0  100% /snap/gtk-common-themes/1514
/dev/loop13      62342    62342       0  100% /snap/gtk-common-themes/1506
/dev/loop14      12860    12860       0  100% /snap/core/9289
/dev/loop15      24071    24071       0  100% /snap/spotify/43
/dev/loop16      24339    24339       0  100% /snap/gnome-3-34-1804/36
/dev/loop17      10809    10809       0  100% /snap/core18/1944
/dev/loop18      15847    15847       0  100% /snap/snap-store/518
/dev/loop19      24012    24012       0  100% /snap/spotify/41
/dev/loop20      16728    16728       0  100% /snap/gimp/322
/dev/loop21      27798    27798       0  100% /snap/gnome-3-28-1804/128
/dev/loop22      18513    18513       0  100% /snap/gnome-3-34-1804/60
/dev/loop23        784      784       0  100% /snap/gnome-system-monitor/148
/dev/loop24      27624    27624       0  100% /snap/gnome-3-26-1604/100
/dev/sda2            0        0       0     - /boot/efi
tmpfs          1003741      101 1003640    1% /run/user/1000
marco@marco-ThinkPad:~$ sudo dpkg --configure -a && sudo apt -f install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  linux-image-4.10.0-37-generic linux-image-4.13.0-45-generic linux-image-4.13.0-46-generic
  linux-image-extra-4.13.0-45-generic linux-image-extra-4.13.0-46-generic
0 upgraded, 0 newly installed, 5 to remove and 0 not upgraded.
5 not fully installed or removed.
After this operation, 547 MB disk space will be freed.
Do you want to continue? [J/n] j
(Reading database ... 426584 files and directories currently installed.)
Removing linux-image-4.10.0-37-generic (4.10.0-37.41) ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 4.10.0-37-generic /boot/vmlinuz-4.10.0
-37-generic
update-initramfs: Deleting /boot/initrd.img-4.10.0-37-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 4.10.0-37-generic /boot/vmlinuz-4.10.0-
37-generic
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.4.0-58-generic
Found initrd image: /boot/initrd.img-5.4.0-58-generic
Found linux image: /boot/vmlinuz-4.15.0-128-generic
Found initrd image: /boot/initrd.img-4.15.0-128-generic
Found Windows Boot Manager on /dev/sda2@/EFI/Microsoft/Boot/bootmgfw.efi
Adding boot menu entry for UEFI Firmware Settings
/etc/grub.d/34_os-prober_proxy: 3: /etc/grub.d/34_os-prober_proxy: 3: /etc/grub.d/bin/grubcfg_pr
oxy: not found/etc/grub.d/proxifiedScripts/os-prober: not found

run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 127
Failed to process /etc/kernel/postrm.d at /var/lib/dpkg/info/linux-image-4.10.0-37-generic.postr
m line 330.
dpkg: error processing package linux-image-4.10.0-37-generic (--remove):
 installed linux-image-4.10.0-37-generic package post-removal script subprocess returned error e
xit status 1
dpkg: too many errors, stopping
Errors were encountered while processing:
 linux-image-4.10.0-37-generic
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)
marco@marco-ThinkPad:

答案1

sudo chmod -x /etc/grub.d/30_os-prober_proxy

同样适用于

/etc/grub.d/10_linux_proxy这些/etc/grub.d/31_linux_proxy 将从脚本中删除可执行标志。然后我们有一个以相同日期创建的文件夹。

sudo mv /etc/grub.d/proxifiedScripts $HOME

@M.Hoppe 抱歉,我忽略了一个文件。sudo chmod -x /etc/grub.d/34_os-prober_proxy

为什么 havens 名称中有一个 bin 和 backup 文件夹?

sudo mv /etc/grub.d/bin $HOME/bin.bak

sudo mv /etc/grub.d/backup  $HOME/backup.bak

所以不会打扰。

sudo mv /etc/grub.d/30_os-prober.dpkg-dist  /etc/grub.d/30_os-prober

确保有足够的空间和空闲的 inode

df -h;df-i

你可以控制它。

sudo dpkg --configure -a && sudo apt -f install

祝你好运,2017 年的文件,我不知道你的 Paketmanagment 损坏程度有多大。

不要使用 grub-customizer,因为它会增加比在 grub2 中手动进行更改更多的工作。

@M.Hoppe 很抱歉,我监督了一个文件。

sudo chmod -x /etc/grub.d/34_os-prober_proxy

相关内容