How do I remove a user from the dpkg-statoverride file?

8,256

You can try this:

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

Should remove the user from statoverride and give you access to install again

Share:
8,256

Related videos on Youtube

blanket_cat
Author by

blanket_cat

Updated on September 18, 2022

Comments

  • blanket_cat
    blanket_cat over 1 year

    Tried to install a package after deleting some servers I no longer needed, and removing the deleted software package's users and groups. Went to fetch and install a new package, and got the following error.

    user@localhost~$ sudo apt-get install any-package
    
    ... package installation output omitted for brevity ...
    
    dpkg: unrecoverable fatal error, aborting:
    syntax error: unknown user 'puppet' in statoverride file
    E: Sub-process /usr/bin/dpkg returned an error code (2)
    

    So /usr/bin/dpkg-statoverride has an option to remove a path, but the binary throws the same error when I try to run it out side of the whole apt-get install context.

    So then I just added the user puppet, and i can download packages again, but I'm trying to remove any extraneous elements from my dev system, so as far as I'm concerned, this isn't a solution just because it works.

    As far as I can tell, the statoverride tells the package manager to install certain stuff to a certain path, and messes with the setuid flag, so potentially, it could be opening up a bunch of security holes by installing programs co-owned by an unused user and group. Is there a reason dpkg-statoverride isn't updated with the rest of the system when a user is removed? And is there a way to circumvent this so that I don't have to :adduser -> install -> deluser: everytime I want to install a package?

  • blanket_cat
    blanket_cat over 9 years
    Worked, thank you. I will come back and upvote you once I have enough rep to upvote. Didn't realize that /usr/bin/dpkg-statoverride was reading data from /var/lib/dpkg/statoverride, for some reason I thought it was written in the elf file. Also found user www-data from apache2 which is no longer installed, in the statoverride file. I'm still really curious as to why some programs, all removed with the --purge flag, leave remnants of configurations, but others don't.
  • itnet7
    itnet7 about 7 years
    This did remove the line containing the user, but in the output when I ran the install again, I now received the following: dpkg: unrecoverable fatal error, aborting: statoverride file contains empty line. I just hand edited it and removed the blank line, and was then able to successfully install my package.