Home and Links
 Your PC and Security
 Server NAS
 DVD making
 Raspberry Pi
 PIC projects
 Other projects
 Next >>

Running Stellarium on the Pi

Pi Stellarium
If you must have Stellarium, it can be done, however it's actually easier to get KStars working on the Raspberry Pi - see my previous page

Why Stellarium is such a pain to get running on the Pi

Stellarium makes massive use of the OpenGL graphics libaries - which, on a PC, will be supported by the GPU hardware on your video card. These days, even a cheap PC video card will have over 100 'cores', whilst the Pi has only 2 !

However, the Pi desktop is a lot simpler than the multi-display 'aero' garbage used on the PC, so those 2 cores CAN deliver decent graphics speed on the Pi.

So whats the problem ? Well, as usual with anything Linux, it's finding a 'compatible' set of modules that will actually work together to deliver a practical working solution

We start with the need for the hardware (GPU based) OpenGL driver (by default, the Pi comes with a cut-down 'OpenGL ES' driver, with full 'OpenGL' supported via software emulation)
A GPU based OpenGL driver exists, but only for the Pi B2 / B3, however it is (still) 'experimental' - which means you have to install (or 'enable') it yourself (although it's no longer necessary to compile it from source yourself :-) )
Next, you need a version of Stellarium that will use the OpenGL hardware driver - which (initally) meant building it yourself.
Finally, you will need to solve the remaining 'compatability' issues (things like 'text' display (font rendering), Planets 'flickering' and NEO/Meteor plotting killing the frame rate), however the Forums will usually help you find a solution.

In 2017 we got Stretch (with the 'experimental' VC4 OpenGL Driver), however the 'software emulation' speed dropped to 1/4 (see here).

Users of Kodi, another heavy Graphics orientated app. also had probelms with Stretch (see here)

Stretch OpenGL emulation speed can be inceased from 1/4 to 1/2 of Jessie speed by 'rolling back' some of the 'core' graphics modules
The KODI probelms can likewise be fixed
This is quite normal in the Linux world where it rakes a while for the bugs to be 'worked out' of every new release

In short, running Stellarium means getting the 'right' combination of graphics libraries etc. It can (and has) been done with (some) version of Jessie. However this seems to be matter of 'hit and miss', and, when a new OS is released (Stretch) it's often a matter of starting again. For now, I would suggest sticking with Jessie for Stellarium

Much of below is from Daniel Chote's web page

Getting Stellarium to work on the Pi B 3

For years various attempts have been made to get Stellarium running on the Raspberry Pi, however before mid 2016, even when success was achieved the frame rates were so appallingly low - seconds per frame, rather than frames per second - that it was a waste of time

The problem is that Stellarium uses OpenGL, not the cut-down ES version that runs on the Pi GPU. OpenGL was thus running on the Pi CPU in 'emulation' mode i.e. about 100x slower than it should.
However, in Feb 2016 the first full OpenGL GPU driver became available, although only for the Pi B2 (full OpenGL won't run** on anything less than a B2, despite the fact that all Pi's have exactly the same Broadcom VideoCore IV GPU)
By mid 2016, the Open GL 2.1 driver was more or less fully working on the Pi B3 (which was released in Feb 2016 to replace the B2) and Stellarium was now achieving decent frame rates = in fact on the B3 it can actually achieve greater than 10 fps, no doubt helped in part by the Pi B3's 400MHz GPU (all other Pi GPU's, including B2, are only 250MHz)
**the Open GL driver seems to have been written for the ARMv7 instruction set of the B2. Previous Pi's (including the Pi Zero) have an ARMv6 core, so installing the driver leads to a non-working system. The Pi B3 has a 4core ARMv8 CPU, which is compatible with v7 code, so the driver works OK.
Since the B2 is now discontinued, we can hope that when the driver is finally released we might get more speed when it takes advantage of the ARMv8 instruction set - on the other hand, since it's the GPU that does most of the work, maybe we will get an ARMv6 version (for the Pi Zero). On the other hand, the B3 has a 400MHz VideoCore IV GPU, whilst the Zero GPU runs at 250MHz, so OpenGL speed on the Zero may never be acceptable.

1) Get the last version of Jessie Lite (2017-07-05)

This is not as easy as you might think. Just like Microsoft, the Pi Foundation has no interest in supporting 'old' systems, so the 'public' download page only offers the latest version (Stretch).

Historical releases can still be downloaded (although there is no way to discover this from the 'public' download page)
Further, you can only get the 'full' version of Jessie (1.5Gb or so) ...
To get Jessie, you have to search around for

For OpenGL 2.1, you need any version from September 2016 onwards. The last version is 2017-01-11-raspbian-jessie-lite.img

