"refresh-mode" daemon on update seems to be not working / no trace in logs

Hello there !

First question :

It seems that when I put refresh-mode: endure in my .yaml my daemon still gets killed and restarted during a snap auto refresh (i did put my system to refresh automatically every 5m).

Am I doing anything wrong ? How can I debug this more ?

Second question :

Is the documentaiton out of date ?

The documentation is mentioning this system here : https://snapcraft.io/docs/snap-format

# Controls whether the daemon should be restarted during a snap refresh. Defaults to 'restart'.
      refresh-mode:  skip-refresh | restart

But on snapcraft 3.8, it tells me that I should use ['endure', 'restart']

Is the documentation out of date ?

Best :slight_smile:

Digging deeper into the problem, it seems that snap on an auto refresh kills and restart my daemon.

I wanted to explore more by looking at the snapd logs with journalctl -u snapd

But all i get is storehelpers.fo : cannot refresh: snap has no updates available and autorefresh.go : all snaps are up to date

Absolutely no trace of the fact that my snap was updated !

Of course snap info mysnap shows me that it’s indeed installed

refresh info can be obtained with the
snap changes
command, details about a change with
snap change <#change_id>

1 Like

Thanks a lot !

I can confirm that on a auto refresh, my two services get restarted even if they have the refresh-mode : endure option.

Commands snap changes give me the confirmation that the snap package were indeed restarted after the refresh, and I can also confirm from my app that it did indeed change.

I tested it on different tracks I have the same behavior.

How can I get around this problem ?

Hi, I tried to reproduce your issue on my system locally with a manual refresh and also an auto refresh from the store and couldn’t reproduce, see my snap.yaml:

name: test-snapd-endure-service-ijohnson
version: 1.0
apps:
  test-snapd-endure-service:
    command: bin/start-stop-mode endure
    stop-command: bin/stop-stop-mode endure
    daemon: simple
    refresh-mode: endure

This is with beta snapd, but I imagine that it’s the same on stable.

$ snap version
snap    2.43~pre1
snapd   2.43~pre1
series  16
ubuntu  19.04
kernel  5.0.0-37-generic
host    amd64 

What does your snap.yaml or snapcraft.yaml look like?

Will test that thank you !

Also the snap is private, I have no idea if that could change something.

No a snap being private should not change this at all.

It looks like that

apps:
  daemon:
     command: bin/mybinary
     daemon: simple
     #after: launcher
     environment: 
        "LD_LIBRARY_PATH": "$LD_LIBRARY_PATH:$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/" 
     refresh-mode: endure #  # will not restart service when refreshed
     stop-mode: sigterm # send sigterm when stopping daemon 
     restart-condition: on-failure
     #restart-delay: 1s
     plugs: [network-bind,shutdown,avahi-control,avahi-observe,raw-usb,network-observe]

  launcher:
    command: bin/launcher --myoption
    daemon: simple
    refresh-mode: endure # will not restart service when refreshed
    stop-mode: sigterm # send sigterm when stopping daemon 
    restart-condition: on-failure
    #restart-delay: 1s
    plugs: [network-bind,shutdown,raw-usb,network-observe]