Bug 1165047 - CD tray closed immediately after ejecting media
CD tray closed immediately after ejecting media
Status: RESOLVED FIXED
: 1165048 (view as bug list)
Classification: openSUSE
Product: openSUSE Distribution
Classification: openSUSE
Component: Basesystem
Leap 15.4
x86-64 Other
: P5 - None : Normal (vote)
: ---
Assigned To: Martin Wilck
E-mail List
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2020-02-26 17:23 UTC by Michael Metz-Heimburg
Modified: 2022-07-21 18:22 UTC (History)
9 users (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Metz-Heimburg 2020-02-26 17:23:09 UTC
Hello,

after updating aaa_base to the version aaa_base-84.87+git20180409.04c9dae-lp151.5.18.1.x86_64.rpm the CD tray closed immediately after ejecting a media. So it is not possible to take the media out of the CD tray, because the time is too short between the opening and closing of the CD tray.
This behavior does not depend from any other programs. It is reproducible every time when a CD, DVD or BD is injected in the CD tray.

With the version aaa_base-84.87+git20180409.04c9dae-lp151.5.15.1.x86_64.rpm all media will be ejected correctly.

System opensuse Leap 15.1
Comment 1 Felix Miata 2020-02-27 00:26:09 UTC
*** Bug 1165048 has been marked as a duplicate of this bug. ***
Comment 2 Michael Metz-Heimburg 2020-03-04 10:38:15 UTC
I tested the new version aaa_base-84.87+git20180409.04c9dae-lp151.5.21.1.x86_64.rpm and this version shows the same behavior. Th CD tray will be closed immediately after ejecting a media.

So I am using still the older version aaa_base-84.87+git20180409.04c9dae-lp151.5.15.1.x86_64.rpm because with this version there are no problems in the behavior of the CD tray.
Comment 3 Ruediger Oertel 2020-03-05 11:07:04 UTC
okay, the only change between the two versions is:
+* Thu Jan 16 2020 ro@suse.de
+- Add patch git-14-12023f2e8aae5b2ac3a895301945566b9f5eb9c3.patch
+  drop dev.cdrom.autoclose = 0 from sysctl config (bsc#1160970)

and in bug#1160970, Hannes said:
>> Which is exceptionally pointless as we have:
>>
>>drivers/cdrom/cdrom.c:static bool autoclose = 0; /* we ship >>/usr/lib/sysctl.d/50
>>-default.conf:dev.cdrom.autoclose = 0 */
>>
>>So we can just drop this line entirely.

Hannes ?
Comment 4 Hannes Reinecke 2020-03-05 15:51:01 UTC
That is curious.
The original bug was about systemd complaining that it could not apply the value.
And to my understanding 'not applying' means 'leave it as default'.
Which seems to contradictionary to this bug, as it clearly is _not_ the case.

Do you see the message:

Couldn't write '0' to 'dev/cdrom/autoclose', ignoring: No such file or directory

in journalctl / dmesg when running the working aaa_base rpm?
Comment 5 Ruediger Oertel 2020-03-05 16:31:53 UTC
actually the "no such file" seems to come from the fact that the "cdrom" module is not autoloaded any more.
if you do a "modprobe cdrom", then you can write the value, at least
on SLE-15-SP1 (4.12.14-197.34-default) and a halfway current TW install (5.4.7-1-default)

cirrus1-opensuse:~ # modprobe cdrom
cirrus1-opensuse:~ # cat /proc/sys/dev/cdrom/autoclose 
0
cirrus1-opensuse:~ # echo 1 > /proc/sys/dev/cdrom/autoclose 
cirrus1-opensuse:~ # cat /proc/sys/dev/cdrom/autoclose 
1
cirrus1-opensuse:~ # echo 0 > /proc/sys/dev/cdrom/autoclose 
cirrus1-opensuse:~ # cat /proc/sys/dev/cdrom/autoclose 
0

now the question is: is the value != 0 on the reporter's machine
and if so .. then why ?
Comment 6 Michael Metz-Heimburg 2020-03-07 12:22:21 UTC
I replaced each changed file of the versions of aaa_base-84.87+git20180409.04c9dae-lp151.5.18.1.x86_64 and aaa_base-84.87+git20180409.04c9dae-lp151.5.21.1.x86_64 separately and tested the behavior of the CD drive. Only the file 50-default.conf had an effect of autoclosing the CD drive. With the versions newer than aaa_base-84.87+git20180409.04c9dae-lp151.5.15.1.x86_64 the CD drive autoclosed immediately after ejecting the media after I replaced the file 50-default.conf.
With the file 50-default.conf of the version aaa_base-84.87+git20180409.04c9dae-lp151.5.15.1.x86_64 the CD tray stays open after ejecting a media and does not autoclose. 

So I guess that autoclosing the CD tray is caused by the deleted line 
"dev.cdrom.autoclose = 0" in the file 50-default.conf.


The values of modprobe cdrom are:

50-default.conf Version aaa_base-84.87+git20180409.04c9dae-lp151.5.15.1.x86_64 without inserted media
Bibliothek:~ # modprobe cdrom
Bibliothek:~ # cat /proc/sys/dev/cdrom/autoclose
0
Bibliothek:~ # echo 1 > /proc/sys/dev/cdrom/autoclose
Bibliothek:~ # cat /proc/sys/dev/cdrom/autoclose
1
Bibliothek:~ # echo 0 > /proc/sys/dev/cdrom/autoclose
Bibliothek:~ # cat /proc/sys/dev/cdrom/autoclose
0

50-default.conf Version aaa_base-84.87+git20180409.04c9dae-lp151.5.15.1.x86_64 with inserted and not mounted media
Bibliothek:~ # modprobe cdrom
Bibliothek:~ # cat /proc/sys/dev/cdrom/autoclose
0
Bibliothek:~ # echo 1 > /proc/sys/dev/cdrom/autoclose
Bibliothek:~ # cat /proc/sys/dev/cdrom/autoclose
1
Bibliothek:~ # echo 0 > /proc/sys/dev/cdrom/autoclose
Bibliothek:~ # cat /proc/sys/dev/cdrom/autoclose
0

50-default.conf Version aaa_base-84.87+git20180409.04c9dae-lp151.5.15.1.x86_64 with inserted and mounted media
Bibliothek:~ # modprobe cdrom
Bibliothek:~ # cat /proc/sys/dev/cdrom/autoclose
0
Bibliothek:~ # echo 1 > /proc/sys/dev/cdrom/autoclose
Bibliothek:~ # cat /proc/sys/dev/cdrom/autoclose
1
Bibliothek:~ # echo 0 > /proc/sys/dev/cdrom/autoclose
Bibliothek:~ # cat /proc/sys/dev/cdrom/autoclose
0


excerpt of messages then ejecting media from cd dive with 50-default.conf of aaa_base-84.87+git20180409.04c9dae-lp151.5.15.1.x86_64:
2020-03-07T09:22:50.622185+01:00 Bibliothek plasmashell[2741]: file:///usr/share/plasma/plasmoids/org.kde.plasma.devicenotifier/contents/ui/FullRepresentation.qml:134: TypeError: Cannot read property 'Icon' of undefined
2020-03-07T09:22:50.622320+01:00 Bibliothek plasmashell[2741]: file:///usr/share/plasma/plasmoids/org.kde.plasma.devicenotifier/contents/ui/FullRepresentation.qml:135: TypeError: Cannot read property 'Description' of undefined
2020-03-07T09:22:50.622402+01:00 Bibliothek plasmashell[2741]: file:///usr/share/plasma/plasmoids/org.kde.plasma.devicenotifier/contents/ui/devicenotifier.qml:249: TypeError: Cannot read property 'Device Types' of undefined
2020-03-07T09:22:50.622483+01:00 Bibliothek plasmashell[2741]: file:///usr/share/plasma/plasmoids/org.kde.plasma.devicenotifier/contents/ui/FullRepresentation.qml:137: TypeError: Cannot read property 'State' of undefined
2020-03-07T09:22:50.622855+01:00 Bibliothek kdeinit5[2699]: QObject::connect: invalid null parameter

The values of modprobe cdrom are:

50-default.conf Version aaa_base-84.87+git20180409.04c9dae-lp151.5.18.1.x86_64 without inserted media

Bibliothek:~ # modprobe cdrom
Bibliothek:~ # cat /proc/sys/dev/cdrom/autoclose
1
Bibliothek:~ # echo 1 > /proc/sys/dev/cdrom/autoclose
Bibliothek:~ # cat /proc/sys/dev/cdrom/autoclose
1
Bibliothek:~ # echo 0 > /proc/sys/dev/cdrom/autoclose
Bibliothek:~ # cat /proc/sys/dev/cdrom/autoclose
0

50-default.conf Version aaa_base-84.87+git20180409.04c9dae-lp151.5.18.1.x86_64 with inserted and not mounted media
Bibliothek:~ # modprobe cdrom
Bibliothek:~ # cat /proc/sys/dev/cdrom/autoclose
0
Bibliothek:~ # echo 1 > /proc/sys/dev/cdrom/autoclose
Bibliothek:~ # cat /proc/sys/dev/cdrom/autoclose
1
Bibliothek:~ # echo 0 > /proc/sys/dev/cdrom/autoclose
Bibliothek:~ # cat /proc/sys/dev/cdrom/autoclose
0

50-default.conf Version aaa_base-84.87+git20180409.04c9dae-lp151.5.18.1.x86_64 with inserted and mounted media
Bibliothek:~ # modprobe cdrom
Bibliothek:~ # cat /proc/sys/dev/cdrom/autoclose
0
Bibliothek:~ # echo 1 > /proc/sys/dev/cdrom/autoclose
Bibliothek:~ # cat /proc/sys/dev/cdrom/autoclose
1
Bibliothek:~ # echo 0 > /proc/sys/dev/cdrom/autoclose
Bibliothek:~ # cat /proc/sys/dev/cdrom/autoclose
0

excerpt of messages then ejecting media from cd dive with 50-default.conf of aaa_base-84.87+git20180409.04c9dae-lp151.5.18.1.x86_64:

2020-03-07T13:06:27.128850+01:00 Bibliothek plasmashell[1866]: file:///usr/share/plasma/plasmoids/org.kde.plasma.devicenotifier/contents/ui/devicenotifier.qml:143: TypeError: Cannot read property 'Removable' of undefined
2020-03-07T13:06:27.376928+01:00 Bibliothek plasmashell[1866]: org.kde.plasmaquick: Applet "Geräteüberwachung" loaded after 0 msec
2020-03-07T13:06:27.377545+01:00 Bibliothek plasmashell[1866]: org.kde.plasmaquick: Increasing score for "Geräteüberwachung" to 25
2020-03-07T13:06:27.383780+01:00 Bibliothek plasmashell[1866]: org.kde.plasmaquick: Applet "Systemabschnitt der Kontrollleiste" loaded after 0 msec
2020-03-07T13:06:27.384287+01:00 Bibliothek plasmashell[1866]: org.kde.plasmaquick: Applet "Systemabschnitt der Kontrollleiste" loaded after 0 msec
2020-03-07T13:06:27.384712+01:00 Bibliothek plasmashell[1866]: org.kde.plasmaquick: Increasing score for "Systemabschnitt der Kontrollleiste" to 45
Comment 7 Michael Zapf 2020-03-09 19:07:28 UTC
I also observe this behavior on Tumbleweed. Doing a echo 0 > /proc/sys/dev/cdrom/autoclose prevents the autoclose.

Interestingly, I had the same problem back in 2011 (I just had a look at my notes, since that behavior indeed rang a bell.)
Comment 8 Ruediger Oertel 2020-03-10 16:36:12 UTC
the interesting part from comment 6 is:

50-default.conf Version aaa_base-84.87+git20180409.04c9dae-lp151.5.18.1.x86_64 without inserted media

Bibliothek:~ # modprobe cdrom
Bibliothek:~ # cat /proc/sys/dev/cdrom/autoclose
1


Hannes, is there some code in the kernel that initializes this differently if the drive is "unpopulated" ?
Comment 9 Michael Metz-Heimburg 2020-03-10 21:24:40 UTC
I tested aaa_base-84.87+git20180409.04c9dae-lp151.5.18.1.x86_64 and aaa_base-84.87+git20180409.04c9dae-lp151.5.21.1.x86_64 with the Kernelversions 5.4.12-1.1, 5.4.14-1.1 and 5.5.7-1.1 of TW with the same results as in comment 6.

Maybe this behavior depends on a change of the kernel in earlier versions on other changes in the basesystem, but I am not sure.
Comment 10 Ruediger Oertel 2020-08-18 10:28:13 UTC
sorry, I can not find any way to reproduce this, autoclose is always initialized to 0 if the module is loaded on a plain system. This could be either a local modprobe configuration (like "options cdrom autoclose=1") or some application overwriting the default but this does not happen on a normal installation.

please reopen if you find a way to reproduce on a clean system.
Comment 11 Michael Zapf 2020-08-18 11:23:20 UTC
I just tried it, 

# cat /proc/sys/dev/cdrom/autoclose
1

and this is the result that I get even when I boot to runlevel 3. 

I searched all files in /etc for the string "autoclose":

# find /etc -type f -exec grep -l "autoclose" {} \;
/etc/sysctl.d/noautoclose.conf

which is my own file containing dev.cdrom.autoclose = 0.

There is an occurrence in /usr/lib/sysimage/rpm/Packages.db with "drop dev.cdrom.autoclose = 0 from sysctl config". I suppose the issue with autoclosing reappeared with this change.

I will install a fresh Tumbleweed on a virtual machine and see what I get.
Comment 12 Michael Zapf 2020-08-19 17:46:51 UTC
I just installed openSUSE Tumbleweed freshly on a Virtualbox host.

See this screenshot: http://www.mizapf.eu/files/autoclose.png

The su/cat was my first action with the fresh installation (just one reboot). So the autoclose is obviously initialized to 1.

Kernel 5.8.0-1-default
Comment 13 Ruediger Oertel 2020-08-19 22:26:13 UTC
sigh ... never trust anything without checking yourself ...

# tar tvf ./openSUSE:Leap:15.1/kernel-source/patches.suse.tar.bz2 | grep autoclose
-rw-r--r-- nobody/nobody   1204 2019-05-10 16:13 patches.suse/cdrom-turn-off-autoclose-by-default.patch
# tar tvf ./openSUSE:Leap:15.2/kernel-source/patches.suse.tar.bz2 | grep autoclose
-rw-r--r-- nobody/nobody   4998 2020-06-09 22:57 patches.suse/cdrom-export-autoclose-logic-as-a-separate-function.patch
-rw-r--r-- nobody/nobody   1200 2020-06-09 22:57 patches.suse/cdrom-turn-off-autoclose-by-default.patch
# tar tvf ./SUSE:SLE-15:GA/kernel-source/patches.suse.tar.bz2 | grep autoclose
-rw-r--r-- nobody/nobody   1204 2018-05-29 23:04 patches.suse/cdrom-turn-off-autoclose-by-default.patch
# tar tvf ./SUSE:SLE-15-SP2:GA/kernel-source/patches.suse.tar.bz2 | grep autoclose
-rw-r--r-- nobody/nobody   4998 2020-06-03 14:16 patches.suse/cdrom-export-autoclose-logic-as-a-separate-function.patch
-rw-r--r-- nobody/nobody   1200 2020-06-03 14:16 patches.suse/cdrom-turn-off-autoclose-by-default.patch
# tar tvf ./openSUSE:Factory/kernel-source/patches.suse.tar.bz2 | grep autoclose
#


so this is patched in all recent SUSE kernels ... BUT NOT IN FACTORY ...

as the original approach via sysctl does not work anyway as the cdrom driver
is not yet loaded when sysctl is executed ...

kernel-team: can we have this in the factory branch as well ?
Comment 14 Miroslav Beneš 2021-12-31 12:39:17 UTC
There is nothing to be done here if I am not mistaken. Leap 15.1 is not supported anymore, Leap 15.2 is about to be unsupported and supported Leap 15.3 shares the kernel with SLE15-SP3 which has the patch (the same applies to Leap 15.4 and SLE15-SP4).

CCing Michal just for the sake of completeness.

Could we close?
Comment 15 Michal Suchanek 2021-12-31 17:57:44 UTC
The autoclose patch that flips the default is not on the master branch.

Since cdrom is modular the sysctl setting is not always effective, even if shipped.

It is not applied in early userspace in the initramfs, either.

To be able to disable autoclose reliably adding the SLE patch to the master is the only way.

On the other hand the observed behavior is due to some broken application polling the drive. Linux has an interface for polling optical drives without triggering the autoclose: opening the drive with O_NONBLOCK.
Comment 16 Takashi Iwai 2022-01-03 16:23:46 UTC
Isn't autoclose a module parameter of cdrom, too?
I guess passing cdrom.autoclose=0 boot option (or creating a config file in /etc/modprobe.d/*) should turn off the default value even without adjustment via sysctl.
Comment 17 Michal Suchanek 2022-01-04 12:12:12 UTC
You should be able to fix with

echo options cdrom autoclose=0 > /etc/modprobe.d/cdrom.conf
dracut -f
Comment 18 Michal Suchanek 2022-01-04 12:18:47 UTC
https://github.com/openSUSE/suse-module-tools/pull/58
Comment 19 Martin Wilck 2022-01-04 13:37:44 UTC
Merged and submitted to Factory (sr#943766) and SLE15-SP4 (sr#261464).
Comment 20 OBSbugzilla Bot 2022-01-04 14:10:03 UTC
This is an autogenerated message for OBS integration:
This bug (1165047) was mentioned in
https://build.opensuse.org/request/show/943766 Factory / suse-module-tools
Comment 25 Lubos Kocman 2022-02-04 12:18:05 UTC
This looks like solved to me, since I've see no further feedback after Takashi's fix.