"snapd.refresh.service" fails to start on startup

Bug #1592503 reported by Wise Melon
206
This bug affects 44 people
Affects Status Importance Assigned to Milestone
Ubuntu GNOME
Expired
Undecided
Unassigned
snapd (Ubuntu)
Expired
High
Unassigned

Bug Description

After upgrading snapd to version 2.0.8 on Ubuntu GNOME 16.04 with GNOME 3.20 I have found that I get an error at startup which tells me that the service "snapd.refresh.service" failed to start. It also tells me the command to run to give me more information on the matter, but it disappears and show the login screen so quickly that I'm not actually too sure what that command is. But if anyone knows, I'd be happy to add the output from it here too.

I tried restarting after it initially refused to start and the same thing happened during the next boot. Here are the relevant log entries from syslog:

    Jun 14 16:48:41 Computer-Name snap[1130]: error: cannot list updates: cannot list snaps: cannot list updates: Post https://search.apps.ubuntu.com/api/v1/metadata?fields=anon_download_url%2Carchitecture%2Cchannel%2Cdownload_sha512%2Csummary%2Cdescription%2Cbinary_filesize%2Cdownload_url%2Cicon_url%2Clast_updated%2Cpackage_name%2Cprices%2Cpublisher%2Cratings_average%2Crevision%2Csnap_id%2Csupport_url%2Ctitle%2Ccontent%2Cversion%2Corigin%2Cprivate%2Cconfinement: dial tcp: lookup search.apps.ubuntu.com on [::1]:53: read udp [::1]:50708->[::1]:53: read: connection refused
    Jun 14 16:48:41 Computer-Name systemd[1]: snapd.refresh.service: Main process exited, code=exited, status=1/FAILURE
    Jun 14 16:48:41 Computer-Name systemd[1]: Failed to start Automatically refresh installed snaps.
    Jun 14 16:48:41 Computer-Name systemd[1]: snapd.refresh.timer: Adding 5h 58min 46.413157s random time.
    Jun 14 16:48:41 Computer-Name systemd[1]: snapd.refresh.service: Unit entered failed state.
    Jun 14 16:48:41 Computer-Name systemd[1]: snapd.refresh.timer: Adding 30min 12.073270s random time.
    Jun 14 16:48:41 Computer-Name systemd[1]: snapd.refresh.service: Failed with result 'exit-code'.

Though it should be noted that I don't have any snaps at the moment installed nor do or have I used snapd.

ProblemType: Bug
DistroRelease: Ubuntu 16.04
Package: snapd 2.0.8
ProcVersionSignature: Ubuntu 4.4.0-24.43-generic 4.4.10
Uname: Linux 4.4.0-24-generic x86_64
ApportVersion: 2.20.1-0ubuntu2.1
Architecture: amd64
CurrentDesktop: GNOME
Date: Tue Jun 14 18:47:35 2016
InstallationDate: Installed on 2016-05-15 (30 days ago)
InstallationMedia: Ubuntu-GNOME 15.10 "Wily Werewolf" - Release amd64 (20151021)
SourcePackage: snapd
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Wise Melon (wise-melon-deactivatedaccount) wrote :
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in snapd (Ubuntu):
status: New → Confirmed
Changed in ubuntu-gnome:
status: New → Confirmed
Revision history for this message
Wise Melon (wise-melon-deactivatedaccount) wrote :

Later output at a later startup time you can see that the error is slightly different:

    Jun 14 18:41:26 Computer-Name /usr/lib/snapd/snapd[882]: daemon.go:181: DEBUG: uid=0;@ GET /v2/find?q=&select=refresh 341.173044ms 500
    Jun 14 18:41:26 Computer-Name snap[5642]: error: cannot list updates: cannot list snaps: cannot list updates: Post https://search.apps.ubuntu.com/api/v1/metadata?fields=anon_download_url%2Carchitecture%2Cchannel%2Cdownload_sha512%2Csummary%2Cdescription%2Cbinary_filesize%2Cdownload_url%2Cicon_url%2Clast_updated%2Cpackage_name%2Cprices%2Cpublisher%2Cratings_average%2Crevision%2Csnap_id%2Csupport_url%2Ctitle%2Ccontent%2Cversion%2Corigin%2Cprivate%2Cconfinement: dial tcp: lookup search.apps.ubuntu.com on 127.0.1.1:53: server misbehaving
    Jun 14 18:41:26 Computer-Name systemd[1]: snapd.refresh.service: Main process exited, code=exited, status=1/FAILURE
    Jun 14 18:41:26 Computer-Name systemd[1]: Failed to start Automatically refresh installed snaps.
    Jun 14 18:41:26 Computer-Name systemd[1]: snapd.refresh.timer: Adding 3h 15min 40.937857s random time.
    Jun 14 18:41:26 Computer-Name systemd[1]: snapd.refresh.service: Unit entered failed state.
    Jun 14 18:41:26 Computer-Name systemd[1]: snapd.refresh.timer: Adding 38min 13.656375s random time.
    Jun 14 18:41:26 Computer-Name systemd[1]: snapd.refresh.service: Failed with result 'exit-code'.

