`snapd` service doesn't start

Hi

Since yesterday I not be able to start snapd service. When I try to install a snap I have the following message:

sudo snap install ubuntu-app-platform
error: cannot communicate with server: Post http://localhost/v2/snaps/ubuntu-app-platform: dial unix /run/snapd.socket: connect: connection refused

If I look into the status of the service, this is what I have:

sudo systemctl status snapd
● snapd.service - Snappy daemon
   Loaded: loaded (/lib/systemd/system/snapd.service; enabled; vendor preset: enable
   Active: inactive (dead) (Result: exit-code) since Wed 2017-04-19 09:05:05 CEST; 6
  Process: 23596 ExecStart=/usr/lib/snapd/snapd (code=exited, status=2)
 Main PID: 23596 (code=exited, status=2)

Apr 19 09:05:05 ubuntu snapd[23596]:         /build/snapd-ds9lFD/snapd-2.23.6/_build
Apr 19 09:05:05 ubuntu snapd[23596]: created by github.com/snapcore/snapd/vendor/gop
Apr 19 09:05:05 ubuntu snapd[23596]:         /build/snapd-ds9lFD/snapd-2.23.6/_build
Apr 19 09:05:05 ubuntu systemd[1]: snapd.service: Main process exited, code=exited, 
Apr 19 09:05:05 ubuntu systemd[1]: snapd.service: Unit entered failed state.
Apr 19 09:05:05 ubuntu systemd[1]: snapd.service: Failed with result 'exit-code'.
Apr 19 09:05:05 ubuntu systemd[1]: snapd.service: Service hold-off time over, schedu
Apr 19 09:05:05 ubuntu systemd[1]: Stopped Snappy daemon.
Apr 19 09:05:05 ubuntu systemd[1]: snapd.service: Start request repeated too quickly
Apr 19 09:05:05 ubuntu systemd[1]: Failed to start Snappy daemon.

Launching it by the command:

sudo /usr/lib/snapd/snapd
2017/04/19 09:14:03.914842 daemon.go:251: started snapd/2.23.6 (series 16; classic) ubuntu/16.04 (amd64) linux/4.4.0-72-generic.
panic: assignment to entry in nil map

goroutine 34 [running]:
panic(0x55b60ca34320, 0xc82033c8a0)
	/usr/lib/go-1.6/src/runtime/panic.go:481 +0x3ea
github.com/snapcore/snapd/interfaces/builtin.(*ContentInterface).SanitizePlug(0x55b60cffc380, 0xc820231b00, 0x0, 0x0)
	/build/snapd-ds9lFD/snapd-2.23.6/_build/src/github.com/snapcore/snapd/interfaces/builtin/content.go:80 +0x4cb
github.com/snapcore/snapd/interfaces.(*Repository).AddSnap(0xc8201ff300, 0xc82019f440, 0x0, 0x0)
	/build/snapd-ds9lFD/snapd-2.23.6/_build/src/github.com/snapcore/snapd/interfaces/repo.go:837 +0x960
github.com/snapcore/snapd/overlord/ifacestate.(*InterfaceManager).setupProfilesForSnap(0xc8202089e0, 0xc8201e0c60, 0xc8202ee1e0, 0xc82019f440, 0xc820000000, 0x0, 0x0)
	/build/snapd-ds9lFD/snapd-2.23.6/_build/src/github.com/snapcore/snapd/overlord/ifacestate/handlers.go:150 +0x19f
github.com/snapcore/snapd/overlord/ifacestate.(*InterfaceManager).doSetupProfiles(0xc8202089e0, 0xc8201e0c60, 0xc8202ee1e0, 0x0, 0x0)
	/build/snapd-ds9lFD/snapd-2.23.6/_build/src/github.com/snapcore/snapd/overlord/ifacestate/handlers.go:124 +0x652
github.com/snapcore/snapd/overlord/ifacestate.(*InterfaceManager).(github.com/snapcore/snapd/overlord/ifacestate.doSetupProfiles)-fm(0xc8201e0c60, 0xc8202ee1e0, 0x0, 0x0)
	/build/snapd-ds9lFD/snapd-2.23.6/_build/src/github.com/snapcore/snapd/overlord/ifacestate/ifacemgr.go:70 +0x44
github.com/snapcore/snapd/overlord/state.(*TaskRunner).run.func1(0x0, 0x0)
	/build/snapd-ds9lFD/snapd-2.23.6/_build/src/github.com/snapcore/snapd/overlord/state/taskrunner.go:146 +0x71
github.com/snapcore/snapd/vendor/gopkg.in/tomb%2ev2.(*Tomb).run(0xc8202ee1e0, 0xc8202ec1b0)
	/build/snapd-ds9lFD/snapd-2.23.6/_build/src/github.com/snapcore/snapd/vendor/gopkg.in/tomb.v2/tomb.go:163 +0x23
created by github.com/snapcore/snapd/vendor/gopkg.in/tomb%2ev2.(*Tomb).Go
	/build/snapd-ds9lFD/snapd-2.23.6/_build/src/github.com/snapcore/snapd/vendor/gopkg.in/tomb.v2/tomb.go:159 +0x133

It happens on the laptop I use in classroom, and my personal desktop at home, both running Ubuntu 16.04

snap --version
snap    2.23.6
snapd   unavailable
series  -

I didn’t try yet on my personal laptop at home with Ubuntu Gnome 17.04, So I can’t tell if it is a general issue :frowning:

For the record, I notice this issue trying to install the snap extia-webapp (https://myapps.developer.ubuntu.com/dev/click-apps/7392/)

Thx in advance for your help

Cheers, Winael

Hey. Sorry for the bad experience, you seem to have found a bug in snapd.

I had a look at the data you attached and although I didn’t yet check the particular snap in question I found and fixed a panic that looks just like the one you reported. The pull request (for snapd developers to review and merge) is here https://github.com/snapcore/snapd/pull/3204

… and sure enough my hunch was right:

$ cat meta/snap.yaml 
apps:
  extia-webapp:
    command: command-extia-webapp.wrapper
    plugs:
    - browser-sandbox
    - home
    - network
    - opengl
    - unity7
    - mir
    - screen-inhibit-control
    - pulseaudio
    - content
architectures:
- amd64
confinement: strict
description: 'Webapp version of the Extia web portal.

  '
grade: stable
name: extia-webapp
plugs:
  browser-sandbox:
    allow-sandbox: false
    interface: browser-support
  platform:
    content: ubuntu-app-platform1
    default-provider: ubuntu-app-platform
    interface: content
    target: ubuntu-app-platform
summary: Extia webapp
version: '1.3'

Notice the “content” plug defined above. This is why things break for you.

@zyga-snapd,

Thx for your quick answer. I add this plug to be able to upload files through the webapp. Throught the website of my company, employees can manage their expenses reports and activity reports with the “intra” subdomain.
Maybe I didn’t use the right plug.

So for now, to be able to use snapd again, I just need to wait for the fix and update my system or do I need to do something else ?

Cheers,
Winael

The content plug is free for all but you specified it twice in practice. The plugs section up top just defines a plug of typoe content that has no attributes. Then the platform plug (which is explicitly defined to be of type content) has the correct data. Just remove the first one up top and you should be good.

I’ve made a pull request to snapd so that in the future such issues won’t cause snapd to crash:

https://github.com/snapcore/snapd/pull/3208

$ snap --version
snap    2.32.9
snapd   unavailable
series  -

I can’t install any package using “snap install hello-world” but the snap is installed and updated. When i try login, It gives me the following error

error: cannot communicate with server: Post http://localhost/v2/login: dial unix /run/snapd.socket: connect: no such file or directory