[HOWTO] Install Ubuntu, VDR and X11 within CE environment

I programmed a script which installs UBNUTU, VDR (www.vdr-portal.de) and X11 (LXDE) within a CoreElec environment.

The script can be downloaded here: install.sh.zip (17.2 KB)

Unzip it, copy it to CoreElec /storage directory and execute it: ./install.sh. The script will download an Ubuntu 20.04 image, extract the rootfs, update it and install missing packages required for VDR and X11. The package list is provided as a base64 encoded tar.bz2-payload within the script.

The user needs to press ENTER several times during installation and finally select the time zone for chroot environment. The script should work on any Amlogic hardware which CE itself is running on. libMali.so-detection is implemented. Network configuration is done automatically. The script will boot into VDR after installation (please reboot). Services are added in /storage/.config/system.d. Scripts are in /storage/UBUNTU/vdr and in /storage/UBUNTU/home/user. KODI can be called from VDR menu, leaving KODI will enable VDR again. While KODI is running, VDR is running in background and VNSI PVR can be used to connect to VDR. The script /storage/UBUNTU/home/user/vdrbyebye.sh will start X11.

Please use the script with care as everything is installed/handled as root.

For un-installation please perform the following steps:

  • disable all new services in /storage/.config/system.d
  • put exit as first line in /storage/UBUNTU/vdr.sh and reboot the box
  • be sure that rootfs is NOT mounted
  • delete UBUNTU directory and remove services files

WARNING: NEVER (!) DELETE UBUNTU WHILE CE FILESYSTEM IS MOUNTED!
The script is CE update safe.

A chroot shell can be started as follows (after installation):

ssh root@ip-of-your-ce-box
cd UBUNTU
chroot . /bin/bash

Afterwards, you can use apt to install/purge packages. If I find the time I may program a KODI addon for this.

Have fun,
Rudi

7 Likes


i tested on Ugoos X4 Pro, everything works, thanks

Youtube 1080p FireFox works smoothly

3 Likes

The script is now available on my Github: GitHub - beta68/install_cevdrx11: Installs VDR and X11 including Ubuntu 20.04 within CoreElec environment

3 Likes

Nice idea, i wanted to run some x11 apps on this box for long, to see, if it is as fast as raspberry pi4.
But armbian doesn’t support it now.
LibreOffice and Thunderbird would be nice to have besides Firefox :wink:

You can easily install those packages using

apt install libreoffice thunderbird

in chroot environment.

1 Like

I tried on my x96max+ (s905x3) the installation took quite a long time but I think everything went OK. However, I’m not very good at configuring linux and after rebooting CoreElec I only get a momentary graphical image of the VDR menu … how do I make the Ubuntu desktop visible? not everyone needs a VDR but it would be great to check your BOX if it can work properly with desktop linux
@hungphutho it looks great on your screen

ssh into the box, then execute:

cd UBUNTU
chroot . /bin/bash
./vdrbyebye.sh

If you do not need VDR, you will need to adapt some scripts, e.g. /storage/UBUNTU/vdr/vdr.sh in order to not start VDR.

I’m giving it a try on my own box but from an SD card installation of CE separate from my internal eMMC install.

Right away I see it’s downloading an Ubuntu minimal image for the Odroid N2, couldn’t I just use that image if I wanted Ubuntu running on my box? It seems to have the 4.9 kernel based on the image filename. Also a quick search shows that there is a 22.04 image available.

Let me try to answer your questions. Yes, it is the Odroid N2 image Ubuntu 20.04. The kernel matches the CE 4.9 kernel (more or less). Thus, you can even compile kernel modules in chroot and use it (tested with USB2CI driver). Can you just use this image? Yes, you can but it will lag accelerated KODI, VPU capabilities and so on. For this you need another kernel (also in my Github), but then KODI needs to be run in chroot in order to get video acceleration.

There is an UBUNTU 22.04 image available. You can even execute do-release-upgrade in chroot. However: snapd does not work in chroot and starting with UBUNTU 22.04 firefox e.g. will be installed based on snapd (such as many other programs). There are debian packages available providing firefox but none of them played videos for me in Ubuntu 22.04. Therefore, I sticked to 20.04.