Changed in snapd (Ubuntu):
importance: Undecided → High
Revision history for this message
Kumaran A (lijikumaran) wrote :

systemctl status snapd.refresh.service
● snapd.refresh.service - Automatically refresh installed snaps
   Loaded: loaded (/lib/systemd/system/snapd.refresh.service; static; vendor pre
   Active: failed (Result: exit-code) since Thu 2016-06-23 15:03:15 IST; 2h 30mi
     Docs: man:snap(1)
  Process: 20485 ExecStart=/usr/bin/snap refresh (code=exited, status=1/FAILURE)
 Main PID: 20485 (code=exited, status=1/FAILURE)

Jun 23 15:02:59 kumaran-desktop systemd[1]: Starting Automatically refresh insta
Jun 23 15:03:15 kumaran-desktop snap[20485]: error: cannot list updates: cannot
Jun 23 15:03:15 kumaran-desktop systemd[1]: snapd.refresh.service: Main process
Jun 23 15:03:15 kumaran-desktop systemd[1]: Failed to start Automatically refres
Jun 23 15:03:15 kumaran-desktop systemd[1]: snapd.refresh.service: Unit entered
Jun 23 15:03:15 kumaran-desktop systemd[1]: snapd.refresh.service: Failed with r

Revision history for this message
Klaus Bielke (k-bielke) wrote :

snapd.refresh.service fails sometimes on startup, not on every startup.
A successfull start of snapd.refresh.service (aktive) may change to failed after suspend/wake up.

Revision history for this message
kern (kernelapi) wrote :

i resolve this problem by login in snap

#snap login <email address hidden>

after login on account from login.ubuntu.com i see this on startup message:
● snapd.refresh.service - Automatically refresh installed snaps
   Loaded: loaded (/lib/systemd/system/snapd.refresh.service; static; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:snap(1)

Revision history for this message
axel (axel334) wrote :

I did not install any snap packages but I get this on start-up
http://i.imgur.com/SFRvIJN.png

Revision history for this message
Arup (arup-chowdhury) wrote :

Happening here as well, fresh installed 16.04 with all updates.

Revision history for this message
Christopher Kosciuk (cjkosciuk) wrote :

Also happening on a fresh install of Ubuntu-MATE 16.04:

$ systemctl status snapd.refresh.service
snapd.refresh.service - Automatically refresh installed snaps
Loaded: loaded (/lib/systemd/system/snapd.refresh.service; static; vendor preset; enabled)
Active: failed (Result: exit-code) since Sun 2016-07-03 12:34:44 EDT; 20min ago
Docs: man:snap(1)
Process: 988 ExecStart=/usr/bin/snap refresh (code=exited, status=1/FAILURE)
Main PID: 988 (code=exited, status=1/FAILURE)

Jul 03 12:34:44 X200 systemd[1]: Starting Automaticcaly refresh installed snaps...
Jul 03 12:34:44 X200 snap[988]: error: cannot list updates: cannot list snaps: cannot list updates: Post https://search.apps.ubuntu.com/api/v1/metadata?fields=a
Jul 03 12:34:44 X200 systemd[1]: snapd.refresh.service: Main process exited, code=exited, status=1/FAILURE
Jul 03 12:34:44 X200 systemd[1]: Failed to start Automatically refresh installed snaps
Jul 03 12:34:44 X200 systemd[1]: snapd.refresh.service: Unit entered failed state
Jul 03 12:34:44 X200 systemd[1]: snapd.refresh.service: Failed with result 'exit-code'.

Revision history for this message
Zygmunt Krynicki (zyga) wrote :

I wonder if this may be caused by the timer firing before the system is online. EDIT, checking the source I see that we have "After=network.target" in the snapd.refresh.service.

Revision history for this message
Avin Varghese (avin.varghese) wrote :

same problem in Kubuntu 16.04

Revision history for this message
Jonathan (j.p.) wrote :

I solve the problem in Ubuntu Server 16.04 LTS for me:
The problem appears, if no internet connection is available. I set my IP address every time manually, and if the IP address is not set (so on startup) no internet connection could be established and the snapd.refresh.service failed to start, and I am not able to restart the service manually, but if I connect to the internet, then every thing works fine and the service start successfully.

Revision history for this message
asgard2 (kamp000x) wrote :

Same problem here ...

I deactivated this deamon with
echo manual | sudo tee /etc/init/snapd.override

Revision history for this message
Antonios Hadjigeorgalis (antonioshadji) wrote :

I'm also seeing the behaviour that the service can be started manually after the internet connection is active. I'm seeing this with both a clean install of 16.04 on a laptop and an upgrade from 14.04 to 16.04 on a desktop.

Revision history for this message
chris pollock (cpollock) wrote :

I also saw this a little while ago during a boot:

failed to start automatically installed snaps

According to 'snap list' I have none installed

 snap list
No snaps are installed yet. Try 'snap install hello-world'.

Revision history for this message
Alex Corrie (electrichead) wrote :

By no means a systemd expert, but if this is failing due to lack of internet connectivity I would suggest making a copy of the service unit, i.e.

  sudo cp /lib/systemd/system/snapd.refresh.service /etc/systemd/system

and modifying the Unit definition by replacing

  After=network.target

with

  Requires=network-online.target
  After=network-online.target

I was getting this failed service error but it was starting fine manually in a desktop session. It hasn't failed since this tweak.

Caveat: I can't say I've thoroughly verified this - it was more of a quick attempt to fix it based on a hypothesis arrived at from various comments here, the error messages themselves and what I understand the functionality to be. I'm not getting the issue now and that's probably good enough for me, for now.

Revision history for this message
Wise Melon (wise-melon-deactivatedaccount) wrote :

Alex Corrie, what you suggest sounds like it should work judging also by the comments on this report. So if it does work for you and you think it fixes the problem then perhaps you could propose a patch?

Revision history for this message
Dorothy (dorothym) wrote :

I am having the same problem since upgrade to ubuntu 16.04 LTS. Here is the log:

-- Logs begin at Wed 2016-09-21 09:33:44 BST, end at Wed 2016-09-21 09:43:01 BST. --
Sep 21 09:33:45 SpaceMonkey systemd[1]: Starting Automatically refresh installed snaps...
Sep 21 09:33:45 SpaceMonkey snap[1185]: error: cannot refresh []: Post https://search.apps.ubuntu.com/api/v1/snaps/metadata: dial tcp: lookup search.apps.ubuntu.com on [::1]:53: read udp [::1]:52266->[::1]:53: read: connection refused
Sep 21 09:33:45 SpaceMonkey systemd[1]: snapd.refresh.service: Main process exited, code=exited, status=1/FAILURE
Sep 21 09:33:45 SpaceMonkey systemd[1]: Failed to start Automatically refresh installed snaps.
Sep 21 09:33:45 SpaceMonkey systemd[1]: snapd.refresh.service: Unit entered failed state.
Sep 21 09:33:45 SpaceMonkey systemd[1]: snapd.refresh.service: Failed with result 'exit-code'.

Revision history for this message
mjmetz64 (m-matt-r) wrote :

16.04 LTS, fairly new install. Can't achieve a full boot to login in text mode or Unity with /etc/rc.local marked executable. I can ssh to the affected machine when /etc/rc.local runs, however, and my application started there, which uses internet connectivity is up and working fine.

systemctl status snapd.refresh.service
● snapd.refresh.service - Automatically refresh installed snaps
   Loaded: loaded (/lib/systemd/system/snapd.refresh.service; static; vendor preset: enabled)
   Active: inactive (dead) since Wed 2016-09-21 09:52:13 CDT; 23min ago
     Docs: man:snap(1)
  Process: 1261 ExecStart=/usr/bin/snap refresh (code=exited, status=0/SUCCESS)
 Main PID: 1261 (code=exited, status=0/SUCCESS)

Sep 21 09:52:12 mlaptop4 systemd[1]: Starting Automatically refresh installed snaps...
Sep 21 09:52:13 mlaptop4 snap[1261]: [4B blob data]
Sep 21 09:52:13 mlaptop4 snap[1261]: All snaps up to date.
Sep 21 09:52:13 mlaptop4 systemd[1]: Started Automatically refresh installed snaps.

Revision history for this message
Wise Melon (wise-melon-deactivatedaccount) wrote :

Although I don't see an error about this on startup, "systemctl status snapd.refresh.service" still records a failed startup on Yakkety.

tags: added: yakkety
Revision history for this message
Wise Melon (wise-melon-deactivatedaccount) wrote :

@eduardo, To not clog things up you can click the little greed "Hide" button (bottom-right-hand corner of comment) on comments to hide them from view.

Revision history for this message
Bruce Pieterse (octoquad) wrote :

This looks fixed now. The service unit has changed since the bug report was filed. Additionally firing up a VM without network connectivity shows:

systemctl status snapd.refresh.service
● snapd.refresh.service - Automatically refresh installed snaps
   Loaded: loaded (/lib/systemd/system/snapd.refresh.service; static; vendor pre
   Active: inactive (dead)
     Docs: man:snap(1)

@Nikita and others affected, can you confirm that is working correctly for you now?

snapd:
  Installed: 2.20.1ubuntu1
  Candidate: 2.20.1ubuntu1
  Version table:
 *** 2.20.1ubuntu1 500
        500 http://za.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages
        100 /var/lib/dpkg/status
     2.0.2 500
        500 http://za.archive.ubuntu.com/ubuntu xenial/main amd64 Packages

Changed in ubuntu-gnome:
status: Confirmed → Incomplete
Revision history for this message
Wayne Berge (quyen) wrote : Re: [Bug 1592503] Re: "snapd.refresh.service" fails to start on startup

It seems to be working ok now. Thanks.

On 15/01/2017 17:59, Bruce Pieterse wrote:
> This looks fixed now. The service unit has changed since the bug report
> was filed. Additionally firing up a VM without network connectivity
> shows:
>
> systemctl status snapd.refresh.service
> ● snapd.refresh.service - Automatically refresh installed snaps
> Loaded: loaded (/lib/systemd/system/snapd.refresh.service; static; vendor pre
> Active: inactive (dead)
> Docs: man:snap(1)
>
> @Nikita and others affected, can you confirm that is working correctly
> for you now?
>
> snapd:
> Installed: 2.20.1ubuntu1
> Candidate: 2.20.1ubuntu1
> Version table:
> *** 2.20.1ubuntu1 500
> 500 http://za.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages
> 100 /var/lib/dpkg/status
> 2.0.2 500
> 500 http://za.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
>
> ** Changed in: ubuntu-gnome
> Status: Confirmed => Incomplete
>

Revision history for this message
Michael Vogt (mvo) wrote :

Is this still a problem with the latest snapd? We use After=network-online.target now which should ensure we do not run until we actually have network.

Changed in snapd (Ubuntu):
status: Confirmed → Incomplete
Revision history for this message
chris pollock (cpollock) wrote :

On Thu, 2017-01-26 at 16:51 +0000, Michael Vogt wrote:
> Is this still a problem with the latest snapd? We use After=network-
> online.target now which should ensure we do not run until we actually
> have network.
>
> ** Changed in: snapd (Ubuntu)
>        Status: Confirmed => Incomplete
>
The last time I saw this was 10 Jan this year.

Jan 10 14:32:19 localhost systemd[1]: snapd.refresh.service: Main
process exited, code=exited, status=1/FAILURE
Jan 10 14:32:19 localhost systemd[1]: Failed to start Automatically
refresh installed snaps.
Jan 10 14:32:19 localhost systemd[1]: snapd.refresh.timer: Adding 28min
33.984038s random time.
Jan 10 14:32:19 localhost systemd[1]: snapd.refresh.timer: Adding 5h
33min 46.386396s random time.
Jan 10 14:32:19 localhost systemd[1]: snapd.refresh.service: Unit
entered failed state.
Jan 10 14:32:19 localhost systemd[1]: snapd.refresh.timer: Adding 1h
1min 47.737419s random time.
Jan 10 14:32:19 localhost systemd[1]: snapd.refresh.timer: Adding 1h
27min 50.955932s random time.
Jan 10 14:32:19 localhost systemd[1]: snapd.refresh.service: Failed
with result 'exit-code'.

--
Chris
KeyID 0xE372A7DA98E6705C
31.11972; -97.90167 (Elev. 1092 ft)
11:41:11 up 19:01, 1 user, load average: 0.66, 0.52, 0.36
Ubuntu 16.04.1 LTS, kernel 4.4.0-59-generic #80-Ubuntu SMP Fri Jan 6
17:47:47 UTC 2017

Revision history for this message
Wayne Berge (quyen) wrote :

Hello. I am not having a problem now. Thanks.

On 27/01/2017 01:46, chris pollock wrote:
> On Thu, 2017-01-26 at 16:51 +0000, Michael Vogt wrote:
>> Is this still a problem with the latest snapd? We use After=network-
>> online.target now which should ensure we do not run until we actually
>> have network.
>>
>> ** Changed in: snapd (Ubuntu)
>> Status: Confirmed => Incomplete
>>
> The last time I saw this was 10 Jan this year.
>
> Jan 10 14:32:19 localhost systemd[1]: snapd.refresh.service: Main
> process exited, code=exited, status=1/FAILURE
> Jan 10 14:32:19 localhost systemd[1]: Failed to start Automatically
> refresh installed snaps.
> Jan 10 14:32:19 localhost systemd[1]: snapd.refresh.timer: Adding 28min
> 33.984038s random time.
> Jan 10 14:32:19 localhost systemd[1]: snapd.refresh.timer: Adding 5h
> 33min 46.386396s random time.
> Jan 10 14:32:19 localhost systemd[1]: snapd.refresh.service: Unit
> entered failed state.
> Jan 10 14:32:19 localhost systemd[1]: snapd.refresh.timer: Adding 1h
> 1min 47.737419s random time.
> Jan 10 14:32:19 localhost systemd[1]: snapd.refresh.timer: Adding 1h
> 27min 50.955932s random time.
> Jan 10 14:32:19 localhost systemd[1]: snapd.refresh.service: Failed
> with result 'exit-code'.
>

Revision history for this message
venkatarao gaddam (venkatarao.gaddam) wrote :

Hello, I am trying to install one app in Ubuntu-core.

'snap list' gives me error:

# snap list
error: cannot list snaps: cannot communicate with server: Get http://localhost/v2/snaps: EOF

And when I am trying for below command:
$ systemctl status snapd.refresh.service
● snapd.refresh.service - Automatically refresh installed snaps
   Loaded: loaded (/lib/systemd/system/snapd.refresh.service; static; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:snap(1)

I am not able to install any app in ubuntu-core. It gives the error as listed below:
error: cannot communicate with server: Post http://localhost/v2/snaps/hello-world: EOF

Revision history for this message
Wayne Berge (quyen) wrote :

Sorry, I cannot help you. Please go back to the forum and post your
message there. Thanks.

On 01/02/2017 17:11, venkatarao gaddam wrote:
> Hello, I am trying to install one app in Ubuntu-core.
>
> 'snap list' gives me error:
>
> # snap list
> error: cannot list snaps: cannot communicate with server: Get http://localhost/v2/snaps: EOF
>
> And when I am trying for below command:
> $ systemctl status snapd.refresh.service
> ● snapd.refresh.service - Automatically refresh installed snaps
> Loaded: loaded (/lib/systemd/system/snapd.refresh.service; static; vendor preset: enabled)
> Active: inactive (dead)
> Docs: man:snap(1)
>
> I am not able to install any app in ubuntu-core. It gives the error as listed below:
> error: cannot communicate with server: Post http://localhost/v2/snaps/hello-world: EOF
>

Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for Ubuntu GNOME because there has been no activity for 60 days.]

Changed in ubuntu-gnome:
status: Incomplete → Expired
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for snapd (Ubuntu) because there has been no activity for 60 days.]

Changed in snapd (Ubuntu):
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.