LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
 
Search this Thread
Old 05-14-2013, 01:42 AM   #1
yars
Member
 
Registered: Apr 2012
Location: Russia
Distribution: Slackware
Posts: 147

Rep: Reputation: 14
My CD/DVD drives is locked when disc inserted


Hi to all!
I have a problem with locking my CD/DVD drives.
Code:
# sdparm --get LOCK /dev/sr{0,1}
    /dev/sr0: TOSHIBA   CD/DVDW SDR5372V  TU11  [cd/dvd]
LOCK        1  [cha: n, def:  1]
    /dev/sr1: LG        CD-ROM CRD-8522B  1.02  [cd/dvd]
LOCK        1  [cha: n, def:  1]
# cat /etc/sysctl.conf 
dev.cdrom.lock=0
dev.cdrom.autoclose=0
# sysctl -q dev.cdrom.lock
dev.cdrom.lock = 0
My question is why the sysctl parameters isn't applied? Thanks.

UPD: When I try to change it with sdparm, I get:
Code:
# sdparm --clear=LOCK /dev/sr{0,1}
    /dev/sr0: TOSHIBA   CD/DVDW SDR5372V  TU11  [cd/dvd]
change_mode_page: page offset failed: given response length too small, offset=8 given_len=8 bd_len=0

    /dev/sr1: LG        CD-ROM CRD-8522B  1.02  [cd/dvd]
change_mode_page: failed setting page: CD/DVD (MM) capabilities and mechanical status (MMC)
UPD2: I cannot eject disks from drives by button on drive...

Last edited by yars; 05-14-2013 at 03:27 PM. Reason: update
 
Old 05-14-2013, 06:41 PM   #2
rkelsen
Senior Member
 
Registered: Sep 2004
Distribution: slackware
Posts: 1,809

Rep: Reputation: 235Reputation: 235Reputation: 235
Is udev running?
 
Old 05-14-2013, 06:44 PM   #3
gdizzle
Member
 
Registered: Jul 2012
Posts: 213

Rep: Reputation: Disabled
After you placed the entried in:

Code:
/etc/sysctl.conf
Did you do a try a:

Code:
sysctl -p
To reload the entries in /etc/sysctl.conf?

I understand you cannot eject disks by button, however does it eject when you use the command:

Code:
eject
 
Old 05-14-2013, 11:56 PM   #4
yars
Member
 
Registered: Apr 2012
Location: Russia
Distribution: Slackware
Posts: 147

Original Poster
Rep: Reputation: 14
Quote:
Originally Posted by rkelsen View Post
Is udev running?
Yes, and it works fine. I'm can't find out the udev rule that enable, disable or override the sysctl settings.
Quote:
To reload the entries in /etc/sysctl.conf?
Yes, entries in sysctl.conf is applied, but does not work. For experience, I try:
Code:
# cat -A /etc/sysctl.conf
dev.cdrom.lock=0$
$
# sysctl -p
dev.cdrom.lock = 0
#  cat /proc/sys/dev/cdrom/lock 
0
Quote:
however does it eject when you use the command
Yes, I know and so far doing so...

Last edited by yars; 05-15-2013 at 12:24 AM.
 
Old 05-15-2013, 03:46 AM   #5
torimus
Member
 
Registered: Apr 2013
Distribution: Slackware
Posts: 81

Rep: Reputation: Disabled
Probably a stupid question, but does not some app automount drive after a disc is inserted ?
Can you see anything related in an output of mount command ?
 
Old 05-16-2013, 08:42 AM   #6
GazL
Senior Member
 
Registered: May 2008
Posts: 3,584

Rep: Reputation: 1075Reputation: 1075Reputation: 1075Reputation: 1075Reputation: 1075Reputation: 1075Reputation: 1075Reputation: 1075
It's udev: lib/udev/rules.d/60-cdrom_id.rules

