CD tray ejecting on hibernate resume


Just looking for some input here (hoping somebody has run across something similar).

Finally got around to updating my desktop to nixos-21.05. All went well (always kudos to the NixOS crew). However, I noticed when I hibernate my system (LUKS, full-disk outside of boot) and resume the CD/disk tray opens and closes before my cryptsetup prompt comes up (stage-1).

Knowing that this occurs at stage-1 drastically reduced my search area (has to be udev/systemd/kernel etc.). But nothing stuck out at me with a quick browse of the nixpkgs tree log. So I went down the full bi-sect route. Around 5000 commits split later I knocked it down to a kernel update (I normally run linuxPackages_latest). So I backed it off to the LTS release, problem still occurred. I despise when these things happens, as this points to a bad fix back-ported.
Little while later picking off the kernel minor number (5.10.47 - good, 5.10.48 - bad) and a shuffle through the release log and I’ve got my bad commit:

scsi: sr: Return appropriate error code when disk is ejected

  • else if (med->media_event_code == 3)

Now my programming background was in networking, so I’m not as well versed with the SCSI driver (I also haven’t committed any kernel work in >10 years). So I’m wondering if i should go about reporting this upstream or go about looking through the disk-access stack and seeing whats picking up the event and acting on it. Thoughts?


what hardware is this?

My desktop is an x86-64-based system (I’d have to check sysfs for the actual CD drive model). CD drive is actually a DVD-RW drive (but SCSI either way, /dev/sr0)

i’m sad that your kernel is not playing ball, but i’m happy you were able to bisect the commit … impressive stuff. A strange problem, you could use this as drinks holder… probably missed due to the dying popularity of cdrom storage devices.

1 Like

Haha, at least I would have a use for it then (no one uses CD/DVD’s these days).

I did file a kernel bug, I’ll see if it goes anywhere. If not, I guess I’ll either just simply disconnect the drive or apply a kernel patch to revert the above commit.


I experienced a similar issue: when booting my desktop computer, the DVD drive would eject. This coincided with updating to Linux 5.10.48. Reverting the scsi patch in a custom kernel fixes the issue however, thank you! Oddly enough, this doesn’t seem to occur with my laptop’s DVD drive (yes, I possess such a thing)


Seems to be resolved for me in 5.10.60. (unpatched)


Confirmed fixed (by a upstream, see previous bug report) in latest kernel 5.13.12 (as well as other lines the patch was backported too).