Skip to content

How to automount optical media on Debian Linux for Kodi

September 27, 2015

Hello

This problem has been bugging me for a while: how to setup my Kodi based home cinema to automatically mount an optical media ?

Turns out the solution is quite simple, now that Debian has switched for systemd. Just add the following line to /etc/fstab:

/dev/sr0 /media/bluray auto defaults,nofail,x-systemd.automount 0 2

Where:

  • /dev/sr0 is the device file. You can also use one of the symbolic links setup by udev in /dev/disk/by-id
  • /media/bluray is the mount point. You can choose another mount point
  • nofail is required to avoid failure report when booting without a disc in the optical drive
  • x-systemd.automount is the option to configure systemd to automatically mount the inserted disc

Do not specify noauto: this would prevent systemd to automatically mount a disc, which defeats the purpose.

To test you setup:

  • Run the command journalctl -x -f in a terminal to check what is going on with systemd
  • Reload systemd configuration with sudo systemctl daemon-reload.
  • load a disc in your optical drive

Then, journalctl should show something like:

Sept. 27 16:07:01 frodo systemd[1]: Mounted /media/bluray.

And that’s it. No need to have obsolete packages like udisk-glue or autofs.

Last but not least: this blog is moderated, please do not waste your time (and mine) posting rants about systemd.

Edited: I’ve later realised that the instruction contained in this post works only if the mount point is opened, e.g. a program opens the mount point directory to check its content. Unfortunately, it’s not enough for kodi: once a media is plugged, systemd makes sure that the plugged device is ready to be mounted, but kodi does not know this. See this Automount usb devices with systemd for a solution.

All the best.

Advertisements

From → computer, Debian

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: