Cannot start snap, stuck after "Watches established"

Hi. I am trying run my PyQt5 snap on Ubuntu Core 20. So I am following this article : https://ubuntu.com/tutorials/x11-kiosk#1-overview

The updated the snapcraft.yaml according to my needs. But after snapping when I installed it, it printed some logs and then got stuck and is not moving forward.

Here is my snapcraft.yaml

name: cluemaster-mediadisplay 
base: core20 
version: '1.0.8' 
summary: snap
description: description
   
grade: stable 
confinement: strict

apps:
  cluemaster-mediadisplay:
    command-chain:
      - env-setup
    command: usr/local/bin/x11_kiosk_launch bin/prepare-launch $SNAP/cluemaster_display
    plugs:
      - home
      - desktop-legacy
      - desktop
      - wayland
      - x11
      - unity7
      - network
      - opengl
      - gsettings
      - pulseaudio
      - network-bind
      - screen-inhibit-control
      - audio-playback
      - shutdown
      - process-control
      - mount-observe
      - network-control

parts:
  copy-source-code:
    plugin: dump
    source: cluemaster_display/
    stage-packages:
      - ffmpeg
      - locales
      - libmpv1
      - va-driver-all
      - vdpau-driver-all
      - mesa-va-drivers
      - libvdpau-va-gl1
      - libglu1-mesa
      - samba-libs
      - git
      - python3-dbus
      - qtwayland5
      - mesa-utils
    stage-snaps: [mir-kiosk-x11]

  desktop-files-and-icons:
    plugin: dump
    source: snap/gui/
    organize: 
      "cluemaster-mediadisplay.desktop": "usr/share/applications/"
      "cluemaster-mediadisplay.png": "usr/share/applications/"
    stage:
      - usr/share/applications/cluemaster-mediadisplay.desktop
      - usr/share/applications/cluemaster-mediadisplay.png

  extras:
    plugin: dump
    source: static/
    organize: 
      "prepare-launch": "bin/"

layout:
  /usr/share/libdrm/amdgpu.ids:
    symlink: $SNAP/usr/share/libdrm/amdgpu.ids
  /usr/share/X11:
    bind: $SNAP/usr/share/X11
  /usr/bin/xkbcomp:
    symlink: $SNAP/usr/bin/xkbcomp
  /usr/share/icons:
    bind: $SNAP/usr/share/icons
  /usr/share/fonts:
    bind: $SNAP/usr/share/fonts
  /etc/fonts:
    bind: $SNAP/etc/fonts

Here is the console logs

