Automatic Ripping Machine - zbrewer/homelab GitHub Wiki
Automatic Ripping Machine (ARM for short) enables quick and easy ripping of media content from optical disks.
Installing on bare metal is relatively simple - all that is needed is a CD, DVD, or Blu-Ray drive; however, installing in a virtualized environment is more challenging. These prerequisites exist for installing ARM in an Ubuntu Server VM running on Proxmox 8.
First, enable IOMMU on the server per the instructions from the Proxmox wiki. Pay special attention when updating the kernel command line to whether you are using Grub or Systemd-boot as your boot loader as the instructions are different. As a tip - ZFS installations will be using Systemd-boot.
With IOMMU enabled (and verified), use the following shell command to list all PCIe devices and their IOMMU group:
for d in /sys/kernel/iommu_groups/*/devices/*; do n=${d#*/iommu_groups/*}; n=${n%%/*}; printf 'IOMMU group %s ' "$n"; lspci -nns "${d##*/}"; done
In order for this to work with ARM - a dedicated SATA controller is needed for the optical drive(s) that will be used and this controller needs to be in its own IOMMU group. If it isn't (as the case may be for an integrated controller), or if it has other devices attached, a new PCIe controller will likely need to be added.
With IOMMU set up, a few more steps will likely need to be completed before PCIe passthrough can be used. These steps are generally outlined on the Proxmox wiki here.
In order to make sure that the SATA controller is able to be reset properly by the guest VM, and that the host doesn't depend on it for some reason, we must make sure that it isn't used by the host at all. First, run lspci -nnk
and identify the SATA controller that you'd like to use.
Check the Kernel driver in use
field and see if it is used by any other devices. If it isn't, the entire driver can be blacklisted to prevent the host OS (Proxmox) from interacting with it. That can be done by adding blacklist <driver_name>
to a new file in /etc/modprobe.d/
where <driver_name>
is the name of the driver you just found.
If, on the other hand, the driver is in use by some other device (like another SATA controller), you will need to force the device to use the vfio-pci
driver instead to effectively blacklist the device itself. In order to do this, you will need the vendor and device IDs for the SATA controller (given in a xxxx:yyyy
format). These are found in brackets after the device name in the output of the lspci
command earlier or can be found with lspci -n -s <device_address>
where <device_address>
is the far left column from the earlier lspci command.
For example, if the output of lspci -nnk
is (for the device we care about):
0d:00.0 SATA controller [0106]: ASMedia Technology Inc. ASM1062 Serial ATA Controller [1b21:0612] (rev 02)
Subsystem: ASMedia Technology Inc. ASM1062 Serial ATA Controller [1b21:1062]
Kernel driver in use: ahci
Kernel modules: ahci
We can see that the device_address
is 0d:00.0
and the vendor:device id
is 1b21:0612
(which could also be found with lspci -n -s 0d:00.0
). In this case, we can also see that the device is using the ahci
driver.
With this information in hand, create a new file under /etc/modprobe.d/
, such as /etc/modprobe.d/vfio.conf
with the following contents:
options vfio-pci ids=<xxxx:yyyy>
softdep <driver_name> pre: vfio-pci
Replace <xxxx:yyyy>
with the vendor:device
ID pair found earlier and <driver_name> with the name of the driver being used (this line can be added multiple times if it ends up defaulting to other drivers before vfio-pci - multiple vendor:device
IDs can also be separated with commas, if needed). For the example above, this looks like:
options vfio-pci ids=1b21:0612
softdep ahci pre: vfio-pci
Then, after saving the file, update the initramfs by running update-initramfs -u -k all
and reboot.
After the system reboots, check that the driver in use is now vfio-pci
. This can be done with lspci -nnk
or with lspci -nnk -s <device_address>
to just see the output for the device we care about (such as lspci -nnk -s 0d:00.0
for the example above). The output should look something like this:
0d:00.0 SATA controller [0106]: ASMedia Technology Inc. ASM1062 Serial ATA Controller [1b21:0612] (rev 02)
Subsystem: ASMedia Technology Inc. ASM1062 Serial ATA Controller [1b21:1062]
Kernel driver in use: vfio-pci
Kernel modules: ahci
Finally, with the device prepared, the VM can be set up.
IMPORTANT NOTE: Make sure that the Start at boot
is not enabled and that you have physical access to the system. If the device doesn't reset properly or something else goes wrong then the host OS (Proxmox) may freeze up, requiring a hard reset. If Start at boot
is accidentally enabled and causes the machine to immediately lock up upon a reboot, disable VT-d
in the BIOS and then reboot - this will prevent the VM from starting.
Create a new VM as you normally would but on the System
page set the Machine
to q35
and set the BIOS
to OVMF (UEFI)
. Let it add and EFI Disk and specify the location for your EFI Storage
. The ISO image for Ubuntu Server can also be specified (optionally) as the boot media during the creation process. Make sure the Start after creation
box is not checked.
After the VM is created, go to the hardware tab and click Add
> PCI Device
. Select Raw Device
on the dialog that opens and check the All Functions
box. Now click the Advanced
box and make sure the ROM-Bar
and PCI-Express
options are enabled.
With that done, you can boot the VM and make sure that the Ubuntu installer comes up and the system doesn't freeze. If it does, complete a normal Ubuntu Server UEFI installation.
For the installation itself, the guide on the ARM wiki can be followed. This includes information for configuring the ARM itself. The lsscsi
command is useful for identifying the physical drive(s) attached during this process.
A Samba share can also be mounted to the Ubuntu OS running Docker/ARM to be used for ripped media. This can be accomplished by creating a new user/password for the Samba share and then adding the following to /etc/fstab
:
# Mount the media CIFS share for use by Plex
//10.0.20.10/media /mnt/media cifs rw,credentials=/root/.media_credentials,uid=root,gid=arm,file_mode=0770,dir_mode=0770,x-systemd.after=network-online.target,x-systemd.automount 0 0
The cifs-utils
package will then need to be installed and the /mnt/media
directory created. Finally, create a file at /root/.media_credentials
containing the username and password for the Samba share:
username=<username>
password=<password>
The share can then be mounted with mount -a
and, if ls /mnt/media
shows the expected contents, the Samba share is working as expected and should be re-mounted upon reboot.
Set the option to True
at Arm Settings > Ripper Settings > SKIP_TRANSCODE
. This is useful if you generally don't wish to transcode automatically (such as if your hardware doesn't support it well).