Service is failing to start

In the last edge release of the yorokobi snap, trying to start the service is returning an error.

sudo snap install yorokobi --edge
sudo snap start yorokobi.daemon 

This is returning (in journalctl -xe):

feb 25 16:29:53 martin-VirtualBox yorokobi.daemon[26889]: Operation not permitted (src/ip_resolver.cpp:520)

Any idea what is causing this and how to fix it? It works fine when I install the python source manually and start the system which make me suspect it is related to snapcraft and/or its confinement mode but I’m a bit stuck as I don’t have much more info to debug.

Any help that may point me to the right direction is much appreciated!

The source is located here:

You need to declare the interfaces your program needs. My guess is you need at least network for both the app and the daemon and network-bind for the deaemon.

apps:
  yorokobi:
    command: yorokobi
    plugs: [network]
  daemon:
    command: yorokobid
    daemon: simple
    restart-condition: always
    plugs: [network, network-bind]

When you develop a snap, it may be useful to use --devmode so that denials are logged but not enforced and then work your way through the necessary plugs.

1 Like

Thank you @mborzecki.

I followed your suggestion but now I’m seeing this error below.

I also tried removing the plugs for the app and keep it only for the daemon and trying the daemon only with [network] plug but still getting this same error.

Any idea?

feb 27 04:35:31 martin-VirtualBox yorokobi.daemon[13667]: Log file is '/var/snap/yorokobi/176/yorokobi.log'
feb 27 04:35:31 martin-VirtualBox yorokobi.daemon[13667]: Traceback (most recent call last):
feb 27 04:35:31 martin-VirtualBox yorokobi.daemon[13667]:   File "/snap/yorokobi/176/bin/yorokobid", line 11, in <module>
feb 27 04:35:31 martin-VirtualBox yorokobi.daemon[13667]:     load_entry_point('yorokobi==0.1.0', 'console_scripts', 'yorokobid')()
feb 27 04:35:31 martin-VirtualBox yorokobi.daemon[13667]:   File "/snap/yorokobi/176/lib/python3.6/site-packages/click/core.py", line 764, in __call__
feb 27 04:35:31 martin-VirtualBox yorokobi.daemon[13667]:     return self.main(*args, **kwargs)
feb 27 04:35:31 martin-VirtualBox yorokobi.daemon[13667]:   File "/snap/yorokobi/176/lib/python3.6/site-packages/click/core.py", line 717, in main
feb 27 04:35:31 martin-VirtualBox yorokobi.daemon[13667]:     rv = self.invoke(ctx)
feb 27 04:35:31 martin-VirtualBox yorokobi.daemon[13667]:   File "/snap/yorokobi/176/lib/python3.6/site-packages/click/core.py", line 956, in invoke
feb 27 04:35:31 martin-VirtualBox yorokobi.daemon[13667]:     return ctx.invoke(self.callback, **ctx.params)
feb 27 04:35:31 martin-VirtualBox yorokobi.daemon[13667]:   File "/snap/yorokobi/176/lib/python3.6/site-packages/click/core.py", line 555, in invoke
feb 27 04:35:31 martin-VirtualBox yorokobi.daemon[13667]:     return callback(*args, **kwargs)
feb 27 04:35:31 martin-VirtualBox yorokobi.daemon[13667]:   File "/snap/yorokobi/176/lib/python3.6/site-packages/yorokobi/cli.py", line 83, in run_agent
feb 27 04:35:31 martin-VirtualBox yorokobi.daemon[13667]:     agent.run()
feb 27 04:35:31 martin-VirtualBox yorokobi.daemon[13667]:   File "/snap/yorokobi/176/lib/python3.6/site-packages/yorokobi/agent.py", line 203, in run
feb 27 04:35:31 martin-VirtualBox yorokobi.daemon[13667]:     self.socket.bind("tcp://0.0.0.0:12996")
feb 27 04:35:31 martin-VirtualBox yorokobi.daemon[13667]:   File "zmq/backend/cython/socket.pyx", line 547, in zmq.backend.cython.socket.Socket.bind
feb 27 04:35:31 martin-VirtualBox yorokobi.daemon[13667]:   File "zmq/backend/cython/checkrc.pxd", line 25, in zmq.backend.cython.checkrc._check_rc
feb 27 04:35:31 martin-VirtualBox yorokobi.daemon[13667]: zmq.error.ZMQError: Address already in use

It looks like there is something already listening on this port. Try using netstat -nlp to find out which process is that.

1 Like

It was exactly that. It is working now.

Thank you so much!

1 Like