Linux Kernel Could Support Automatic Closing Of CD/DVD Drive Trays On Mount (Again)
The Linux kernel would automatically close open CD/DVD drive trays on mount two decades ago. Updates to various kernel subsystems broke that functionality ages ago. This breakage was "fixed" by adding some ugly hacks to the
mount command and other user-space utilities from the
util-linux package. Various kernel changes added over the last few years broke those hacks. The util-linux maintainer is flat out refusing to add more ugly hacks to fix it. Michal Suchanek from German Linux vendor SUSE has submitted a series of patches to the kernel mailing list which re-adds proper support to the Linux kernel - where it belongs - many times the last few years. It could finally get through to git master in time for Linux 5.5.
published 2019-12-05 - last edited 2019-12-05
Kernel developer Michal Suchanek describes his proposed patch-set as:
"There is cdrom autoclose feature that is supposed to close the tray, wait for the disc to become ready, and then open the device.
This used to work in ancient times. Then in old times there was a hack in util-linux which worked around the breakage which probably resulted from switching to scsi emulation.
Currently util-linux maintainer refuses to merge another hack on the basis that kernel still has the feature so it should be fixed there. The code needs not be replicated in every userspace utility like mount or dd which has no business knowing which devices are CD-roms and where the autoclose setting is in the kernel.
This is rebase on top of current master."
The patch-set for fixing the kernel's broken CD/DVD tray auto-closing feature was first proposed on December 14th, 2017 - almost two years ago. The many attempts to get it into the mainline Linux kernel have been met with various degrees of resistance.
"Please separate whitespace-only changes from functional changes such that this patch series becomes easier to review."
"Please fix the coding style. static never should be on a line of its own.."
"It's kind of a stretch to add core functionality for a device type that's barely being manufactured anymore and is mostly used in a virtualized fashion. I think it you could fix this without 10 patches of churn and without adding a new ->open() addition to fops, then people would be a lot more receptive to the idea of improving cdrom auto-close."
The patch-set does have 10 small patches but the files it changes are not that many:
fs/block_dev.c as well as the header files
The Germans have not given up trying give you and your family a mainline Linux kernel capable of automatically closing a CD/DVD/BlueRay drives tray when you click on such a drive in a file manager like Thunar or Dolphin or issue a
mount command in a terminal. They are, sadly, not having much success on their own. The patch-set exists, it compiles and it works - but the Danish gatekeeper in charge the CD/DVD/BlueRay related sub-system is not about to let you or you family have access to this.
It seems clear that it would take an effort of bug-filing at bugzilla.kernel.org to get support for automatic closing of CD/DVD/BD drive trays into the mainline kernel. It is time to voice your opinion if you have an ancient coffee cup holder and you are using it for more than holding coffee cups. The patch-set could easily be added to the upcoming 5.5 kernel. It is unlikely that it will be unless those who are affected by the current lack of kernel functionality remind those in charge that there are some actually end-users who rely on optical media drivers functioning properly.