Solved kodi v19.4 / pi 4b and removable (usb) disks
#1
Hi

I'm experiencing a weird problem when using kodi with removable disks. System is a 2Gb Pi4b, os loaded via PINN just the other day, then updated to latest software. Kodi is from the standard repo and version 19.4

If I boot the pi, plug the disk in, wait a few seconds (for udisks2 to complete the mount), then start kodi, kodi sees the disk as a media source and adds an icon. Expected behaviour.

I have modified the udisks2 mount options page such that the disk is always mounted read-only. I do this as a) this system has no requirement to write to the disk, and b) I want to be able to hotplug the drive (in and out) without damage.

If I now unplug the disk, kodi gives me an 'unsafe removal message' which should not matter, but the icon is not removed. It does not do anything either, but it seems odd that the icon remains.

OK, new test. If I boot the pi, do not plug the disk in then start kodi, kodi does not show the disk. Which again would be expected.

If I now plug the disk in ... nothing happens. Kodi does not add the disk as an icon. Not only that but kodi does not show that the disk has been mounted to its expected mountpoint (/media/pi/yaddayadda). If I ssh into the pi, the *system* has not actually mounted the disk, even tho' there seems to be no errors or other problems with the udisks2 subsystem. If I exit kodi, I can now see that the disk has been mounted by udisks2 as expected.

It's as if kodi is suspending the udisks2 service ...

Kodi also has it's own automounting gizmo that can be enabled via the advancedsettings.xml file. The read somewhere that this operates via udisks2 ... but I'm not sure this is true, and this approach has it's own significant disadvantages.

1) It ignores my udisks2 mount options settings, so the disks are mounted rw, not read-only.
2) It insists on mounting the pi RECOVERY and SETTINGS partitions ... I have tried the usual tricks of marking them ignored in the udev rules, but to no avail, the kodi automounter still mounts them.

So does anyone know how I can either get kodi and the system service udisks2 to work together, or how I can use the kodi automounting gizmo to behave the way I need ?


-- Chris
Reply
#2
For anyone who is interested, I did get a solution to this.

1) I'm using the kodi automounter - enabled in advanced settings.xml.
2) It does honour the udisk2 mounts options ... at least enough of them for it to work for me. When I first tested it I used a global ro settings in mount_options.conf

[defaults]
defaults=ro

That didn't seem to work for the kodi automounter (although it did work fine when hotplugging disks to the OS). Don't know why. However if I used a specific ro option on each of the filesystem mount options, the read-only flag was honoured correctly.

3) The easiest way to stop kodi from automount ing other partitions that you may not wish it to play with, is to mount them via fstab under the /boot partition, see UDisks2Provider.cpp CUDisks2Provider::Filesystem::IsApproved() .

So if I add
/dev/mmcblk0p1    /boot/recovery    vfat    ro,defaults    0    2
/dev/mmcblk0p5    /boot/settings    ext4    ro,defaults    0    2

to the fstab, although the offending partitions are mounted to the os, kodi does not fiddle with them, and as they are mounted read-only, they cannot be messed with either.


-- Chris
Reply
#3
Thread marked solved.
Reply
#4
I was very concerned about recovering deleted files. A large number of files were mistakenly deleted on the work PC. I did some research and found that recover a partition could help. I wasn't sure if it would work, but I decided to try it. Thankfully, it worked! The recovered files were a lifesaver!
Reply

Logout Mark Read Team Forum Stats Members Help
kodi v19.4 / pi 4b and removable (usb) disks0