There is a troublemaking empty file (md5sums of kernel 4.19.1) left on my ubuntu system, with has strange owner/group/date/attributes

How to fix or workaround this defect file?

$ uname -a
Linux olly-ryzen-pc1 4.20.10-042010-generic #201902150516 SMP Fri 
Feb 15 10:19:07 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux


$ stat /var/lib/dpkg/info/linux-image-unsigned-4.19.1-041901-generic.md5sums 
  Datei: /var/lib/dpkg/info/linux-image-unsigned-4.19.1-041901-generic.md5sums 
  Größe: 0             Blöcke: 0          EA Block: 4096   Normale 
leere Datei <= empty file
Gerät: 802h/2050d    Inode: 27918873    Verknüpfungen: 1 
Zugriff: (5625/-rwS-w-r-t)  Uid: (477987903/ UNKNOWN)   Gid: (3699747887/ 
Zugriff    : 2381-05-02 11:29:39.163881368 +0100 
Modifiziert: 2293-06-01 00:54:46.455862499 +0100 
Geändert   : 2167-05-10 21:19:01.867729249 +0100 
 Geburt    : - 


$ lsattr /var/lib/dpkg/info/linux-image-unsigned-4.19.1-041901-generic.md5sums
lsattr: Keine Daten verfügbar Beim Lesen der Flags von /var/lib/dpkg/info/linux-image-unsigned-4.19.1-041901-generic.md5sums

apt, dpkg

This file can't changed or deleted (remove/purge 4.19.1), but troubles apt-get to install applications.

--fix-broken or --reinstall dpkg exit also with 'not allowed' message.

Cannot be deleted. Die Control-Info-Datei »/var/lib/dpkg/info/linux-image-unsigned-4. 19.1-041901-generic.md5sums« kann nicht gelöscht werden: Vorgang nicht zulässig

chmod -st, chown root:root

No changes.

rm -f


live USB

Also tried a boot of ubuntu (install 4.18) from USB-Stick to repair, but:

sudo e2fsck -f /dev/sba2 does not report an error

sudo badblocks -vsn /dev/sda2 reports 0 bad blocks

and rm, chmod, chown: same behaivior as above ..

Only to compare, here is a neighbor file:

$ stat /var/lib/dpkg/info/linux-sound-base.md5sums 
  Datei: /var/lib/dpkg/info/linux-sound-base.md5sums 
  Größe: 545           Blöcke: 8          EA Block: 4096   Normale Datei 
Gerät: 802h/2050d    Inode: 27269131    Verknüpfungen: 1 
Zugriff: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root) 
Zugriff    : 2019-02-03 16:56:08.943545720 +0100 
Modifiziert: 2015-07-31 05:42:23.000000000 +0200 
Geändert   : 2018-05-22 01:20:37.178864616 +0200 
 Geburt    : - 

$ lsattr /var/lib/dpkg/info/linux-image-unsigned-4.19.1-041901-generic.list
  • Have you tried mv to rename the file?
    – wurtel
    Mar 6 '19 at 8:17
  • sudo mv ..md5sums ..md5sums.ren => 'Operation not permitted'
    – Olly
    Mar 7 '19 at 9:58

As fsck does not find anything wrong, you may need to use debugfs to clear the inode. Note that I last used debugfs years ago, so take care! Read the manpage first to see what's possible with this tool.

Boot from a rescue medium, and run

debugfs /dev/sda2

You can try to use debugfs's rm command to remove the file:

rm /var/lib/dpkg/info/linux-image-unsigned-4.19.1-041901-generic.md5sums

(assuming that /dev/sda2 is mounted on /, not /var)

If that doesn't work, you might try freeing the inode. You already know the inode number (27918873) from the stat output. You can free the inode with:

freei 27918873

After manipulating the filesystem with debugfs I recommend running fsck again.

  • Thank you Wurtel, will check this out in the evening.
    – Olly
    Mar 6 '19 at 8:54
  • See result below.
    – Olly
    Mar 7 '19 at 10:22


debugfs: open -w /dev/sda2

debugfs: stat 27918873

27918873: File not found by ext2_lookup

debugfs: ncheck 27918873

Inode    Pathname

27918873 /var/lib/dpkg/info/linux-image-unsigned-4.19.1-041901-generic.md5sums

debugfs: rm /var/lib/dpkg/info/linux-image-unsigned-4.19.1-041901-generic.md5sums

debugfs: quit

ubuntu@ubuntu:~$ sudo e2fsck /dev/sda2

e2fsck 1.44.1 (24-Mar-2018) /dev/sda2: clean, 367369/30498816 files, 20494756/121965056 blocks

ubuntu@ubuntu:~$ sudo e2fsck -f /dev/sda2

Pass 1: Checking inodes, blocks, and sizes

Pass 2: Checking directory structure

Pass 3: Checking directory connectivity

Pass 4: Checking reference counts

Pass 5: Checking group summary information

/dev/sda2: 367369/30498816 files (2.1% non-contiguous), 20494756/121965056 blocks

boot to main system

olly@olly-ryzen-pc1:~$ sudo apt-get purge

Paketlisten werden gelesen... Fertig

Abhängigkeitsbaum wird aufgebaut.

Statusinformationen werden eingelesen.... Fertig

Die folgenden Pakete werden ENTFERNT: linux-image-unsigned-4.19.1-041901-generic

0 aktualisiert, 0 neu installiert, 1 zu entfernen und 187 nicht aktualisiert.

1 nicht vollständig installiert oder entfernt.

Nach dieser Operation werden 8.626 kB Plattenplatz freigegeben.

Möchten Sie fortfahren? [J/n] j

(Lese Datenbank ... 207988 Dateien und Verzeichnisse sind derzeit installiert.)

Entfernen von linux-image-unsigned-4.19.1-041901-generic (4.19.1-041901.201811041431) ...

DONE! Finally! Thank you @wurtel a lot!

  • Shall I freei 27918873 after all?
    – Olly
    Mar 7 '19 at 10:21
  • 1
    freei shouldn't be needed if the rm succeeded. Please accept my answer as correct as it worked for you. (Although perhaps you can't as you don't have enough reputation yet?)
    – wurtel
    Mar 7 '19 at 10:28
  • @Wurtel anyone who's asked a question can accept an answer on their question.
    – roaima
    Mar 7 '19 at 11:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.