41

I had an application installed on my htpc running ubuntu server called mediatomb, a few months ago I uninstalled it and replaced it with a Plex install. At the weekend when querying existing users on the machine I noticed that the mediatomb user and group still existed so I used the command

sudo deluser mediatomb

to remove the user. A day or so later I went to install htop sudo apt-get install htop but I found that I was getting an error:

syntax error: unknown user 'mediatomb' in statoverride file.

I thought I would just be able to open the statoverride file using nano and edit out any references to mediatomb but I wasn't able to open the file correctly using nano. I ran a grep command

grep 'mediatomb' /var/lib/dpkg/statoverride

which returned two locations in the file which don't exist on the system anymore. The only way I am able to get around the issue for now is to re-create the user mediatomb and then everything works fine. Obviously this isn't a good long-term solution.

What I would like to know is, what is the statoverride file and why does it retain users in it which have been removed from the system? Am I removing the users in the wrong or deprecated way?

9 Answers 9

82

I know this question is a little old, but have come across this twice now. Once with puppet, once with virtualbox. It cropped up again and I found something that worked. It's a variation on serverfault.com.

Instead of relying on dpkg-statoverride --remove /path/to/offending/file.ext which, throws the error

dpkg: unrecoverable fatal error, aborting:
syntax error: unknown group offendinggroup in statoverride file

You can get fancy with sed, or you can simply open /var/lib/dpkg/statoverride in your favorite text editor and remove only the lines containing the item(s) that were causing the error. I found that this is a documented bug, for both Debian, and Ubuntu,

That said, I just fixed mine by manually editing out any entry that threw an error, and I am happily downloading packages again. Hope this helps the next person, who visits this number 1 Google search result for this problem.

5
  • Thank you so much! I was just beginning to be worried that I will be spending all of eternity discovering obscure corners of linux world in order to resolve this simple cockup i'd made some days ago. don't know how i managed to do this, but removing that one line from that file fixed the problem. thanks so much for saving me a lot of time! Oct 30, 2016 at 21:08
  • You are awesome! Fixed my issue.
    – Elad Weiss
    Feb 20, 2019 at 13:28
  • The line I removed applied to geoclue. I had recently turned off 'Location Services' in Settings >> Privacy >> Location Services. After removing that geoclue line, I no longer received a fatal error during an update. I also backed up statoverride, just in case.
    – noobninja
    Dec 30, 2019 at 16:58
  • You saved my day, many thanks! Dpkg stucked after I uninstalled netdata with their script. Removing this user from /var/lib/dpkg/statoverride resolved this problem.
    – Rapekas
    Feb 20, 2021 at 16:25
  • MongoDB on Ubuntu 18.04 also causes this issue...
    – MestreLion
    Jun 4, 2023 at 20:55
17

While I can't answer your question as asked I can help you with your dilemma. I experienced the exact same problem you are having after using 'User Accounts' to remove user 'backuppc' - a user I manually configured for backups. Well I scrapped that route but didn't try to remove the user until a couple weeks later (IE - today). I hadn't been experiencing any trouble until Update Manager found and tried to apply updates; the process would fail reading

dpkg: unrecoverable fatal error, aborting:  
 syntax error: unknown user 'backuppc' in statoverride file
W: Waited for dpkg --assert-multi-arch but it wasn't there - dpkgGo (10: No child processes)
E: Sub-process /usr/bin/dpkg returned an error code (2)
A package failed to install.  Trying to recover:

After some searching I found a solution.

x@y ~ $ cat /var/lib/dpkg/statoverride
root postdrop 2555 /usr/sbin/postdrop
root postdrop 2555 /usr/sbin/postqueue
root mlocate 2755 /usr/bin/mlocate
postfix postdrop 2710 /var/spool/postfix/public
backuppc www-data 4750 /usr/lib/backuppc/cgi-bin/index.cgi
root ssl-cert 710 /etc/ssl/private
root crontab 2755 /usr/bin/crontab

Fixed by running: sudo sed -i '/backuppc/d' /var/lib/dpkg/statoverride

x@y ~ $ sudo sed -i '/backuppc/d' /var/lib/dpkg/statoverride; cat /var/lib/dpkg/statoverride
[sudo] password for x: 
root postdrop 2555 /usr/sbin/postdrop
root postdrop 2555 /usr/sbin/postqueue
root mlocate 2755 /usr/bin/mlocate
postfix postdrop 2710 /var/spool/postfix/public
root ssl-cert 710 /etc/ssl/private
root crontab 2755 /usr/bin/crontab

