I'm unable to remove package.

[sudo] password for admin: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 173 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 143102 files and directories currently installed.)
Removing webmin (1.900) ...
dpkg: error processing package webmin (--remove):
 cannot remove '/usr/share/webmin/qmailadmin/stop.cgi': Bad message
Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)

When I looked in to the permissions, I see the following:

ls: cannot access '/usr/share/webmin/qmailadmin/stop.cgi': Bad message
total 16
drwxr-xr-x   2 root root  4096 Jan 29 21:50 .
drwxr-xr-x 111 root root 12288 Jan 29 20:54 ..
-?????????   ? ?    ?        ?            ? stop.cgi

How to fix this.

  • 1
    Please show the output of mount to allow more detailed answers. – Bodo Jan 30 '19 at 16:53

Try to umount the file system that contains the corrupt file and check it with fsck (or probably e2fsck, depending on your file system type).

If you cannot umount the file system because it's in use, you might have to boot a live system from CD/DVD/USB to do the fsck

  • I already did fsck. No luck so far. – Mov Jan 30 '19 at 17:03
  • 1
    @Mov Did you unmount the file system for fsck? Maybe you have to force the check. Please show the fsck command and its output in your question. ...and the mount output as already suggested. If you unsuccessfully tried other things, add this information to your question. – Bodo Jan 30 '19 at 17:11
  • I did force fsck at boot and rebooted the system. and no errors reported at that time. AFAIK, at the boot time, when you run fsck, filesystem is always in unmounted state. I assuming you are not referring to the single user run level after the boot. May be I need to nuke the filesystem? – Mov Jan 30 '19 at 17:19
  • 1
    Please add all important information to the question. This way it's easier for everyone to understand the problem. You could try to boot a live system and see if it shows the same problem for the affected file and if yes try to run fsck from there. If you only write what you did without showing the exact command and output it is not possible to check for errors or give hints for better commands. – Bodo Jan 30 '19 at 17:45

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.