Snapd on yocto 3.1 (dunfell)

Hi there,

so I’ve been trying to get

working on the current Yocto Dunfell release on this fork

https://github.com/crossbario/meta-snappy/commits/support-dunfell

Using the (now available) libseccomp recipe in Yocto, I am getting to:

Oct 19 22:53:31 raspberrypi3 systemd[1]: snapd.service: Scheduled restart job, restart counter is at 2.
Oct 19 22:53:31 raspberrypi3 systemd[1]: Stopped Snappy daemon.
Oct 19 22:53:31 raspberrypi3 systemd[1]: Starting Snappy daemon...
Oct 19 22:53:31 raspberrypi3 snapd[873]: AppArmor status: apparmor not enabled
Oct 19 22:53:31 raspberrypi3 snapd[873]: daemon.go:379: started snapd/2.38 (series 16; classic; devmode) poky/3.1.3 (armhf) linux/5.4.59-v7.
Oct 19 22:53:32 raspberrypi3 systemd[1]: Started Snappy daemon.
Oct 19 22:53:32 raspberrypi3 snapd[873]: stateengine.go:102: state ensure error: cannot sections: got unexpected HTTP status code 403 via GET to "https://api.snapcraft.io/api/v1/snaps/sections"
Oct 19 22:53:32 raspberrypi3 snapd[873]: stateengine.go:102: state ensure error: devicemgr:
Oct 19 22:53:32 raspberrypi3 snapd[873]:  - broken assertion storage, looking for model: broken assertion storage, cannot decode assertion: parsing assertion headers: invalid header name: "type"
Oct 19 22:53:32 raspberrypi3 snapd[873]:  - invalid option name: "seed"
Oct 19 22:53:37 raspberrypi3 snapd[873]: daemon.go:611: gracefully waiting for running hooks
Oct 19 22:53:37 raspberrypi3 snapd[873]: daemon.go:613: done waiting for running hooks
Oct 19 22:53:37 raspberrypi3 snapd[873]: NL
Oct 19 22:53:37 raspberrypi3 systemd[1]: snapd.service: Succeeded.
Oct 19 22:55:34 raspberrypi3 systemd[1]: Starting Snappy daemon...
Oct 19 22:55:34 raspberrypi3 snapd[887]: AppArmor status: apparmor not enabled
Oct 19 22:55:34 raspberrypi3 snapd[887]: daemon.go:379: started snapd/2.38 (series 16; classic; devmode) poky/3.1.3 (armhf) linux/5.4.59-v7.
Oct 19 22:55:34 raspberrypi3 systemd[1]: Started Snappy daemon.
Oct 19 22:55:34 raspberrypi3 snapd[887]: stateengine.go:102: state ensure error: Get "https://api.snapcraft.io/api/v1/snaps/sections": net/http: invalid header field value "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x002*\x00\x00d8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>
Oct 19 22:55:39 raspberrypi3 snapd[887]: daemon.go:611: gracefully waiting for running hooks
Oct 19 22:55:39 raspberrypi3 snapd[887]: daemon.go:613: done waiting for running hooks
Oct 19 22:55:39 raspberrypi3 snapd[887]: daemon stop requested to wait for socket activation
Oct 19 22:55:39 raspberrypi3 systemd[1]: snapd.service: Succeeded.

Note that this is still using snapd 2.38 rather than the current 2.47.1.

I am wondering what the best approach for porting the patches to the current snapd code base would be … and if there is interest in possibly merging this upstream.

Any hints or comments welcome!

Cheers,
/Tobias

more info:

root@raspberrypi3:~# file /usr/lib/snapd/snapd 
/usr/lib/snapd/snapd: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 3.2.0, Go BuildID=4ZEi8CZeIvujXNmea9Y5/CZ0TKUfoOGbhy33RENq1/wwH6Z00SWNKGFmIDF6dW/dU5uTNq14IQXZCyGjHP5, BuildID[sha1]=a89f14f7fcf70b94410440b665381b85a90abe29, stripped
root@raspberrypi3:~# du -h /usr/lib/snapd/snapd 
8.3M	/usr/lib/snapd/snapd
root@raspberrypi3:~# uname -a
Linux raspberrypi3 5.4.59-v7 #1 SMP Mon Aug 24 16:30:19 UTC 2020 armv7l armv7l armv7l GNU/Linux
root@raspberrypi3:~# cat /proc/cpuinfo 
processor	: 0
model name	: ARMv7 Processor rev 4 (v7l)
BogoMIPS	: 38.40
Features	: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xd03
CPU revision	: 4

processor	: 1
model name	: ARMv7 Processor rev 4 (v7l)
BogoMIPS	: 38.40
Features	: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xd03
CPU revision	: 4

processor	: 2
model name	: ARMv7 Processor rev 4 (v7l)
BogoMIPS	: 38.40
Features	: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xd03
CPU revision	: 4

processor	: 3
model name	: ARMv7 Processor rev 4 (v7l)
BogoMIPS	: 38.40
Features	: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xd03
CPU revision	: 4

Hardware	: BCM2835
Revision	: a02082
Serial		: 00000000f5f92df0
Model		: Raspberry Pi 3 Model B Rev 1.2
root@raspberrypi3:~# dmesg
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 5.4.59-v7 (oe-user@oe-host) (gcc version 9.3.0 (GCC)) #1 SMP Mon Aug 24 16:30:19 UTC 2020
[    0.000000] CPU: ARMv7 Processor [410fd034] revision 4 (ARMv7), cr=10c5383d
[    0.000000] CPU: div instructions available: patching division code
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] OF: fdt: Machine model: Raspberry Pi 3 Model B Rev 1.2
...

