Can't install snap app

When I install a snap app on Ubuntu 16.04 or Ubuntu 17.04 I get this error:
error: cannot communicate with server: Get http://localhost/v2/changes/1: dial unix /run/snapd.socket: connect: connection refused

After this error I can’t install any snap.

Thanks for your message! This sounds like there is a bug in snapd, could you please paste the output of:

journalctl -u snapd

after you get the error: cannot communicate with server: Get http://localhost/v2/changes/1: dial unix /run/snapd.socket: connect: connection refused message? This should help us tracking the error down.

journalctl -u snapd gives very old logs.
I tried this: journalctl -u snapd.socket

Apr 24 13:35:25 turan systemd[1]: Starting Socket activation for snappy daemon.
Apr 24 13:35:25 turan systemd[1]: Listening on Socket activation for snappy daemon.
Apr 24 14:15:15 turan systemd[1]: snapd.socket: Unit entered failed state.

the .socket logs sadly don’t tell me anything. What are the “very old logs” you have for snapd?

Apr 24 11:00:55 turan-HP-ENVY-15-Notebook-PC systemd[1]: Started Snappy daemon.
Apr 24 11:00:59 turan-HP-ENVY-15-Notebook-PC /usr/lib/snapd/snapd[1268]: cmd.go:111: DEBUG: restarting into "/snap/core/current/usr/lib/snapd/snapd"
Apr 24 11:01:03 turan-HP-ENVY-15-Notebook-PC /usr/lib/snapd/snapd[1268]: snapmgr.go:373: DEBUG: snapmgr refresh randomness 2h20m45.389108094s
Apr 24 11:01:03 turan-HP-ENVY-15-Notebook-PC /usr/lib/snapd/snapd[1268]: daemon.go:250: DEBUG: init done in 529.949µs
Apr 24 11:01:03 turan-HP-ENVY-15-Notebook-PC snapd[1268]: 2017/04/24 11:01:03.901586 daemon.go:251: started snapd/2.23.6 (series 16; classic) ubuntu/16.04 (amd64) linux/4.4.0-72-generic.
Apr 24 11:01:03 turan-HP-ENVY-15-Notebook-PC /usr/lib/snapd/snapd[1268]: daemon.go:251: started snapd/2.23.6 (series 16; classic) ubuntu/16.04 (amd64) linux/4.4.0-72-generic.
Apr 24 11:01:03 turan-HP-ENVY-15-Notebook-PC /usr/lib/snapd/snapd[1268]: stateengine.go:98: state ensure error: cannot refresh snap-declaration for "core": Get https://assertions.ubuntu.com/v1/assertions/
Apr 24 11:01:03 turan-HP-ENVY-15-Notebook-PC /usr/lib/snapd/snapd[1268]: taskrunner.go:353: DEBUG: Running task 14 on Doing: Setup snap "instagraph" (unset) security profiles
Apr 24 11:01:03 turan-HP-ENVY-15-Notebook-PC snapd[1268]: 2017/04/24 11:01:03.903058 stateengine.go:98: state ensure error: cannot refresh snap-declaration for "core": Get https://assertions.ubuntu.com/v1
Apr 24 11:01:05 turan-HP-ENVY-15-Notebook-PC snapd[1268]: panic: assignment to entry in nil map
Apr 24 11:01:05 turan-HP-ENVY-15-Notebook-PC snapd[1268]: goroutine 24 [running]:
Apr 24 11:01:05 turan-HP-ENVY-15-Notebook-PC snapd[1268]: panic(0x55abc68eb320, 0xc820350190)
Apr 24 11:01:05 turan-HP-ENVY-15-Notebook-PC snapd[1268]:         /usr/lib/go-1.6/src/runtime/panic.go:481 +0x3ea
Apr 24 11:01:05 turan-HP-ENVY-15-Notebook-PC snapd[1268]: github.com/snapcore/snapd/interfaces/builtin.(*ContentInterface).SanitizePlug(0x55abc6eb3380, 0xc82034e880, 0x0, 0x0)
Apr 24 11:01:05 turan-HP-ENVY-15-Notebook-PC snapd[1268]:         /build/snapd-ds9lFD/snapd-2.23.6/_build/src/github.com/snapcore/snapd/interfaces/builtin/content.go:80 +0x4cb
Apr 24 11:01:05 turan-HP-ENVY-15-Notebook-PC snapd[1268]: github.com/snapcore/snapd/interfaces.(*Repository).AddSnap(0xc820203340, 0xc8202e5680, 0x0, 0x0)
Apr 24 11:01:05 turan-HP-ENVY-15-Notebook-PC snapd[1268]:         /build/snapd-ds9lFD/snapd-2.23.6/_build/src/github.com/snapcore/snapd/interfaces/repo.go:837 +0x960
Apr 24 11:01:05 turan-HP-ENVY-15-Notebook-PC snapd[1268]: github.com/snapcore/snapd/overlord/ifacestate.(*InterfaceManager).setupProfilesForSnap(0xc82020a960, 0xc8201e8900, 0xc8202bea50, 0xc8202e5680, 0xc
Apr 24 11:01:05 turan-HP-ENVY-15-Notebook-PC snapd[1268]:         /build/snapd-ds9lFD/snapd-2.23.6/_build/src/github.com/snapcore/snapd/overlord/ifacestate/handlers.go:150 +0x19f
Apr 24 11:01:05 turan-HP-ENVY-15-Notebook-PC snapd[1268]: github.com/snapcore/snapd/overlord/ifacestate.(*InterfaceManager).doSetupProfiles(0xc82020a960, 0xc8201e8900, 0xc8202bea50, 0x0, 0x0)
Apr 24 11:01:05 turan-HP-ENVY-15-Notebook-PC snapd[1268]:         /build/snapd-ds9lFD/snapd-2.23.6/_build/src/github.com/snapcore/snapd/overlord/ifacestate/handlers.go:124 +0x652
Apr 24 11:01:05 turan-HP-ENVY-15-Notebook-PC snapd[1268]: github.com/snapcore/snapd/overlord/ifacestate.(*InterfaceManager).(github.com/snapcore/snapd/overlord/ifacestate.doSetupProfiles)-fm(0xc8201e8900,
Apr 24 11:01:05 turan-HP-ENVY-15-Notebook-PC snapd[1268]:         /build/snapd-ds9lFD/snapd-2.23.6/_build/src/github.com/snapcore/snapd/overlord/ifacestate/ifacemgr.go:70 +0x44
Apr 24 11:01:05 turan-HP-ENVY-15-Notebook-PC snapd[1268]: github.com/snapcore/snapd/overlord/state.(*TaskRunner).run.func1(0x0, 0x0)
Apr 24 11:01:05 turan-HP-ENVY-15-Notebook-PC snapd[1268]:         /build/snapd-ds9lFD/snapd-2.23.6/_build/src/github.com/snapcore/snapd/overlord/state/taskrunner.go:146 +0x71
Apr 24 11:01:05 turan-HP-ENVY-15-Notebook-PC snapd[1268]: github.com/snapcore/snapd/vendor/gopkg.in/tomb%2ev2.(*Tomb).run(0xc8202bea50, 0xc8202bd470)
Apr 24 11:01:05 turan-HP-ENVY-15-Notebook-PC snapd[1268]:         /build/snapd-ds9lFD/snapd-2.23.6/_build/src/github.com/snapcore/snapd/vendor/gopkg.in/tomb.v2/tomb.go:163 +0x23
Apr 24 11:01:05 turan-HP-ENVY-15-Notebook-PC snapd[1268]: created by github.com/snapcore/snapd/vendor/gopkg.in/tomb%2ev2.(*Tomb).Go
Apr 24 11:01:05 turan-HP-ENVY-15-Notebook-PC snapd[1268]:         /build/snapd-ds9lFD/snapd-2.23.6/_build/src/github.com/snapcore/snapd/vendor/gopkg.in/tomb.v2/tomb.go:159 +0x133
Apr 24 11:01:05 turan-HP-ENVY-15-Notebook-PC systemd[1]: snapd.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Apr 24 11:01:05 turan-HP-ENVY-15-Notebook-PC systemd[1]: snapd.service: Unit entered failed state.
Apr 24 11:01:05 turan-HP-ENVY-15-Notebook-PC systemd[1]: snapd.service: Failed with result 'exit-code'.
Apr 24 11:01:06 turan-HP-ENVY-15-Notebook-PC systemd[1]: snapd.service: Service hold-off time over, scheduling restart.
Apr 24 11:01:06 turan-HP-ENVY-15-Notebook-PC systemd[1]: Stopped Snappy daemon.
Apr 24 11:01:06 turan-HP-ENVY-15-Notebook-PC systemd[1]: Started Snappy daemon.
Apr 24 11:01:06 turan-HP-ENVY-15-Notebook-PC /usr/lib/snapd/snapd[1567]: cmd.go:111: DEBUG: restarting into "/snap/core/current/usr/lib/snapd/snapd"
Apr 24 11:01:06 turan-HP-ENVY-15-Notebook-PC /usr/lib/snapd/snapd[1567]: snapmgr.go:373: DEBUG: snapmgr refresh randomness 1h30m25.913048311s
Apr 24 11:01:06 turan-HP-ENVY-15-Notebook-PC /usr/lib/snapd/snapd[1567]: daemon.go:250: DEBUG: init done in 420.775µs
Apr 24 11:01:06 turan-HP-ENVY-15-Notebook-PC /usr/lib/snapd/snapd[1567]: daemon.go:251: started snapd/2.23.6 (series 16; classic) ubuntu/16.04 (amd64) linux/4.4.0-72-generic.
Apr 24 11:01:06 turan-HP-ENVY-15-Notebook-PC snapd[1567]: 2017/04/24 11:01:06.100665 daemon.go:251: started snapd/2.23.6 (series 16; classic) ubuntu/16.04 (amd64) linux/4.4.0-72-generic.
Apr 24 11:01:06 turan-HP-ENVY-15-Notebook-PC /usr/lib/snapd/snapd[1567]: stateengine.go:98: state ensure error: cannot refresh snap-declaration for "core": Get https://assertions.ubuntu.com/v1/assertions/
Apr 24 11:01:06 turan-HP-ENVY-15-Notebook-PC /usr/lib/snapd/snapd[1567]: taskrunner.go:353: DEBUG: Running task 14 on Doing: Setup snap "instagraph" (unset) security profiles
Apr 24 11:01:06 turan-HP-ENVY-15-Notebook-PC snapd[1567]: 2017/04/24 11:01:06.101656 stateengine.go:98: state ensure error: cannot refresh snap-declaration for "core": Get https://assertions.ubuntu.com/v1
Apr 24 11:01:06 turan-HP-ENVY-15-Notebook-PC snapd[1567]: panic: assignment to entry in nil map
Apr 24 11:01:06 turan-HP-ENVY-15-Notebook-PC snapd[1567]: goroutine 19 [running]:
Apr 24 11:01:06 turan-HP-ENVY-15-Notebook-PC snapd[1567]: panic(0x55db07976320, 0xc8202b5650)
Apr 24 11:01:06 turan-HP-ENVY-15-Notebook-PC snapd[1567]:         /usr/lib/go-1.6/src/runtime/panic.go:481 +0x3ea
Apr 24 11:01:06 turan-HP-ENVY-15-Notebook-PC snapd[1567]: github.com/snapcore/snapd/interfaces/builtin.(*ContentInterface).SanitizePlug(0x55db07f3e380, 0xc8202b98e0, 0x0, 0x0)
Apr 24 11:01:06 turan-HP-ENVY-15-Notebook-PC snapd[1567]:         /build/snapd-ds9lFD/snapd-2.23.6/_build/src/github.com/snapcore/snapd/interfaces/builtin/content.go:80 +0x4cb
Apr 24 11:01:06 turan-HP-ENVY-15-Notebook-PC snapd[1567]: github.com/snapcore/snapd/interfaces.(*Repository).AddSnap(0xc820203280, 0xc8202fafc0, 0x0, 0x0)
Apr 24 11:01:06 turan-HP-ENVY-15-Notebook-PC snapd[1567]:         /build/snapd-ds9lFD/snapd-2.23.6/_build/src/github.com/snapcore/snapd/interfaces/repo.go:837 +0x960
Apr 24 11:01:06 turan-HP-ENVY-15-Notebook-PC snapd[1567]: github.com/snapcore/snapd/overlord/ifacestate.(*InterfaceManager).setupProfilesForSnap(0xc82020a900, 0xc8201cec60, 0xc8202bc410, 0xc8202fafc0, 0xc
Apr 24 11:01:06 turan-HP-ENVY-15-Notebook-PC snapd[1567]:         /build/snapd-ds9lFD/snapd-2.23.6/_build/src/github.com/snapcore/snapd/overlord/ifacestate/handlers.go:150 +0x19f
Apr 24 11:01:06 turan-HP-ENVY-15-Notebook-PC snapd[1567]: github.com/snapcore/snapd/overlord/ifacestate.(*InterfaceManager).doSetupProfiles(0xc82020a900, 0xc8201cec60, 0xc8202bc410, 0x0, 0x0)
Apr 24 11:01:06 turan-HP-ENVY-15-Notebook-PC snapd[1567]:         /build/snapd-ds9lFD/snapd-2.23.6/_build/src/github.com/snapcore/snapd/overlord/ifacestate/handlers.go:124 +0x652
Apr 24 11:01:06 turan-HP-ENVY-15-Notebook-PC snapd[1567]: github.com/snapcore/snapd/overlord/ifacestate.(*InterfaceManager).(github.com/snapcore/snapd/overlord/ifacestate.doSetupProfiles)-fm(0xc8201cec60,
Apr 24 11:01:06 turan-HP-ENVY-15-Notebook-PC snapd[1567]:         /build/snapd-ds9lFD/snapd-2.23.6/_build/src/github.com/snapcore/snapd/overlord/ifacestate/ifacemgr.go:70 +0x44
Apr 24 11:01:06 turan-HP-ENVY-15-Notebook-PC snapd[1567]: github.com/snapcore/snapd/overlord/state.(*TaskRunner).run.func1(0x0, 0x0)
Apr 24 11:01:06 turan-HP-ENVY-15-Notebook-PC snapd[1567]:         /build/snapd-ds9lFD/snapd-2.23.6/_build/src/github.com/snapcore/snapd/overlord/state/taskrunner.go:146 +0x71
Apr 24 11:01:06 turan-HP-ENVY-15-Notebook-PC snapd[1567]: github.com/snapcore/snapd/vendor/gopkg.in/tomb%2ev2.(*Tomb).run(0xc8202bc410, 0xc820256540)