Hi
I have a LXD container for building my projects and snaps packages. in this container a have installed snapcraft from the snap-store.
but when i try build snap package a have errors because my KVM system already used and LXD is running because i try deploy LXD containers in LXD container O_o ))
So the only way to build a snap is to use a build without virtualization or containers.
How to build snap package without multipass and lxd ?
root@crack-gnu:~/worker/Linux/LinuxBuilder/QuasarApp/CQtDeployer# snapcraft
Launching a VM.
Build environment is in unknown state, cleaning first.
Name: snapcraft-app
State: Stopped
IPv4: --
Release: --
Image hash: 7c5c8f24046c (Ubuntu Snapcraft builder for Core 18)
Load: --
Disk usage: --
Memory usage: --
launch failed: The following errors occurred:
kvm version too old
qemu-system-x86_64: failed to initialize KVM: Inappropriate ioctl for device
snapcraft-app: shutdown called while starting
An error occurred with the instance when trying to launch with 'multipass': returned exit code 2.
Ensure that 'multipass' is setup correctly and try again.
Why are you starting a container and running snapcraft inside that, rather than letting snapcraft handle the container spawning?
If you really want to not use snapcraft’s lxd or multipass support then you can use --destructive-mode, but be aware that this will install all the build-packages onto the system that is executing snapcraft (in your case the container).
Why are you starting a container and running snapcraft inside that, rather than letting snapcraft handle the container spawning?
Because sometimes I have situations when I need to transfer my build machine to other servers. In addition, the use of a container solves the issue of backup.
This helps to save time since I do not need to set up everything in case of relocation or technical failure.
If you really want to not use snapcraft’s lxd or multipass support then you can use --destructive-mode, but be aware that this will install all the build-packages onto the system that is executing snapcraft (in your case the container).
in truth, now I’m more interested in how to solve the question that multipass arises when trying to use KVM. What else is this error and why is the KVM version provided by the digitalokean service too old?
kvm version too old
qemu-system-x86_64: failed to initialize KVM: Inappropriate ioctl for device
sudo is required to succeed. You also need to restart your container for the device change to take effect:
lxc restart linuxHostBuilders
Once you’re sure the device is correctly exposed, run kvm-ok inside your container to verify whether kvm support is functional (ideally you’d also run this on your host to verify there as well because if it doesn’t work on your host then no amount of forwarding into containers will work).
Although, thinking on this… if you’re using LXD via the Snap Package (I suspect this is the only way to get it these days) then the kvm device is likely prevented from being accessed by the cgroups and apparmor rules that snapd puts the LXD processes under.