Troubles with running iproute2 inside a snap

I have troubles with running this command:

ip link add dev my_eth1 link eth1 type macvlan

from a snap application installed in devmode.

This results in a error:

ip: relocation error: /snap/mysnap/x3/lib/x86_64-linux-gnu/libdl.so.2: symbol _dl_catch_error, version GLIBC_PRIVATE not defined in file libc.so.6 with link time reference

Does anyone know if this is an expected outcome?

The snap has been installed in a Ubuntu Core on KVM.
The same command executes correctly when launched on that system directly from the shell.
It also executes correctly when launched from inside the shell of the snap environment. That is after calling

sudo snap run --shell mysnap.app

It sounds like you may have built your snap on a release of Ubuntu newer than Xenial. Is that true?

Yes. In a 17.10 desktop.

use “snapcraft cleanbuild” on non xenial systems to get proper snaps …

Well, the fact is this. I have a program in Vala. xenial has an older version of valac than the one I use. Precisely, it has package “valac” at version 0.30 and package “valac-0.30-vapi”, while in my development environment I have version 0.36 of both.
So, in my environment, my code builds ok. If I use “snapcraft cleanbuild” it pulls a xenial image and my code does not build.

Someone suggested me to add a part for building valac and its vapi files at the version I need. It sounds a bit hard for me to do that.

How exactly a snap built on a newer system with snapcraft is not a “proper” snap?

snaps run on top of the core snap which is xenial based … so you have to somehow backport vala if you need a newer version …

It’s because of libc. Newer releases of Ubuntu have a newer libc than the one in Xenial. libc typically does a good job of maintaining backward-compatibility (e.g. something built against an older libc often runs fine against a newer version) but the other way often sees breakage: building against a newer libc than that which you run against (e.g. building against the libc on 17.10 but then running against the libc in 16.04, which is what you do in a snap) often does not result in happiness.

1 Like

I succeeded in adding a part for building the newer ‘valac’ and installing it in the host before building the rest and staging and priming it. This way I can build against the libc on xenial, with ‘snapcraft cleanbuild’, and it works.
Thank you for the explanation.

1 Like