Linux Mint Desktop: CD/DVD drive tray closes immediately after opening

Written by - 2 comments

Published on - Listed in Hardware Linux


These days using CDs or DVDs has become rare. Very rare. But it eventually happened recently: I needed to read data from an optical disk!

So when I pushed the physical "eject button" on the drive, it opened - but then closed immediately again. Not even giving me enough time to place a CD or DVD into the tray. I filmed this and created an animated gif (how? read Create an animated gif from a video source using ffmpeg, imagemagick and gifsicle to see how to do this) to show this weird behaviour:

Linux Desktop: CD/DVD drive tray opens but then closes immediately again

Although my research led me into reading bug reports on udev, it turned out to be something else: Linux's system controls (sysctl) or Kernel parameters. There are a couple of Kernel parameters related to cdrom:

ck@mintp ~ $ sudo sysctl -a|grep cdrom
dev.cdrom.autoclose = 1
dev.cdrom.autoeject = 0
dev.cdrom.check_media = 0
dev.cdrom.debug = 0
dev.cdrom.info = CD-ROM information, Id: cdrom.c 3.20 2003/12/17
dev.cdrom.info =
dev.cdrom.info = drive name:        sr0
dev.cdrom.info = drive speed:        48
dev.cdrom.info = drive # of slots:    1
dev.cdrom.info = Can close tray:        1
dev.cdrom.info = Can open tray:        1
dev.cdrom.info = Can lock tray:        1
dev.cdrom.info = Can change speed:    1
dev.cdrom.info = Can select disk:    0
dev.cdrom.info = Can read multisession:    1
dev.cdrom.info = Can read MCN:        1
dev.cdrom.info = Reports media changed:    1
dev.cdrom.info = Can play audio:        1
dev.cdrom.info = Can write CD-R:        1
dev.cdrom.info = Can write CD-RW:    1
dev.cdrom.info = Can read DVD:        1
dev.cdrom.info = Can write DVD-R:    1
dev.cdrom.info = Can write DVD-RAM:    0
dev.cdrom.info = Can read MRW:        0
dev.cdrom.info = Can write MRW:        0
dev.cdrom.info = Can write RAM:        1
dev.cdrom.info =
dev.cdrom.info =
dev.cdrom.lock = 0

The relevant parameter: dev.cdrom.autoclose. This is set to 1 (on) by default. At least on my Linux Mint 19.3 (based on Ubuntu 16.04).

After changing the value to 0 (off)...

ck@mintp ~ $ sudo sysctl -w dev.cdrom.autoclose=0

... the DVD tray finally staid open!

To make this Kernel setting survive a reboot, this can be added into /etc/sysctl.d (as root):

ck@mintp ~ $ sudo -i
mintp ~ # echo "dev.cdrom.autoclose=0" > /etc/sysctl.d/99-cdrom.conf


Add a comment

Show form to leave a comment

Comments (newest first)

Thankful from wrote on Dec 26th, 2023:

Brilliant!


PCFreak from Bavaria/Germany wrote on Sep 22nd, 2020:

same on Ubuntu 20.04

dev.cdrom.autoclose = 1

Nice finding! - Thank you.


RSS feed

Blog Tags:

  AWS   Android   Ansible   Apache   Apple   Atlassian   BSD   Backup   Bash   Bluecoat   CMS   Chef   Cloud   Coding   Consul   Containers   CouchDB   DB   DNS   Database   Databases   Docker   ELK   Elasticsearch   Filebeat   FreeBSD   Galera   Git   GlusterFS   Grafana   Graphics   HAProxy   HTML   Hacks   Hardware   Icinga   Icingaweb   Icingaweb2   Influx   Internet   Java   KVM   Kibana   Kodi   Kubernetes   LVM   LXC   Linux   Logstash   Mac   Macintosh   Mail   MariaDB   Minio   MongoDB   Monitoring   Multimedia   MySQL   NFS   Nagios   Network   Nginx   OSSEC   OTRS   Office   PGSQL   PHP   Perl   Personal   PostgreSQL   Postgres   PowerDNS   Proxmox   Proxy   Python   Rancher   Rant   Redis   Roundcube   SSL   Samba   Seafile   Security   Shell   SmartOS   Solaris   Surveillance   Systemd   TLS   Tomcat   Ubuntu   Unix   VMWare   VMware   Varnish   Virtualization   Windows   Wireless   Wordpress   Wyse   ZFS   Zoneminder   


Update cookies preferences