snapd uses "never" in systemd unit files when it should be using "no"

Bug #1595661 reported by Kyle Fazzari
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Snapcraft
Fix Released
High
Kyle Fazzari
snapd (Ubuntu)
Fix Released
High
Kyle Fazzari

Bug Description

Here's a .service file from my system for a service with `restart-condition: never` in the YAML (note the Restart=never):

[Unit]
# Auto-generated, DO NO EDIT
Description=Service for snap application data-writer.service
After=snapd.frameworks.target
Requires=snapd.frameworks.target
X-Snappy=yes

[Service]
ExecStart=/usr/bin/ubuntu-core-launcher snap.data-writer.service snap.data-writer.service /snap/data-writer/x4/bin/write-data from-service
Restart=never
WorkingDirectory=/var/snap/data-writer/x4
Environment="SNAP=/snap/data-writer/x4" "SNAP_DATA=/var/snap/data-writer/x4" "SNAP_NAME=data-writer" "SNAP_VERSION=1.0" "SNAP_REVISION=x4" "SNAP_ARCH=amd64" "SNAP_LIBRARY_PATH=/var/lib/snapd/lib/gl:" "SNAP_USER_DATA=/root/snap/data-writer/x4"

TimeoutStopSec=30
Type=simple

[Install]
WantedBy=multi-user.target

Revision history for this message
Yann Sionneau (yann-sionneau) wrote :

I am also affected by this bug.
I can confirm.

Changed in snapd (Ubuntu):
status: New → Confirmed
Revision history for this message
Yann Sionneau (yann-sionneau) wrote :

On the same kind of topic, daemon: oneshot is buggy and cannot work also.
Because it does set Restart=on-failure, which is refused by systemd.

And because of this very bug (the one reported by Kyle), you cannot use restart-condition: never to make oneshot daemon work.

Revision history for this message
Kyle Fazzari (kyrofa) wrote :

Adding snapcraft to this bug as well-- it needs to accept "no."

Revision history for this message
Kyle Fazzari (kyrofa) wrote :

Snapcraft could also accept "never" if snapd means to rewrite that to "no."

Kyle Fazzari (kyrofa)
Changed in snapcraft:
status: New → Confirmed
Revision history for this message
Kyle Fazzari (kyrofa) wrote :
Changed in snapcraft:
importance: Undecided → High
Changed in snapd (Ubuntu):
importance: Undecided → High
Changed in snapcraft:
assignee: nobody → Kyle Fazzari (kyrofa)
Changed in snapd (Ubuntu):
assignee: nobody → Kyle Fazzari (kyrofa)
Revision history for this message
Kyle Fazzari (kyrofa) wrote :
Kyle Fazzari (kyrofa)
Changed in snapcraft:
status: Confirmed → Fix Committed
milestone: none → 2.13
Revision history for this message
Yann Sionneau (yann-sionneau) wrote :

Thanks for the quick fix!

Kyle Fazzari (kyrofa)
Changed in snapd (Ubuntu):
status: Confirmed → Fix Committed
Changed in snapcraft:
status: Fix Committed → Fix Released
Michael Vogt (mvo)
Changed in snapd (Ubuntu):
status: Fix Committed → Fix Released
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.