Chromium Browser on Pi 4

G’day guys

New Pi user here but this should be simple for some of you.

I am currently trying to setup my Pi to autoboot into a browser so we can have a website up on a TV at work that we use for tracking aircraft movements.

My first issue I’m running into is when I test the command in a terminal I get the following error:

chromium-browser --kiosk https://cloud.tracplus.com

[3214:3214:1201/110217.260748: ERROR:chrome_browser_cloud_management_controller.c c(163)] Cloud management controller initialization aborted as CBCM is not enabled.

Doesn’t matter if I try @chromium-browser or --kiosk I still get that same error. I’ve tried to disable extensions manually and also running Chromium with the command --disable-extensions and also a command line --disable-cloud-import

Second issue I’m running into is getting Chromium to load up on start. I’ve tried editing the global autostart file with Sudo commands in Nano and Mouse pad to no avail. I also created a directory under home/pi/.config/lxsession/lxde-pi/autostart

I obviously kept th first three lines in that autostart as per the global but yeh, doesn’t even seem to do anything on start up. Starts up fine but don’t see it trying to load chromium even with a basic @chromium-browser command in the autostart file.

Any help is much appreciated. I’m completely new to Linux etc so go easy :joy:

Hi Trent,

Sparkfun has a good guide on the different ways to autostart, in particular their autostart path looks different to yours, I wonder if that might fix it?

https://learn.sparkfun.com/tutorials/how-to-run-a-raspberry-pi-program-on-startup/method-2-autostart

Regarding that error, the only other fix I found was specifying a new user data directory with a flag to wipe the slate clean:
https://chromium.googlesource.com/chromium/src/+/master/docs/user_data_dir.md#Overriding-the-User-Data-Directory

Hi Trent

In Chrome settings it is possible on start-up to open a specific page (or set of pages). Would this solve your first problem? See chrome://settings/onStartup
With the auto start I have always found crontab reliable although I have not tried it for Chrome.

crontab -e
@reboot chromium-browser
1 Like

I appreciate the help guys.

I actually thought of the start up setting within Chromium which was handy and works.

I cannot get this autostart to work though. I must be doing something wrong though. In the crontab case I open terminal, type in crontab -e, select 1 for nano editor. Type in the final line @reboot chromium-browser, Ctrl + X, Save, Yes.

Reboot and nothing. Tried the same for Firefox.

Tried starting fresh and removing the directories I made for autostart in home/pi/.config etc etc and re.creating them to no avail.

Back at square one :frowning: thought setting a program to load on startup would be super basic? I ran sudo systemctl cron.service and received the below:

Hi Trent

Sorry just realised crontab will not work because chromium (or any program which runs in a GUI) cannot start until the GUI window is running. Perhaps crontab should execute a script which has an inbuilt delay. Surprising that something which is so easy in Windows is hard in Linux.

Edit
autostart should work.

1 Like

Yeh after reading a lot of stuff I realised that too re. GUI and I understand the concept around running a script and could definitely manage that. However im at the point now where I think I might need to reinstall the OS on the card and start from scratch. The autostart isn’t working as it should at all. Global autostart file won’t work after Sudo editing it and even creating the directory and autostart file in /home/pi/.config/lxsession/LXDE-pi/autostart doesn’t work…Am I correct in understanding that if this directory exists with an autostart file in it the system will prioritise that instead of the one found in /etc/xdg ?

1 Like

Fantastic, alright so I’ve actually set up a number of these kinds of displays before, I’ve nicknamed them as display “kiosks”. So here’s the process for setting up a “kiosk”:

  1. Download Raspberry Pi OS (latest is Bookworm)

  2. (Optional) Ensure SSH, VNC, FTP, and any other network services are disabled in raspi-config if you don’t need remote access to your kiosk.

  3. Install packages (personally I use firefox-esr, but you can easily use any other browser you’d prefer, I just like Firefox ESR for the low memory usage and simple syntax on the Pi):

sudo apt install firefox-esr unclutter xscreensaver
  1. Edit the file at ~/.config/lxsession/LXDE-pi/autostart to the following content for the user that is logged in automatically at boot:
lxpanel --profile LXDE-pi
@pcmanfm --desktop --profile LXDE-pi
@xscreensaver -no-splash
point-rpi
@unclutter -idle 1 -root
@firefox-esr --kiosk https://example.com/
  1. (Optional) Use crontab -e to edit your crontab to reboot every so often, use sudo raspi-config under performance > enable overlay to make the service read-only so your uSD won’t go corrupt, you can also use vcgencmd display_power 0|1 to toggle your display on or off in a cronjob if you comment out the dtoverlay line in /boot/config.txt

Based on what you’ve described. I’d reckon there’s a missing read permission on your autostart file that you’ve got set up at the moment depending on which user you used to create or edit it. You can probably use ls -la to check the bits, then sudo chmod a+rwx autostart or a similar command to fix this, although starting from scratch is probably easier imo.

All the best with the project!

2 Likes

Hey Bryce

I appreciate your help and hope you’ll bear with me.

I have formatted the drive and installed the latest version (Bookworm) as you mentioned.

Ive installed the firefox-esr package listed as the website is pretty heavy at higher resolutions so as lite as possible would be good.

Copied the autostart folder from etc/xdg to ~/.config/lxsession/LXDE-pi

Edited that file with nano exactly how you said and it still won’t autoboot the browser. Tried the same commands but with chromium-browser and without --kiosk just to test. Still nothing. I’ve also tried --kiosk --start-fullscreen and used https://www google.com to test as well with no luck.

Any ideas?




1 Like

Hey Trent,

How unusual, can you please try running ls -la on the autostart folder? Curious to see what the read bits are set to.

Also, you shouldn’t have an @ at the start of lxpanel on the first line, I’ll have to double check but I’m fairly sure in this context that runs it as a background task.

1 Like

Ok thanks for that I’ve rectified the @ sign. See the image below for ls -la

I’m so confused :confused:

2 Likes

Hey Trent,

No worries, so ls -la is just listing what permissions exist for each user (all-group-owner) and if led with a d, that means it is a directory along with some other info such as last modification time, owner, etc.

You’ve just run ls -la in your home directory which you can see here represented by a tilda, this is actually /home/claremont_pi/:

image

Can you please run the following two commands:

~ $ cd ~/.config/lxsession/LXDE-pi/
~/.config/lxsession/LXDE-pi/ $ ls -la

First is a cd or change directory, into the LXDE-pi/ directory where autostart should be, and the second is ls or list directory with a couple flags on which basically just make the output more verbose so we can see those bits. If they’re not what we’re expecting, you can just run chmod or change mode to update those permissions, you may need to do this as superuser so I added a sudo or superuser do at the start:

~/.config/lxsession/LXDE-pi/ $ sudo chmod a+rwx autostart

Which will add read-write-execute permissions for all users to the autostart file so we’re certain users with any permissions or groups can read/run it.

All we need to do is check that autostart has r in the right spot in those permissions on the far left so your user can actually read and run it when logged in.

1 Like