Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
sr0 device permissions change on closing the tray
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
Lord_Raptor
n00b
n00b


Joined: 22 Aug 2011
Posts: 12

PostPosted: Tue Jan 10, 2012 12:19 pm    Post subject: sr0 device permissions change on closing the tray Reply with quote

Hello,
I got an odd problem:
After successfully starting the system, the permission for dev/sr0 are set correctly as defined in udev
Code:
brw-rw-rw- root cdrom
But when I open and then close the tray, the permissions are changed to
Code:
brw-rw---- root disk
This means my users cannot access their dvd/cd writers without logging in as root and changing the permissions.

There is no mention of this permission change in dmesg or any other log that I could find on the system. The system is running on kernel version linux-2.6.38.7

Anyone got any idea where to start searching for a solution

P.S. This problem only appears for sr[0-9] devices, everything attached by IDE works fine
Back to top
View user's profile Send private message
VoidMage
Watchman
Watchman


Joined: 14 Oct 2006
Posts: 6196

PostPosted: Tue Jan 10, 2012 2:03 pm    Post subject: Reply with quote

:roll: You should have only sr[0-9] devices.
Back to top
View user's profile Send private message
Logicien
Veteran
Veteran


Joined: 16 Sep 2005
Posts: 1555
Location: Montréal

PostPosted: Tue Jan 10, 2012 2:43 pm    Post subject: Reply with quote

I do not think the group change because you open/close the tray. It change because it pass from no media to a media in cdrom. Try to boot with a cd in the cdrom, and check the permissions. It have to do with /etc/udev/rules.d/70-persistent-cd.rules . Editing the rules in that file can force the group. I do not know how for the moment.

If the disk group is only for cdrom, I don't think, it is use to for PATA/SATA disks, you can put your users in the disk group as a workaround. A better workaround is to put the mount option users in the line of the cdrom in /etc/fstab. Then all users will be able to mount and unmount the media in cdrom regardless the group of cdrom in /dev.

Me, /dev/sr0 stay in the cdrom group with no or cdrom in. /dev/{cdrom,dvd,scd0} are symbolics links to it. cdrom and sr_mod modules drive the cdrom.
Back to top
View user's profile Send private message
Lord_Raptor
n00b
n00b


Joined: 22 Aug 2011
Posts: 12

PostPosted: Tue Jan 10, 2012 3:43 pm    Post subject: Reply with quote

Hm, maybe I should have explained a little more:
I have no control over which devices are there nor can I start the system from a CD because it is a terminal system that boots over ethernet from another server. And the problem exists on all computers that have a SATA CD/DVD-RW drive

The permission change happens from closing the tray, because it is irrelevant if a CD is in the tray or not and it happens to fast for the drive even to check for a disk.

/etc/udev/rules.d/70-persistent-cd.rules does not exist in this system (maybe that is the problem? all other devices work fine)

I think it may have something to do with KDE automount, but I´m not sure how to confirm that

greetings
Raptor
Back to top
View user's profile Send private message
Lord_Raptor
n00b
n00b


Joined: 22 Aug 2011
Posts: 12

PostPosted: Wed Jan 11, 2012 11:24 am    Post subject: Reply with quote

I made a debug log of udev, maybe that will help:

http://unreal.lu/udev.log

It begins exactly after I close the drive tray.

Here a snippet from the 50-udev.rules
Code:

/etc/udev/rules.d/50-udev.rules
32: # all block devices
33: SUBSYSTEM=="block", GROUP="disk"
34:
35: # cdrom symlinks and other good cdrom naming
36: KERNEL=="sr[0-9]*|hd[a-z]|pcd[0-9]*", ACTION=="add", IMPORT{program}="cdrom_id --export $tempnode"
37: ENV{ID_CDROM}=="?*", GROUP="cdrom", MODE="0666"


It seems that the rule at line 36-37 is not executed, only the one at 33.
Back to top
View user's profile Send private message
VoidMage
Watchman
Watchman


Joined: 14 Oct 2006
Posts: 6196

PostPosted: Wed Jan 11, 2012 10:21 pm    Post subject: Reply with quote

A question somebody should have already asked: 'lspci -k' ?
Back to top
View user's profile Send private message
Lord_Raptor
n00b
n00b


Joined: 22 Aug 2011
Posts: 12

PostPosted: Fri Jan 13, 2012 8:02 am    Post subject: Reply with quote

