Snap stop command timeouts

Looks like snap stop <snap> command is hardcoded to wait only for 5 seconds before giving up (if I am not wrong, this is the line.

I have a snap with daemon service with stop-timeout set to 60s, the service takes some time to stop under certain circumstances . The systemctl command to stop the service works fine systemctl stop snap.mysnap.service but snap stop mysnap fails with <exceeded maximum runtime of 5s>

$ snap stop mysnap
error: cannot perform the following tasks:

  • stop of [mysnap.beser] (# systemctl stop snap.mysnap.beser.service

<exceeded maximum runtime of 5s>)

  • stop of [mysnap.beser] (exceeded maximum runtime of 5s)

$ systemctl show snap.mysnap.beser.service | grep Timeout
TimeoutStartUSec=1min 30s
TimeoutStopUSec=1min

1 Like