NOTE. To try the experimental OpenGL driver (vc4-kms-v3d) on a Pi 3 you need kernel 4.4.35. If you don't have that, you can install it using '# BRANCH=next raspi-update' (you also need 'xcompmgr' (which should already be installed) and the 'libgl1-mesa-dri' package). Before you reboot, you have to MANUALLY edit /boot/config.txt to change the kernal (default is 'kernel=vmlinuz-4.4.0-1-rpi2' and 'initramfs initrd.img-4.4.0-1-rpi2 followkernel') == if you don't, then after you enable the driver via raspi-config the Pi WON'T BOOT

You will need a keyboard and mouse to control Stellarium, so you might as well start with these plugged in, however it's a lot easier to 'cut and paste' the commands below if you control the Pi via a command terminal (SSH in from a PC running PuTTY) = so plug it into your LAN as well.


After Jessie resizes to the SDHC card max. and reboots, update the package lists and upgrade the system files :-

  sudo apt-get update sudo apt-get upgrade  

Make sure you have the OpenGL utils :-

  sudo apt-get install mesa-utils  

About the only other thing you might need to worry about now is the resolution of your display. Open GL seems to have problems with displays that don't bother to 'announce' themselves (i.e. non-HDMI reached via an adapater (DVI) or converter (SVGA)), so it's a 'good idea' to get the resolution right now (you will also have to setup Stellarium = see at end)).

Unless you are using a modern HD display (which the Pi will detect automatically), make sure /boot/config.txt contains the correct settings :-
sudo nano /boot/config.txt modify as necessary :- # uncomment if hdmi display is not detected and composite is being output hdmi_force_hotplug=1 # uncomment to force a specific HDMI mode # (group 2 is 4:3, mode 35 is 1280x1024 (mode 51 is 1600x1200), 60Hz) hdmi_group=2 hdmi_mode=35

Then reboot just to be sure :-)

Setup the Stellarium 'user'

adduser --disabled-password --disabled-login --gecos "" Stellarium usermod -a -G cdrom,audio,video,plugdev,users,dialout,dip,input stellarium

Install the required system packages

apt-get install --no-install-recommends raspi-gpio xcompmgr dbus-x11 libgl1-mesa-dri xserver-xorg xinit bzr qtmultimedia5-dev

Once you have installed these packages, you should run raspi-config to set your timezone and locale information (this is important, as Stellarium will use it) and then enable the GL Driver (in raspi-config, under the "advanced" menu). Once enabled, you will be prompted to reboot your Pi, do so and then continue.

Activating OpenGL adds the line "dtoverlay=vc4-kms-v3d" to the end of config.txt

Edit /etc/kbd/config and /etc/X11/xinit/xinitrc to stop your screen from turning off.

/etc/kbd/config BLANK_TIME=0 BLANK_DPMS=off POWERDOWN_TIME=0 /etc/X11/xinit/xinitrc xset s noblank xset s off xset -dpms

If you keep getting blank screens or your screen image is shifted off the edge of your display, go back to /boot/config.txt and mofify as follows :- # add the following if you keep getting blank screens hdmi_force_edid_3d=1 avoid_warnings=2 # add the following of your screen image is shiftd off the edge of your display disable_overscan=1 glxgears

If you can't get a good display with glxgears, sort it now (there is no point in building Stellarium until the display is working in OpenGL mode)

Get Stellarium

The latest version of Stellarium, i.e. the one you "apt-get" from the Raspbian repository, has corrupted fonts in it. You have to build it yourself.

Install the Stellarium build dependencies:

apt-get build-dep stellarium

Checkout Stellarium using bzr (note: this takes a while):

cd /usr/src bzr co lp:stellarium stellarium

Switch to the revision that works (HEAD wouldn't compile).

cd stellarium bzr branch -r8418

Build Stellarium

Now build Stellarium:

mkdir -p builds/unix cd builds/unix cmake ../.. make -j4 make install

Start Stellarium on boot

Setup a systemd service to start Stellarium on boot

sudo nano /etc/systemd/system/stellarium.service add the following :- [Unit] Description = Stellarium After = systemd-user-sessions.service network.target sound.target [Service] User = stellarium Group = stellarium Type = simple ExecStart = /usr/bin/xinit /usr/bin/dbus-launch --exit-with-session /usr/local/bin/stellarium -t -- :0 -s 0 dpms -nolisten tcp vt7 Restart = on-abort RestartSec = 5 [Install] WantedBy = multi-user.target
After building Stellarium by hand it will be at /usr/local/bin/stellarium.
The "apt-get" version (of it's ever fixed) will be in /usr/bin/stellarium

Now you should test to ensure Stellarium works, you can do this by running :-

sudo service stellarium start

To make sure to get the native display resolution, edit Stellarium's config file :-

sudo nano /home/stellarium/.stellarium/config.ini for eg, a 1280x1024 display, adjust the settings : fullscreen = true screen_w = 1280 screen_h = 1024

The pages in this topic are :-

[This is the last page in the "Raspberry Pi" topic. Use the Navigation menu, left, to select a new Top Topic]