Raspberry Pi Install Java 8 SDK and OpenHab 2 on Raspberry Pi Desktop for RPI 4

I wanted to install OpenHab 2 on my RPI 4 which is running the latest Raspberry Pi Desktop. But I was missing Java 8 which is a prerequisite and unfortunately not available anymore as a stable version, for Debian 10, due to a security issue.

Click to Read More

First, here is the version of Raspberry Pi Desktop I have:

$ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

Trying to install Java 8 SDK was resulting in errors like:

$ sudo apt-get install openjdk-8-jdk
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package

Or like:

Reading package lists... Done
Building dependency tree
Reading state information... Done
Package openjdk-8-jdk is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
openjdk-8-jdk-headless
E: Package 'openjdk-8-jdk' has no installation candidate

My Package sources were:

deb http://ftp.debian.org/debian/ buster main contrib non-free
deb http://security.debian.org/ buster/updates main contrib non-free
deb http://ftp.debian.org/debian/ buster-updates main contrib non-free

The solution was to add a new source with the 'unstable' arm-hf packages in /etc/apt/sources.list.d/raspi.list ('sid' is the codename for unstable):

$ echo 'deb http://ftp.debian.org/debian sid main' | sudo tee -a /etc/apt/sources.list.d/

Next, do:

$ sudo apt-get update
$ sudo apt install gcc-8-base
$ sudo apt-get install openjdk-8-jdk

NB.: without installing gcc-8-base, you would get an error like this :

Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
libc6-dev : Breaks: libgcc-8-dev (< 8.4.0-2~) but 8.3.0-6+rpi1 is to be installed
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.

 

Now, you can install OpenHab 2:

$ wget -qO - 'https://bintray.com/user/downloadSubjectPublicKey?username=openhab' | sudo apt-key add -
$ sudo apt-get install apt-transport-https
$ echo 'deb https://dl.bintray.com/openhab/apt-repo2 stable main' | sudo tee /etc/apt/sources.list.d/openhab2.list
$ sudo apt-get update

If you get an error like this one:

E: The repository 'https://openhab.jfrog.io/openhab/openhab-linuxpkg unstable Release' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

Then do:

$ echo 'deb [trusted=yes] https://dl.bintray.com/openhab/apt-repo2 stable main' | sudo tee /etc/apt/sources.list.d/openhab2.list

Finally, do:

$ sudo apt-get install openhab2
$ sudo apt-get install openhab2-addons
$ sudo systemctl daemon-reload
$ sudo systemctl enable openhab2.service
$ sudo adduser openhab dialout
$ sudo adduser openhab tty

Edit /etc/default/openhab2 to add access for Java to the serial ports (ex.:for Zwave keys)

$ nano /etc/default/openhab2 

EXTRA_JAVA_OPTS="-Dgnu.io.rxtx.SerialPorts=/dev/ttyUSB0:/dev/ttyS0:/dev/ttyS2:/dev/ttyACM0:/dev/ttyAMA0"

It should output:

openhab2.service - openHAB 2 - empowering the smart home
Loaded: loaded (/usr/lib/systemd/system/openhab2.service; disabled; vendor preset: enabled)
Active: active (running) since Wed 2020-07-15 21:57:07 BST; 28min ago
Docs: https://www.openhab.org/docs/
https://community.openhab.org
Main PID: 26101 (java)
Tasks: 101 (limit: 4915)
Memory: 212.3M
CGroup: /system.slice/openhab2.service
└─26101 /usr/bin/java -Dopenhab.home=/usr/share/openhab2 -Dopenhab.conf=/etc/openhab2 -Dopenhab.runtime=/usr/share/openhab2/runtime -Dopenhab.userdata=/var/lib/openhab2 -Dopenhab.logdir=/var/log/openhab2 -Dfelix.cm.dir=/var/li

Jul 15 21:57:07 Helios systemd[1]: Started openHAB 2 - empowering the smart home.

 

As far as I am concerned, I share via smb the various folders

Edit /etc/samba/smb.conf

$ sudo nano /etc/samba/smb.conf

[openHAB2-userdata]comment=openHAB2 userdata
path=/var/lib/openhab2
browseable=Yes
writeable=Yes
only guest=no
public=no
create mask=0777
directory mask=0777

[openHAB2-conf]comment=openHAB2 site configuration
path=/etc/openhab2
browseable=Yes
writeable=Yes
only guest=no
public=no
create mask=0777
directory mask=0777

[openHAB2-logs]comment=openHAB2 logs
path=/var/log/openhab2
browseable=Yes
writeable=Yes
only guest=no
public=no
create mask=0777
directory mask=0777

[openHAB2-backups]comment=oepnHAB2 backups
path=/var/lib/openhab2/backups
browseable=Yes
writeable=Yes
only guest=no
public=no
create mask=0777
directory mask=0777

Restart the Samba service:

$ sudo systemctl restart smbd.service

 

Start openHab with:

$ sudo systemctl start openhab2.service
$ sudo systemctl status openhab2.service

It can take 15' to be initialized, but soon you should be able to access openHab on your RPI on port 8080!

 

Do a backup with:

$ sudo ./usr/share/openhab2/runtime/bin/backup

Restore a backup with:

$ sudo systemctl stop openhab2.service
$ sudo ./usr/share/openhab2/runtime/bin/restore /var/lib/openhab2/backups/openhab2-backup-....
$ sudo systemctl start openhab2.service

It will take long minutes to restart!

 

More details about installing openHAb on Linux on the official page.

