Remove LibreELEC File Manager Extra Sources (Recovery, root, boot, data etc)

If you have installed LibreELEC (KODI) on a Raspberry Pi using NOOBs you may have noticed quite a few random sources in the File Manager. They will be named RECOVERY, root, boot, data etc.

This may no longer be needed as newer versions of LibreELEC don't show most of the extra PINN / NOOBS mounts.

What is happening is that LibreELEC is detecting the extra partitions on the SD card and automatically mounting these in the /var/media directory. KODI picks up mounts in this location as sources.

Eg. when you plug in a USB drive, it is mounted in the /var/media directory and therefore shown in KODI.

As KODI thinks these directories are mounted media, it won't allow you to remove the sources - only "remove safely". This does remove them, but they will pop up again after a reboot. Arrgh!

The solution is to tell LibreELEC not to mount these partitions in the first place.

Below are the instructions to do this.

First remove any external USB media from the Pi (eg. Hard-drive, USB stick)

Make sure SSH is enabled in System -> LibreELEC -> Services -> Enable SSH

Find the IP of the Pi in System -> System info -> Summary -> IP address

Download putty.exe from HERE
You will need a windows PC on the same network.

Save it somewhere you can easily find it.
It's portable - which means it doesn't need to be installed.

Double click the saved putty.exe to start Putty.

Enter the Pi's IP address in the host name field and make sure the port is 22.
Then click Open.

You should see "login as:" appear.
Type root and hit enter.
Now type in the password libreelec

First we need to find out the names of the partitions we don't want mounted, do this using the below command in the terminal

ls -l /dev/disk/by-label
This will show you all the current mounts with labels.

We now have the partition labels for the partitions we want not mounted.

My labels are 'RECOVERY', 'SETTINGS', 'boot', 'root0' and 'share0'
You may notice these are close or identical as the names in the KODI file manger.

Now that we have these labels, we need to tell LibreELEC to not mount them.
We do this by putting them into a UDEV rule file.

We first need to copy the default system file using the below command in terminal

cp /usr/lib/udev/rules.d/95-udevil-mount.rules /storage/.config/udev.rules.d/
Our copied file will now over-ride the default system file.

Now let's modify the copied file

nano /storage/.config/udev.rules.d/95-udevil-mount.rules
Move down to the line that starts with "ENV{ID_FS_LABEL}"

We want to add our partition labels to this list "EFI|BOOT|Recovery|RECOVERY"
Each item in the list needs to be separated by a pipe |
Most keyboards you get this character by using SHIFT + BACK SLASH.

My line will be changed to

You can even use wildcards. eg. boot*|root*|volumio*"

Once you are done, save the file with Ctrl-X, Y, ENTER

That's it.
Reboot KODI and the extra file sources should be gone!

Mmmm, so clean!