Prevent --disabled service from restarting when reloading the snap?

I’m working on my oss tool found at Kushtaka.org and I started shipping it as a snap. I encountered a weird edge case that I’m hoping someone can help me with.

Kushtaka can act as either a server or a sensor and after you install the snap, you either enable/disable the mode of operation you want.

I noticed that after I run snap refresh kushtaka the --disabled service will be re-enabled.

As I do not want this, I’m wondering how I can account for it? Thoughts?

Thanks in advance!

Jared

well, how did you disable the service in the first place ?

if via systemctl, that might indeed be ingored by snapd … you should use snap stop --disable <snap>.<app>, if this does not save the state, then there is a bug somewhere …

[EDIT] I have put this into the snapd category

1 Like

Thanks Ogra. Here are my steps.

  1. $ sudo snap stop --disable kushtakad.server
  2. I release a new version of the snap to the snap store
  3. $ sudo snap refresh kushtakad --edge --devmode
  4. $ sudo snap services
  5. The kushtakad.server is re-enabled

If this sounds like a bug point me to the bug filer and I’ll double check and write it up.

Thanks!

there is no snap reload, you mean refresh, right?

1 Like

Yes. My bad. I’m a snap newb. *corrected the above posts

1 Like

ah, this is discussed here

and there seems to be a bug for it already

1 Like

Beaut. Thanks so much!

Can you try refreshing to the edge channel of the core snap and trying your situation again? we should have this fixed in the edge channel due to https://github.com/snapcore/snapd/pull/7431

1 Like

I’m shipping a new release some time today. I’ll go through the workflow and document it and let you know. Cheers and yay for OSS!

Thoughts? I’m assuming I screwed up with the core install? Advice or guidance appreciated.

Jared

$ sudo snap install core --edge
core (edge) 16-2.42.4+git1579.c9f48be from Canonical✓ installed
$ sudo snap services
Service           Startup   Current   Notes
kushtakad.sensor  enabled   active    -
kushtakad.server  disabled  inactive  -
$ sudo snap refresh kushtakad --devmode
kushtakad (edge) 0.2.12 from Jared Folkins (backwardselvis) refreshed
$ sudo snap services
Service           Startup  Current  Notes
kushtakad.sensor  enabled  active   -
kushtakad.server  enabled  active   -

Are you on Ubuntu Core 18 by any chance?

Again, I’m new to the snap scene, if I’m not giving you good data, let me know the explicit commands. Thanks again!

Welcome to Ubuntu 18.04.3 LTS (GNU/Linux 5.0.0-1023-azure x86_64)
$ uname -a
Linux [redacted] 5.0.0-1023-azure #24~18.04.1-Ubuntu SMP Wed Oct 2 20:23:29 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
name: kushtakad
version: 0.2.12
summary: Kushtakad act as either a server or sensor
description: Kushtaka.org is a sustainable all-in-one honeypot and honeytoken orchestrator
  for under-resourced Blue Teams.
base: core18
license: Apache-2.0
grade: devel
confinement: devmode
architectures:
- amd64
apps:
  conf:
    command: kushtakad
  sensor:
    command: kushtakad -sensor
    plugs:
    - network
    - network-bind
    daemon: simple
  server:
    command: kushtakad -server
    plugs:
    - network
    - network-bind
    daemon: simple

Hi, I am able to reproduce your issue and am working on a fix, we seem to have a regression.

1 Like

Hi, can you try this again with the core snap from the beta channel?

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

I tested again and am no longer able to reproduce this with the released beta channel. I think the issue previously was that we hadn’t yet actually released a version of snapd with the fix in.