Et voilà!

Raspberry Pi Use a Z-Wave Controller USB Key with openHAB in Docker on a RPI 4

It took me quite some hours to be able to use my Aeotec Z-Stick Gen5 (ZW090) key within my Docker image of openHAB, running on a Raspberry Pi 4 (with a Raspberry Pi OS). Here are all the tips I used.

Click to Read More

First, before plugging the controller  in your RPI, configure it to see the Serial Ports. Connect onto your RPI within a SSH Console (ex.: via Putty)  and type the command:

sudo raspi-config

Use "5 interfacing Options" > "P6 Serial" > "Yes" > "Ok"

And now reboot.

Next, back into a SSH conscole, check what USB devices already exists with the command:

lsusb

Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

And flush the kernel and boot logs:

sudo dmesg -c >> ~/dmesg-`date +%d%m%Y`.log

Then, plug your Z-Wave Controller USB Key in a USB Port and check that it's detected and mounted properly:

lsusb

Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 009: ID 0658:0200 Sigma Designs, Inc. Aeotec Z-Stick Gen5 (ZW090) - UZB
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

dmesg

[ 3124.779069] usb 1-1.4: new full-speed USB device number 9 using xhci_hcd
[ 3124.919928] usb 1-1.4: New USB device found, idVendor=0658, idProduct=0200, bcdDevice= 0.00
[ 3124.919942] usb 1-1.4: New USB device strings: Mfr=0, Product=0, SerialNumber=1
[ 3124.919953] usb 1-1.4: SerialNumber: 32303136-3131-3033-3030-303031383932
[ 3124.926704] cdc_acm 1-1.4:1.0: ttyACM0: USB ACM device

 

"lsusb" should show you a new device. Ex.: Aeotec Z-Stick Gen5 (ZW090) - UZB.

And "dmesg" must should you the mount point: cdc_acm 1-1.4:1.0: ttyACM0: USB ACM device.

If you don't see the mount point, then you possibly have a device not supported by the RPI 4. It seems that it is the case with the old Aeotec "Z-Stick Gen5". "New Z-Stick Gen5" and "Z-Stick Gen5+" should however be compatible. But there is a trick: plug your key on the RPI 4 via a USB HUB (2.0 or 3.0).

I presume that the Docker Image is already up and running. If not, install it.

sudo useradd -r -s /sbin/nologin openhab
usermod -a -G openhab pi
mkdir /opt/openhab
mkdir /opt/openhab/conf
mkdir /opt/openhab/userdata
mkdir /opt/openhab/addons
chown -R openhab:openhab /opt/openhab

Check the id of the user openhab with:

id openhab

uid=999(openhab) gid=994(openhab) groups=994(openhab)

Grant access on the Serial Port for the user 'openhab':

sudo chmod 777 /dev/ttyACM0
sudo chown openhab /dev/ttyACM0

And use the uid and gid found above in the following command, setting the ttyA* found previously and specifying the version to be used:

docker run --name openhab --net=host --device=/dev/ttyACM0 -v /etc/localtime:/etc/localtime:ro -v /etc/timezone:/etc/timezone:ro -v /opt/openhab/conf:/openhab/conf -v /opt/openhab/userdata:/openhab/userdata -v /opt/openhab/addons:/openhab/addons -d -e USER_ID=<uid> -e GROUP_ID=<gid> --restart=always openhab/openhab:latest

 

Now, using Portainer (because it's easy), open a console within openhab... Portainer is not yet installed ? Do it with:

docker run -d -p 9000:9000 -p 8000:8000 --name portainer1 --restart always -v /var/run/docker.sock:/var/run/docker.sock -v portainer:/data portainer/portainer:latest

Go to the page http://<Your RPI IP>:9000, open the Containers and click on the "Exec Console" icon of 'openhab' container:

Grant the same accesses inside the image than on the RPI:

sudo chmod 777 /dev/ttyACM0
sudo chown openhab /dev/ttyACM0

chown -R openhab:openhab /opt/openhab

Now restart the 'openhab' container (with the icon Restart ;) ). It will take some minutes to be available. But once you can get into it, go to the Things and configure the Controller to use the Serial Port ttyACM0:

 

Et voilà

Raspberry Pi Raspberry Pi's SD card full ?

Trying to update one of my Raspberry Pi Desktop, I see messages pretending that there is not enough free space ? 

Click to Read More

I saw that my Pi was full when I tried to update it with

sudo apt-get update && sudo apt-get upgrade -y

 Error writing to output file - write (28: No space left on device)

I could also see that there was no free storage anymore as the system was unable to allocate the swap file:

systemctl status dphys-swapfile.service

