Looped bash scripts blocks plasma_session startup SUMMARY I have few looped bash scripts for maintenance tasks (resume paused printers, mute sound after headphones disconnect). So I placed one of them to ~/.config/plasma-workspace/env/ During next login session didn't start leaving me with a mouse cursor on a black background. STEPS TO REPRODUCE 1. On ~/.config/plasma-workspace/env/ create file test.sh with content while true; do : done 2. Log out from session 3. Try to login OBSERVED RESULT Black background with a mouse cursor. I switched to different tty and htop showed that process /bin/sh /usr/lib/x86_64-linux-gnu/libexec/plasma-sourceenv.sh /home/$USER/.config/plasma-workspace/env/test.sh loads 100% percent of 1 CPU After I killed it plasma_session and other services started to load. Solution for my problem was to push that script into the background (adding "&" after "done") done & EXPECTED RESULT Looped script doesn't block plasma_session startup SOFTWARE/OS VERSIONS Linux/KDE Plasma: Kubuntu 20.04 KDE Plasma Version: 5.18.4 KDE Frameworks Version: 5.68.0 Qt Version: 5.12.8
Fixing that would break other use cases as we have to source env variables from that into our running environment. The scripts doing what you're describing are probably best suited for the .local/share/autostart-scripts these are run async and even if broken won't lock startup.
(In reply to David Edmundson from comment #1) > Fixing that would break other use cases as we have to source env variables > from that into our running environment. Sure. now I understand that this folder is primarily for env variables which must be set before starting anything else in session. By the way, some locations are not easily discoverable for an inexperienced user ... Hope with Plasma 6 structure would be reconsidered. > > The scripts doing what you're describing are probably best suited for the > .local/share/autostart-scripts these are run async and even if broken won't > lock startup. Thank you! Just a small correction: it's .config/autostart-scripts