I managed to run firefox and I must say it works really OK for BOX (s905x3)
However, I can’t do much because the system is in German … how to change it (Polish) and adapt the desktop to the width of the TV used? … in my free time I will look for a solution
but thank you for your hard work!

Please execute

sudo dpkg-reconfigure locales

in chroot environment and change LANG in /home/user/startx.sh from

echo "/bin/sh -c 'cd /home/user && HOME=/home/user PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin DISPLAY=:0.0 LAN
G=de_DE.UTF-8 /usr/bin/dbus-launch /usr/bin/lxsession'" | at now

de.DE_UTF-8 to whatever you need.

Switch the lines

echo 2160p50 > /sys/class/display/mode
sleep 1
echo 1080p50hz > /sys/class/display/mode
sleep 1

for 4K resolution. Amlogic frambuffer needs to change the resoultion one time before it works correctly.

I did install libreoffice, and have to say, it is usable and feels as fast as on raspberry pi4.
Did make a little Libre-Calc spreadsheet with a chart, and a Write document.

There seems to be a problem with VDR (which starts first now), as the screen goes black, after i press a button on remote, on my X96-X4 (S905x4) TV-Box. This could be because i configured IR-Remote service in KODI and also the VFD Display service, they could interfere maybe with VDR i think.
I was able to switch to X11 by using ssh connection, and the vdrbyebye script.
Therefore it would be better for some people, to just switch between KODI and X11 instead VDR in between.

Also on ubuntu X11, xrandr says screen resoultion is 1920x1079, so there may be somewhere a bug, because it is x1080 of course.

1 Like

I noticed the same 1079 bug. however, I think it comes from CE/KODI. My hyperion.ng sometimes also shows one pixel offset.
In order to leave VDR out one needs to adapt the /storage/UBUNTU/vdr/vdr.sh script.
You can unmask KODI (thus it will start automatically and simply disable vdr.service). However, in this case you need to call vdrbyebye.sh script using chroot command after calling /storage/ubuntu.sh.

1 Like

I did that, and disabled vdr.service, then restarted, and stopped kodi (which worked fine again after unmasking), then removed lxde title bars and used xcompmgr and transset with scrot to make a screenshot.
Also screen resolution was now correct again at 1080p.


I also posted this screenshot from ubuntu chroot CE, so it is very usable.
Just needs some mechanism to start from kodi power menu, instead shutdown, stop kodi and start x11.

2 Likes

I am glad to hear that it worked for you and that you are satisfied. You could add a small addon based on hello world addon which switches to X11 for you or add another menu entry.

Edit: As a small example I am attaching here my ambilight switch on/off plugin which you can use in order to see how the system calls can be done from KODI. It is based on the hello world plugin.

ambilight.zip (317.7 KB)

changes in the file /home/user/startx.sh helped with changing the language ! :+1:
But I don’t know how to adjust the width/height of the desktop to my non-standard TV. (pansonic 48") TX-48AS640E
part of the panel bar is not visible.

You can try to get possible settings with (switched-on TV)

cat  /sys/class/amhdmitx/amhdmitx0/disp_cap

Afterwards, write the coerrect resolution for your TV this way:

echo 1080p50 > /sys/class/display/mode

whereas 1080p50 needs to be replaced with the correct resolution. Also, some TVs allow adjusting the picture (something like letterbox, original, scan, zoom).

Edit: Last idea: You could use fbset in order to set the correct number of pixels in chroot.

You were right, it was enough to set the TV options to turn off :16:9 Overscan …uuuppss
thank you very much for your answers
because I would be looking for a few days :slight_smile:

1 Like

You are very welcome. I have been dealing with KODI/VDR/LINUX for decades. And frankly speaking I highly appreciate the work of the complete CoreElec team. I know that this is a tremendous effort. Therefore, I am glad that I can give something back to this community.

2 Likes

So with in systemctl disabled vdr, and unmasked kodi:

I tried yesterday to make an addon, but failed.
The stop_kodi_start_x11.sh in /storage works, when called from ssh connection,
but not when called from addon. Did something wrong in python.

edit:
now works, see below.