Pi Zero with Chromium xsession: unable to start X session --- no "/root/.xsession file"

Having issues with your DietPi installation or found a bug? Post it here.
Post Reply
jowelboy
Posts: 4
Joined: Mon Oct 11, 2021 9:11 am

Pi Zero with Chromium xsession: unable to start X session --- no "/root/.xsession file"

Post by jowelboy »

Hi, first post here..
Brand new Bullseye install on my pi zero. I have only installed Chromium as a kiosk, nothing else but I am constantly getting an error that X cannot start.
Picture here: https://1drv.ms/u/s!Ak0P-dq44C_Xl6pZmXMCudKYT1Tr2A

My skills in linux are limited but I have enthusiasm! For context I am using these boards as digital displays and they *have* been working well until now. I simply don't know what's going wrong - brand new install, nothing out of the ordinary...

All help greatly appreciated.
User avatar
Joulinar
Posts: 5998
Joined: Sat Nov 16, 2019 12:49 am

Re: Pi Zero with Chromium xsession: unable to start X session --- no "/root/.xsession file"

Post by Joulinar »

Hi,

short question. How you are going to start Chromium?
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
jowelboy
Posts: 4
Joined: Mon Oct 11, 2021 9:11 am

Re: Pi Zero with Chromium xsession: unable to start X session --- no "/root/.xsession file"

Post by jowelboy »

I used the autostart option in dietpi.

Also an update: I installed LDXE desktop and that booted, but when I switched the autostart to Chromium, I got this error:
"... installed/Chromium_autostart.sh" no such file or folder.

To confirm this is on a fresh install of Dietpi. Is there a Chromium install issue?
Thanks all
User avatar
Joulinar
Posts: 5998
Joined: Sat Nov 16, 2019 12:49 am

Re: Pi Zero with Chromium xsession: unable to start X session --- no "/root/.xsession file"

Post by Joulinar »

did you used root user to start Chromium via autostart?
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
jowelboy
Posts: 4
Joined: Mon Oct 11, 2021 9:11 am

Re: Pi Zero with Chromium xsession: unable to start X session --- no "/root/.xsession file"

Post by jowelboy »

Yes, I tried with root and dietpi both with the same resonse. :-(
jowelboy
Posts: 4
Joined: Mon Oct 11, 2021 9:11 am

Re: Pi Zero with Chromium xsession: unable to start X session --- no "/root/.xsession file"

Post by jowelboy »

However, I still had the same error when I *didn't* change the auto boot: I left it to boot into terminal and then did the 'startx' command and I still got the same error.
User avatar
MichaIng
Site Admin
Posts: 3357
Joined: Sat Nov 18, 2017 6:21 pm

Re: Pi Zero with Chromium xsession: unable to start X session --- no "/root/.xsession file"

Post by MichaIng »

When you install Chromium only, no desktop is installed and startx hence has no default X client to start. You should be able to to run xinit /usr/bin/chromium-browser --kiosk however to start Chromium in kiosk mode explicitly. With some more flags for fullscreen etc your wrapper can be used which is called as well when using the autostart option:

Code: Select all

/var/lib/dietpi/dietpi-software/installed/chromium-autostart.sh
And now I found and fixed the reason why the script does not exist in your case: https://github.com/MichaIng/DietPi/comm ... c90d64d37c
We installed it forcefully with a desktop in the past where the directory for the script was created. When installing it without a desktop, the directory may not exist yet and the script is then not created. To fix it in your case:

Code: Select all

G_EXEC mkdir -p /var/lib/dietpi/dietpi-software/installed
cat << '_EOF_' > /var/lib/dietpi/dietpi-software/installed/chromium-autostart.sh
#!/bin/bash
# Autostart run script for Kiosk mode, based on @AYapejian https://github.com/MichaIng/DietPi/issues/1737#issue-318697621
# - Please see /root/.chromium-browser.init (and /etc/chromium.d/custom_flags) for additional egl/gl init options

# Command line switches https://peter.sh/experiments/chromium-command-line-switches/
# --test-type gets rid of some of the chromium warnings that you may or may not care about in kiosk on a LAN
# --pull-to-refresh=1
# --ash-host-window-bounds="400,300"

# Resolution to use for kiosk mode, should ideally match current system resolution
RES_X=$(sed -n '/^[[:blank:]]*SOFTWARE_CHROMIUM_RES_X=/{s/^[^=]*=//p;q}' /boot/dietpi.txt)
RES_Y=$(sed -n '/^[[:blank:]]*SOFTWARE_CHROMIUM_RES_Y=/{s/^[^=]*=//p;q}' /boot/dietpi.txt)

CHROMIUM_OPTS="--kiosk --test-type --window-size=$RES_X,$RES_Y --start-fullscreen --start-maximized --window-position=0,0"
# If you want tablet mode, uncomment the next line.
#CHROMIUM_OPTS+=' --force-tablet-mode --tablet-ui'

# Add URL for first run:
URL=$(sed -n '/^[[:blank:]]*SOFTWARE_CHROMIUM_AUTOSTART_URL=/{s/^[^=]*=//p;q}' /boot/dietpi.txt)
CHROMIUM_OPTS+=" --homepage $URL"

# Find absolute filepath location of Chromium binary.
FP_CHROMIUM=$(command -v chromium)
if [[ ! $FP_CHROMIUM ]]; then

	# Assume RPi
	FP_CHROMIUM="$(command -v chromium-browser)"

fi

xinit $FP_CHROMIUM $CHROMIUM_OPTS
_EOF_
G_EXEC chmod +x /var/lib/dietpi/dietpi-software/installed/chromium-autostart.sh
Only strange is that the last command was present already and is error handled, so if the script was not created, that should have lead to an error prompt and aborted the installation :?. However, please check whether copy&pasting the above code into the console solves it.
User avatar
MichaIng
Site Admin
Posts: 3357
Joined: Sat Nov 18, 2017 6:21 pm

Re: Pi Zero with Chromium xsession: unable to start X session --- no "/root/.xsession file"

Post by MichaIng »

Currently the RPi Chromium seems to be broken anyway on another level, probably you can contribute testing, from console, from desktop, from terminal emulator and with different modes/graphics driver selections (fKMS, KMS, legacy): https://github.com/MichaIng/DietPi/issues/4782
Post Reply