++ dirname /run/user/1000/snap.cluemaster-mediadisplay
+ real_xdg_runtime_dir=/run/user/1000
+ '[' '!' -O /run/user/1000 ']'
++ find /snap/cluemaster-mediadisplay/x2/hacks -name 'setup-*'
+ for hack in $(find "${SNAP}/hacks" -name setup-\*)
+ . /snap/cluemaster-mediadisplay/x2/hacks/setup-gl
++ set -x
++ export __EGL_VENDOR_LIBRARY_DIRS=/snap/cluemaster-mediadisplay/x2/etc/glvnd/egl_vendor.d:/snap/cluemaster-mediadisplay/x2/usr/share/glvnd/egl_vendor.d
++ __EGL_VENDOR_LIBRARY_DIRS=/snap/cluemaster-mediadisplay/x2/etc/glvnd/egl_vendor.d:/snap/cluemaster-mediadisplay/x2/usr/share/glvnd/egl_vendor.d
++ export LIBGL_DRIVERS_PATH=/snap/cluemaster-mediadisplay/x2/usr/lib/x86_64-linux-gnu/dri
++ LIBGL_DRIVERS_PATH=/snap/cluemaster-mediadisplay/x2/usr/lib/x86_64-linux-gnu/dri
++ export LD_LIBRARY_PATH=/snap/cluemaster-mediadisplay/x2/usr/lib/x86_64-linux-gnu:/snap/cluemaster-mediadisplay/x2/lib/x86_64-linux-gnu:/var/lib/snapd/lib/gl:/var/lib/snapd/lib/gl32:/var/lib/snapd/void:/snap/cluemaster-mediadisplay/x2/lib:/snap/cluemaster-mediadisplay/x2/usr/lib:/snap/cluemaster-mediadisplay/x2/lib/x86_64-linux-gnu:/snap/cluemaster-mediadisplay/x2/usr/lib/x86_64-linux-gnu
++ LD_LIBRARY_PATH=/snap/cluemaster-mediadisplay/x2/usr/lib/x86_64-linux-gnu:/snap/cluemaster-mediadisplay/x2/lib/x86_64-linux-gnu:/var/lib/snapd/lib/gl:/var/lib/snapd/lib/gl32:/var/lib/snapd/void:/snap/cluemaster-mediadisplay/x2/lib:/snap/cluemaster-mediadisplay/x2/usr/lib:/snap/cluemaster-mediadisplay/x2/lib/x86_64-linux-gnu:/snap/cluemaster-mediadisplay/x2/usr/lib/x86_64-linux-gnu
+ for hack in $(find "${SNAP}/hacks" -name setup-\*)
+ . /snap/cluemaster-mediadisplay/x2/hacks/setup-mir
++ set -x
++ export MIR_SERVER_PLATFORM_PATH=/snap/cluemaster-mediadisplay/x2/usr/lib/x86_64-linux-gnu/mir/server-platform
++ MIR_SERVER_PLATFORM_PATH=/snap/cluemaster-mediadisplay/x2/usr/lib/x86_64-linux-gnu/mir/server-platform
++ export MIR_SERVER_XWAYLAND_PATH=/snap/cluemaster-mediadisplay/x2/usr/bin/Xwayland
++ MIR_SERVER_XWAYLAND_PATH=/snap/cluemaster-mediadisplay/x2/usr/bin/Xwayland
+ for hack in $(find "${SNAP}/hacks" -name setup-\*)
+ . /snap/cluemaster-mediadisplay/x2/hacks/setup-wayland-host
++ set -x
++ snapctl is-connected wayland
+++ dirname /run/user/1000/snap.cluemaster-mediadisplay
++ real_wayland=/run/user/1000/wayland-0
++ '[' '!' -O /run/user/1000/wayland-0 ']'
+++ dirname /run/user/1000/wayland-0
++ inotifywait --event create /run/user/1000
Setting up watches.
Watches established.
/run/user/1000/ CREATE,ISDIR speech-dispatcher
++ '[' '!' -O /run/user/1000/wayland-0 ']'
+++ dirname /run/user/1000/wayland-0
++ inotifywait --event create /run/user/1000
Setting up watches.
Watches established.

After a little research, I found its related to inotify

Any suggestions would be really appreciated. If you have any other idea to achieve this. That would be great too. :slightly_smiling_face:

Thanks in advance.

there is no wayland socket a normal user could access on Ubuntu Core … you could try running the command with sudo or turn it into a daemon …

Thanks for the reply @ogra. I can try converting it into a daemon and let you know, if it works. Thanks again

1 Like

Hi @ogra. I converted it into a daemon, uploaded it to my Ubuntu Core and now I am getting these logs right now, using

snap logs cluemaster-mediadisplay.cluemaster-mediadisplay

Here is the full logs

hiransarkar@ubuntu:~$ snap logs cluemaster-mediadisplay.cluemaster-mediadisplay
2021-09-03T12:20:29Z cluemaster-mediadisplay.cluemaster-mediadisplay[1540]: [2021-09-03 12:20:29.755728] <information> mirserver: . |_ Scaling factor: 1.00
2021-09-03T12:20:29Z cluemaster-mediadisplay.cluemaster-mediadisplay[1541]: /tmp/tmp.B0qmuUuuVF CLOSE_WRITE,CLOSE
2021-09-03T12:20:29Z cluemaster-mediadisplay.cluemaster-mediadisplay[1560]: /snap/cluemaster-mediadisplay/42/usr/local/bin/x11_kiosk_launch: 19: bin/prepare-launch: not found
2021-09-03T12:20:29Z cluemaster-mediadisplay.cluemaster-mediadisplay[1540]: [2021-09-03 12:20:29.762487] < - debug - > mirserver: Handling Terminated from pid=1509
2021-09-03T12:20:29Z systemd[1]: snap.cluemaster-mediadisplay.cluemaster-mediadisplay.service: Succeeded.
2021-09-03T12:20:30Z systemd[1]: snap.cluemaster-mediadisplay.cluemaster-mediadisplay.service: Scheduled restart job, restart counter is at 6.
2021-09-03T12:20:30Z systemd[1]: Stopped Service for snap application cluemaster-mediadisplay.cluemaster-mediadisplay.
2021-09-03T12:20:30Z systemd[1]: snap.cluemaster-mediadisplay.cluemaster-mediadisplay.service: Start request repeated too quickly.
2021-09-03T12:20:30Z systemd[1]: snap.cluemaster-mediadisplay.cluemaster-mediadisplay.service: Failed with result 'start-limit-hit'.
2021-09-03T12:20:30Z systemd[1]: Failed to start Service for snap application cluemaster-mediadisplay.cluemaster-mediadisplay.
hiransarkar@ubuntu:~$ 

