snapd.refresh.service runs when being offline or on expensive/slow internet

Bug #1618207 reported by Martin Pitt
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
snapd (Ubuntu)
Triaged
Medium
Unassigned

Bug Description

snapd.refresh.service apparently does no checking about network connectivity. In a VM without network connection it fails:

● 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 Mon 2016-08-29 22:29:46 CEST; 3min 28s ago
     Docs: man:snap(1)
  Process: 2498 ExecStart=/usr/bin/snap refresh (code=exited, status=1/FAILURE)
 Main PID: 2498 (code=exited, status=1/FAILURE)

Aug 29 22:29:46 autopkgtest systemd[1]: Starting Automatically refresh installed snaps...
Aug 29 22:29:46 autopkgtest /usr/bin/snap[2498]: cmd.go:81: DEBUG: restarting into "/snap/ubuntu-core/current/usr/bin/snap"
Aug 29 22:29:46 autopkgtest snap[2498]: error: cannot refresh []: Post https://search.apps.ubuntu.com/api/v1/snaps/metadata: dial tcp: lookup search.apps.ubuntu.com: Temporary failure in name resolution
Aug 29 22:29:46 autopkgtest systemd[1]: snapd.refresh.service: Main process exited, code=exited, status=1/FAILURE
Aug 29 22:29:46 autopkgtest systemd[1]: Failed to start Automatically refresh installed snaps.
Aug 29 22:29:46 autopkgtest systemd[1]: snapd.refresh.service: Unit entered failed state.
Aug 29 22:29:46 autopkgtest systemd[1]: snapd.refresh.service: Failed with result 'exit-code'.

This alone is mostly just a wart (although failed services are always a red flag). More importantly this shows that this will run even on 3G, tethering, or other slow/expensive links. Please limit auto-upgrading snaps to when the system is on a high-quality ethernet/wifi link.

ProblemType: Bug
DistroRelease: Ubuntu 16.10
Package: snapd 2.13+16.10
ProcVersionSignature: Ubuntu 4.4.0-9136.55-generic 4.4.16
Uname: Linux 4.4.0-9136-generic x86_64
ApportVersion: 2.20.3-0ubuntu7
Architecture: amd64
CurrentDesktop: i3
Date: Mon Aug 29 22:33:19 2016
EcryptfsInUse: Yes
SourcePackage: snapd
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Martin Pitt (pitti) wrote :
Michael Vogt (mvo)
Changed in snapd (Ubuntu):
status: New → Triaged
importance: Undecided → Medium
Revision history for this message
Peter Parzer (peter-parzer) wrote :

A simple fix is to change one target in /lib/systemd/system/snapd.refresh.service. I changed the line

After=network.target snapd.firstboot.service snapd.socket

to

After=network-online.target snapd.firstboot.service snapd.socket

Now the service is started, when the network is really online.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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