As expected from Linux, there is no graphical user interface for this, so we have to just figure out how to do it based on what random people say on the Internet.
Resetting Permissions
If you want to reset only the permissions, that has to be done through Flatseal. There's a "Reset" button in the window's titlebar that resets the permissions settings for the selection flatpak.
Resetting the User Data
If you want to keep an application, but just reset the user data, it seems you can do it by deleting the flatpak's data that's directory descendant of the user's home directory.
[...] It's so easy, probably no one thought a command would be needed for it. You just delete the app's folder in ~/.var/app/.
https://www.reddit.com/r/flatpak/comments/tbualg/looking_for_a_command_to_reset_app_data/ (accessed 2024-10-24)
That's right, there's not flatpak
command for this because it's "so easy." Let's take a look at how "easy" this is.
Via GUI
To delete your user data, follow the following steps:
1: make sure that the flatpak application that you want to reset isn't running. If it's running, it's possible that it will try to save the user data it currently has loaded when you close it, which will make all the next steps meaningless.
2: open Nemo (Mint's file manager) and go to your home directory.
You won't find the .var
directory in your home directory because Nemo hides dotfiles by default. They're called "hidden" files in some applications by convention, despite their original purpose not being that.
3: click on View -> Show Hidden Files on the menubar (keyboard shortcut: Ctrl+H) to be able to view these files and folders.
4: navigate to .var
and then to the subdirectory app
.
Alternatively: press Ctrl+L to type the filepath in your address bar, type ~/.var/app and press Enter.
You should see a separate directory for each flatpak you have installed. Unfortunately, none of them actually have the name of the flatpak, instead their filenames are a text code used to uniquely identify flatpaks by programs that deal with flatpaks.
For examples, Bottles' directory seems to be com.usebottles.bottles
.
5: figure out what's the name of the flatpak you want to delete.
If it's not obvious, and there are reasons why it wouldn't be obvious (e.g. the application used to be called one thing, but changed names and couldn't change the identifier because if it did everyone would lose their user data), you can discover the identifier of the flatpak by its normal name following the following steps:
5.1: open the start menu in Linux Mint and type the name of the application you want to delete.
5.2: right click on the application's icon to reveal its context menu (which on Cinnamon strangely slides under it).
5.3: click on "Properties" in the context menu to show the "Launcher Properties" dialog window.
5.4: the command field should say something like:
/usr/bin/flatpak run --branch=stable --arch=x86_64 --command=rssguard io.github.martinrotter.rssguard
The --command=rssguard io.github.martinrotter.rssguard
indicates the identifier of the flatpak, in this case, RSS Guard's identifier would be io.github.martinrotter.rssguard
.
6: select the folder associated with the flatpak and rename or delete it.
I recommend renaming it first, just in case things go wrong. because then you can just un-rename it.
7: open the flatpak application. It should be reset to its factory settings.
I've tested this with NewsFlash when I writing its review and it worked.
Observation: when a flatpak is installed, it doesn't create its user data directory for all users, which means the directory is only created when you launch the application. Flatpak is a sandboxing method. Presumably, the flatpak system itself is responsible for initializing this directory, so you don't need to worry about applications that may crash because they forgot to initialize the directory. It's also unlikely that an application stores configuration data elsewhere on your PC because that would defeat the purpose of flatpak, so removing this folder probably removes everything.
Via the Terminal
Warning: I don't recommend doing this via the terminal because you'll need to delete a directory, and there are few things scarier on Linux than deleting a directory via the terminal.
2: execute cd ~/.var/app
to go to got to the directory. This step isn't necessary, but it may minimize potential damage.
3: rename the directory named after the flatpak's identifier using the mv <old name> <new name>
command, or delete it with rm -r <name>
.
For example, to rename RSS Guard's directory appending .old
to its name, we could use:
mv io.github.martinrotter.rssguard io.github.martinrotter.rssguard.old
Uninstalling and Deleting the User Data
By default, if you uninstall a flatpak, e.g. through the Software Manager, it doesn't delete the flatpak's data. This means if you install and uninstall an infinite number of flatpaks, theoretically you'll run out of hard disk space one day (if your hard disk doesn't stop working first) as their forgotten user data accumulates.
It's possible to uninstall a flatpak AND delete the user data, through a terminal command. For this, you would take the flatpak's identifier and open the terminal (as we've seen above how to do these two things), and then, if, for example, if you wanted to remove RSS Guard (whose identifier is io.github.martinrotter.rssguard
), you would run1:
flatpak uninstall --delete-data io.github.martinrotter.rssguard
Why is this option not available in the Software Manager? I don't know, ask whoever developers the Software Manager. Is it the Linux Mint team? I honestly have no idea.
If you're asking yourself why is this option not documented when you run flatpak --help
, that's because this option is documented when you run man flatpak uninstall
and somebody didn't think they had to put it in --help
as well, or even mention they had more information in the manual áge, leading you to think that perhaps the "Application Options" that shows in --help
is an exhaustive list of options when it's not.
In the manual, it says this by the way:
--delete-data
Remove app data in ~/.var/app and in the permission store.
So, in case it wasn't clear before, --delete-data
doesn't only delete the user's data created by the application, it also deletes the permissions data created by flatpak.
Does deleting the app data in ~/.var/app
delete the permissions? I assume this means it doesn't, because they're stored elsewhere.
Leave a Reply