I'm setting up a Pi Zero W to run a script on boot to run a Chromium kiosk with a specific URL, refreshing the page every 5 minutes. Initially everything worked great. I tested it over multiple reboots and the script worked flawlessly.
Satisfied with the setup, I began another reboot and removed the USB hub which had two wireless dongles for a mouse/keyboard plugged in to ensure that everything still worked without any input/peripherals, as it's meant to be a wall display. This time, it booted into the desktop and then sat idle with very little CPU load, no script activity. It sat this way for a few minutes until I plugged in the hub again to investigate, at which point the script immediately ran and worked fine. I've tested this a few times and it consistently works with at least one dongle plugged in (mouse or keyboard), but never without. After 20-30 minutes, the script does eventually work without the peripherals.
I'm at a loss as to what's causing this. I followed the steps/scripts in this article except that I'm using xdotool to do a periodic refresh rather than change tabs: https://pimylifeup.com/raspberry-pi-kiosk/
Does something in my script require a physical peripheral, or is Raspbian waiting on a peripheral before it fires off my script?
Script:
#!/bin/bash
xset s noblank
xset s off
xset -dpms
unclutter -idle 0.5 -root &
sed -i 's/"exited_cleanly":false/"exited_cleanly":true/' /home/pi/.config/chromium/Default/Preferences
sed -i 's/"exit_type":"Crashed"/"exit_type":"Normal"/' /home/pi/.config/chromium/Default/Preferences
/usr/bin/chromium-browser --noerrdialogs --disable-infobars --kiosk https:REDACTED &
while true; do
xdotool keydown ctrl+r; xdotool keyup ctrl+r;
sleep 300
done
Running from the following service:
[Unit]
Description=Chromium Kiosk
Wants=graphical.target
After=graphical.target
[Service]
Environment=DISPLAY=:0
Environment=XAUTHORITY=/home/pi/.Xauthority
Type=simple
ExecStart=/bin/bash /home/pi/kiosk.sh
Restart=on-abort
User=pi
Group=pi
[Install]
WantedBy=graphical.target
If I check the status of the script while it's hanging, I get the following:
Jun 03 08:20:06 ConferenceScreen systemd[1]: Started Chromium Kiosk.
Jun 03 08:20:06 ConferenceScreen bash[351]: xset: unable to open display ":0"
Jun 03 08:20:11 ConferenceScreen bash[351]: Invalid MIT-MAGIC-COOKIE-1 keyxset:
Jun 03 08:20:11 ConferenceScreen bash[351]: Invalid MIT-MAGIC-COOKIE-1 keyxset:
Jun 03 08:20:11 ConferenceScreen bash[351]: Invalid MIT-MAGIC-COOKIE-1 keyunclut
Jun 03 08:20:11 ConferenceScreen bash[351]: Invalid MIT-MAGIC-COOKIE-1 keyError:
Jun 03 08:20:11 ConferenceScreen bash[351]: Failed creating new xdo instance
Jun 03 08:20:12 ConferenceScreen bash[351]: Invalid MIT-MAGIC-COOKIE-1 keyError:
Jun 03 08:20:12 ConferenceScreen bash[351]: Failed creating new xdo instance
Jun 03 08:20:24 ConferenceScreen bash[351]: : getrandom indicates that the entropy pool has not been initialized. Rather than continue with poor entropy, this process will block until entropy is available.
After everything finally starts, it adds:
Jun 03 08:29:52 ConferenceScreen bash[351]: Fontconfig warning: "/etc/fonts/fonts.conf", line 100: unknown element "blank"
Jun 03 08:29:57 ConferenceScreen bash[351]: [443:1219:0603/082957.316700:ERROR:bus.cc(396)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
Jun 03 08:30:11 ConferenceScreen bash[351]: ATTENTION: default value of option force_s3tc_enable overridden by environment.
Jun 03 08:30:16 ConferenceScreen bash[351]: [1:8:0603/083016.742760:ERROR:command_buffer_proxy_impl.cc(124)] ContextResult::kTransientFailure: Failed to send GpuChannelMsg_CreateCommandBuffer.