Unable to Start snapd on Disco Dingo

I have installed Ubuntu 19.04 Disco Dingo on a brand new hard drive (so not an upgrade from any previous version), and having troubles getting snaps to install.

When I click an “Install” link in the snapcraft store (specifically https://snapcraft.io/code was my first attempt, but it fails on any snap I try), I get “Failed to install: not supported” in the Ubuntu Store application. Attempting to install from the command line, I get (I’m using the fish shell, so the prompt is ~> rather than ~$ from BASH):

~> sudo snap install vscode
[sudo] password for xxxxx: 
error: cannot communicate with server: Post http://localhost/v2/snaps/vscode: dial unix /run/snapd.socket: connect: connection refused

When I try to get my version of snap, I get this:

~> snap version
snap    2.38+19.04
snapd   unavailable
series  -

It would appear to be something wrong with the snapd service, so I do this:

~> systemctl status snapd.service
● snapd.service - Snappy daemon
Loaded: loaded (/lib/systemd/system/snapd.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sat 2019-04-20 11:07:43 MDT; 30min ago
Process: 19101 ExecStart=/usr/lib/snapd/snapd (code=exited, status=2)
Main PID: 19101 (code=exited, status=2)

Apr 20 11:07:43 Hopper systemd[1]: snapd.service: Service RestartSec=100ms expired, scheduling restart.
Apr 20 11:07:43 Hopper systemd[1]: snapd.service: Scheduled restart job, restart counter is at 5.
Apr 20 11:07:43 Hopper systemd[1]: Stopped Snappy daemon.
Apr 20 11:07:43 Hopper systemd[1]: snapd.service: Start request repeated too quickly.
Apr 20 11:07:43 Hopper systemd[1]: snapd.service: Failed with result 'exit-code'.
Apr 20 11:07:43 Hopper systemd[1]: Failed to start Snappy daemon.
Apr 20 11:07:43 Hopper systemd[1]: snapd.service: Triggering OnFailure= dependencies.

Running “sudo systemctl restart snapd” and then checking the status again results in the same thing, just with different timestamps.

When I run “journalctl -u snapd” I find the following in there:

Apr 20 11:39:28 Hopper systemd[1]: Starting Snappy daemon...
Apr 20 11:39:28 Hopper snapd[21182]: AppArmor status: apparmor is enabled and all features are available
Apr 20 11:39:28 Hopper snapd[21182]: daemon.go:379: started snapd/2.38+19.04 (series 16; classic) ubuntu/19.04 (amd64) linux/5.0.0-11-generic.
Apr 20 11:39:28 Hopper systemd[1]: Started Snappy daemon.
Apr 20 11:39:28 Hopper snapd[21182]: panic: runtime error: invalid memory address or nil pointer dereference
Apr 20 11:39:28 Hopper snapd[21182]: [signal SIGSEGV: segmentation violation code=0x1 addr=0x50 pc=0x55a35ad68716]
Apr 20 11:39:28 Hopper snapd[21182]: goroutine 10 [running]:
Apr 20 11:39:28 Hopper snapd[21182]: github.com/snapcore/snapd/snap.ReadSeedYaml(0xc420037420, 0x1d, 0x1, 0xc420037420, 0x1d)
Apr 20 11:39:28 Hopper snapd[21182]:         github.com/snapcore/snapd/snap/seed_yaml.go:73 +0x236
Apr 20 11:39:28 Hopper snapd[21182]: github.com/snapcore/snapd/overlord/devicestate.populateStateFromSeedImpl(0xc420314000, 0x55a35afda9ee, 0x4, 0x55a35b237700, 0xc42
Apr 20 11:39:28 Hopper snapd[21182]:         github.com/snapcore/snapd/overlord/devicestate/firstboot.go:110 +0x24f
Apr 20 11:39:28 Hopper snapd[21182]: github.com/snapcore/snapd/overlord/devicestate.(*DeviceManager).ensureSeedYaml(0xc4203b64b0, 0x0, 0x0)
Apr 20 11:39:28 Hopper snapd[21182]:         github.com/snapcore/snapd/overlord/devicestate/devicemgr.go:354 +0x190
Apr 20 11:39:28 Hopper snapd[21182]: github.com/snapcore/snapd/overlord/devicestate.(*DeviceManager).Ensure(0xc4203b64b0, 0x0, 0x0)
Apr 20 11:39:28 Hopper snapd[21182]:         github.com/snapcore/snapd/overlord/devicestate/devicemgr.go:465 +0x42
Apr 20 11:39:28 Hopper snapd[21182]: github.com/snapcore/snapd/overlord.(*StateEngine).Ensure(0xc420322c90, 0x0, 0x0)
Apr 20 11:39:28 Hopper snapd[21182]:         github.com/snapcore/snapd/overlord/stateengine.go:100 +0x10b
Apr 20 11:39:28 Hopper snapd[21182]: github.com/snapcore/snapd/overlord.(*Overlord).Loop.func1(0x0, 0x0)
Apr 20 11:39:28 Hopper snapd[21182]:         github.com/snapcore/snapd/overlord/overlord.go:290 +0x5e
Apr 20 11:39:28 Hopper snapd[21182]: github.com/snapcore/snapd/vendor/gopkg.in/tomb%2ev2.(*Tomb).run(0xc42030c000, 0xc420031e60)
Apr 20 11:39:28 Hopper snapd[21182]:         github.com/snapcore/snapd/vendor/gopkg.in/tomb.v2/tomb.go:163 +0x2d
Apr 20 11:39:28 Hopper snapd[21182]: created by github.com/snapcore/snapd/vendor/gopkg.in/tomb%2ev2.(*Tomb).Go
Apr 20 11:39:28 Hopper snapd[21182]:         github.com/snapcore/snapd/vendor/gopkg.in/tomb.v2/tomb.go:159 +0xbb
Apr 20 11:39:28 Hopper systemd[1]: snapd.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Apr 20 11:39:28 Hopper systemd[1]: snapd.service: Failed with result 'exit-code'.
Apr 20 11:39:28 Hopper systemd[1]: snapd.service: Service RestartSec=100ms expired, scheduling restart.
Apr 20 11:39:28 Hopper systemd[1]: snapd.service: Scheduled restart job, restart counter is at 1.
Apr 20 11:39:28 Hopper systemd[1]: Stopped Snappy daemon.

This repeats itself five times with the “restart counter” going up by one until it hits 5 and systemctl gives up.

The very first log entry (the day I installed Ubuntu 19.04) shows this:

-- Logs begin at Sat 2019-04-13 16:29:04 MDT, end at Sat 2019-04-20 11:52:36 MDT. --
Apr 13 16:29:11 Hopper systemd[1]: Starting Snappy daemon...
Apr 13 16:29:11 Hopper snapd[859]: AppArmor status: apparmor is enabled and all features are available
Apr 13 16:29:11 Hopper snapd[859]: helpers.go:145: error trying to compare the snap system key: system-key missing on disk
Apr 13 16:29:11 Hopper snapd[859]: daemon.go:379: started snapd/2.38+19.04 (series 16; classic) ubuntu/19.04 (amd64) linux/5.0.0-11-generic.
Apr 13 16:29:11 Hopper systemd[1]: Started Snappy daemon.
Apr 13 16:29:22 Hopper snapd[859]: panic: runtime error: invalid memory address or nil pointer dereference
Apr 13 16:29:22 Hopper snapd[859]: [signal SIGSEGV: segmentation violation code=0x1 addr=0x50 pc=0x564ed1823716]
Apr 13 16:29:22 Hopper snapd[859]: goroutine 38 [running]:

And then the same stack trace as before (confirmed with diff). The only difference between the two error logs is the line

helpers.go:145: error trying to compare the snap system key: system-key missing on disk

But Google isn’t giving me much hints on where to go with that one.

I’ve taken a quick look at https://github.com/snapcore/snapd/blob/master/snap/seed_yaml.go at line 73 and I’ve never done Go programming before, but is it possible that sn.File is hitting a nil pointer dereference because I don’t have any snaps installed (this being a brand new install)?

1 Like

it’s likely you have an empty entry in your seed.yaml, and that is causing snapd to fall over.
See the bug report for more info. If you look in /var/lib/snapd/seed/seed.yaml you might find it’s got empty entries.

Out of curiosity, what was your installation media? (what are the contents of /var/log/installer/media-info?)

1 Like

Wow, that bug report (and comments in pull request 6756) is exactly like mine.

~> cat /var/lib/snapd/seed/seed.yaml 
snaps:
  -
    name: core18
    channel: stable/ubuntu-19.04
    file: core18_941.snap
  -
  -
    name: gnome-3-28-1804
    channel: stable/ubuntu-19.04
    file: gnome-3-28-1804_23.snap
  -
    name: gnome-calculator
    channel: stable/ubuntu-19.04
    file: gnome-calculator_406.snap
  -
    name: gnome-characters
    channel: stable/ubuntu-19.04
    file: gnome-characters_254.snap
  -
    name: gnome-logs
    channel: stable/ubuntu-19.04
    file: gnome-logs_61.snap
  -
    name: gnome-system-monitor
    channel: stable/ubuntu-19.04
    file: gnome-system-monitor_77.snap
  -
    name: core
    channel: stable
    file: core_6673.snap
  -
    name: gtk-common-themes
    channel: stable/ubuntu-19.04
    file: gtk-common-themes_1198.snap

And

~> cat /var/log/installer/media-info 
Ubuntu 19.04 "Disco Dingo" - Alpha amd64 (20190413)

I guess this was a bug fixed in the final week leading up to release of Ubuntu. Deleting one of the doubled-up hyphen lines allows snapd to run.

Thanks for pointing out where to look!

2 Likes

Thanks! This is also discussed in https://bugs.launchpad.net/ubuntu/+source/snapd/+bug/1825437 and it turns out that there was a brief installer breakage that got fixed in the final image.