Sorry I'm not able to answer your question, but this was the second result in google so I wanted to put a solution here for people. My answer originated from http://rickfoosusa.blogspot.com/2012/04/howto-ubuntu-unknown-user-in.html.

3
  • 3
    This is the worst approach to the problem. You should instead reinstall/reconfigure the package instead of going around deleting things that are not meant to be deleted.
    – Braiam
    Oct 11, 2014 at 0:30
  • @Braiam, can it be a bug in some package configuration that "forgot" to remove those lines when it should have after a previous upgrade?
    – Matthieu
    Jan 24, 2020 at 10:08
  • @Matthieu if that were the case, the correct solution is to make aware the package maintainer of it, otherwise other users would face the same problem, which could be fixed for all. BTW, it is actually weird this is not caught by the CI systems. Also, this specific instance was fixed.
    – Braiam
    Jan 24, 2020 at 14:26
6

I was getting following error:

dpkg: unrecoverable fatal error, aborting:
syntax error: unknown group "crontab" in statoverride file,
 E: Sub-process /usr/bin/dpkg returned an error code (2)
dpkg: unrecoverable fatal error, aborting:
 unknown group 'messagebus' in statoverride file
E: Sub-process /usr/bin/dpkg returned an error code (2)

Below command solved my apt-get install problem

sudo sed -i '/crontab/d' /var/lib/dpkg/statoverride

You can change the crontab word but keep the '/d' until you can successfully install any apt-get without any syntax error.

root@localhost:~# sudo sed -i '/messagebus/d' /var/lib/dpkg/statoverride
root@localhost:~# apt-get install wifite
Reading package lists... Done
1
  • This worked for me! Thanks. Apr 8, 2020 at 5:50
4

For MongoDB installation issues, such as unknown user 'mongodb' in statoverride file : open terminal then go to : sudo vim /var/lib/dpkg/statoverride

Remove :

mongodb mongodb 755 /var/log/mongodb

Then Re-install mongodb.

2
  • Working solution for mongodb
    – sam
    Jul 18, 2020 at 5:46
  • after 24H struggling this helped me out
    – Tichel
    Feb 1, 2021 at 18:23
2

It is because you may have deleted the user and now dpkg queries /etc/passwd to compare with the statoverride file, it checks that all entries of the statoverride file are in the passwd, and if they are not, issue a warning, which is what is happening.

That is easily fixable if you reconfigure/reinstall the relevant package (in your case it was mediatomb, it can be anything else, luckily Debian (the OS Ubuntu is based on) uses the same username as the name of the project, normally) and it will (re)create the user in the passwd file.

sudo apt-get --reinstall install package

or

sudo dpkg-reconfigure package
2

I got a issue regarding mongo installation.I tried different solutions.But only thing that worked was editing the file manually.

 sudo vim  /var/lib/dpkg/statoverride

So,I removed the mongodb references from there and finally able to install the mongo completely without any obstacle.The error occurred mentioned at below.

dpkg: unrecoverable fatal error, aborting:
unknown user 'mongodb' in statoverride file
E: Sub-process /usr/bin/dpkg returned an error code (2)

Hope this will help someone

1
  • 1
    This was exactly what I've encountered when i try to upgrade from mongo3 to 5. One solution of deletion of mongo advised to delete groupuser, and probably this caused an issue but your solution worked. Thx. Dec 31, 2021 at 0:18
1

When I installed DelugeD, it created a user called debian-deluged. Later on, I changed Deluge config to use another user ID and I removed the auto-created user. This resulted in the statoverride error when installing the package speedometer.

I launched sudo nano /var/lib/dpkg/statoverride and manually replaced the auto-created user with the assigned user-ID and the error was resolved.

0

I had a similar error and fixed it by first backing up the statoverride file and then removing all the lines containing the word postdrop.

Remember to add a new line at the end of statoverride file.

0

Post still relevant in 2023 (Thx :)

I had the same bug after clamav's uninstall

sudo nano /var/lib/dpkg/statoverride

Removing all lines with "clamav" (AND NOT leaving a single empty line in the file) Did the job.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .