-
-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider support for Flatpak/snapd #2766
Comments
Any updates towards this milestone? I'm eager to have this. |
I just wrote a simple script which makes snappy installs persistent over reboots in app VM's. |
@maximilize looking at your script it seems enough to make some directory persistent using bind-dirs. For example
This doesn't handle |
The mount files are created by snap during app installation. Here a script to recreate the systemd mount files: #!/bin/bash -e
cd /var/lib/snapd/snaps/
while read app revision; do
cat >/etc/systemd/system/snap-$app-$revision.mount <<EOF
[Unit]
Description=Mount unit for ${app}, revision ${revision}
Before=snapd.service
[Mount]
What=/var/lib/snapd/snaps/${app}_${revision}.snap
Where=/snap/${app}/${revision}
Type=squashfs
Options=nodev,ro,x-gdu.hide
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl -q enable snap-$app-$revision.mount
sudo systemctl -q start snap-$app-$revision.mount
done < <(ls *.snap | cut -d'.' -f1 | sed 's/_/ /') |
Here my final solution: https://gist.github.com/maximilize/6070958a08246f7a849379a9d530faa9 It would be great to see a system like this integrated into qubes. With snap, it is possible to install new persistent apps in AppVM's, without the need to touch the template. |
I've packaged it here: https://github.com/QubesOS/qubes-app-linux-snapd-helper
Debian packaging on the way. |
Awesome, thanks for integrating it so quickly! |
Take a look at it, especially if you're ok with GPLv2+ license (right now only mentioned in rpm file, need to add actual license file). |
Sure, GPLv2 is fine. I already checked your code, it all seems to be good. |
For now only to R4.0 QubesOS/qubes-issues#2766
Package uploaded to current-testing repository for R4.0. |
It may be useful to create AppVM-specific menu entries in AppVM itself. It may be an application installed there (in /usr/local, or using snap QubesOS/qubes-issues#2766), but it may be also some user custom shortcut. To support this, dom0 will accept menu entries also from TemplateBasedVMs. But to avoid duplicates, qubes.GetAppmenus service should send only menu entries actually stored in that VM, not inherited from its template. To distingush them, first check what type of persistence this VM has (from qubesdb-read /qubes-vm-persistence). If it's rw-only, send only entries stored on /rw. To make it more robust, use $XDG_DATA_DIRS and $XDG_DATA_HOME to discover directories, instead of looking only for /usr/{,local/}share/applications. This makes snap and flatpak handled for free. Fixes QubesOS/qubes-issues#4152
This sounds really good. I'd just like to mention that the ability to install in /rw per-user comes with the downside that persistent malware can reside there. This should be mentioned when documenting the feature. As an alternative, it may be possible to have templates configured for a separate snapd/flatpak volume that is read-only to appvms. (Maybe they could even be shared between templates, at least in snap's case - although I'm not sure if this is a great way to save resources.) Otherwise, simple installation into template root is the better and more Qubes-like policy. |
Note for other people as dense as I was today: You're supposed to install qubes-snapd-helper package in the template vm, to be able to install snaps in derived vms. Cheers. |
@maximilize The reason I ask is that some packages are now only readily available as snaps, so there is a use case where the user simply wants to use snapd because software is not available via default apt or dnf repos. In this case, the software stays in root and is therefore more secure than if it resided in /rw. |
@marmarek is there any documentation how to use this |
I had a fedora template reliably hang while trying to apply (dnf) updates during some flatpack step. I had to go in and kill some flatpack process for the VM to be able to proceed with updates. Unfortunately I don't remember the details of exactly what the process was and what it was blocked on, and I don't have an old template with the same behavior lying around to reproduce, but figured I'd mention it anyway. It was reproducible at the time though (trying to update would hang every time, until I finally helped it past that step by killing the process). |
Like #4466 ? I've seen that too. I haven't managed to reproduce it reliably, but it looked like waiting for some network data. Which is weird, as templates don't have normal network interface (nor flatpak is configured to use updates proxy), so it should fail immediately with "no route to host" error. Back to the topic of this issue, flatpak generally should work fine in TemplateBasedVM as long as I've updated description to include those steps. |
Yes, IIRC exactly that. |
Back to the topic of this issue, flatpak generally should work fine in
TemplateBasedVM as long as `flatpak install --user` is used.
I can confirm it. It works well for me. I see two pitfalls:
* You have to add repositories with --user, too. I am not sure if repositories added without --user are used when installing with --user, but even if they are, they obviously won't survive reboot unless they are in the template.
* If you accidentally use sudo with --user, you obviously install the app for root, not for user. While this looks quite obvious, it took some time to realize it.
So, when you just copy a command from some howto, you likely need to both add `--user` and remove `sudo `.
|
@marmarek Never mind my comment above. For future reference/others - it seems all you need to do is to (for Fedora based VMs):
WARNING My problem was caused by symlink |
I've used the instruction above to install 2 programs using snap (slack+freeplane): Unfortunately, it happens on a regulary basis (weekly), that starting these apps results in the following error: After that the progs are not startable anymore. The same error is shown. Restart doesn't help. The workaround is to re-install the snap programs. Unfortunately, with this you lose all settings of the progs. Any suggestions or ideas? |
I noticed that my issue reported above disappears if I disable connections to api.snapcraft.io
|
Following the instructions from @ioleo worked like a charm for Signal Messenger. I successfully installed it to a current Fedora 30-based AppVM. Thank you. Note that when installing Now let's see if I run into the same issues as @100111001. For now I'll allow connections to api.snapcraft.io. |
Include instructions for installing snapd and qubes-snapd-helper from issue #2766 (QubesOS/qubes-issues#2766) based on the instructions from @ioleo that worked for me.
@heinrich-ulbricht have you experienced the same issue I described? I faced it again on 2 different machines. At the one with access to api.snapcraft.io slacks and other apps stop starting from time to time and I have ro reinstall them (via snap). At the other with blocked access to api.snapcraft.io no so such issue appears. |
@100111001 I had no problems since installing Signal Messenger on my machine. So far it just works. |
I'd like to try to narrow it down to a root cause. I'm using:
@heinrich-ulbricht could you provide your system details? |
I remember similar issues with snapd, although I don't have exact description. As far as I have remember, even `--classic` snaps (namely Powershell) have those issues.
|
Since I'm only using one snap so far (Signal Messenger) I might be of limited help here. But we can try :) |
The `--classic` option is required by some snaps and it disables sandboxing. As I can read at https://snapcraft.io/signal-desktop[https://snapcraft.io/signal-desktop] , Signal messenger doesn't require it, so you probably don't use it, unless you have explicitly (and probably knowingly) specified this option.
|
Sorry if this is a stupid question (just getting started with Linux): After installing qubes-snapd helper in the Fedora Template VM (and rebooting), am I supposed to be able to invoke "snap" in the App VM? (command not found). Am I also required to snapd in the template VM? |
Yes, you also need to install |
@100111001 I have the exact same problem. This time when I restarted, it was /var/lib/snapd/snaps/spotify_42.snap that was removed. when I try to run it, I see
Everytime I start my VM, I see a random number of
showing which snap install broke this time. Does anyone have a solution to this problem? This has really be impacting my work, snaps are randomly broken constantly. Notes: I'm running qubes 4.0.3 with debian appvms, and most of these packages do require --classic to function. |
Do you have
Check at both times when application is working and when it just broke.
|
@marmarek
Any idea why this isn't properly being linked automatically? What can I do to fix this? It also doesn't look like /snap exists in /var/lib/snapd, I wonder why that is
Idk if this matters, but I installed snap on the template, is that what's causing this issues? I installed the actual snap packages on the appvm |
I missed you said Debian VM - there /snap is supposed to be a directory, not a symlink. |
Oh shoot, gotcha. I've got qubes-snapd-helper on the template. Very strange that it's happening on all my cubes. Maybe I'll try creating some fresh qubes from scratch and see if it's still an issue. Thanks anyways mate! |
Does anyone have a solutio
Does anyone have any solution to this? This happens when I start new containers for both debian and fedora. Packages will almost always break within 1-3 restarts of the appvm. Is there a way that I can stop this from happening? |
I haven't checked the suggestion from Marek (#2766 (comment)), yet, as this issue happens now less often. But from time to time my slack breaks the same way. My latest hypothesis is that it's a concurrency issue during start of the AppVM, because sometimes when this error occurred, it could be solved by rebooting the AppVM. As soon as I couldn't resolve this after the 3rd reboot, I re-installed the (slack) snap. It's not really a solution, but at least 2 workarounds which work for me. |
Once again it happened that a snap was missing after a restart of the VM everything works again. Both
and
show the same result not depending on whether snap is working or not. Looking forward to support in further investigations. |
Trying to execute the snap application at command line results in: cannot perform operation: mount --rbind /dev /tmp/snap.rootfs_Sfyhgj//dev: No such file or directory After a restart of the AppVM, the snap starts like a charm. |
Additional observation: Since it happened again that my snap refused to start, I checked the directory |
Hello there, couple questions on flatpak/snap usage here. Let's take for granted the usage of the following apps: session-desktop, riseup-vpn, signal-desktop; which distributes themselves as snap images through snap default repositories. Let's take for granted that only
Basically: would you recommend to QubesOS users to use snap/flatpak? I am still not convinced about flatpak/snap and am looking to have my mind changed. Thanks EDIT:
|
FYI, @micahflee has just published "Qube Apps: a Flatpak-based app store for each qube", which looks very cool and might be of interest to folks here. |
Both Flatpak and Snapd can be eused alogside of usual package managers. Flatpak seems to be more interesting, because it supports per-user installation. So, if you need a specific app in one VM (e.g., Skype or Spotify), you can install it there without affecting the template and without cloning it. Snapd does not seem to (currently) support it.
For snapd support, it should be relatively easy:
For basic support of Flatpak, it is the same:
For user installs, it might be a little harder:
Related discussion: https://groups.google.com/forum/#!topic/qubes-users/VDs-5y6tUlI
The text was updated successfully, but these errors were encountered: