Raspi on QEMU: system does not fully support snapd

Hey y’all,
I’m trying to figure out how to build an armhf version of a Python snap (since, ya know, cross compilation isn’t implemented for Python). So I spun up a Raspbian image on QEMU, but when I went to install snapcraft, I got this error.

pi@raspberrypi:~ $ sudo snap install snapcraft
error: system does not fully support snapd: cannot mount squashfs image using "squashfs": mount:
       /tmp/sanity-mountpoint-511874327: unknown filesystem type 'squashfs'.

Here’s the command I’m using to run Raspbian:

qemu-system-arm -kernel /home/wnilges/Downloads/qemu-rpi-kernel-master/kernel-qemu-4.19.50-buster -cpu arm1176 -m 256 -M versatilepb -serial stdio -append "root=/dev/sda2 rootfstype=ext4 rw" -hda /home/wnilges/Downloads/armemu/2020-05-27-raspios-buster-lite-armhf.img -no-reboot -dtb /home/wnilges/Downloads/qemu-rpi-kernel-master/versatile-pb-buster.dtb -net user,hostfwd=tcp::5022-:22 -net nic

I got to it with the help of this article and this article

I guess it doesn’t like the way I’m mounting it?

I tried installing squashfuse but that didn’t work. Any ideas?

One possible consensus is that the custom kernel I’m using doesn’t support it.

Why are you using Raspbian in the VM to build the snap? Why not use ubuntu?

But yes I assume your kernel config is to blame here

I couldn’t figure out how to get an armhf version of ubuntu working. That’d be a better solution if you know how to do that.

here is a universal Ubuntu Core image running on all pi’s from pi2 onwards:

http://cdimage.ubuntu.com/ubuntu-core/18/stable/current/ubuntu-core-18-armhf+raspi.img.xz

run through the setup wizard … ssh in … then:

snap install lxd
sudo lxd init # just answer all questions with enter
sudo lxc launch ubuntu:18.04 bionic
sudo lxc shell bionic

now you can snap install snapcraft … git clone your repo and build it with snapcraft --destructive-mode

alternatively you can use fabrica:

(will be slow on a pre-pi4 model indeed)

Does this work with classic confinement and everything? And, does Fabrica compile for any platform?

the lxd container is a fully fledged classic ubuntu with full snap support, no limits here …

fabrica only builds for the used host architecture currently (it does just the git checkout and runs snapcraft in the tree inside an lxd container, similar to what i described as manual process above)

1 Like

Sorry, I’m a little confused. Are you saying that I should emulate the core18 image? Do you have a command for that?

no, just flash it to an SD card and boot … :slight_smile:

EDIT: argh … sorry … i didnt really get that you are not actually using a pi the qemu pi emulation is rather a joke … i wouldnt bother with it and invest the 25€ to buy an actual pi2 or 3

Oh, I think you misunderstand, I’m emulating because I don’t have an ARM board to build with. That’s why I’m not using ubuntu, because I couldn’t figure out how to get an armhf version of it to run on QEMU.

you could try this though:

Unfortunately, I can’t do that, it’s proprietary software.

I think that all I need to get ubuntu working on qemu is an armhf kernel. Know where I can find a standard precompiled one?

Well, then my best recommendation still stands … get a Pi4 … a good USB 3.1 SSD (sandisk extreme shows very good results here) and use snapcraft (or fabrica) as i described above … cross building with snapcraft is possible (i do it all day for kernels and gadgets) but as soon as you have anything that requires dependencies it gets extremely painful

also note that the slowest pi will still be 10x faster and 10x more reliable than using any of the qemu armhf VMs available …

1 Like

Why does there have to be so much cool stuff to work on in the world, yet so little time? It’d be awesome if someone could get this working well!

Then again, the need for this was spawned by the fact that you can’t cross-compile with the Python plugin, so that’d probably be higher priority.

Hello @willnilges sorry for jumping late actually i got notification summary in my mail, I had worked on ubuntu core some time ago & i had similar issue to build snaps for armhf snap, As @ogra suggested for native build (build on host) we should good to go with Pi or similar SOC having armhf architecture.
I was having Pi-3B+ board with 1Gb RAM where i was struggling with the speed to create kernel or gadget snap and SOC also got heated.

At that time i had done some workaround for this issue may be this will help -

  1. I used docker concept here, i have pulled armv7/armhf-ubuntu(Xenial) image from docker hub.
  2. Attaching docker file for your help -

FROM armv7/armhf-ubuntu:xenial

COPY qemu-arm-static /usr/bin/

ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8

RUN apt-get -y update && apt-get -y install --fix-missing
RUN apt-get -y update && apt-get -y install wget git build-essential python3-pip
RUN apt-get -y install snapcraft
RUN apt-get -y install sudo

CMD ["/bin/bash"]

Once image is install run the container with volumes( sharedir b/w docker container and host machine: ubuntu 18.04 LTS )

this will sadly give you a completely outdated snapcraft (which is why i never propose the qemu-user-static package (that package ships a qemu-debootstrap command btw, using that saves you from the extra “cp qemu-arm-static …” command you are doing above))

snaps can not run in chroots, so you can not use the latests snapcraft (iirc 18.04 is somewhere at 2.x while the snap is right now at 4.0) and will be missing features/have to have incompatible snapcraft.yaml’s …

Thanks for your valuable information :slight_smile:

@ogra diverting from the main topic, i have one query actually i am facing an issue when i try to install an application snap in Ubuntu classic, i shipped this application snap in the server image and try to install this from rc.local file.
But it through an error that unable to install snap due to bad permission, contact developer where as same is successfully installed manually.

May me you can point me any docs and any idea to figure out the real root causes.

I appreciate your support :wink: