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

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.

Hi,

short question. How you are going to start Chromium?

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

did you used root user to start Chromium via autostart?

Yes, I tried with root and dietpi both with the same resonse. :frowning:

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.

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:

/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/commit/1de0482ce775e84e1e4cb1dbd00b7dc90d64d37c
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:

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 :thinking:. However, please check whether copy&pasting the above code into the console solves it.

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

Hi all, thanks so much for your help. Since the release of 7.7 I re-downloaded the .img and tried again, but I’m getting the same issue!
Just to confirm I’m not losing my own mind, THIS is the link on the website I’m using: https://dietpi.com/downloads/images/DietPi_RPi-ARMv6-Bullseye.7z
When I unzip it (I did this today) the .img file had a modification date of 13-08-2021 so I was wondering if I’m consistently downloading the WRONG version? OR am I simply, like an idiot, downloading the wrong file for my Pi Zero W?

I’m going to have a go at the code that was posted, wish me luck!!

Thanks
Ian

we don’t create new images on every version released. This would simply to much work. Therefore the image your download did not change. However, during first initial boot, DietPi will update themselves to the latest version. But the issue you faced has no relation to DietPi version/scripts. It’s related to the Chromium package themselves, as this would need to be rebuild by it’s maintainer. Something that is out of our scope.

Aaahhh thanks for the explanation! I don’t have a lot of linux knowledge, so it’s great to hear from those with greater experience.
Thanks,
Ian

Aside of the fix provided above (first page if this topic), the second fix is:

apt install libgtk-3-0

A missing dependency of the Chromium package on Bullseye. Reported to the RPi devs already: https://github.com/RPi-Distro/chromium-browser/issues/22

Hi all. It’s been a while and I am revisiting this. I have a pi zero and I’m trying to do the same thing as before but I’m getting the same error “chromium-autostart.sh file not found”.
I have updated and my pi is running 8.6.1
As previously I simply want to run chromium in kiosk mode, so I set dietpi-autostart to Chromium (option 11) but I keep coming up against this error.
I could not find Chromium in the software list so I suspect it’s not been installed.

Can anyone shed any light on this? I tried all the suggestions above, but I still have the same issues.

Thanks all.

Did you already installed Chromium browser?

dietpi-software install 113

I get the error “Chromium is not supported on armv6 systems”
Maybe dietpi won’t let Chromium run on pi zero?

Ah yeah found it. We disabled Chromium on ARMv6 because of horrible performance, close to be unusable. Topic was discussed with RPI devs last year [Bullseye] Chromium fails to start on ARMv6 · Issue #21 · RPi-Distro/chromium-browser · GitHub

Aahhh I see. Yes, I totally can see how rubbish the performance is but for a digital display showing static slides it works fine. Now that the pi zero 2 is out with better performance would you reconsider letting Chromium back into the inner circle again? :wink:
Side note: would a different, light weight browser work better for kiosk mode?
Side note 2: The reason a pi zero is so good for this is that it can be powered from the usb socket on the tv…

Thanks

There should be no limitation for the Zero 2 W as this SBC is supporting ARMv8 and we just disabled it for older ARMv6 models.

Thanks for explaining this to me. I didn’t realise the zero 2 was armv8, that explains a lot. Shame there’s no zero 2’s to purchase at the moment :slight_smile:

depends how much you like to pay. I have seen some for around 100 EUR on Amazon :rofl: