How to completely remove flatpak

37,027

Solution 1

I'm assuming you didn't uninstall the run times that flatpak applications require. I would recommend reinstalling flatpak and running the following commands:

flatpak uninstall --unused

sudo apt-get remove --autoremove flatpak

sudo apt-get purge flatpak

This should erase the majority of the files left behind from flatpak. I had around 4000 after trying it out. I decided it wasn't for me and had to look for a few hours to find a way to remove the majority of the files. These three commands had reduced nearly 4000 files that dealt with flatpak to 197.

Hope this helps.

Solution 2

Flatpak applications and runtimes aren't removed when you uninstall the flatpak package using apt.

I'd rather reinstall flatpak, use it to remove any leftover Flatpak packages, and then purge it. On Ubuntu 20.04 Focal:

$ sudo apt install flatpak
$ flatpak uninstall --all
$ sudo apt purge --autoremove flatpak

You can look at /var/lib/flatpak/ to check that everything has been removed. You may also need to reboot or logout/login to update application launchers.

Share:
37,027

Related videos on Youtube

Ntakwetet
Author by

Ntakwetet

Updated on September 18, 2022

Comments

  • Ntakwetet
    Ntakwetet almost 2 years

    I have removed flatpak with sudo apt-get purge flatpak; however, if I run locate flatpak I find several files and several directories. Can I remove them all with rm -r or there is a "better" way? If so, how do I have to do that?

    Edit

    Since my output is 21909 rows long and, as @mook765 noted, nobody will ever be so crazy to read them all I think I should reformulate the question as follows: if I had a normal installation of flatpak, what would be the best way to remove it and all its files and folders?

    • Admin
      Admin almost 5 years
      Nope, your way will work fine.
    • Admin
      Admin almost 5 years
      You shouldn't do that! Without seeing the output of your command locate flatpak it's impossible to give better advice.
    • Admin
      Admin almost 5 years
      Do I have to add the full output of the command? It is 21909 rows. Note that I just want to remove every file and directory left by flatpak...
    • Admin
      Admin almost 5 years
      That's a lot. Remove them on your own risk. No one of us will go through 21909 rows of output...
  • Milan Kerslager
    Milan Kerslager about 4 years
    flatpak uninstall --all