0

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.
  • How should we know what your script does? – RalfFriedl May 31 at 13:10
  • Sorry, the script and service are in the link, but I've added them to the post as well. – lriemer May 31 at 13:52
  • The script needs the X server. Does the X server start without the USB hub? Can you connect via LAN so that you can see whether the script runs? Otherwise, look at the log for hints. – RalfFriedl May 31 at 13:58
  • I can certainly SSH in without the hub, but I confess I have no idea how to check if the X server is running. What's the best way to do that? – lriemer May 31 at 18:01
  • what do you see on the screen during the 20-30 minute delay? – jsotola Jun 1 at 17:22
1

In case anyone else is running into this, I finally figured out that it's hanging on the lack of entropy. Apparently without a mouse/keyboard or any activity, it takes a long time to generate enough entropy for random to function. Running

sudo apt-get install rng-tools

Completely resolved the issue for me.

  • What operating system do you use? Since Raspbian Stretch 2019-04-08 rng-tools are installed by default. If you use Raspbian it is always a good idea to do sudo apt update && sudo apt full-upgrade from time to time. – Ingo Jun 3 at 19:52
  • I bought a kit and used whatever came loaded on the SD card with NOOBS, I'll run some updates, thanks for the tip! – lriemer Jun 3 at 21:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.