Score:0

rm: cannot remove '/boot/grub/grub.cfg.new': Bad message

ng flag

I get

run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 1
dpkg: error processing package linux-image-5.4.0-100-generic (--remove):
 installed linux-image-5.4.0-100-generic package post-removal script subprocess returned error exit status 1
dpkg: too many errors, stopping
Errors were encountered while processing: linux-image-5.4.0-100-generic
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1) 

wen running sudo apt --fix-broken install I am on Ubuntu 20.04

Edit

df -i
Filesystem                           Inodes  IUsed     IFree IUse% Mounted on
udev                                1005233    655   1004578    1% /dev
tmpfs                               1017091   1317   1015774    1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv  13107200 304989  12802211    3% /
tmpfs                               1017091      5   1017086    1% /dev/shm
tmpfs                               1017091      6   1017085    1% /run/lock
tmpfs                               1017091     18   1017073    1% /sys/fs/cgroup
/dev/loop2                            10803  10803         0  100% /snap/core18/2128
/dev/loop3                            10847  10847         0  100% /snap/core18/2284
/dev/loop5                            11777  11777         0  100% /snap/core20/1328
/dev/loop6                             1602   1602         0  100% /snap/lxd/21029
/dev/loop7                              796    796         0  100% /snap/lxd/21835
/dev/sdb2                             65536  16393     49143   26% /boot
tmpfs                               1017091     81   1017010    1% /run/user/1000
/dev/sda1                         122101760    250 122101510    1% /media/jeremie/Servarr2
/dev/loop10                           12847  12847         0  100% /snap/core/12725
/dev/loop0                              480    480         0  100% /snap/snapd/14978
/dev/loop1                            11777  11777         0  100% /snap/core20/1361
df -h
Filesystem                         Size  Used Avail Use% Mounted on
udev                               3.9G     0  3.9G   0% /devtmpfs                              795M  3.8M  791M   1% 
/run/dev/mapper/ubuntu--vg-ubuntu--lv  196G   75G  112G  41% /
tmpfs                              3.9G  4.0K  3.9G   1% /dev/shm
tmpfs                              5.0M  4.0K  5.0M   1% /run/lock
tmpfs                              3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/loop2                          56M   56M     0 100% /snap/core18/2128
/dev/loop3                          56M   56M     0 100% /snap/core18/2284
/dev/loop5                          62M   62M     0 100% /snap/core20/1328
/dev/loop6                          71M   71M     0 100% /snap/lxd/21029
/dev/loop7                          68M   68M     0 100% /snap/lxd/21835
/dev/sdb2                          976M  929M     0 100% /boot
tmpfs                              795M   28K  795M   1% /run/user/1000
/dev/sda1                          1.8T  160G  1.6T  10% /media/jeremie/Servarr2
/dev/loop10                        111M  111M     0 100% /snap/core/12725
/dev/loop0                          44M   44M     0 100% /snap/snapd/14978
/dev/loop1                          62M   62M     0 100% /snap/core20/1361
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
+++-===========================================================-===========================================================-============-======================================================================================================
ic  cloud-initramfs-dyn-netconf                                 0.45ubuntu2                                                 all          write a network interface file in /run for BOOTIF
ic  cryptsetup-initramfs                                        2:2.2.2-3ubuntu2.4                                          all          disk encryption support - initramfs integration
iF  initramfs-tools                                             0.136ubuntu6.7                                              all          generic modular initramfs generator (automation)
rH  linux-image-5.4.0-100-generic                               5.4.0-100.113                                               amd64        Signed kernel image generic
ic  linux-modules-extra-5.4.0-100-generic                       5.4.0-100.113                                               amd64        Linux kernel extra modules for version 5.4.0 on 64 bit x86 SMP
it  man-db                                                      2.9.1-1                                                     amd64        tools for reading manual pages
ic  overlayroot                                                 0.45ubuntu2                                                 all          use an overlayfs on top of a read-only root filesystem

Edit 2

apt-mark showmanual | grep linux-'[g|i|m|h]' | egrep -v linux-generic | xargs sudo apt-mark auto
linux-image-5.4.0-100-generic set to automatically installed.linux-image-5.4.0-96-generic set to automatically installed.
linux-image-5.4.0-97-generic set to automatically installed.
linux-image-5.4.0-99-generic set to automatically installed.
linux-modules-extra-5.4.0-96-generic set to automatically installed.
linux-modules-extra-5.4.0-97-generic set to automatically installed.
linux-modules-extra-5.4.0-99-generic set to automatically installed.
sudo apt autoremove --purge
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  amd64-microcode* cryptsetup* cryptsetup-bin*
  cryptsetup-run* i965-va-driver* intel-media-va-driver*
  intel-microcode* iucode-tool* kodi-inputstream-adaptive*
  kodi-inputstream-rtmp* kodi-peripheral-joystick*
  libaacs0* libass9* libbdplus0* libbluray2* libcdio19*
  libcec4* libcrossguid0* libdouble-conversion3*
  libfstrcmp0* libigdgmm11* libiso9660-11* libmariadb3*
  libmicrohttpd12* libnunit-cil-dev*
  python3-pycryptodome* qt5-gtk-platformtheme*
  qttranslations5-l10n* thermald* va-driver-all*
  vdpau-driver-all*
0 upgraded, 0 newly installed, 74 to remove and 6 not upgraded.
2 not fully installed or removed.
After this operation, 871 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 252533 files and directories currently installed.)
Removing linux-image-5.4.0-100-generic (5.4.0-100.113) ...
/etc/kernel/postrm.d/initramfs-tools:
update-initramfs: Deleting /boot/initrd.img-5.4.0-100-generic/etc/kernel/postrm.d/zz-update-grub:
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
rm: cannot remove '/boot/grub/grub.cfg.new': Bad message
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 1
dpkg: error processing package linux-image-5.4.0-100-generic (--remove):
 installed linux-image-5.4.0-100-generic package post-removal script subprocess returned error exit status 1
dpkg: too many errors, stopping
Errors were encountered while processing:
 linux-image-5.4.0-100-generic
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)

Edit 3

sudo rm -f /boot/grub/grub.cfg.new
[sudo] password for jeremie: 
rm: cannot remove '/boot/grub/grub.cfg.new': Bad message
 du -h --max-depth=2 /boot/
du: cannot read directory '/boot/lost+found': Permission denied
16K     /boot/lost+found
du: cannot read directory '/boot/grub': Bad message
4.0K    /boot/grub
315M    /boot/
ls -al /boot/grub/grub.cfg.new
ls: cannot access '/boot/grub/grub.cfg.new': Bad message

Do you think that running "Boot Repair" on a USB stick is a good idea?

nobody avatar
gh flag
Please [edit] your question and show us `df -i;df -h` also `dpkg -l | egrep -v '^ii|rc'`
nobody avatar
gh flag
Oh your /boot filesystem is full. `apt-mark showmanual | grep linux-'[g|i|m|h]' | egrep -v linux-generic | xargs sudo apt-mark auto` and `sudo apt autoremove --purge` I hope the 2. command is working.
nobody avatar
gh flag
`sudo rm -f /boot/grub/grub.cfg.new` if it is not working please add `du -h --max-depth=2 /boot/` and `ls -al /boot/grub/grub.cfg.new` there less kernel, than I expected. and please make a backup from your data and make sure you have a install media, just for security.
nobody avatar
gh flag
Please no boot repair. I think something is not okay with your 2.Hardrive (/dev/sdb) You have backup? if so, boot up a live linux(ubuntu) and try to make a file-systemcheck for /dev/sdb2. there is your /boot. and check the harddrive with smartmontools.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.