tests/lib/prepare-restore: further tweak snapd package purge
On some distros, attempting to purge a package that does not exist may fail.
Make sure we purge snapd only where we know it's preinstalled, but make sure
that there are no signs of snapd on other systems too.
Signed-off-by: Maciej Borzecki <email address hidden>
tests: add workaround for missing cache reset on older snapd
Older versions of snapd did not do a `rm -rf /var/cache/snapd/*`.
Newer versions of snapd create /var/cache/snapd/aux which means
that `dpkg --purge snapd` may fail after a re-exec. We need to
think how to fix that.
However to unblock tests we should add this workaround.
ubuntu: disable -buildmode=pie on armhf to fix memory issue
ubuntu: disable -buildmode=pie on armhf to fix memory issue
This PR disables -buildmode=pie on 32bit systems only and leaves it
on for the other arches (for now).
Building go binaries with -buildmode=pie causes issue on ARM
32bit boards. This was originally reported by a customer and
tracked in LP #1822738.
The issue is that the new GC in 1.7+ allocates a large chunk
of memory (>150Mb in our case) on ARM systems when using
buildmode=pie on the low-memory system where this was observed.
The following happens:
1. We build snap/snapd with -buildmode=pie
2. There is a bug in the malloc.go code in 1.10
3. Because the board this runs on has too little ram the kernel
relocates it from a relatively low memory start address to a pretty
high one. Because the GO memory system assumes it initially owns
all the memory from the point where it start to the start it creates
a huge GC bitmap memory region.
4. Because the pi2 does have enough ram the kernel does not relocate it
so we cannot observe the error there.
Use the dpkg-architecture command to determine if the system
is 32bit and if so do *not* use -buildmode=pie. Also update
the test to look at 32/64 bit instead of using `uname -m`.
Recent versions of docker now create a symlink from /dev/ptmx to
/dev/pts/ptmx in order to create a new interactive shell instead of
performing a bind mount. This access allows one to disconnect the
privileged interface from docker and still use the "less privileged"
version of the docker-support interface.