Flatpak integration in Qubes OS templates

This looks like you’re running it in a fedora-40 qube which should be your template. If you’re not running it in a template then say it like this:

its running in an app qube based on fedora-40 template

yes, i stand greatfully corrected in my poor language, yet i am indeed running in an app qube based on fedora-40 template

i did download the freetube as said however it not play videos, i went onto another app qube and went on Amazon to watch a video about a product and that not play either so i think im missing something that permits videos to play such as streaming freetube etc would you perhaps know what that could be please?

Solene, you are a hero!

1 Like

This is very neat! I hope Qubes OS add your feature as built in out of the box.

I also had to do this, but followed the initial instructions exactly I thought?

Is it possible something in the initial guide needs to be different or is this an error with something I have done?

Interesting. I will give this a try in a template. I have currently been using flatpaks with the --user tag and set them to update automatically via a script I made, to execute in each appvm . First I installed the flatpak program in the template (sudo apt install flatpak) which then persists over each appvm connected to that template. And then on each appvm, I made this script:

#!/bin/bash

# Define directories and files
log_dir="$HOME/.local/share"
config_dir="$HOME/.config/systemd/user"
service_file="$config_dir/flatpak-update.service"
timer_file="$config_dir/flatpak-update.timer"

# Step 1: Create required directories
mkdir -p "$log_dir"
mkdir -p "$config_dir"

# Step 2: Create the flatpak-update.service file
echo "[Unit]
Description=Update Flatpak apps every 1 hour

[Service]
Type=oneshot
ExecStart=/bin/bash -c '/usr/bin/flatpak --user update -y > $log_dir/flatpak-update.log 2>&1'

[Install]
WantedBy=default.target" > "$service_file"

# Step 3: Create the flatpak-update.timer file
echo "[Unit]
Description=Run flatpak update every 1 hour

[Timer]
OnBootSec=0
OnUnitActiveSec=1h

[Install]
WantedBy=timers.target" > "$timer_file"

# Step 4: Enable and start the timer
systemctl --user enable flatpak-update.timer
systemctl --user start flatpak-update.timer

echo "Flatpak auto-update setup completed!"

I have only been running this for a few days so I can’t say how it works long term but everything seems ok so far, although it probably isn’t as good as your idea as my script still requires booting the appvm’s for it to update. I will try your method. I am not very good at scripts and it took me ages to make this with a lot of thought on how to actually go about it and scripting itself, but if your way works better I will go with that!

Solene, your scripts work really well. I have just done them on my templates and it’s great. The only thing is that when I install a flatpak I get this: Warning: While downloading http://ciscobinary.openh264.org/libopenh264-2.5.1-linux64.7.so.bz2: While fetching http://ciscobinary.openh264.org/libopenh264-2.5.1-linux64.7.so.bz2: [6] Couldn’t resolve host name
Installation complete.

But everything still works perfectly so I don’t know if that is important or not?

I am only using debian templates if that makes any difference.

ah, can you also define the variable http_proxy ?

The cisco repository is using http and not https, so we need to give it a http proxy

1 Like

hello solene. I am not quite sure what you are asking? I am quite new to qubesos so still have a lot of learning to do on it! I am guessing you want me to input export http_proxy="http://127.0.0.1:8082/" into the proxy.conf in
/home/user/.config/environment.d/ ?

I just want to make sure I have that right before going ahead!

Ah, as you followed my guide, you should already have this in the file:

https_proxy=http://127.0.0.1:8082/

replace https_proxy by all_proxy and restart the qube to be sure it’s changed

2 Likes

Thank you solene everything works perfectly now!

Solene
I have just updated the templates in the qubesos updater and non of the flatpaks was updated. There are flatpak updates available because if I go into the terminal of the templates and type in flatpak update then it shows a few flatpaks that are ready for updates. So it seems like the automatic function is not working.

The flatpaks are installed on debian and kicksecure templates if that makes any difference.

It seems like the 05-flatpak-update.sh file in the /etc/qubes/post-install.d directory is not executable as it is not in green, and its permissions with ls -la are -rw-r–r-- while the other green executable files are -rwxr-xr-x. Also, when I input (within the directory) sudo ./05-flatpak-update.sh it just doesn’t work. I have tried to sudo chmod -x it a few times but nothing changes. Strange…

UPDATE:
I think I might be a moron. I was not using the correct command for chmod. I was using - instead of +! Let me see if this works

yes I was stupid. Sorry about that Solene. It was my fault for not making the updater file executable. So will I now have to wait until the system needs an update or should it automatically show up in the qubes update tool?

Indeed you need to run chmod +x

I’ve been keeping track of my updates for the past few months and have only realized a 35% success rate of automatically updated flatpaks when updates were available. The remainder I had to update manually after Qubes update of the template failed to recognize that flatpak updates were available. Is this expected? If not, where should I look for a failure in my setup? My 05-flatpak-update.sh file is executable, so that’s not the problem.

Solene I have made it executable now but the qubes update tool is not showing that anything needs updating. Do I have to wait until the system or apt packages need to be updated for the qubes update tool to notify me that an update is needed which then bundles in the flatpak updates at the same time?

Could you share the logs ?

The flatpak updates will only trigger when there is an update. It could be possible to add some update check in the appvm, but I don’t remember how to do this.

Ok Solene I will wait until a system update is available and I will let you know how things go. As far as updating in the appvm, would this work?

#!/bin/bash

# Define directories and files
log_dir="$HOME/.local/share"
config_dir="$HOME/.config/systemd/user"
service_file="$config_dir/flatpak-update.service"
timer_file="$config_dir/flatpak-update.timer"

# Step 1: Create required directories
mkdir -p "$log_dir"
mkdir -p "$config_dir"

# Step 2: Create the flatpak-update.service file
echo "[Unit]
Description=Update Flatpak apps every 1 hour

[Service]
Type=oneshot
ExecStart=/bin/bash -c '/usr/bin/flatpak --user update -y > $log_dir/flatpak-update.log 2>&1'

[Install]
WantedBy=default.target" > "$service_file"

# Step 3: Create the flatpak-update.timer file
echo "[Unit]
Description=Run flatpak update every 1 hour

[Timer]
OnBootSec=0
OnUnitActiveSec=1h

[Install]
WantedBy=timers.target" > "$timer_file"

# Step 4: Enable and start the timer
systemctl --user enable flatpak-update.timer
systemctl --user start flatpak-update.timer

echo "Flatpak auto-update setup completed!"