And yes the screen is black on my Core PC

Problem fixed. I looked the logs carefully and found out that a file was missing

2021-09-03T12:20:29Z cluemaster-mediadisplay.cluemaster-mediadisplay[1560]: /snap/cluemaster-mediadisplay/42/usr/local/bin/x11_kiosk_launch: 19: bin/prepare-launch: not found

updated the location and now its running…

Thanks @ogra. You have been very helpful.

Now there is only one issue. I can’t hear the sounds when playing a video from the snap. What you have any idea as to what might be the problem. Or should I open another thread regrading the sound issue?

  • install the pulseaudio snap from the beta channel
  • add audio-playback to your plugs
  • ship libpulse0 as a stage-package …
  • … and make sure the subdir it gets installed in is in your LD_LIBRARY_PATH
  • if you do not use any desktop launcher (i.e. from an extension or the snapcraft desktop launchers github tree) you might also need to set PULSE_SERVER to point to “$XDG_RUNTIME_DIR/…/pulse/native”
  • connect your snaps audio-playback interface plug to pulseaudio
1 Like

thanks @ogra I will try and let you know the results. However I am facing one more issue, the snap doesn’t auto start until I connect to the core pc using ssh. Do you have any idea what might be the issue?

anything interesting in your journal ?

Hi @ogra. Sorry for the late reply. How do I check the journal?

you log in to the device, for seeing the journal you use sudo journalctl to read the journal … there is also the systemctl command as well as snap logs <yoursnap> to see infos about errors and issues.

Hi @ogra. I obtained this logs using

snap logs cluemaster-mediadisplay.cluemaster-mediadisplay

Logs:

2021-09-05T07:03:07Z cluemaster-mediadisplay.cluemaster-mediadisplay[1438]: Watches established.
2021-09-05T07:03:10Z cluemaster-mediadisplay.cluemaster-mediadisplay[1437]: [2021-09-05 07:03:10.083398] <information> mirserver: Starting
2021-09-05T07:03:10Z cluemaster-mediadisplay.cluemaster-mediadisplay[1437]: [2021-09-05 07:03:10.289641] < - debug - > mirserver: Not using logind for session management: Failed to find active session
2021-09-05T07:03:10Z cluemaster-mediadisplay.cluemaster-mediadisplay[1437]: [2021-09-05 07:03:10.289791] < - debug - > mirserver: Not using Linux VT subsystem for session management: Failed to find the current VT
2021-09-05T07:03:10Z cluemaster-mediadisplay.cluemaster-mediadisplay[1437]: [2021-09-05 07:03:10.289812] < - debug - > mirserver: No session management supported
2021-09-05T07:03:10Z cluemaster-mediadisplay.cluemaster-mediadisplay[1437]: [2021-09-05 07:03:10.294145] <information> VT switch key handler: No VT switching support available: MinimalConsoleServices does not support VT switching
2021-09-05T07:03:10Z cluemaster-mediadisplay.cluemaster-mediadisplay[1437]: [2021-09-05 07:03:10.294376] <information> mircommon: Loading modules from: /snap/cluemaster-mediadisplay/44/usr/lib/x86_64-linux-gnu/mir/server-platform
2021-09-05T07:03:10Z cluemaster-mediadisplay.cluemaster-mediadisplay[1437]: [2021-09-05 07:03:10.294451] <information> mircommon: Loading module: /snap/cluemaster-mediadisplay/44/usr/lib/x86_64-linux-gnu/mir/server-platform/graphics-wayland.so.19
2021-09-05T07:03:10Z cluemaster-mediadisplay.cluemaster-mediadisplay[1437]: [2021-09-05 07:03:10.294499] <information> mirserver: Found graphics driver: mir:wayland (version 2.3.3) Support priority: 256
2021-09-05T07:03:10Z cluemaster-mediadisplay.cluemaster-mediadisplay[1437]: [2021-09-05 07:03:10.294618] <information> mirserver: Selected driver: mir:wayland (version 2.3.3)