dphys-swapfile.service - dphys-swapfile - set up, mount/unmount, and delete a swap file
Loaded: loaded (/lib/systemd/system/dphys-swapfile.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sun 2020-06-28 12:35:15 BST; 4min 21s ago
[...]Jun 28 12:35:15 helios dphys-swapfile[327]: want /var/swap=100MByte, restricting to 50% of remaining disk size: 0MBytes
Jun 28 12:35:15 helios systemd[1]: Failed to start dphys-swapfile - set up, mount/unmount, and delete a swap file.

And indeed, the swap file was 0B:

free -h

      total   used   free   shared  buff/cache  available
Mem: 3.8Gi 285Mi 2.7Gi 11Mi    886Mi       3.4Gi
Swap: 0B      0B     0B

Start to investigate with:

sudo df -h

Filesystem      Size  Used Avail Use% Mounted on
/dev/root 29G 29G 0 100% /
devtmpfs 1.8G 0 1.8G 0% /dev
tmpfs 2.0G 0 2.0G 0% /dev/shm

Or use the version for Inode which won't include the mounted drives

sudo df -i

Filesystem Inodes  IUsed  IFree   IUse% Mounted on
/dev/root 1895552 328167 1567385 18% /
devtmpfs 117763 409 117354 1% /dev
tmpfs 183811 1 183810 1% /dev/shm

Check, in the output of those commands, that the size of the root partition (/dev/root) is close the the size of your SD (Here above, I have IUsed =~ 32G). If it is not the case, enlarge it with:

sudo raspi-config

7 Advanced Options > A1 Expand Filesystem 

(reboot)

If the size of the root partition is maximum, then investigate to find the very large stuff with:

sudo du -xh / | grep -P "G\t"

1,2G /opt/openhab/userdata
1,2G /opt/openhab
1,2G /opt
1,3G /usr
11G /var/lib/docker
11G /var/lib
11G /var
16G /mnt/backup
16G /mnt
29G /

To only have the size of the first level folders, use:

sudo du -xh --max-depth=1 / | grep -P "G\t"

1.2G /opt
1.3G /usr
11G /var
16G /mnt
29G /

Check, in the output of that command, if there as any folder or file which could be cleaned-up.

You can also us this to navigate into your SD:

sudo mount --bind /  /mnt
sudo ncdu -x /mnt

-- /mnt ------------------------
15,1 GiB [##########] /mnt
10,6 GiB [###### ] /var
1,3 GiB [ ] /usr
1,2 GiB [ ] /opt
415,3 MiB [ ] /home
353,3 MiB [ ] /lib
9,3 MiB [ ] /bin

You can navigate in this table (with keys up and down) and open folders (press enter) to see the details of their content. Exit this table by pressing "q".

If by any accident, you don't succeed to delete a large file or folder (especially if located under /media or /mnt), check that it's not on a mounted drive. Auto-mount are usually in /etc/fstab and may only be :

cat /etc/fstab

You can umount all at once with

sudo umount -a -t cifs -l

 

Regarding packages, You can cleanup some space with:

sudo apt-get autoremove

sudo rm -R /var/cache/

sudo mkdir -p /var/cache/apt/archives/partial
sudo touch /var/cache/apt/archives/lock
sudo chmod 640 /var/cache/apt/archives/lock
sudo apt-get clean

 

If you are using docker,

you can check the space consumed with:

sudo du -sh /var/lib/docker/overlay2

docker system df

you can cleanup some space with:

docker system prune -a -f

docker system prune --all --volumes --force

docker volume rm $(docker volume ls -qf dangling=true)

 

If using GitLab, you can cleanup some space with:

sudo gitlab-ctl registry-garbage-collect

 

Other useful commands:

sudo find / -type f -size +500M -exec ls -lh {} \;

sudo touch /forcefsck ; sudo reboot

sudo resize2fs /dev/mmcblk0p2 ; sudo reboot

After reboot check the resize status with:

systemctl status resize2fs_once.service

If you see the error "Failed to start LSB: Resize the root filesystem to fill partition", you can disable the resize2fs with:

sudo systemctl disable resize2fs_once

 

What was the issue in my own case: my remote folder for backup was not mounted anymore on /mnt/backup but the backup script run and stored a 16Gb file into the local folder /mnt/backup. I have been able to delete the local backup by commenting the related shared folder in /ect/stab, rebooting and then deleting /mnt/backup.

Et voilà!

Raspberry Pi Run Raspberry Pi Desktop 4 in VMWare

Instead of testings new softwares or configs on my actual RPI, I do it in a VM Machine. Much easier to rollback if I do a mistake. There are many videos on YouTube to explain how to install the Raspberry Pi Desktop in VMWare.

Click to Read More

The ISO image of Raspberry Pi Desktop is available here.

I did create an VM, as illustrated here, with:

  • 4GB Memory
  • 32GB Hard Disk(SCSI)
  • USB 3 .1
  • And everything else "by default"
    • 1 processor
    • NAT Network Adapter
    • ...

I did:

  • a "Graphical Install" of the Raspberry Pi Desktop
  • enable SSH
  • keep the password "raspberry" for the user pi (with auto-login enabled)
  • configure the keyboard for me (Belgian - Azerty)
  • configure to location as Brussels/Belgium
  • install the VMWare-Tools (screen resolution maximized automatically)
  • Create an icon "Desktop Update" to update the packages via: sudo apt-get update && sudo apt-get upgrade -y

And here attached in the resulting VM (a 4.5GB zip file). Download it, unzip and double click the file "Raspberry Pi 4.vmx" to open the VM into your VMWare Workstation.

Et voilà.

Raspberry Pi Create a Plex Media Player with a Raspberry 4

I used to run Rasplex on a RPI 2 to play movies from my Plex Media Server. Unfortunately Rasplex has not been updated to run on a RPI 4. Here is how to build PMP for RPI 4.

Click to Read More

Install an OS on your RPI 4

  1. Download the "Raspberry Pi Imager" here.
  2. Download next the "Raspberry Pi OS (32-bit) with desktop" here (the 64-bit is still only in beta. See here). Unzip the file.
    • This is the smallest image (no extra softwares) with a Desktop (mandatory to display the Plex Media Player GUI)
  3. Install and Run the "Raspberry Pi Imager" to setup the "Raspberry Pi OS" on a micro-SD card.
    • Click on "Choose OS"

    • Select "Use Custom"

    • Pick the .img file "YYYY-MM-DD-raspios-buster-armhf.img" unzipped from the "Raspberry Pi OS (32-bit) with desktop" image.
    • Next Click "Choose SD" and "Write".
    • Once the operation completed, install the micro-SD in your RPI 4 and turn it on. The Raspberry Pi Desktop will appear after some automatic reboots. Follow the setup of the Welcome screen. Steps are:
      • Setup the Country (use Page up and Page down in the Country Combo to scroll faster)
      • Change the Password of the user 'pi'. ATTENTION: the keyboard layout is most probably not the right one. Untick the "Hide characters" option to check what you type!
      • Set Up Screen
      • Select Wireless Network (You can skip this step if the RPI is connected via ethernet). Again, untick the "Hide characters" option to check what you type!
      • Update Software
      • Click "Restart" on the last step "Setup Complete"

Configure your OS

Open a "Terminal" :

First, type this command in the Terminal to check your IP address:

ifconfig

Type next this command to configure the os:

sudo raspi-config

Among other:

  • Configure your keyboard if required via "4 Localisation Options" > "change keyboard layout"
    • If your keyboard is not in the list, use the Generic 100x-Key PC corresponding to your layout. Look the picture of this wiki page for more details.
    • You can possibly also find more info about your keyboard here.
  • Enable SSH via "5 Interfacing Options" > "P2 SSH"
  • Give at least 512MB or more to your GPU via "7 Advanced Options" > "Memory Split" (I did set 512. Using 1024 result in a black screen after reboot)
  • I gave the whole micro-SD card storage for the OS via "7 Advanced Options" > A1 Expand File System"
  • I set the audio output on the HDMI port via "7 Advanced Options" > A4 Audio"
  • NB.: I don't use the 4Kp60 HDMI, but it can be configured via "7 Advanced Options" > AA Pi 4 Video Output"
  • Finally, reboot to be sure that it still work.
    • If you have an issue, wait for 3 minutes and proceed with the next step here under.

 

You can now open a SSH console from your PC (E.g: using PuTTY) to connect on the IP address found previously and login with the user 'pi' and the password you introduced during the installation.

You will possibly get a PuTTY Security Alert because of the ssh key fingerprint... Accept if you are sure that you are connecting safely to your RPI.

If it seems that your RPI didn't reboot properly and you are not able to connect using SSH after a moment, they you probably have to redo to whole setup from scratch and try other configuration options within raspi-config

If it seems that your RPI didn't reboot properly and you are able to connect via SSH, redo the configuration with the command sudo raspi-config (try to reset the "Memory Split" to 64 if you did change it).

If you want to be sure that your OS is up-to-date, with the very latest fixes, type the following commands:

sudo apt-get update
sudo apt-get full-upgrade

And finally disable the screen sleep with the command

sudo sed -i 's/#xserver-command=X.*/xserver-command=X -s 0 dpms/g' /etc/lightdm/lightdm.conf

Build PMP for your RPI 4

Use now the SSH console (to be able to copy/paste from here) to execute this:

sudo apt-get install -y autoconf automake libtool libharfbuzz-dev libfreetype6-dev libfontconfig1-dev libx11-dev libxrandr-dev libvdpau-dev libva-dev mesa-common-dev libegl1-mesa-dev yasm libasound2-dev libpulse-dev libuchardet-dev zlib1g-dev libfribidi-dev git libgnutls28-dev libgl1-mesa-dev libsdl2-dev cmake python3 python python-minimal git mpv libmpv-dev

Then these 3 commands:

wget https://github.com/koendv/qt5-opengl-raspberrypi/releases/download/v5.12.5-1/qt5-opengl-dev_5.12.5_armhf.deb 
sudo apt-get install -y ./qt5-opengl-dev_5.12.5_armhf.deb
rm qt5-opengl-dev_5.12.5_armhf.deb

And finally these:

mkdir ~/pmp
cd ~/pmp
git clone git://github.com/plexinc/plex-media-player
cd plex-media-player/
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Debug -DQTROOT=/usr/lib/qt5.12/ -DCMAKE_INSTALL_PREFIX=/usr/local/ ..
make -j4
sudo make install

Now, PMP can be run. Go back to the Raspberry Pi Desktop, and type this command in a Terminal:

plexmediaplayer --fullscreen --tv &

In my case, the option 'tv' is not convenient (I can't see enough on the screen)...

You will have to Sign In via the link page of Plex.tv and next configure Plex Media Player.

Configure PMP to launch at boot

Back into you SSH Console, on your PC, create a new user 'plex' with a password:

sudo adduser plex
sudo adduser --disabled-password plex
sudo passwd -d plex

Login as 'plex' in your RPI desktop to run once PMP via a Terminal (Without this step, it will not be displayed full screen after an autologin):

plexmediaplayer --fullscreen --tv &

Configure the user 'plex' to autologin with a desktop session named 'plex':

sudo sed -i 's/#*user-session=.*/user-session=plex/g' /etc/lightdm/lightdm.conf
sudo sed -i 's/#*autologin-user=.*/autologin-user=plex/g' /etc/lightdm/lightdm.conf
sudo sed -i 's/#*autologin-user-timeout=.*/autologin-user-timeout=delay/g' /etc/lightdm/lightdm.conf

Create the 'plex' desktop:

sudo nano /usr/share/xsessions/plex.desktop

and paste into it:

[Desktop Entry]Name=Plex
Comment=Plex Media Player
Exec=/usr/local/bin/plexmediaplayer
Icon=
Type=Application

And now reboot ! (It can take 3 long minutes !!):

sudo reboot

If there is a configuration issue with the desktop, edit the config via a SSH console and restart lightDM (the Desktop Manager):

sudo service lightdm restart

Tips: I had no issue with getting Plex Media Player in fullscreen but here are notes in case I would have to resize it:

sudo apt-get install -y xdotool
export DISPLAY=':0.0'
xdotool search --onlyvisible --maxdepth 1 ""
xdotool windowmove {window_id} {posx} {posy} windowsize {window_num} {sizex} {sizey}

 

This is based on a post of Stueh on Plex forum (see here)

 

If you did configure Plex Media Player on a PC Screen and move next on TV Screen, it will most probably not fit that screen et the resolution will possibly not be correct. In that case, here is how I proceed:

  • Log on your RPI using any SSH console on your mobile or Tablet (I presume that your PC is not next to your TV). I am using "RaspController" on Android
  • Edit the desktop to force an error. Hence, you will fallback on the default Desktop. Type in you SSL console : sudo nano /usr/shared/xsession/plex.desktop
    • Ex.: modify this line to define an invalid path: Exec=xxx/usr/local/bin/plexmediaplayer
  • Now, restart LightDM
    • Either type this in your SSH console: sudo service lightdm restart
    • Or CTRL-ALT-Backspace on the keyboard of your RPI.
  • You will get an error message because 'xxx/usr/local/bin/plexmediaplayer' does not exist and next get a prompt to login.
  • Login as 'pi' 
  • Now, open the Start menu > Preferences > Raspberry Pi Configuration > Display (or Interfaces). If you don't see the 'Start menu' because it is out of the screen, press the 'Windows' key on your Keyboard.

  • Next, change the resolution to fit the limitation of your TV:
    • 480p = DVD, old TV 720 x 480 pixels, format 16/9.
    • 720p = HD Ready, 1280 x 720 pixels, format 16/9.
    • 1080p = Full HD, 1920 x 1080 pixels, format 16/9.
    • 2160p, UHDTV1, 3840 x 2160 pixels, format 16/9 (a.ka. UHD-4K or 4K).
    • 4320p, UHDTV2, 7680 x 4320 pixels, format 16/9 (a.k.a UHD-8K or 8K).
  • Then, open Plex Media Player (Start Menu > ...) and configure it in TV mode. If it does not fit the TV Screen, reduce the resolution.
  • Finally, log off (or restrat lightDM with CTRL-ALT-BACKSPACE) and login as 'plex' to also run Plex Media Player and be sure it's also well configured.
  • Ho, yes, sure: edit again the plex.desktop to remove the xxx in the path of the EXEC setting and reboot.

Voilà

Raspberry Pi Projector losing Raspberry Pi 2's HDMI signal

When I am watching a movie played with RasPlex (on my Raspberry Pi 2), it happens from time to time (possibly several times during a movie) that my projector loses the HDMI signal. The signal comes back quite immediately but this is a real annoyance. I solved the problem by boosting the HDMI signal in Raspberry Pi 2's config file.

Click to Read More

I had no issue when playing a movie with my PC or with my ChromeCast, both of them being however connected on the same home cinema amplifier (a Yamaha HTR-4067) as the Raspberry PI 2 and, from there, on the projector (a Benq W1070+) via a long HDMI cable.

The problem became especially unsupportable with 3D movies as not only the signal was lost, but also the projector was coming back in 2D mode. So, I had to set it back in 3D when the signal was recovered.

It was sometimes mentioned on various blogs or forums that the problem could have been with the HDMI cable, with the power supply of the Raspberry Pi 2, with the HDMI port of the amplifier, ... But I found the true solution here: boost the HDMI signal in the config file of the Raspberry Pi 2.

While already being in the config file to solve the problem, I took the opportunity to also overclock a bit the Raspberry as documented here. And finally, as I noticed that there was no specific memory size set for the GPU on my Raspberry, which has 1Gb Ram, if fixed that too. It seems to me that the config file used by RasPlex is not fully optimized for the Raspberry Pi 2.

To edit the "config.txt" file, I simply put the SD card of the Raspberry Pi 2 into my Windows PC and opened that file with Notepad++ (it's located on the root of the card). I ended with a config file like this one (changes are in bold):

#########################################################################
# This file is part of OpenELEC - http://www.openelec.tv
# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv)
# Inspired and partly copied from:
# http://youresuchageek.blogspot.fr/2012/09/howto-raspberry-pi-openelec-on.html
#
# This Program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This Program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenELEC.tv; see the file COPYING. If not, write to
# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA.
# http://www.gnu.org/copyleft/gpl.html
#################################################################
# Bootloader configuration - config.txt
#################################################################

#################################################################
# Memory (System/GPU configuration )
#################################################################

# default GPU memory split (do not change if you do not know what you are doing)
gpu_mem=128

# SDRAM size based GPU memory split, uncomment and setup to override 'gpu_mem'
gpu_mem_256=64
gpu_mem_512=128
gpu_mem_1024=256

#################################################################
# Overclocking settings
# WARNING: Do not change/enable if you do not know what you are doing!
# The System may become unstable or you can have data corruption or
# you can loose your warranty if you set wrong settings
#
# please read: http://elinux.org/RPi_config.txt#Overclocking_configuration
#################################################################

# Overclock mode settings.
#
# default recommended values are: arm_freq | core_freq | sdram_freq | over_voltage
# no overclocking : 700 | 250 | 400 | 0
# mode 'Modest' : 800 | 300 | 400 | 0
# mode 'Medium' : 900 | 333 | 450 | 2
# mode 'High' : 950 | 450 | 450 | 6
# mode 'Turbo' : 1000 | 500 | 500 | 6

#arm_freq=900
core_freq=500
sdram_freq=500
over_voltage=2

# set to 'force_turbo=1' to disable dynamic overclocking (you can lose your warranty!)
force_turbo=0

# If you have any data corruption using Turbo Mode and overclocking
# try with this setting uncommented
# If this still fails, try to use Medium mode without "over_voltage=2"
# If it ultimately keeps failing, forget about this until it gets fixed
# Use a more conservative mode that will works fine in any cases:
# initial_turbo=30

#################################################################
# Overscan settings
#################################################################

# Make display smaller to stop text spilling off the screen
# see also http://www.raspberrypi.org/phpBB3/viewtopic.php?f=67&t=15700
# overscan_scale=1
# disable_overscan=1

# Adapt overscan values to your needs
# overscan_left=57
# overscan_right=59
# overscan_top=20
# overscan_bottom=20

#################################################################
# various settings see also: http://elinux.org/RPi_config.txt
#################################################################

# Force HDMI even if unplugged or powered off
# hdmi_force_hotplug=1

# Uncomment to force a console size. By default it will be display's size minus
# overscan.
# framebuffer_width=1280
# framebuffer_height=720

# Uncomment to force a specific HDMI mode (this will force VGA).
# hdmi_group=1
# hdmi_mode=1

# Uncomment to force an HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes.
# hdmi_drive=2

# Uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display. Max value = 7
config_hdmi_boost=4

# Uncomment for composite PAL
# sdtv_mode=2

# Uncomment to overclock the ARM. 700 MHz is the default.
# arm_freq=800

#################################################################
# License keys to enable GPU hardware decoding for various codecs
# to obtain keys visit the shop at http://www.raspberrypi.com
#################################################################

# decode_MPG2=0x00000000
# decode_WVC1=0x00000000
# decode_DTS=0x00000000
# decode_DDP=0x00000000

#################################################################
#
# >>>>>>>> RasPlex default settings override <<<<<<<<<
#
#################################################################

hdmi_force_hotplug=1
hdmi_drive=2
gpu_mem_256=64
gpu_mem_512=256
gpu_mem_1024=256
dtoverlay=lirc-rpi
#################################################################
# End of default configuration
# all values below this line were inserted from config.txt.bk (your old config)
# and can be merged with the above values
#################################################################

Raspberry Pi HDMI CEC between an amplifier Yamaha HTR-4067 and a Raspberry Pi 2

I just bought the new Raspberry Pi 2 to run Rasplex (Plex + OpenElec) within my Home Theater System. The only question I had was: would I be able to use the remote of my amplifier to control Rasplex. The answer is yes, it works !

Yamaha-HTR-4067

Yamaha-HTR-4067

Click to Read More

My Home Theater System includes:

  • A amplifier Yamaha HTR-4067
  • Speakers Eltax Monitor 91 HC  with
    • two floor-standing speakers Eltax Monitor IX
    • two speakers Eltax Monitor I
    • one speaker Eltax Monitor Center
  • A subwoofer Yamaha NS-SW200
  • A projector BenQ W1070+
  • A Raspberry Pi 2 with RasPlex

NB.:

  • The Raspberry is connected on the "HDMI 1 (BD/DVD)" input.
  • I had to change the HDMI cable to use one certified "High Speed with Ethernet".
  • I had to turn on first the Amplifier, next the projector, and finally the Raspberry.

When starting, Rasplex  :

  1. Detects the "Pulse-Eight CEC adapter"
  2. Updates the CEC adapter configuration
  3. And finally displays a message: "connected: TV-HTR-4067"

Within Plex:

  • I went to "> Preferences > Change Preferences for System"
  • I selected "Input Devices" and then "Peripherals"
  • There, Plex displays info about the "CEC adapter". I did click on "Ok" to enter the settings of that adapter. There, I have the following settings:
    • Enabled is ticked
    • Make XBMC the active source when stating is not ticked
    • "Device to power on..." is none
    • "Device to pwoer off..." is none
    • "Send inactive source..." is ticked
    • "Put device in standby..." is not ticked
    • "When the TV is switched off" is "Ignore"
    • "Put device in standby" is not ticked
    • "Use the TV's language setting" is not ticked
    • "Pause playback" is ticked
    • "Physical address (overrules HDMI port)" is 0
    • "Com port" is -

Notice: when the amplifier is switched off (standby), the video is still forwarded to the projector, as well as the sound. But what's great is that the remote control still works too via CEC !!!

Raspberry Pi XBMC on Raspberry Pi: get Sound but no Video

It's well known that when a video does not play on a Raspberry Pi, it's usually due to a codec issue. But in my case, I was able to play video from the "Movies" menu but not from a "Smart Playlist". The problem was due to the amount of ram assigned to the GPU. It seems that there was no free resource anymore to play video once a "Smart Playlist" opened.

Click to Read More

I have a Raspberry Pi model b with 512 Mb Ram.

  1. In order to find the reason of the problem, I have activated the logging on XBMC: In  Settings -> System -> Debugging, toggle the Enable debug logging setting.
  2. I have opened a Smart Playlist and started a movie. I only got the sound but no video.
  3. I have looked into the log file, whose path depend on the distribution:
    • OpenELEC: /storage/.xbmc/temp/xbmc.log
    • Raspbmc: /home/pi/.xbmc/temp/xbmc.log
    • XBian: /home/xbian/.xbmc/temp/xbmc.log
  4. In that log I found this:

DEBUG: JSONRPC: Calling player.getactiveplayers
ERROR: COMXCoreComponent::DecoderEventHandler OMX.broadcom.video_decode - OMX_ErrorInsufficientResources, insufficient resources
ERROR: OMXPlayerVideo : Error open video output
DEBUG: JSONRPC: Calling application.getproperties

The problem was "Insufficient Resources". Googling on that I found a simple solution: add more ram for the GPU.

  1. Open a telnet session to the Raspberry Pi and log (user: pi, password raspberry on RaspBMC)
  2. Edit the config.txt file which is located in /boot.
  3. Set gpu_mem_512=256 (instead of the current value 128)
  4. Restart the Rasberry Pi using the command: sudo reboot

If editing the config.txt file using "telnet" is not easy, possibly "ftp" the Raspberry to "get" the file, edit this one on Windows and "put" it back.

Regarding the codec problem that can occur, it's usually for mpeg2 video as one has to purchase the mpeg2 license and configured the raspberry pi. See this blog for details.

About logging: http://wiki.xbmc.org/index.php?title=Log_file/Easy

About Raspberry pi : http://wiki.xbmc.org/?title=Raspberry_Pi/FAQ

More about Ram usage and split between CPU and GPU (from Krzysztof Adamski)

Click to Read More

256MB version

For older RaspberryPi, with 256 MB of RAM, 4 splits are available:

  • 240/16 - The most RAM size ARM can get (240MB) with mimial GPU memory. It's the best for general computing when you don't need 3D graphics or hardware video acceleration. It has enough memory to handle 1920x1200x16bpp framebuffer resolution. While 32bpp is also working, it's not recommended since it leaves very small amount of free memory for GPU.
  • 224/32 - This one is deprecated in favor of 240/16 split. It has 3D and hardware video decoding build in but since there is not enough memory to actually use it, there's little point in using it. Unless you have some problems with 240/16 split or want to use 32bpp framebuffer at highest resolution. It is possible it will be deleted in the future.
  • 192/64 - You need at least 64MB of GPU split to use hardware video acceleration or 3D graphics. It may not be enough GPU memory for hardware accelerated video playback at highest resolution or if you need a lot of GPU memory for things like textures.
  • 128/128 - The most RAM GPU can get. Use it when you need a lot of memory for 3D graphic card and hardware accelerated video playback in high resolution. This split is needed for RaspBMC to work properly or to play fullHD video content with omxplayer without problems.

512MB version

New versions of RaspberryPi has 512 MB of RAM. You have 4 additional splits designed for this version:

  • 496/16 and 448/64 - like 240/16 and 192/64 split for 256MB respectively but with 256MB more RAM available for ARM. Since GPU has only 16 MB/64MB or RAM, all the limitations from240/16/192/64 still apply.
  • 384/128 - Similar to 128/128 split for 256MB - you should get all the graphic chip features but with reasonable amount of ARM memory. This will probably be the most universal split right now.
  • 256/256 - Some bonus graphic card memory if you really need it, like for big textures and similar things. While 256MB of ARM memory is bigger than you could possibly have in older RaspberryPis, I don't think this one will be used on many occasions.

HardwaresRaspberry Pi A HTPC for 35€: Raspberry Pi + XBMC

Raspberry Pi Model B

I have just received the "Raspberry Pi Model B" I ordered two weeks ago on "RS Components" website. It rocks !!!

Within 30 minutes, I was watching on my HD TV a 1080p movies streamed from my NAS :p

Click to Read More

Mine is in a black case bought from RS components. I also bought there a power supply and a HDMI cable. The big advantage of using a Raspberry pi is that

  • It has a very low power consumption (about 1-2 watts at idle)
  • It is really small 85.60mm x 53.98mm x 17mm (invisible behind the TV)
  • It has a HDMI with Audio with CEC support (you can pilot XBMC on the Raspberry Pi with the TV remote control)
  • It comes with codec license for MPEG4 & H.264 (hardware accelerated)
  • Licenses can also be bought here to play back MPEG2 or VC1.
  • The Model B comes with 512MB Ram (Only 256 on the Model A)
  • It boots a Linux from a SD card (= silent) in about 50 seconds (depending on the distribution). There are 3 distributions of Linux with XBMC targeting the Raspberry Pi (see the wiki here). Some Install Guides:
  • A 2GB SD is enough, but I use a 16GB class 6, the only SD I had
  • There are 2 USB slots that I use for a keyboard and a mouse. That can be expanded with a USB hub (There is only one USB port on the Model A). A USB HDD can be plugged to add extra storage if required.
  • There is a 10/100Gbs Ethernet Port (No Ethernet port on the Model A) with supports of various power management wakeup features, including Magic Packet™, Wake-on LAN (WOL) and Link Status Change. UNFORTUNATELY, albeit Pi's Lan chipset does support WOL, the Pi's lack of power management (ACPI) means it doesn't support this Lan chipset features :(
  • It does not need a fan cooler (= silent)
  • The Model B uses a standard power supply capable of supplying 5V 700ma (the Model A requires 5V 300ma)
  • The GPU is capable of 1Gpixel/s
  • It can be easily overclocked (and overvolted to increase stability) up to 1000MHz (without making the warranty void !). By default the Raspberry Pi runs as 700Mhz and is overclocked at 800Mhz by RaspBmc...
  • Overall real world performance is something like a 300MHz Pentium 2 with great graphic performances.
As mentioned, I decided to install RaspBmc. It's really straightforward [EDIT: RapsBmc is now deprecated and replaced by Osmc).
  1. Plug the SD card in a PC (I am using Windows 8 )
  2. Format the SD card, e.g. using a tools dedicated to SD/SDHC/SDXC like "SD Formatter".
  3. Download the raspbmc installer (Not available anymore on the official webstite) and "run As Administrator" the setup.exe . It will automatically download an image and copy it to the SD card.
  4. Plug next the SD card in the Raspberry Pi, plug the HDMI cable on the TV (I didn't test the RCA/Audio output), plug an Ethernet cable and plug the power supply. Select the right HDMI input on your TV and you should see the Raspberry PI display. It will configure itself (get an IP address from DHCP server, download the latest release/updates, etc...) and after about 20 minutes, it should start XBMC.
  5. In XBMC, go to the main menu > System > Lower submenu > System info and take note for your URL. You can also get there the MAC Address if you prefer like me to configure your DHCP server to assign a fix IP to the Raspberry PI (recommended to remote control XBMC or configure NFS access to Synology - reboot required).
  6. On your PC, run a Browser and type the IP address of the Raspberry PI to get access to the XBMC web control UI (on the port 80 configured by default in Raspbmc). It can be used to remote control XBMC.
  7. On your Android Phone, install the XBMC official Remote Control (Not available anymore) and configure it with the IP address of the Raspberry Pi with port 80 (this is the default of RaspBmc). There is neither a username nor a password defined by default in RaspBmc for accessing the Web Control UI (Another good remote for Android is Yatse Widget).
  8. On Synology, enable the "guest" account and grant read access on the shared folders "music", "video" and "photo" (I still have to find where I can configure a username in raspbmc to access smb/nfs - I know I could at least do it on the smb/nfs sources configured in XBMC: protocol://user:pass@synoIP/sharename)
    • The default username is "pi" and the default password is "raspberry", but for some reasons, adding such a user on the Synology with adhoc rights on the shares does not grant raspbmc access on those ?!
  9. On XBMC, add video, music and photo sources. I am not using "uPnP" as it does not support use of metadata stored next to the media files. Instead I am currently using smb.
  10. On XBMC, you can go to the menu "Programs" to get access to the RaspBmc settings.
The Android Remote Control for XBMC works really fine, as well as controlling XBMC with the TV Remote, which makes this HTPC from far the greatest for that price: ~35€!
A few notes:
  • WOL does not work because the lack for "power management" on Raspberry Pi. The only other way to "power on" the device remotely is to plug its power cable into a USB port on the TV (USB voltage is standardized at 5.0v, so you only have to check the max A supported by your TV). When you turn on the TV the pi powers on too. However, the Pi draws less power when turned on then many Tvs do when off, so there is really no reason to ever turn it off. Turning it off would not significantly reduce power consumption unless it is also unplugged.
    • So, don't ever use the "Power Off" button of XBMC. The only way to restart the Raspberry Pi would be to unplug and plug back in the power supply.
    • Power over Ethernet (PoE) is not yet supported. Maybe in a future version of the Raspberry Pi.
  • In XBMC, go to the main menu > System > Lower submenu > Settings > Apparence > Region. Set e.g. the "Langue of the interface" or your language as "Preferred Language for audio" although you like to watch the movies in O.V.
  • In XBMC, go to the main menu > System > Lower submenu > Settings > Services > SMB Client. Change the name of the Workgroup to match your.
  • Login on the Raspberry Pi via SSH (using Putty, username "pi", password "raspberry". Note: "root" user is disabled by default on RaspBmc) and Raspbmc will prompt you to choose your keyboard layout - use the space bar to select a layout and Tab to move the cursor onto the Ok button. On the next screen, set your layout as the default one and wait until it's "generated" (can be a long process). Continue the configuration with the selection of your region and country. Type "exit" to close the SSH session.
  • Raspbmc overclocks the Raspberry Pi to a safe clock frequency (from the default 700MHz to 800Mhz). Notice that a change of the clock frequency does not blow the OTP (Over Temperature Protection). It is overvolting that does this. Overclocking is therefore not making the warranty void while overvolting will permanently set a bit which invalidates the warranty. Overvolting will also reduce the lifespan.
    • Here is a tutorial to overclock the Raspberry Pi with RaspBmc via SSH
    • Here is a tutorial to overvolt the Raspberry Pi with RaspBmc via SSH
    • Here is a tutorial to do the same with the Raspbery config tool (if not using RaspBmc
    • And here are more details on possible values for the overclocking/overvolting.
  • With RaspBmc, there is no need to manually update the firmware (via SSH). This is done automatically by RaspBmc, insuring that the kernel is fully compatible.

site: http://www.raspberrypi.org (Look at the quick-start-guide and the FAQ)

RaspBmc: http://www.raspbmc.com (Look at the FAQ)

XBMC for Raspberry: http://wiki.xbmc.org/index.php?title=Raspberry_Pi/FAQ

buy: http://raspberrypi.rsdelivers.com/default.aspx?cl=1