Makemkv needs write access to /dev/sr0

I can’t change the title of File_mmap of /dev/zero is currently blocked and this doesn’t relate so much to the title so I’ve decided to make a new topic for it…

I’m working on makemkv a blu-ray video disc backup utility. I’ve got through several issues such as executable stacks and shared memory locations, but am stuck on a denial of write access to /dev/sr0 which seems to be blocking the utility from starting properly.

= AppArmor =
Time: Dec  6 13:19:55
Log: apparmor="DENIED" operation="open" profile="snap.makemkv.makemkvcon" name="/dev/sr0" pid=822 comm="makemkvcon" requested_mask="w" denied_mask="w" fsuid=1000 ouid=0
File: /dev/sr0 (write)

The app reports:

MakeMKV v1.10.8 linux(x64-release) started
Failed to get full access to drive "HL-DT-ST BD-RE  BH16NS40". Make sure that you either have write access to device "/dev/sr0", are member of "cdrom" group or have CAP_SYS_RAWIO enabled.

Another denial I’m seeing is that it want to lock access to the mkv files while it’s writing to them, but this doesn’t seem to be fatal:

= AppArmor =
Time: Dec  6 13:20:46
Log: apparmor="DENIED" operation="file_lock" profile="snap.makemkv.makemkvcon" name="/media/dllewellyn/Junk/test_t04.mkv" pid=822 comm="makemkvcon" requested_mask="k" denied_mask="k" fsuid=1000 ouid=1000
File: /media/dllewellyn/Junk/test_t04.mkv (write)
Suggestion:
* adjust program to write to $SNAP_DATA, $SNAP_COMMON, $SNAP_USER_DATA or $SNAP_USER_COMMON

This is not currently covered by any interface policy. Currently the optical-drive policy only allows read access. If you are able, I suggest sending up a PR to make this read/write, then people can comment if it should be in another interface or not.

This is a bug in the removable-media interface. I’ve submitted https://github.com/snapcore/snapd/pull/4366 for this.