Quote:
00:00.0 Host bridge: Intel Corporation 82G33/G31/P35/P31 Express DRAM Controller (rev 02)
Subsystem: Giga-byte Technology Device 5000
00:01.0 PCI bridge: Intel Corporation 82G33/G31/P35/P31 Express PCI Express Root Port (rev 02)
Kernel driver in use: pcieport
00:1a.0 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #4 (rev 02)
Subsystem: Giga-byte Technology Device 5004
Kernel driver in use: uhci_hcd
Kernel modules: uhci-hcd
00:1a.1 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #5 (rev 02)
Subsystem: Giga-byte Technology Device 5004
Kernel driver in use: uhci_hcd
Kernel modules: uhci-hcd
00:1a.2 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #6 (rev 02)
Subsystem: Giga-byte Technology Device 5004
Kernel driver in use: uhci_hcd
Kernel modules: uhci-hcd
00:1a.7 USB Controller: Intel Corporation 82801I (ICH9 Family) USB2 EHCI Controller #2 (rev 02)
Subsystem: Giga-byte Technology Device 5006
Kernel driver in use: ehci_hcd
00:1b.0 Audio device: Intel Corporation 82801I (ICH9 Family) HD Audio Controller (rev 02)
Subsystem: Giga-byte Technology Device a002
Kernel driver in use: HDA Intel
Kernel modules: snd-hda-intel
00:1c.0 PCI bridge: Intel Corporation 82801I (ICH9 Family) PCI Express Port 1 (rev 02)
Kernel driver in use: pcieport
00:1c.3 PCI bridge: Intel Corporation 82801I (ICH9 Family) PCI Express Port 4 (rev 02)
Kernel driver in use: pcieport
00:1c.4 PCI bridge: Intel Corporation 82801I (ICH9 Family) PCI Express Port 5 (rev 02)
Kernel driver in use: pcieport
00:1d.0 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #1 (rev 02)
Subsystem: Giga-byte Technology Device 5004
Kernel driver in use: uhci_hcd
Kernel modules: uhci-hcd
00:1d.1 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #2 (rev 02)
Subsystem: Giga-byte Technology Device 5004
Kernel driver in use: uhci_hcd
Kernel modules: uhci-hcd
00:1d.2 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #3 (rev 02)
Subsystem: Giga-byte Technology Device 5004
Kernel driver in use: uhci_hcd
Kernel modules: uhci-hcd
00:1d.7 USB Controller: Intel Corporation 82801I (ICH9 Family) USB2 EHCI Controller #1 (rev 02)
Subsystem: Giga-byte Technology Device 5006
Kernel driver in use: ehci_hcd
00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev 92)
00:1f.0 ISA bridge: Intel Corporation 82801IB (ICH9) LPC Interface Controller (rev 02)
Subsystem: Giga-byte Technology Device 5001
00:1f.2 SATA controller: Intel Corporation 82801IB (ICH9) 4 port SATA AHCI Controller (rev 02)
Subsystem: Giga-byte Technology Device b005
Kernel driver in use: ahci
00:1f.3 SMBus: Intel Corporation 82801I (ICH9 Family) SMBus Controller (rev 02)
Subsystem: Giga-byte Technology Device 5001
Kernel driver in use: i801_smbus
Kernel modules: i2c-i801
01:00.0 VGA compatible controller: nVidia Corporation G92 [GeForce 8800 GT] (rev a2)
Kernel driver in use: nvidia
Kernel modules: nvidia
03:00.0 SATA controller: JMicron Technology Corp. JMB362/JMB363 Serial ATA Controller (rev 02)
Subsystem: Giga-byte Technology GA-EP45-DS5 Motherboard
Kernel driver in use: ahci
03:00.1 IDE interface: JMicron Technology Corp. JMB362/JMB363 Serial ATA Controller (rev 02)
Subsystem: Giga-byte Technology GA-EP45-DS5 Motherboard
Kernel driver in use: JMicron IDE
04:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 01)
Subsystem: Giga-byte Technology GA-EP45-DS5 Motherboard
Kernel driver in use: r8169


I managed to do a dirty fix, I wrote a seperate udev rule for the sr devices
Code:
KERNEL=="sr[0-9]*", GROUP="cdrom", MODE="0666"


But I dont know if this is a good idea?
Back to top
View user's profile Send private message
VoidMage
Watchman
Watchman


Joined: 14 Oct 2006
Posts: 6196

PostPosted: Fri Jan 13, 2012 2:15 pm    Post subject: Reply with quote

Is "JMicron IDE" CONFIG_PATA_JMICRON or CONFIG_BLK_DEV_JMICRON ?
Back to top
View user's profile Send private message
wcg
Guru
Guru


Joined: 06 Jan 2009
Posts: 588

PostPosted: Sat Jan 14, 2012 3:52 pm    Post subject: Reply with quote

I do not think logician meant boot with a bootable cd necessarily,
he meant boot with any cd in the drive (like some non-bootable
iso9660 data cd). The point is to see what the permissions are on
/dev/sr0 without opening/closing the tray but with mountable media
already in the drive.

If you use an iso9660 data cd, you can try manually mounting
it after booting with the mount command and see if the permissions
change on mount.

(What happens when you open/close a dvd/cd-rom drive? A uevent.
What monitors uevents? udev, X input driver, I do not know what all
else. So there is a good chance that this relates to some default
behavoir of udev in the absence of an applicable rule. But is the actual
result dependent on recognition of the device event or recognition
of the inserted media? That seems to be the sense of logician's question.)
_________________
TIA
Back to top
View user's profile Send private message
Lord_Raptor
n00b
n00b


Joined: 22 Aug 2011
Posts: 12

PostPosted: Tue Jan 17, 2012 9:26 am    Post subject: Reply with quote

The drive starts with the correct permissions "brwrwrw root cdrom". I saw in the udev log, that the rule concerning the cdrom drive is not executed again after the system is running, I dont know why. This means the last rule that is executed regarding this device is the standart block device rule, which explains the permissions. The question is, why is the other rule not executed and why on the other hand is the additional rule I inserted executed.

@VoidMage: I dont know what you mean, how to I check that? Are those kernel settings?
Back to top
View user's profile Send private message
VoidMage
Watchman
Watchman


Joined: 14 Oct 2006
Posts: 6196

PostPosted: Tue Jan 17, 2012 10:40 am    Post subject: Reply with quote

Yes, those two are kernel settings.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum