MdaG
Posts: 3
Joined: Fri Feb 14, 2020 10:27 am

Running fullscreen browser with lite OS

Fri Feb 14, 2020 10:35 am

Hi,

I'm new to Raspberry Pi, but I've heard a lot of good things about it.

I'd like to run a minimalistic build where a web browser pointed towards a specific url is run on startup.

My attempts so far includes installing Raspian Lite and installing chromium-browser along with xserver-conf.

My idea was that I'd just need to run something like

Code: Select all

chromium-browser --kiosk https://myurl.com
, but Raspian complains about not finding my display.

Am I going about this the wrong way?

Internet suggests prefixing the above command with

Code: Select all

DISPLAY=:0
, but I don't have an env variable named DISPLAY. This is supposedly created when I start an X server. Do I need to go down that route?

GlowInTheDark
Posts: 374
Joined: Sat Nov 09, 2019 12:14 pm

Re: Running fullscreen browser with lite OS

Fri Feb 14, 2020 11:25 am

nternet suggests prefixing the above command with

DISPLAY=:0

, but I don't have an env variable named DISPLAY.
You should, of course, try it before assuming it won't work.

It doesn't matter whether or not the variable already exists.

Comment: This often trips people up. They'll see advice on the Internet to edit such-and-such file (or set such-and-such option) and then they look and find that they don't already have that file. And assume, quite possibly correctly, that they have the wrong path or something like that. It'd be nice if there was some clear-cut way to indicate that "a thing" that is being discussed might not already exist, but that if it doesn't, that's not a problem. Note that this later assertion may not be in true in some cases (say, if instructions tell you to edit /etc/passwd - clearly, that file should already exist), but there should be some way to make this clear one way or the other.

Yeah, someday, I'm going to make it my job to re-write every tutorial on the InterWeb. Yeah, and before breakfast...
GitD's list of things that are not ready for prime time:
1) IPv6
2) 64 bit OSes
3) USB 3
4) Bluetooth

MdaG
Posts: 3
Joined: Fri Feb 14, 2020 10:27 am

Re: Running fullscreen browser with lite OS

Fri Feb 14, 2020 3:38 pm

I have tried using DISPLAY and it didn't work. The reason I assume, that it isn't available unless I start a X Server.
I do however get everything to work if I first start a X Server, but if I can do without or at least within the same command from terminal, that would be preferable.

GlowInTheDark
Posts: 374
Joined: Sat Nov 09, 2019 12:14 pm

Re: Running fullscreen browser with lite OS

Fri Feb 14, 2020 3:47 pm

(Sorry - the way you phrased it made it sound like you hadn't even tried it)

Well, you're going to need an X server of some sort. As far as I know, there are no web browsers for Linux that meet both of the following criteria:

1) Do graphics (in the normal way we expect and the way in which we normally interpret that term)

2) Don't use X (i.e., don't need to access an X server)


I guess I don't understand what the problem is. Either you have an X server and can run X apps or you don't (and can't - except see below).

One thing you can do is run stuff on the Pi without having an X server running on the Pi - by setting DISPLAY to point to some other X server (e.g., something running on a Windows PC - e.g., MobyXterm).
GitD's list of things that are not ready for prime time:
1) IPv6
2) 64 bit OSes
3) USB 3
4) Bluetooth

bjtheone
Posts: 454
Joined: Mon May 20, 2019 11:28 pm
Location: The Frozen North (AKA Canada)

Re: Running fullscreen browser with lite OS

Fri Feb 14, 2020 5:00 pm

GlowInTheDark wrote:
Fri Feb 14, 2020 3:47 pm
(Sorry - the way you phrased it made it sound like you hadn't even tried it)

Well, you're going to need an X server of some sort. As far as I know, there are no web browsers for Linux that meet both of the following criteria:

1) Do graphics (in the normal way we expect and the way in which we normally interpret that term)

2) Don't use X (i.e., don't need to access an X server)
Well you could use wayland instead of X....

But fundamentally you are correct. To run a program that wants to output to a window system, one need to be running a window system. Chromium, or any other graphical browser most definitely requires a windowing system to be up and running. Raspbian Lite does not include X. Typically a full X system contains X server (usually X.Org), Window manager (Openbox, XFWM, …), Desktop environment (PIXEL, LXDE, MATE, …), Login manager (for example LightDM). You can punt the desktop environment and setup autologin, but you still need the server and a window manager.

At a minimum you are going to need something like:

Code: Select all

sudo apt-get install --no-install-recommends xserver-xorg x11-xserver-utils xinit openbox

MdaG
Posts: 3
Joined: Fri Feb 14, 2020 10:27 am

Re: Running fullscreen browser with lite OS

Sat Feb 15, 2020 9:55 am

Thanks. I really could've phrased it: "Can I run chrome without booting into a desktop environment first" or similar. Anyway this seems to have done the trick for me. I know I'm booting into a desktop environment, but it's automatic now and you'd barely notice it.

Code: Select all

$ sudo apt-get install chromium-browser unclutter lxde
$ sudo nano ~/.config/lxsession/LXDE/autostart
and change to

Code: Select all

@xset s off
@xset -dpms
@xset s noblank
@sed -i 's/"exited_cleanly": false/"exited_cleanly": true/' ~/.config/chromium-browser Default/Preferences
@chromium-browser --noerrdialogs --kiosk https://myurl.com --incognito --disable-translate

Return to “Beginners”