Build snap package in Qubes OS AppVM

36 views Asked by At

I tried to install snapcraft in a Qubes OS AppVM using the instructions on this page, but it failed because after rebooting the AppVM (to force a user logout), I get:

[user@docker ~]$ lxd init --minimal
Error: Failed to connect to local LXD: Get "http://unix.socket/1.0": dial unix /var/snap/lxd/common/lxd/unix.socket: connect: no such file or directory

and in fact the group lxd that was added before rebooting has disappeared.

1

There are 1 answers

0
Robin Green On

Because an AppVM doesn't have a persistent root, and it seems the user can't log out without restarting the AppVM, which loses some persistent changes such as the group just added, we need to make some slight alterations to the instructions.

  1. After installing snapd, snapcraft and lxd, restart the AppVM
  2. snap disable lxd
  3. snap enable lxd
  4. sudo snap start lxd
  5. sudo useradd snap. The second and subsequent times that you do this after a reboot, you will get a warning that the home directory already exists. This is expected and can be ignored.
  6. sudo usermod -a -G lxd snap
  7. sudo su - snap
  8. lxd init --minimal
  9. mkdir my-project
  10. cd my-project
  11. snapcraft init
  12. snapcraft
  13. Wait a while for the build to succeed or fail. At this point, the container fails while waiting for the network to come up (check the log file provided to confirm this). It turns out that something has brought down the AppVM's virtual ethernet card, so we need to bring it back up. Open a new terminal tab, and in that tab, type sudo /usr/lib/qubes/setup-ip add eth0. You will get a warning RTNETLINK answers: File exists. This can be ignored.
  14. Switch back to the other terminal tab, and try the build again: snapcraft.

You will have to repeat these instructions (except steps 9 and 11) every time you restart the AppVM.