Raspberry Pi autostart chromium on login

To autostart chromium on start / boot, without Desktop Environment, you have to do the following:

1. Install Chromium
My tutorial to install chromium an Raspberry Pi without desktop Environment.

2. Use raspi-config to configure

sudo raspi-config

-> Boot Config
–> Desktop / CLI
—> Console Autologin

2. Add your start script at the end of „.bashrc“
Mine is

xinit /home/pi/start-c.sh

Don’t forget the xinit.

My startscript Looks like this:

#!/bin/sh
# Turn off HDMI to safe energy
sudo /opt/vc/bin/tvservice -o
# I want no Cursor, but this doesn't work
# Rotate touch input by 90°
matchbox-window-manager -use_cursor no -use_titlebar no &
xinput set-prop 'FT5406 memory based driver' 'Coordinate Transformation Matrix' 0 -1 1 1 0 0 0 0 1
# Power saving and screensaver after 2 minutes
xset dpms 120 120 120
# watch gpio pin for Motion sensor and start chromium with some options
gpio-watch -e rising 4&
chromium-browser  --fast --fast-start --disable-popup-blocking --disable-infobars --kiosk --incognito  --disable-session-crashed-bubble --touch-events=enabled --allow-running-insecure-content https://yoururl/

Installing Chromium on Raspberry Pi without desktop

Start with a Rasbian light version.
Install chromium and x-server

sudo apt-get install chromium-browser
sudo apt-get install xserver-xorg
sudo apt-get install xinit

If you now start chromium-browser it will show the following error:

Failed to put Xlib into threaded mode.

Gtk-WARNING cannot open display

this is because you have to start it with xinit:

xinit chromium-browser

Chromium will start, but you will need a minimal window manager.

sudo apt-get install matchbox-window-manager

Now you need a shell script to start your chromium

sudo nano start-c.sh

Insert the following lines, Exit with ctrl+x, Y and Enter.

#!/bin/sh
matchbox-window-Manager -use_cursor no&
chromium-browser
chmod +x start-c.sh

Start it now with:

xinit ./start-c.sh

Add Chromium options as you like. E.g. –Kiosk –allow-running-insecure-content plus your URL