Code:
# media eject button pressed
ENV{DISK_EJECT_REQUEST}=="?*", RUN+="cdrom_id --eject-media $devnode", GOTO="cdrom_end"

# import device and media properties and lock tray to
# enable the receiving of media eject button events
IMPORT{program}="cdrom_id --lock-media $devnode"
I comment both of those out on my systems, but doing so mgiht stop the removable-volume management features of the desktop environment from working with cdroms: I use an autofs mapping for removable media, so this side-effect doesn't bother me.
 
1 members found this post helpful.
Old 05-16-2013, 10:14 AM   #7
yars
Member
 
Registered: Apr 2012
Location: Russia
Distribution: Slackware
Posts: 147

Original Poster
Rep: Reputation: 14
GazL, thanks you, I need to continue to be careful. I was looking through this rule, but did not notice anything similar to the one shown you. Also thanks to all for answers. The problem is solved:
Code:
# cp /lib/udev/rules.d/60-cdrom_id.rules /etc/udev/rules.d/60-cdrom_id.rules
# sed 's/IMPORT/#
IMPORT/' /etc/udev/
rules.d/60-cdrom_id.rules
#kill -HUP $(pidof `which udevd`)

Last edited by yars; 05-16-2013 at 10:20 AM.
 
Old 05-16-2013, 10:17 AM   #8
GazL
Senior Member
 
Registered: May 2008
Posts: 3,584

Rep: Reputation: 1075Reputation: 1075Reputation: 1075Reputation: 1075Reputation: 1075Reputation: 1075Reputation: 1075Reputation: 1075
Quote:
Originally Posted by yars View Post
I was looking through this rule, but did not notice anything similar to the one shown you
Ah, yes. I often forget that I'm running 'current'. Sorry about that.
 
Old 12-19-2013, 10:39 AM   #9
yars
Member
 
Registered: Apr 2012
Location: Russia
Distribution: Slackware
Posts: 147

Original Poster
Rep: Reputation: 14
Hi all again. I decided to go back to this problem again. Removing in the /etc/udev/rules.d/60-cdrom_id.rules from line
Code:
IMPORT{program}="cdrom_id --lock-media $devnode"
the "--lock-media" parameter makes able to eject the media when it is mounted, so it is not a good solution. I tried to number experiences with udev, but cannot get the DISK_EJECT_REQUEST event. I have enabled the in-kernel-polling by placing into a /etc/udev/rules.d/60-persistent-storage.rules line
Code:
  # enable in-kernel media-presence polling
  ACTION=="add", SUBSYSTEM=="module", KERNEL=="block", ATTR{parameters/events_dfl_poll_msecs}=="0", ATTR{parameters/events_dfl_poll_msecs}="2000"
+ ACTION=="add", ATTR{removable}=="1", ATTR{events_poll_msecs}=="-1", ATTR{events_poll_msecs}="2000"
that is disabled by default. And that is works same as when in-kernel-polling is disabled: when disc is inserted, but not mounted, I can eject a disc by pressing the button on a drive, when disc is mounted, drive is locked, and events from that button is not received. /sys/block/sr0/events contains:
Code:
cat /sys/block/sr0/events
media_change eject_request
Why this contain a two records? Any ideas? Thanks again.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] CD/DVD/BD/M-Disc drives not writing dchmelik Slackware 28 11-16-2013 01:52 AM
DVD Drive runs constantly when Blank DVD inserted starwarp2000 Solaris / OpenSolaris 3 07-17-2008 03:21 AM
ext3 partitions deleted when win xp disc inserted Sweetness Linux - Hardware 1 04-30-2005 07:53 PM
k3b hangs when trying to burn dvd+rw disc but not cd rw disc laiboonh Slackware 0 11-06-2004 11:22 AM
K3b problems when recording DVD's: no disc inserted bmpv666 Linux - Software 13 09-22-2004 05:59 PM


All times are GMT -5. The time now is 11:50 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration