Score:5

CD tray opens and closes occasionally. Sometimes at halfway

it flag

Ubuntu 20.04 LTS

The CD tray of my Desktop PC opens and closes by itself occasionally. Sometimes it moves back at halfway. How can I fix this problem?

From its movement I believe it is due to some software problem.

It works really well when I insert CD. Can I turn it off without any problem by using any method? Can DISKS app help with this problem?

Since it is not a good solution I don't like to keep a CD inside always.

Score:7
tr flag
sudo apt install setcd
sudo setcd -s /dev/sr0

It should output something like this:

/dev/sr0:
  Auto close tray:     cleared
  Auto open tray:      cleared
  Use O_NONBLOCK flag: set
  Lock tray:           set
  Check CD type:       cleared

If "Auto open tray" says "set" instead, running sudo setcd -o0 /dev/sr0 should fix your problem until the next reboot

For permanent fix, create a service file to run the command at boot time

Create a file in /etc/systemd/system with a descriptive name and a .service suffix. For example, let's call it /etc/systemd/system/dvd-stop-open.service. The contents of the file should be:

[Unit]
Description=Disable DVD auto-open
Documentation=man:setcd(1)

[Service]
Type=oneshot
ExecStart=/usr/bin/setcd -o0 /dev/sr0
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

Once the service file is created, enable the service:

sudo systemctl enable dvd-stop-open.service

Test by starting the service and verifying that the Active: field in service status says active (exited):

sudo systemctl start dvd-stop-open.service
systemctl status dvd-stop-open.service
ru flag
Comments are not for extended discussion; this conversation has been [moved to chat](https://chat.stackexchange.com/rooms/126431/discussion-on-answer-by-edmund-cd-tray-opens-and-closes-occasionally-sometimes).
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.