Skip to content

Instantly share code, notes, and snippets.

@emilyst
Last active June 15, 2024 04:36
Show Gist options
  • Save emilyst/72f6d8a91bc96aaa576de5bc65a27cce to your computer and use it in GitHub Desktop.
Save emilyst/72f6d8a91bc96aaa576de5bc65a27cce to your computer and use it in GitHub Desktop.
Description for getting MakeMKV working on Synology with DSM 7 using jlesage/makemkv via Docker Compose
SUBSYSTEMS=="usb", ATTRS{idVendor}=="", ATTRS{idProduct}=="", GROUP="cdrom", MODE="0666"
version: '3'
services:
makemkv:
image: jlesage/makemkv:latest
container_name: makemkv
restart: unless-stopped
network_mode: bridge
ports:
- "5800:5800"
environment:
MAKEMKV_KEY: <redacted>
USER_ID: 1026
GROUP_ID: 101
AUTO_DISC_RIPPER: 1
APP_NICENESS: 19
volumes:
- "/volume1/Docker/makemkv/config:/config:rw"
- "/volume1/Downloads:/storage:ro"
- "/volume1/Media:/output:rw"
devices:
- "/dev/sg6:/dev/sg6"

These are the steps I used to get MakeMKV working from Docker on my Synology NAS (DS1520+).

In my setup, I have a shared folder for Media, for Downloads, and for Docker-related files. Amend these steps for your own purposes by using directories which exist on your NAS. My USB Blu-ray drive is a Pioneer BDR-XD05B.

  1. Enable SSH if needed.
  2. SSH to the Synology NAS.
  3. Connect USB CD-ROM drive to the physical NAS.
  4. Use dmesg to see which SCSI device was created.
    • In my case, it was sg6, so I knew that the device was created at /dev/sg6. Adjust as needed for your own purposes.
  5. Create the needed directories: mkdir -p /volume1/Docker/makemkv/config
  6. Copy docker-compose.yml from below to /volume1/Docker/makemkv.
    • Adjust any directory names if needed.
    • Adjust the name of the SCSI device if needed.
    • Adjust the MAKEMKV_KEY environment variable value to contain your key.
    • Adjust any other environment variables needed. See documentation.
  7. Copy 99-usb-cdrom.rules from below to /lib/udev/rules.d/. (Requires root permissions with sudo.)
    • At this time, you should also chmod 0666 /dev/sg6 (or whichever device you have) so that you don't have to reboot to apply the necessary permissions. (Requires root permissions with sudo.)
  8. Change directory: cd /volume1/Docker/makemkv.
  9. Create the container: docker-compose up -d.
  10. Access MakeMKV on your Synology unit at http://<synology>:5800/.
    • You can either open up port 5800 in the firewall settings in DSM, or you can set up a reverse proxy configuration to access it securely. Both methods are outside the scope of this procedure.
@greentigerfeet
Copy link

Hi

Please excuse a bunch of newbie questions but I've been chewing away at this one for a while. I have the container up and running and can access the gui but have failed to establish a connection between the container and the optical drive.

Editing udev rules is a new area of endeavour for me. I see the sample file you have provided and I have found my VID and PID numbers but I don't know where to incorporate them in that line of text. I'm guessing in between the quotes?

I'm also pretty unsure about how to create and insert the file in the specified directory (I'm pretty new to cmd line and I can't see how to access that directory via the DSM gui)

Any help greatly appreciated

@emilyst
Copy link
Author

emilyst commented Jan 4, 2024

Hi

Please excuse a bunch of newbie questions but I've been chewing away at this one for a while. I have the container up and running and can access the gui but have failed to establish a connection between the container and the optical drive.

Don’t sweat it. This process is a little arcane if you’re new to operating systems like Linux.

Editing udev rules is a new area of endeavour for me. I see the sample file you have provided and I have found my VID and PID numbers but I don't know where to incorporate them in that line of text. I'm guessing in between the quotes?

That’s correct! (It’s very odd I bothered to describe everything else so carefully and then skipped this part. I’ll revise the instructions.)

I'm also pretty unsure about how to create and insert the file in the specified directory (I'm pretty new to cmd line and I can't see how to access that directory via the DSM gui)

You won’t be able to do it from the GUI, that’s true. You’ll need to create the file, upload it to the Synology NAS (if it isn’t already there somewhere), and then copy it to the correct place.

First, you just need to create the file as plain text, with the above contents. The easiest way is actually to download it from this Gist. You can do so from the “Download ZIP” button at the top right of this page. Inside that ZIP file, you’ll find the .rules file. Edit it in something like Notepad or Text Edit. Insert the numbers in the correct positions.

If you haven’t already copied the file to the Synology NAS somewhere, do so. Doesn’t matter where, just so long as you know where to find it.

Finally, from the command line, you’ll need to copy the file to the correct place. The specific command you use will depend on where you copied the file. Use a command like the following:

sudo cp /volume1/homes/$(id -n)/99-usb-cdrom.rules /lib/udev/rules.d/

After that, you can proceed to step 8.

Any help greatly appreciated

I hope this helps. If you’re troubleshooting, here’s a couple of tips.

  1. Check the format of the vendor ID and product ID. There should be no spaces around them. They should be in hexadecimal format, like “05a9”. Make sure nothing accidentally turned the quotation marks into “smart” or “curly” quotation marks.
  2. Check the permissions on the file once it’s in place. Doing so is a bit out of scope for explaining here, but it’s easy to find out how to do so online. The correct permissions will probably be 0666.

@greentigerfeet
Copy link

Thank you very much I now have the container up and running.

Everything is working except auto eject. I had previously created makemkv in a VM on Synology including auto eject. The only difference I can see is that inside the VM, the container is looking for two optical drive devices which are present (sr2 and sg3) but outside the VM with the container running in Synology Container Manager it is only looking for one (sg5).

Do you have autoeject operating?

@emilyst
Copy link
Author

emilyst commented Jan 5, 2024

Thank you very much I now have the container up and running.

I'm so glad I could be helpful!

Everything is working except auto eject. I had previously created makemkv in a VM on Synology including auto eject. The only difference I can see is that inside the VM, the container is looking for two optical drive devices which are present (sr2 and sg3) but outside the VM with the container running in Synology Container Manager it is only looking for one (sg5).

Do you have autoeject operating?

I wrote this almost three years ago and then promptly forgot about it until your comment. I'm afraid I don't remember, and I probably did not get auto-eject working. Sorry. Feel free to follow up if you do get that working as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment