Daemon does not start automatcially

I have bundled pcscd into my snap, so I have:

[...]

apps:
  pcscd:
    command: usr/local/sbin/pcscd --auto-exit --foreground
    daemon: simple
    restart-condition: always
    plugs:
      - hardware-observe
      - network
      - network-bind
      - raw-usb
      - serial-port
    sockets:
      pcscd-socket:
        listen-stream: $SNAP_COMMON/pcscd/pcscd.comm
        socket-mode: 0666
  app:
    autostart: app.desktop
    command: command.sh
    adapter: full
    plugs: 
      - desktop
      - desktop-legacy
      - home
      - x11
      - wayland
      - unity7
      - browser-support
      - network
      - gsettings
      - audio-playback
      - pulseaudio
      - opengl
    environment:
      DISABLE_WAYLAND: 1
      TMPDIR: $XDG_RUNTIME_DIR
      PATH: $SNAP/usr/sbin:$SNAP/usr/bin:$SNAP/sbin:$SNAP/bin:$PATH
      SNAP_DESKTOP_RUNTIME: $SNAP/gnome-platform
      LD_LIBRARY_PATH: $SNAP_LIBRARY_PATH:$SNAP/lib:$SNAP/usr/lib:$SNAP/lib/x86_64-linux-gnu:$SNAP/usr/lib/x86_64-linux-gnu:$SNAP/usr/local/lib/:$LD_LIBRARY_PATH

[...]

and when I start the part where a smartcard needs to be inserted, I get stuck.

What does work is opening a terminal, and running

sudo snap run app.pcscd

and leaving the terminal open.

But I want to run the pcscd app when the desktop app starts… also without the sudo… How can I achieve it?

I thought that by defining the socket it would get autostarted, whenever something (pcsp lib) accesses it, but it doesn’t seem to be the case.

I noticed that sudo snap start app.pcscd also works after connecting the connections for raw-usb and hardware-observe

After you install the snap (so a clean remove and re-install), what is the output of snap services ? It’s possible your snap is forking and so you should use daemon: forking instead of daemon: simple.

1 Like

Indeed, it works now, but thank you mentioning snap services, another useful tool to know!

1 Like