How can I recover my home folder after "apt purge" removed all it's contents?

cn flag

I was on my Ubuntu 22.04 cleaning up some unused apps as sudo. Already had removed 3 of them so I ran the following command:

apt-get purge assinador-serpro

It was taking longer than usual when it said that could not remove /home/myuser folder because it was a folder and wasn't empty. Tried to cancel but didn't respond until basically all my home folder files were gone (only remained those that were blocked by some process).

Shouldn't the apt purge only remove config files? How could my home folder be affected by that command??

Also, I cannot recover any of those files, already tried testdisk/photorec, extundelete and ext4magic, none of them found the deleted files.

How could I recover those deleted files?

Ps: my partitions are like this:

/dev/nvme0n1p2: /
/dev/nvme0n1p3: /usr
/dev/nvme0n1p4: /var
/dev/nvme0n1p5: /home
Artur Meinild avatar
vn flag
Sounds like a huge error in the scripts of that package...
Marco avatar
br flag
At least in the newest version of the package, there is no code to remove the homedir. Just restore your files from the backup ... you have backup ? of course you have backup, you are a clever person.
Hannu avatar
ca flag - looks like a very official package, I would expect "more" care of such a package.
vanadium avatar
cn flag
`apt purge` indeed *never* should remove anything from user's home directories. Only systemwide configuration may be removed, and then only with the `purge` command or option. For recovery, you will need to restore from backup. Undelete tools can recover fragments at best.
bpanatta avatar
cn flag
I got 95% backed, but would make life much easier to just restore those files.
I sit in a Tesla and translated this thread with Ai:


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.