The current recipe is for 2.38, which is a bit old and probably needs a version bump. Hopefully there shouldn’t be too many changes needed. Feel free to update the recipe and open a PR to morphis/meta-snappy. I can review the changes and help you land it.

Which patches do you have in mind?

Which patches do you have in mind?

these https://github.com/morphis/meta-snappy/tree/master/recipes-support/snapd/files

eg applying to v2.47 fails with


ERROR: snapd-2.47.1-r0 do_configure: QA Issue: snapd: configure was passed unrecognised options: --enable-seccomp [unknown-configure-option]
ERROR: snapd-2.47.1-r0 do_configure: Fatal QA errors found, failing task.
ERROR: Logfile of failure stored in: /home/oberstet/.yocto/simplethings-hub-rpi3-dunfell/build/tmp/work/cortexa7t2hf-neon-vfpv4-poky-linux-gnueabi/snapd/2.47.1-r0/temp/log.do_configure.103818
ERROR: Task (/home/oberstet/.yocto/simplethings-hub-rpi3-dunfell/src/meta-snappy/recipes-support/snapd/snapd_2.47.1.bb:do_configure) failed with exit code '1'

how is that best done practically? manually editing the patch files? recreating new patches on top of the current code by manually transporting each change?


ok, had a quick look at one example. I think I’ll need to recreate the patch files newly … too much changed in the meantime …

IIRC using devtool became a recommended way to work on recipes including patching the source code.

Having a quick look at the patches, I think you can drop:

I think that 0001-packaging-use-templates-for-relevant-systemd-units.patch and 0005-cmd-add-poky-to-the-list-of-distros-which-don-t-supp.patch could be fixed upstream and then cherry-picked as needed.

As for the last patch, the projects I worked on usually defined their own distro instead of using Poky, but it should be fine if one stays with the out of the box Yocto experience.

thanks for the hints! that should allow me to work on this.

rgd patch 5: seems like the default distro name “poky” is known to upstream at least in some places:

oberstet@intel-nuci7:~/scm/3rdparty/snapd$ find . -name "*.go" -exec grep -Hi '"fedora"' {} \;
./release/release_test.go:	c.Check(os.IDLike, DeepEquals, []string{"rhel", "fedora"})
./cmd/snap/cmd_paths_test.go:	restore := release.MockReleaseInfo(&release.OS{ID: "fedora"})
./cmd/snap/cmd_snap_op_test.go:	restore := release.MockReleaseInfo(&release.OS{ID: "fedora"})
./cmd/snap/cmd_snap_op.go:	return release.DistroLike("fedora", "opensuse", "debian")
./interfaces/mount/ns_test.go:	s.AddCleanup(release.MockReleaseInfo(&release.OS{ID: "fedora"}))
./interfaces/builtin/desktop_test.go:	for _, distroWithQuirks := range []string{"fedora", "arch"} {
./interfaces/builtin/desktop_test.go:		if distroWithQuirks == "fedora" {
./interfaces/builtin/desktop.go:		if release.DistroLike("arch", "fedora") {
./dirs/dirs_test.go:	restore := release.MockReleaseInfo(&release.OS{ID: "fedora"})
./dirs/dirs_test.go:		{"fedora", nil, false},
./dirs/dirs_test.go:		{"rhel", []string{"fedora"}, false},
./dirs/dirs_test.go:		{"centos", []string{"fedora"}, false},
./dirs/dirs.go:		"fedora",
./dirs/dirs.go:	if release.DistroLike("fedora") || opensuseTWWithLibexec() {
./dirs/dirs.go:		// both RHEL and CentOS list "fedora" in ID_LIKE
./dirs/dirs.go:	if release.DistroLike("fedora") && !release.DistroLike("amzn") {
./overlord/snapstate/snapstate_install_test.go:		ID: "fedora",
./overlord/snapstate/readme_test.go:	restore := release.MockReleaseInfo(&release.OS{ID: "fedora"})
./sanity/version_test.go:	// ID_LIKE="fedora"
./snapdtool/tool_test.go:	for _, id := range []string{"fedora", "centos", "rhel", "opensuse", "suse", "poky"} {
./snapdtool/tool_test.go:		"fedora", "centos", "rhel", "opensuse", "suse", "poky",
./snapdtool/tool_test.go:	restore := release.MockReleaseInfo(&release.OS{ID: "fedora"})
oberstet@intel-nuci7:~/scm/3rdparty/snapd$ find . -name "*.go" -exec grep -Hi 're-exec not supported on distro' {} \;
./snapdtool/tool_linux.go:		logger.Debugf("re-exec not supported on distro %q yet", release.ReleaseInfo.ID)
oberstet@intel-nuci7:~/scm/3rdparty/snapd$ find . -name "*.go" -exec grep -Hi -n5 're-exec not supported on distro' {} \;
./snapdtool/tool_linux.go-63-func distroSupportsReExec() bool {
./snapdtool/tool_linux.go-64-	if !release.OnClassic {
./snapdtool/tool_linux.go-65-		return false
./snapdtool/tool_linux.go-66-	}
./snapdtool/tool_linux.go-67-	if !release.DistroLike("debian", "ubuntu") {
./snapdtool/tool_linux.go:68:		logger.Debugf("re-exec not supported on distro %q yet", release.ReleaseInfo.ID)
./snapdtool/tool_linux.go-69-		return false
./snapdtool/tool_linux.go-70-	}
./snapdtool/tool_linux.go-71-	return true
./snapdtool/tool_linux.go-72-}
./snapdtool/tool_linux.go-73-
oberstet@intel-nuci7:~/scm/3rdparty/snapd$ 

just from pattern matching, sth like

if !release.DistroLike("debian", "ubuntu", "poky") {

etc seems to make sense … I’ll have a closer look

rgd devtool, found this https://www.yoctoproject.org/docs/latest/mega-manual/mega-manual.html#dev-manually-upgrading-a-recipe

alright, got the current snapd version now, but I get a sigsegv =(

Oct 20 10:55:37 raspberrypi3 systemd[1]: Starting Snap Daemon...
Oct 20 10:55:38 raspberrypi3 snapd[488]: AppArmor status: apparmor not enabled
Oct 20 10:55:38 raspberrypi3 snapd[488]: daemon.go:343: started snapd/2.47.1 (series 16; classic; devmode) poky/3.1.3 (armhf) linux/5.4>
Oct 20 10:55:38 raspberrypi3 snapd[488]: daemon.go:436: adjusting startup timeout by 30s (pessimistic estimate of 30s plus 5s per snap)
Oct 20 10:55:38 raspberrypi3 snapd[488]: panic: runtime error: invalid memory address or nil pointer dereference
Oct 20 10:55:38 raspberrypi3 snapd[488]: [signal SIGSEGV: segmentation violation code=0x1 addr=0xc pc=0x7650c4a0]
Oct 20 10:55:38 raspberrypi3 snapd[488]: goroutine 1 [running]:
Oct 20 10:55:38 raspberrypi3 snapd[488]: regexp.(*machine).match(0x45668680, 0x76aaa3c0, 0x456686e0, 0x0, 0x76)
Oct 20 10:55:38 raspberrypi3 snapd[488]:         /usr/lib/go/src/regexp/exec.go:222 +0x27c
Oct 20 10:55:38 raspberrypi3 snapd[488]: regexp.(*Regexp).doExecute(0x45660c60, 0x0, 0x0, 0x0, 0x0, 0x0, 0xbd2c67, 0xf, 0x0, 0x0, ...)
Oct 20 10:55:38 raspberrypi3 snapd[488]:         /usr/lib/go/src/regexp/exec.go:542 +0xf8
Oct 20 10:55:38 raspberrypi3 snapd[488]: regexp.(*Regexp).doMatch(...)
Oct 20 10:55:38 raspberrypi3 snapd[488]:         go/src/regexp/exec.go:514
Oct 20 10:55:38 raspberrypi3 snapd[488]: regexp.(*Regexp).MatchString(...)
Oct 20 10:55:38 raspberrypi3 snapd[488]:         go/src/regexp/regexp.go:507
Oct 20 10:55:38 raspberrypi3 snapd[488]: github.com/snapcore/snapd/snap/naming.ValidateInterface(0xbd2c67, 0xf, 0xf, 0x0)
Oct 20 10:55:38 raspberrypi3 snapd[488]:         github.com/snapcore/snapd/snap/naming/validate.go:116 +0x74
Oct 20 10:55:38 raspberrypi3 snapd[488]: github.com/snapcore/snapd/snap.ValidateInterfaceName(...)
Oct 20 10:55:38 raspberrypi3 snapd[488]:         github.com/snapcore/snapd/snap/validate.go:90
Oct 20 10:55:38 raspberrypi3 snapd[488]: github.com/snapcore/snapd/interfaces.(*Repository).AddInterface(0x45644570, 0xdeb0b0, 0x456761>
Oct 20 10:55:38 raspberrypi3 snapd[488]:         github.com/snapcore/snapd/interfaces/repo.go:78 +0x94
Oct 20 10:55:38 raspberrypi3 snapd[488]: github.com/snapcore/snapd/overlord/ifacestate.(*InterfaceManager).addInterfaces(0x456610e0, 0x>
Oct 20 10:55:38 raspberrypi3 snapd[488]:         github.com/snapcore/snapd/overlord/ifacestate/helpers.go:57 +0x6c
Oct 20 10:55:38 raspberrypi3 snapd[488]: github.com/snapcore/snapd/overlord/ifacestate.(*InterfaceManager).StartUp(0x456610e0, 0x0, 0x0)
Oct 20 10:55:38 raspberrypi3 snapd[488]:         github.com/snapcore/snapd/overlord/ifacestate/ifacemgr.go:153 +0x178
Oct 20 10:55:38 raspberrypi3 snapd[488]: github.com/snapcore/snapd/overlord.(*StateEngine).StartUp(0x4540c020, 0x0, 0x0)
Oct 20 10:55:38 raspberrypi3 snapd[488]:         github.com/snapcore/snapd/overlord/stateengine.go:109 +0x138
Oct 20 10:55:38 raspberrypi3 snapd[488]: github.com/snapcore/snapd/overlord.(*Overlord).StartUp(0x4599e080, 0x1c, 0x0)
Oct 20 10:55:38 raspberrypi3 snapd[488]:         github.com/snapcore/snapd/overlord/overlord.go:339 +0x94
Oct 20 10:55:38 raspberrypi3 snapd[488]: github.com/snapcore/snapd/daemon.(*Daemon).Start(0x4599e000, 0x0, 0x0)
Oct 20 10:55:38 raspberrypi3 snapd[488]:         github.com/snapcore/snapd/daemon/daemon.go:440 +0x94
Oct 20 10:55:38 raspberrypi3 snapd[488]: main.run(0x457f6e80, 0x0, 0x0)
Oct 20 10:55:38 raspberrypi3 snapd[488]:         github.com/snapcore/snapd/cmd/snapd/main.go:137 +0x2b4
Oct 20 10:55:38 raspberrypi3 snapd[488]: main.main()
Oct 20 10:55:38 raspberrypi3 snapd[488]:         github.com/snapcore/snapd/cmd/snapd/main.go:64 +0x100
Oct 20 10:55:38 raspberrypi3 systemd[1]: snapd.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Oct 20 10:55:38 raspberrypi3 systemd[1]: snapd.service: Failed with result 'exit-code'.
Oct 20 10:55:38 raspberrypi3 systemd[1]: Failed to start Snap Daemon.
Oct 20 10:55:39 raspberrypi3 systemd[1]: snapd.service: Scheduled restart job, restart counter is at 7.
Oct 20 10:55:39 raspberrypi3 systemd[1]: Stopped Snap Daemon.
Oct 20 10:55:39 raspberrypi3 systemd[1]: snapd.service: Start request repeated too quickly.
Oct 20 10:55:39 raspberrypi3 systemd[1]: snapd.service: Failed with result 'exit-code'.
Oct 20 10:55:39 raspberrypi3 systemd[1]: Failed to start Snap Daemon.
Oct 20 10:55:39 raspberrypi3 systemd[1]: snapd.service: Triggering OnFailure= dependencies.
root@raspberrypi3:~# uname -a
Linux raspberrypi3 5.4.59-v7 #1 SMP Mon Aug 24 16:30:19 UTC 2020 armv7l armv7l armv7l GNU/Linux
root@raspberrypi3:~# /usr/lib/snapd/snapd --version
AppArmor status: apparmor not enabled
2020/10/20 10:59:04.838516 daemon.go:343: started snapd/2.47.1 (series 16; classic; devmode) poky/3.1.3 (armhf) linux/5.4.59-v7.
2020/10/20 10:59:04.960527 daemon.go:436: adjusting startup timeout by 30s (pessimistic estimate of 30s plus 5s per snap)
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0xc pc=0x764b84a0]

goroutine 1 [running]:
regexp.(*machine).match(0x455fe500, 0x76a563c0, 0x455fe560, 0x0, 0x4e)
	/usr/lib/go/src/regexp/exec.go:222 +0x27c
regexp.(*Regexp).doExecute(0x45668c00, 0x0, 0x0, 0x0, 0x0, 0x0, 0xbd1c67, 0xf, 0x0, 0x0, ...)
	/usr/lib/go/src/regexp/exec.go:542 +0xf8
regexp.(*Regexp).doMatch(...)
	go/src/regexp/exec.go:514
regexp.(*Regexp).MatchString(...)
	go/src/regexp/regexp.go:507
github.com/snapcore/snapd/snap/naming.ValidateInterface(0xbd1c67, 0xf, 0xf, 0x0)
	github.com/snapcore/snapd/snap/naming/validate.go:116 +0x74
github.com/snapcore/snapd/snap.ValidateInterfaceName(...)
	github.com/snapcore/snapd/snap/validate.go:90
github.com/snapcore/snapd/interfaces.(*Repository).AddInterface(0x4564c570, 0xdea0b0, 0x4567e1e0, 0x0, 0x0)
	github.com/snapcore/snapd/interfaces/repo.go:78 +0x94
github.com/snapcore/snapd/overlord/ifacestate.(*InterfaceManager).addInterfaces(0x45669080, 0x0, 0x0, 0x0, 0x0, 0x0)
	github.com/snapcore/snapd/overlord/ifacestate/helpers.go:57 +0x6c
github.com/snapcore/snapd/overlord/ifacestate.(*InterfaceManager).StartUp(0x45669080, 0x0, 0x0)
	github.com/snapcore/snapd/overlord/ifacestate/ifacemgr.go:153 +0x178
github.com/snapcore/snapd/overlord.(*StateEngine).StartUp(0x4540c020, 0x0, 0x0)
	github.com/snapcore/snapd/overlord/stateengine.go:109 +0x138
github.com/snapcore/snapd/overlord.(*Overlord).StartUp(0x45938180, 0x1c, 0xde8598)
	github.com/snapcore/snapd/overlord/overlord.go:339 +0x94
github.com/snapcore/snapd/daemon.(*Daemon).Start(0x45938100, 0x0, 0x0)
	github.com/snapcore/snapd/daemon/daemon.go:440 +0x94
main.run(0x4590cc00, 0x0, 0x0)
	github.com/snapcore/snapd/cmd/snapd/main.go:137 +0x2b4
main.main()
	github.com/snapcore/snapd/cmd/snapd/main.go:64 +0x100
root@raspberrypi3:~# file /usr/lib/snapd/snapd          
/usr/lib/snapd/snapd: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 3.2.0, Go BuildID=haOY820FXvf_DjciWH4u/dqj8fl7Pm_zgOxHCsbyF/GpwKBYujnvXRV0_WkeAj/Pu-MI1EXDp4q_7GQRb6t, BuildID[sha1]=ae4c093360aaa93ecb87b94950d7cdac59c88386, stripped
root@raspberrypi3:~# 

I’ve added the (non-working ^) changes to a PR https://github.com/morphis/meta-snappy/pull/28

1 Like

I was able to update the recipe to snapd 2.41.1 and it seems to work in qemu, however the raspberry pi image that we produce is still faced by similar issues.

Here is a log that I just gathered. Do note that the last two start attempts failed with different errors.

Do these logs hint to anything fundamentally wrong that we are doing ? (cc @zyga-snapd)

-- Logs begin at Thu 1970-01-01 00:00:05 UTC, end at Thu 2020-10-22 06:52:05 UTC. --
Oct 22 06:49:36 raspberrypi3 systemd[1]: Starting Snap Daemon...
Oct 22 06:49:39 raspberrypi3 snapd[210]: AppArmor status: apparmor not enabled
Oct 22 06:49:39 raspberrypi3 snapd[210]: daemon.go:343: started snapd/2.47.1 (series 16; classic; devmode) poky/3.1.3 (armhf) linux/5.4.59-v7.
Oct 22 06:49:39 raspberrypi3 snapd[210]: daemon.go:436: adjusting startup timeout by 30s (pessimistic estimate of 30s plus 5s per snap)
Oct 22 06:49:40 raspberrypi3 snapd[210]: panic: runtime error: invalid memory address or nil pointer dereference
Oct 22 06:49:40 raspberrypi3 snapd[210]: [signal SIGSEGV: segmentation violation code=0x1 addr=0xc pc=0x765a14a0]
Oct 22 06:49:40 raspberrypi3 snapd[210]: goroutine 1 [running]:
Oct 22 06:49:40 raspberrypi3 snapd[210]: regexp.(*machine).match(0x456c6000, 0x76b3f370, 0x456c6054, 0x0, 0x1)
Oct 22 06:49:40 raspberrypi3 snapd[210]:         /usr/lib/go/src/regexp/exec.go:222 +0x27c
Oct 22 06:49:40 raspberrypi3 snapd[210]: regexp.(*Regexp).doExecute(0x457771a0, 0x0, 0x0, 0x45734000, 0x7a, 0x600, 0x0, 0x0, 0x0, 0x0, ...)
Oct 22 06:49:40 raspberrypi3 snapd[210]:         /usr/lib/go/src/regexp/exec.go:542 +0xf8
Oct 22 06:49:40 raspberrypi3 snapd[210]: regexp.(*Regexp).doMatch(...)
Oct 22 06:49:40 raspberrypi3 snapd[210]:         go/src/regexp/exec.go:514
Oct 22 06:49:40 raspberrypi3 snapd[210]: regexp.(*Regexp).Match(...)
Oct 22 06:49:40 raspberrypi3 snapd[210]:         go/src/regexp/regexp.go:513
Oct 22 06:49:40 raspberrypi3 snapd[210]: github.com/snapcore/snapd/sandbox/seccomp.(*Compiler).VersionInfo(0x45780f60, 0x0, 0x0, 0x1b, 0x457ce920)
Oct 22 06:49:40 raspberrypi3 snapd[210]:         github.com/snapcore/snapd/sandbox/seccomp/compiler.go:74 +0x100
Oct 22 06:49:40 raspberrypi3 snapd[210]: github.com/snapcore/snapd/interfaces/seccomp.snapSeccompVersionInfoImpl(0xdcb7b8, 0x45780f60, 0x0, 0x0, 0x1, 0x456bbc48)
Oct 22 06:49:40 raspberrypi3 snapd[210]:         github.com/snapcore/snapd/interfaces/seccomp/backend.go:68 +0x24
Oct 22 06:49:40 raspberrypi3 snapd[210]: github.com/snapcore/snapd/interfaces/seccomp.(*Backend).Initialize(0x4540f340, 0x457578f0, 0x457d3c18, 0x0)
Oct 22 06:49:40 raspberrypi3 snapd[210]:         github.com/snapcore/snapd/interfaces/seccomp/backend.go:144 +0x40c
Oct 22 06:49:40 raspberrypi3 snapd[210]: github.com/snapcore/snapd/overlord/ifacestate.(*InterfaceManager).addBackends(0x45777500, 0x0, 0x0, 0x0, 0x0, 0x0)
Oct 22 06:49:40 raspberrypi3 snapd[210]:         github.com/snapcore/snapd/overlord/ifacestate/helpers.go:72 +0xb0
Oct 22 06:49:40 raspberrypi3 snapd[210]: github.com/snapcore/snapd/overlord/ifacestate.(*InterfaceManager).StartUp(0x45777500, 0x0, 0x0)
Oct 22 06:49:40 raspberrypi3 snapd[210]:         github.com/snapcore/snapd/overlord/ifacestate/ifacemgr.go:156 +0x1ac
Oct 22 06:49:40 raspberrypi3 snapd[210]: github.com/snapcore/snapd/overlord.(*StateEngine).StartUp(0x45772040, 0x0, 0x0)
Oct 22 06:49:40 raspberrypi3 snapd[210]:         github.com/snapcore/snapd/overlord/stateengine.go:109 +0x138
Oct 22 06:49:40 raspberrypi3 snapd[210]: github.com/snapcore/snapd/overlord.(*Overlord).StartUp(0x45668c00, 0x1c, 0x0)
Oct 22 06:49:40 raspberrypi3 snapd[210]:         github.com/snapcore/snapd/overlord/overlord.go:339 +0x94
Oct 22 06:49:40 raspberrypi3 snapd[210]: github.com/snapcore/snapd/daemon.(*Daemon).Start(0x45668b80, 0x0, 0x0)
Oct 22 06:49:40 raspberrypi3 snapd[210]:         github.com/snapcore/snapd/daemon/daemon.go:440 +0x94
Oct 22 06:49:40 raspberrypi3 snapd[210]: main.run(0x4590cb40, 0x0, 0x0)
Oct 22 06:49:40 raspberrypi3 snapd[210]:         github.com/snapcore/snapd/cmd/snapd/main.go:137 +0x2b4
Oct 22 06:49:40 raspberrypi3 snapd[210]: main.main()
Oct 22 06:49:40 raspberrypi3 snapd[210]:         github.com/snapcore/snapd/cmd/snapd/main.go:64 +0x100
Oct 22 06:49:40 raspberrypi3 systemd[1]: snapd.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Oct 22 06:49:40 raspberrypi3 systemd[1]: snapd.service: Failed with result 'exit-code'.
Oct 22 06:49:40 raspberrypi3 systemd[1]: Failed to start Snap Daemon.
Oct 22 06:49:40 raspberrypi3 systemd[1]: snapd.service: Scheduled restart job, restart counter is at 1.
Oct 22 06:49:40 raspberrypi3 systemd[1]: Stopped Snap Daemon.
Oct 22 06:49:40 raspberrypi3 systemd[1]: Starting Snap Daemon...
Oct 22 06:49:40 raspberrypi3 snapd[320]: AppArmor status: apparmor not enabled
Oct 22 06:49:41 raspberrypi3 snapd[320]: daemon.go:343: started snapd/2.47.1 (series 16; classic; devmode) poky/3.1.3 (armhf) linux/5.4.59-v7.
Oct 22 06:49:41 raspberrypi3 snapd[320]: daemon.go:436: adjusting startup timeout by 30s (pessimistic estimate of 30s plus 5s per snap)
Oct 22 06:49:41 raspberrypi3 snapd[320]: panic: runtime error: invalid memory address or nil pointer dereference
Oct 22 06:49:41 raspberrypi3 snapd[320]: [signal SIGSEGV: segmentation violation code=0x1 addr=0xe pc=0x7653a710]
Oct 22 06:49:41 raspberrypi3 snapd[320]: goroutine 1 [running]:
Oct 22 06:49:41 raspberrypi3 snapd[320]: regexp.(*Regexp).doOnePass(0x45740c00, 0x0, 0x0, 0x0, 0x0, 0x0, 0xbc7c67, 0xf, 0x0, 0x0, ...)
Oct 22 06:49:41 raspberrypi3 snapd[320]:         /usr/lib/go/src/regexp/exec.go:429 +0x168
Oct 22 06:49:41 raspberrypi3 snapd[320]: regexp.(*Regexp).doExecute(0x45740c00, 0x0, 0x0, 0x0, 0x0, 0x0, 0xbc7c67, 0xf, 0x0, 0x0, ...)
Oct 22 06:49:41 raspberrypi3 snapd[320]:         /usr/lib/go/src/regexp/exec.go:532 +0x37c
Oct 22 06:49:41 raspberrypi3 snapd[320]: regexp.(*Regexp).doMatch(...)
Oct 22 06:49:41 raspberrypi3 snapd[320]:         go/src/regexp/exec.go:514
Oct 22 06:49:41 raspberrypi3 snapd[320]: regexp.(*Regexp).MatchString(...)
Oct 22 06:49:41 raspberrypi3 snapd[320]:         go/src/regexp/regexp.go:507
Oct 22 06:49:41 raspberrypi3 snapd[320]: github.com/snapcore/snapd/snap/naming.ValidateInterface(0xbc7c67, 0xf, 0xf, 0x0)
Oct 22 06:49:41 raspberrypi3 snapd[320]:         github.com/snapcore/snapd/snap/naming/validate.go:116 +0x74
Oct 22 06:49:41 raspberrypi3 snapd[320]: github.com/snapcore/snapd/snap.ValidateInterfaceName(...)
Oct 22 06:49:41 raspberrypi3 snapd[320]:         github.com/snapcore/snapd/snap/validate.go:90
Oct 22 06:49:41 raspberrypi3 snapd[320]: github.com/snapcore/snapd/interfaces.(*Repository).AddInterface(0x45867560, 0xde00b0, 0x457581e0, 0x0, 0x0)
Oct 22 06:49:41 raspberrypi3 snapd[320]:         github.com/snapcore/snapd/interfaces/repo.go:78 +0x94
Oct 22 06:49:41 raspberrypi3 snapd[320]: github.com/snapcore/snapd/overlord/ifacestate.(*InterfaceManager).addInterfaces(0x458f99e0, 0x0, 0x0, 0x0, 0x0, 0x0)
Oct 22 06:49:41 raspberrypi3 snapd[320]:         github.com/snapcore/snapd/overlord/ifacestate/helpers.go:57 +0x6c
Oct 22 06:49:41 raspberrypi3 snapd[320]: github.com/snapcore/snapd/overlord/ifacestate.(*InterfaceManager).StartUp(0x458f99e0, 0x0, 0x0)
Oct 22 06:49:41 raspberrypi3 snapd[320]:         github.com/snapcore/snapd/overlord/ifacestate/ifacemgr.go:153 +0x178
Oct 22 06:49:41 raspberrypi3 snapd[320]: github.com/snapcore/snapd/overlord.(*StateEngine).StartUp(0x458f7500, 0x0, 0x0)
Oct 22 06:49:41 raspberrypi3 snapd[320]:         github.com/snapcore/snapd/overlord/stateengine.go:109 +0x138
Oct 22 06:49:41 raspberrypi3 snapd[320]: github.com/snapcore/snapd/overlord.(*Overlord).StartUp(0x4574ac00, 0x1c, 0x0)
Oct 22 06:49:41 raspberrypi3 snapd[320]:         github.com/snapcore/snapd/overlord/overlord.go:339 +0x94
Oct 22 06:49:41 raspberrypi3 snapd[320]: github.com/snapcore/snapd/daemon.(*Daemon).Start(0x4574ab80, 0x0, 0x0)
Oct 22 06:49:41 raspberrypi3 snapd[320]:         github.com/snapcore/snapd/daemon/daemon.go:440 +0x94
Oct 22 06:49:41 raspberrypi3 snapd[320]: main.run(0x458d3980, 0x0, 0x0)
Oct 22 06:49:41 raspberrypi3 snapd[320]:         github.com/snapcore/snapd/cmd/snapd/main.go:137 +0x2b4
Oct 22 06:49:41 raspberrypi3 snapd[320]: main.main()
Oct 22 06:49:41 raspberrypi3 snapd[320]:         github.com/snapcore/snapd/cmd/snapd/main.go:64 +0x100
Oct 22 06:49:41 raspberrypi3 systemd[1]: snapd.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Oct 22 06:49:41 raspberrypi3 systemd[1]: snapd.service: Failed with result 'exit-code'.
Oct 22 06:49:41 raspberrypi3 systemd[1]: Failed to start Snap Daemon.
Oct 22 06:49:41 raspberrypi3 systemd[1]: snapd.service: Scheduled restart job, restart counter is at 2.
Oct 22 06:49:41 raspberrypi3 systemd[1]: Stopped Snap Daemon.
Oct 22 06:49:41 raspberrypi3 systemd[1]: Starting Snap Daemon...
Oct 22 06:49:42 raspberrypi3 snapd[363]: AppArmor status: apparmor not enabled
Oct 22 06:49:42 raspberrypi3 snapd[363]: daemon.go:343: started snapd/2.47.1 (series 16; classic; devmode) poky/3.1.3 (armhf) linux/5.4.59-v7.
Oct 22 06:49:42 raspberrypi3 snapd[363]: daemon.go:436: adjusting startup timeout by 30s (pessimistic estimate of 30s plus 5s per snap)
Oct 22 06:49:42 raspberrypi3 snapd[363]: panic: runtime error: invalid memory address or nil pointer dereference
Oct 22 06:49:42 raspberrypi3 snapd[363]: [signal SIGSEGV: segmentation violation code=0x1 addr=0xc pc=0x765394a0]
Oct 22 06:49:42 raspberrypi3 snapd[363]: goroutine 1 [running]:
Oct 22 06:49:42 raspberrypi3 snapd[363]: regexp.(*machine).match(0x45918180, 0x76ad73c0, 0x459181e0, 0x0, 0x4)
Oct 22 06:49:42 raspberrypi3 snapd[363]:         /usr/lib/go/src/regexp/exec.go:222 +0x27c
Oct 22 06:49:42 raspberrypi3 snapd[363]: regexp.(*Regexp).doExecute(0x45660c00, 0x0, 0x0, 0x0, 0x0, 0x0, 0xb87c67, 0xf, 0x0, 0x0, ...)
Oct 22 06:49:42 raspberrypi3 snapd[363]:         /usr/lib/go/src/regexp/exec.go:542 +0xf8
Oct 22 06:49:42 raspberrypi3 snapd[363]: regexp.(*Regexp).doMatch(...)
Oct 22 06:49:42 raspberrypi3 snapd[363]:         go/src/regexp/exec.go:514
Oct 22 06:49:42 raspberrypi3 snapd[363]: regexp.(*Regexp).MatchString(...)
Oct 22 06:49:42 raspberrypi3 snapd[363]:         go/src/regexp/regexp.go:507
Oct 22 06:49:42 raspberrypi3 snapd[363]: github.com/snapcore/snapd/snap/naming.ValidateInterface(0xb87c67, 0xf, 0xf, 0x0)
Oct 22 06:49:42 raspberrypi3 snapd[363]:         github.com/snapcore/snapd/snap/naming/validate.go:116 +0x74
Oct 22 06:49:42 raspberrypi3 snapd[363]: github.com/snapcore/snapd/snap.ValidateInterfaceName(...)
Oct 22 06:49:42 raspberrypi3 snapd[363]:         github.com/snapcore/snapd/snap/validate.go:90
Oct 22 06:49:42 raspberrypi3 snapd[363]: github.com/snapcore/snapd/interfaces.(*Repository).AddInterface(0x45642570, 0xda00b0, 0x456761e0, 0x0, 0x0)
Oct 22 06:49:42 raspberrypi3 snapd[363]:         github.com/snapcore/snapd/interfaces/repo.go:78 +0x94
Oct 22 06:49:42 raspberrypi3 snapd[363]: github.com/snapcore/snapd/overlord/ifacestate.(*InterfaceManager).addInterfaces(0x45661080, 0x0, 0x0, 0x0, 0x0, 0x0)
Oct 22 06:49:42 raspberrypi3 snapd[363]:         github.com/snapcore/snapd/overlord/ifacestate/helpers.go:57 +0x6c
Oct 22 06:49:42 raspberrypi3 snapd[363]: github.com/snapcore/snapd/overlord/ifacestate.(*InterfaceManager).StartUp(0x45661080, 0x0, 0x0)
Oct 22 06:49:42 raspberrypi3 snapd[363]:         github.com/snapcore/snapd/overlord/ifacestate/ifacemgr.go:153 +0x178
Oct 22 06:49:42 raspberrypi3 snapd[363]: github.com/snapcore/snapd/overlord.(*StateEngine).StartUp(0x4540c020, 0x0, 0x0)
Oct 22 06:49:42 raspberrypi3 snapd[363]:         github.com/snapcore/snapd/overlord/stateengine.go:109 +0x138
Oct 22 06:49:42 raspberrypi3 snapd[363]: github.com/snapcore/snapd/overlord.(*Overlord).StartUp(0x45668c00, 0x1c, 0x0)
Oct 22 06:49:42 raspberrypi3 snapd[363]:         github.com/snapcore/snapd/overlord/overlord.go:339 +0x94
Oct 22 06:49:42 raspberrypi3 snapd[363]: github.com/snapcore/snapd/daemon.(*Daemon).Start(0x45668b80, 0x0, 0x0)
Oct 22 06:49:42 raspberrypi3 snapd[363]:         github.com/snapcore/snapd/daemon/daemon.go:440 +0x94
Oct 22 06:49:42 raspberrypi3 snapd[363]: main.run(0x45876e40, 0x0, 0x0)
Oct 22 06:49:42 raspberrypi3 snapd[363]:         github.com/snapcore/snapd/cmd/snapd/main.go:137 +0x2b4
Oct 22 06:49:42 raspberrypi3 snapd[363]: main.main()
Oct 22 06:49:42 raspberrypi3 snapd[363]:         github.com/snapcore/snapd/cmd/snapd/main.go:64 +0x100
Oct 22 06:49:42 raspberrypi3 systemd[1]: snapd.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Oct 22 06:49:42 raspberrypi3 systemd[1]: snapd.service: Failed with result 'exit-code'.
Oct 22 06:49:42 raspberrypi3 systemd[1]: Failed to start Snap Daemon.
Oct 22 06:49:43 raspberrypi3 systemd[1]: snapd.service: Scheduled restart job, restart counter is at 3.
Oct 22 06:49:43 raspberrypi3 systemd[1]: Stopped Snap Daemon.
Oct 22 06:49:43 raspberrypi3 systemd[1]: Starting Snap Daemon...
Oct 22 06:49:43 raspberrypi3 snapd[377]: AppArmor status: apparmor not enabled
Oct 22 06:49:43 raspberrypi3 snapd[377]: cannot run daemon: cannot export experimental config flags: mkdir -
Oct 22 06:49:43 raspberrypi3 snapd[377]: -
Oct 22 06:49:43 raspberrypi3 snapd[377]: 0
Oct 22 06:49:43 raspberrypi3 snapd[377]: 9
Oct 22 06:49:43 raspberrypi3 snapd[377]: a
Oct 22 06:49:43 raspberrypi3 snapd[377]: z
Oct 22 06:49:43 raspberrypi3 snapd[377]: : invalid argument
Oct 22 06:49:43 raspberrypi3 systemd[1]: snapd.service: Main process exited, code=exited, status=1/FAILURE
Oct 22 06:49:43 raspberrypi3 systemd[1]: snapd.service: Failed with result 'exit-code'.
Oct 22 06:49:43 raspberrypi3 systemd[1]: Failed to start Snap Daemon.
Oct 22 06:49:44 raspberrypi3 systemd[1]: snapd.service: Scheduled restart job, restart counter is at 4.
Oct 22 06:49:44 raspberrypi3 systemd[1]: Stopped Snap Daemon.
Oct 22 06:49:44 raspberrypi3 systemd[1]: Starting Snap Daemon...
Oct 22 06:49:44 raspberrypi3 snapd[386]: AppArmor status: apparmor not enabled
Oct 22 06:49:44 raspberrypi3 snapd[386]: panic: cannot initialize the builtin base-declaration: cannot assemble the builtin base-declaration: slot-snap-type in allow-installation in slot rule for interface "modem-manager" contains an invalid element: "core"
Oct 22 06:49:44 raspberrypi3 snapd[386]: goroutine 1 [running]:
Oct 22 06:49:44 raspberrypi3 snapd[386]: github.com/snapcore/snapd/interfaces/policy.init.0()
Oct 22 06:49:44 raspberrypi3 snapd[386]:         github.com/snapcore/snapd/interfaces/policy/basedeclaration.go:197 +0xe4
Oct 22 06:49:44 raspberrypi3 systemd[1]: snapd.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Oct 22 06:49:44 raspberrypi3 systemd[1]: snapd.service: Failed with result 'exit-code'.
Oct 22 06:49:44 raspberrypi3 systemd[1]: Failed to start Snap Daemon.
Oct 22 06:49:45 raspberrypi3 systemd[1]: snapd.service: Scheduled restart job, restart counter is at 5.
Oct 22 06:49:45 raspberrypi3 systemd[1]: Stopped Snap Daemon.
Oct 22 06:49:45 raspberrypi3 systemd[1]: snapd.service: Start request repeated too quickly.
Oct 22 06:49:45 raspberrypi3 systemd[1]: snapd.service: Failed with result 'exit-code'.
Oct 22 06:49:45 raspberrypi3 systemd[1]: Failed to start Snap Daemon.
Oct 22 06:49:45 raspberrypi3 systemd[1]: snapd.service: Triggering OnFailure= dependencies.

Interestingly all 3 panics (one in the log @oberstet provided) point to a regex from different code paths. That would suggest there might be something off the the stdlib or the build.

Could you try to build a minimal Go code sample using regexp and run it on rspi? This should be sufficient:

package main
import (
	"fmt"
	"regexp"
)
func main() {
	var r = regexp.MustCompile("foo(bar)?[123]+")
	fmt.Println(r.MatchString("foo111"))
	fmt.Println(r.MatchString("foobar333"))
	fmt.Println(r.MatchString("foobarbar333"))
}

You can use devtool to create a new recipe in your $WORKSPACE.

So it seems the issue was already fixed for x86 but needed a similar treatment for armhf/aarch64. I was able to get snapd working by adding

GO_DYNLINK_arm = ""
GO_DYNLINK_aarch64 = ""

here https://github.com/morphis/meta-snappy/blob/1779e0054089d92002cc09289529e6b95311530b/recipes-support/snapd/snapd_2.38.bb#L59

1 Like

Thanks for opening you PR with support for dunfell. I’ve finally taken time to build everything and land it.

I’ve opened a followup with some cleanups: https://github.com/morphis/meta-snappy/pull/30 Since we’re not using Yocto much internally, I’d be great if someone else than me gave it a go too. If you have some time, please take a look and try to build it locally.

Once it lands, I’ll open another one with an update to 2.48 (or 2.49 if that is released earlier).

1 Like