Hi,
I’m using DietPi v6.31.2 on RPi 3B+ with LXDE installed. From the diet-autostart, I have enabled Chromium. Now there are two issues.
- If I select the dietpi user, chromium fails to start. Mostly a permission error, I’ve tried to remove .XAuthority file, but no success. How do I add appropriate permission to my user.
- I don’t want the user to press ALT+F4 and exit the chromium. For that I’ve create a script that uses xmodmap to remove the KeyBindings. I’m unable to start this script with chromium autostart. I’ve tried the following:
- Create a systemd service that runs on startup, but the service fails with error unable to open display ‘’, meaning it runs before xserver starts.
- Edit .profile and add the script to execute, the script doesn’t run.
- Edit custom startup script, then chromium doesn’t run.
Please help.
Hi,
did you tried to create your own custom start script and call the Chromium start script put of it?
Yes, I did. I called the chromium autostart script inside that and then called my script. All times, my custom script doesn’t seem to be running or throwing error of
unable to find display ‘’
I modified chromium-autostart to run my script from there by modifying the last lines as follows:
echo "hello"
xinit $FP_CHROMIUM $CHROMIUM_OPTS &
/root/rpi-backend/OS_files/disable-keys.sh
My disable-keys.sh file:
#!/bin/bash
sleep 30
xmodmap -e "keycode 37 = "
xmodmap -e "keycode 64 = "
xmodmap -e "keycode 70 = "
xmodmap -e "keycode 105 = "
xmodmap -e "keycode 133 = "
xmodmap -e "keycode 134 = "
xmodmap -e "keycode 204 = "
xmodmap -e "keycode 206 = "
If I use the custom.sh, the OS doesn’t boot to desktop.
#!/bin/bash
#---Examples---
# Desktop
# startx
# Chromium
/root/rpi-backend/OS_files/chromium-autostart.sh &
# Print Hello
#echo "Hello"
#---Put your code below this line---
/root/rpi-backend/OS_files/disable-keys.sh
I have tried all the scripts with and without &, but no success so far.
just for my understanding. Are you trying to launch a LXDE desktop, a Chromium browser or both?
I am trying to launch a chromium browser and disable certain keys like ALT, CTRL etc.
ok I was a little bit confused as you have LXDE installed and you meant that the desktop doesn’t start
Let me try to replicate the issue
Thanks. Let me know if any more information is required.
ok that’s a tricky one. I’m able to manipulate the keyboard bindings if I first start a xsession and manually launch chromium out of it. But this has nothing to do with an automated start of chromium right after booting the system as it require user intervention.
Yeah, exactly. Then I think it is not possible to directly open the chromium-browser. What can be tried is log in to desktop and then open chromium using bash script in kiosk mode and disable the keys as well. I’ll try that then and post the results.
Thanks.
basically I just installed Chromium from dietpi-software catalogue. Once finished I used startx to create a xsession command line. There I was able to used xmodmap and launched chromium-browser once keybindings manipulated. I did not install a real desktop.
So this is the final solution that I am using and works for me.
Modify dietpi-autostart to boot into desktop. Modify /etc/xdg/lxsession/LXDE/autostart to execute my modmap script and then chromium script which serves the purpose.
A few things that I tried and failed, so putting here for reference.
In dietpi-autostart, select custom script, inside the custom.sh, run startx and then run my scripts. This doesn’t work as startx doesn’t finish. If I make it
startx &
then X-server fails to start.
To run the script after login, I added scripts to .profile but that works only for terminal.
Now I need help to run the desktop as user. If I configure dietpi-autostart and select the dietpi user in the user selection page, startx fails, but I will post another post.
Thanks for the help Joulinar
yes basically it’s an actual behavior that user dietpi is not able to start an xsession. Same like this https://github.com/MichaIng/DietPi/issues/3586
as well a proposes workaround.
Okay. I’m dumb. Can’t get this to work. Maybe I am putting the scripts in the wrong place. Or wrong permissions.
Talk to me like a noob. I am missing something obvious when trying to edit a default PI setup.
My aim: To have a Chromium Kiosk mode running on a DietPI with a keyboard in a table tennis club to show scores and book games. So I need to lock out as many of the CTRL+T \ F1 key combos as possible but still allow people to type on a keyboard.
I want to only display only our selection of pages from a scoreboard.
Auto-Starting Chromium - looked good, but keyboard shortcuts live and teens can jump out to live internet. (This is a preferred option without desktop)
Auto-starting a desktop - can’t get these scripts to start Chromium and it still has F1 \ CTRL+T live anyway. Where do I put them?
Open to any ideas? I guess I am doing something daft. Thanks in advance.