Do you think it might be related to this line

2021-09-05T07:03:10Z cluemaster-mediadisplay.cluemaster-mediadisplay[1437]: [2021-09-05 07:03:10.289641] < - debug - > mirserver: Not using logind for session management: Failed to find active session

no, that just means it will not use session management, but the lines below show it started fine … the content of the journalctl output right after boot might be more interesting to see if it was even attempted to be started and if it failed with any errors to do so …

Give me sometime , I will try to fetch it and send you the logs

just push them to https://paste.ubuntu.com and post the resulting link here

1 Like

hi @ogra. Sorry, it took some time for me to generate those logs, because the auto start issue was kinda random. I noticed something strange, that is when I shutdown the PC by directly plugging off the power cord, the app auto starts on the next boot, but whenever, I use DBUS to restart or shutdown the core PC, the app does not auto starts the next time. I need to log into it using ssh and then only the app starts on the core PC.

Here are the logs:

Thanks

well, the one boot you included the full log from seemingly has started the app fine, try capturing the journal from one that failed …

EDIT: and to quieten the annoying font error, you can just add another layout:

layout:
...
  /usr/local/share/fonts:
    bind: $SNAP/usr/local/share/fonts

thanks, i will add the layout to my snapcraft.yaml.
the app also doesn’t produce any sounds, did you find anything related to sound in the logs? thanks again

what is the output of:

snap info pulseaudio | grep installed

and

snap connections pulseaudio

pulse itself seems to be starting fine, if all interfaces are connected and you use the correct version, it must be an app (or app environment) issue …

Hi @ogra.

The first command

snap info pulseaudio | grep installed

Output

hiransarkar@ubuntu:~$ snap info pulseaudio | grep installed
installed:          8.0-3                 (9) 2MB -

The second command

snap connections pulseaudio

Output:

hiransarkar@ubuntu:~$ snap connections pulseaudio
Interface   Plug                Slot                Notes
home        pulseaudio:home     -                   -
network     pulseaudio:network  :network            -
pulseaudio  pulseaudio:client   pulseaudio:service  -

And here are the interfaces of the app

hiransarkar@ubuntu:~$ snap connections cluemaster-mediadisplay
Interface               Plug                                            Slot               Notes
alsa                    cluemaster-mediadisplay:alsa                    :alsa              manual
audio-playback          cluemaster-mediadisplay:audio-playback          -                  -
audio-record            cluemaster-mediadisplay:audio-record            -                  -
desktop                 cluemaster-mediadisplay:desktop                 -                  -
desktop-legacy          cluemaster-mediadisplay:desktop-legacy          -                  -
gsettings               cluemaster-mediadisplay:gsettings               -                  -
home                    cluemaster-mediadisplay:home                    :home              manual
mount-observe           cluemaster-mediadisplay:mount-observe           -                  -
network                 cluemaster-mediadisplay:network                 :network           -
network-bind            cluemaster-mediadisplay:network-bind            :network-bind      -
network-control         cluemaster-mediadisplay:network-control         -                  -
opengl                  cluemaster-mediadisplay:opengl                  :opengl            -
process-control         cluemaster-mediadisplay:process-control         -                  -
screen-inhibit-control  cluemaster-mediadisplay:screen-inhibit-control  -                  -
shutdown                cluemaster-mediadisplay:shutdown                :shutdown          -
unity7                  cluemaster-mediadisplay:unity7                  -                  -
wayland                 cluemaster-mediadisplay:wayland                 mir-kiosk:wayland  -
x11                     cluemaster-mediadisplay:x11                     -                  -