MakeMKV Linux and USB optical drives: Read issues and solution

The place to discuss linux version of MakeMKV
Post Reply
evbuk
Posts: 15
Joined: Sat May 22, 2021 3:10 pm

MakeMKV Linux and USB optical drives: Read issues and solution

Post by evbuk »

I have two drives supplied by Asmcom in the UK. One is an Hitachi LG-BH16NS40 cross-flashed to a Hitachi LG-WH16NS60 on firmware version 1-00DE (LibreDrive) in an OWC Mercury Pro external USB3 enclosure. The other is an LG BH16NS55 on firmware 1.02DE (LibreDrive) in a Vantec external USB3 enclosure.

I am running Ubuntu Desktop 20.04 LTS and the Linux version of MakeMKV installed via the APT repository.

I was running into a problem (with both drives) where DVD (and only DVD) media would cause the drive to seek repeatedly and the disc would never be mounted on the system. If I inserted a DVD into either drive, it would not mount and any disc that I inserted afterwards (bluray or UHD included) would also cause an infinite seek loop and no mount behaviour. The only way to get the drives working again would be to shut the computer down, turn the power to the drive off and on and then start the machine again. I should say that both drives performed without issue under Windows 10 no matter what type of media was inserted.

Initially I thought that the problem was caused by a faulty drive, but when the behaviour happened again with the newer LG in the OWC enclosure, I started to dig deeper. With the help of someone else who was having the same problem with 20.04 LTS and a different drive in a different enclosure, we found a solution which I hope might help others who run into the same issue.

The solution is to make the following configuration changes:

Code: Select all

sudo cp /usr/lib/udev/rules.d/60-persistent-storage.rules /etc/udev/rules.d/60-persistent-storage.rules
sudo vim /etc/udev/rules.d/60-persistent-storage.rules
and make the following lines in /etc/udev/rules.d/60-persistent-storage.rules:

Code: Select all

# probe filesystem metadata of optical drives which have a media inserted
KERNEL=="sr*", ENV{DISK_EJECT_REQUEST}!="?*", ENV{ID_CDROM_MEDIA_TRACK_COUNT_DATA}=="?*", ENV{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}=="?*", \
  IMPORT{builtin}="blkid --offset=$env{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}"
# single-session CDs do not have ID_CDROM_MEDIA_SESSION_LAST_OFFSET
KERNEL=="sr*", ENV{DISK_EJECT_REQUEST}!="?*", ENV{ID_CDROM_MEDIA_TRACK_COUNT_DATA}=="?*", ENV{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}=="", \
  IMPORT{builtin}="blkid --noraid"
look like this:

Code: Select all

# probe filesystem metadata of optical drives which have a media inserted
KERNEL=="sr*", ENV{DISK_EJECT_REQUEST}!="?*", ENV{ID_CDROM_MEDIA_TRACK_COUNT_DATA}=="?*", ENV{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}=="?*", \
  GOTO="persistent_storage_end"
##  IMPORT{builtin}="blkid --offset=$env{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}"
# single-session CDs do not have ID_CDROM_MEDIA_SESSION_LAST_OFFSET
KERNEL=="sr*", ENV{DISK_EJECT_REQUEST}!="?*", ENV{ID_CDROM_MEDIA_TRACK_COUNT_DATA}=="?*", ENV{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}=="", \
  GOTO="persistent_storage_end"
##  IMPORT{builtin}="blkid --noraid"
(the IMPORT... statements are commented out and replaced with GOTO... replacements)

Reboot and then try your DVD media again - it should work now.

Ref:

I ran across this bug report on a Fedora system, which mentions a similar issue on yet more dissimilar hardware. The one thing they had in common was the use of a BluRay drive in a SATA to USB3 external enclosure.

That bug report indicated that their problem was with poor behavior of blkid when optical media was inserted into the drive. Like him, I was able to validate that the drive functioned perfectly fine on a Win10 system, but on multiple Ubuntu 20.04 machines, DVD Movie media would cause the drive to hang for a period and the media would never be recognized by the OS.

Another bug report was referenced as source material where the work-around to this is referenced.

Unfortunately, both bug reports were ultimately closed as not-resolved due to them ageing out. Would love to put this in front of one of the util-linux package maintainers and a kernel maintainer to see where the true fix for this should really be implemented.
[/code]
jmeline
Posts: 1
Joined: Sun May 30, 2021 7:01 am

Re: MakeMKV Linux and USB optical drives: Read issues and solution

Post by jmeline »

I made an account just to say thank you for that solution!

I run Archlinux at home and my old bluray drive (LG UH12NS30 1.00) housed in an OWC Mercury Pro started acting up on me. This drive would rip about five blurays/dvds before it seemed to get stuck doing nothing when I tried to switch disks. The drive would just constantly spin and makemkv would freeze while it was trying to identify the available optical drives. Rebooting my computer didn't work. I didn't quite understand what was happening and I thought that either the drive or the enclosure was bad.

Reading your post described exactly what I was experiencing. Tonight my drive began to act up and I decided to look through the forums hoping someone would have run into this. Found your post and I modified my udev rules as described. Upon reboot I was back in business. I am 99% sure this was the issue I experienced. Thank you! Thank you! Thank you! :D
teaboyteaboy
Posts: 1
Joined: Wed Feb 08, 2023 11:11 pm

Re: MakeMKV Linux and USB optical drives: Read issues and solution

Post by teaboyteaboy »

I, like jmeline, created a forum account just to say thank you!

My scenario was a mix between the two, where my drive in an OWC enclosure (Ubuntu 22.04 LTS [jammy]) would read 1, and only 1, DVD and then "lose its mind" with seeking, forever giving me "Failed to open disc" in makemkv. It would rip 4k/standard blu rays like it was going out of style, but once the first DVD was read the drive was useless for reading anything (blu ray or DVD) until I either reset the drive (moderately successful) or rebooted (always successful).

I just made these changes and read 2 DVDs in a row, an event never before seen unless I passed my drive through to a windows VM (which would read anything/everything, albeit slightly slower).

Thanks again, I thought I was going insane until I saw this post!
The_Randalorian
Posts: 1
Joined: Sat Aug 17, 2024 9:28 pm

Re: MakeMKV Linux and USB optical drives: Read issues and solution

Post by The_Randalorian »

I'm the third person to make a forum account just to say thank you. I've been having this issue for months whenever I used my laptop with DVDs, and I made a Google search for the problem on a whim. This was the first result and it solved everything perfectly.

This fix is still working for (K)ubuntu 24.04.

Thank you, evbuk, for being the biggest Linux MakeMKV Chad out there.

:D
cakedev
Posts: 1
Joined: Thu Sep 12, 2024 6:53 pm

Re: MakeMKV Linux and USB optical drives: Read issues and solution

Post by cakedev »

How can I thank you!?!?! Running VMWare Fusion Pro on M1 Mac Mini running Automatic Ripping Machine this error was locking up my rips... I think you just saved my home media server!
Setup: M1 Mac Mini Sequoia 15.1.1
VM Ware Fusion running Ubuntu 24.04.1 ARM 64b Virtual Machine.
ASUS BW-16D1HT
Automatic Ripping Machine running in docker on the VM.
Post Reply