Weblog entry #3 for summitwulf

Music, maestro - as long as you are root
Posted by summitwulf on Mon 27 Feb 2006 at 01:27
Tags: none.
I installed Totem and GnomeBaker on a Dell box with Debian Sarge. What's weird is that both these programs only see the CDROM drives if I am root. They run if I am a normal user, but I get errors (see below) if I try to play a CD.

The /etc/fstab file seems to be correctly set up for the CDROMs:

/dev/hdc /media/cdrom0 auto ro,user,noauto,exec 0 0
/dev/hdd /media/cdrom1 auto ro,user,noauto,exec 0 0

and the permissions on the files in /media are:

drwxr-xr-x 2 root root 4096 2006-2-25 03:28 cdrom0
drwxr-xr-x 2 root root 4096 2006-2-25 03:28 cdrom1

For example, from Totem as a normal user I get:

Error: Failed to play Audio/Video Disc - Failed to open device /dev/hdd for reading: permission denied

and yet it works fine if I quit and restart it after an su. In GnomeBaker, if I try to say copy a CD, I repeatedly get 'Information - Please insert a disk into the SONY CD-RW CRX216E'. The disk is there already, and once again I don't get this error if I run GnomeBaker as root.

I'm sure this is simple. Can any kind soul enlighten me as to how to fix this? It looks to me like the group permissions on the CDROM drives should have another group added to them so they can be accessed by these programs, but what group should it be, and how do I find out?

SW

 

Comments on this Entry

Posted by Steve (82.41.xx.xx) on Mon 27 Feb 2006 at 05:21
[ Send Message | View Steve's Scratchpad | View Weblogs ]

The error message says 'permission denied' on /dev/hdd so I'd take a look at that.

On my system I have:

skx@itchy:~$ ls -l /dev/hdd
brw-rw---- 1 root disk 22, 64 2005-02-26 06:38 /dev/hdd

So to read + write to it I have to be a member of group disk.

Run, as root:

addgroup youID disk

Where "youID" is the ID of your non-root login. Then logout, login, and try again.

Steve

[ Parent | Reply to this comment ]

Posted by summitwulf (72.130.xx.xx) on Mon 27 Feb 2006 at 09:48
[ Send Message | View Weblogs ]
Well, I added my user account to the group 'disk' and Totem works fine now - I no longer need to be root.

Thanks for your help! =)

SW

[ Parent | Reply to this comment ]

Posted by simonw (84.45.xx.xx) on Mon 27 Feb 2006 at 18:30
[ Send Message | View Weblogs ]
This is fine, except access to group "disk" means you can escalate privileges, or mess up the entire file system with a /dev/ typo, or badly written multimedia application. Did anyone mention viruses that write to boot sectors ? ;)

The CDROM really ought to be in group "cdrom".

Like here;
brw-rw---- 1 root cdrom 22, 0 2006-02-15 15:27 hdc

When the worst you are likely to do by mistake is make extra coasters, or play your DVDs at inopportune moments.

Afraid I have no idea why it isn't listed as a CDROM, or how to change it, it may be MAKEDEV or udev, probably MAKEDEV (less /sbin/MAKEDEV), as udev is newer than the stock Sarge kernels. Afraid when I had to do this for myself, I found a newsgroup article, made the change, and erased my memory.

Dare say if you post kernel version, CD ROM drive type, the lazyweb make spring into action.

[ Parent | Reply to this comment ]

Posted by vaxxla (62.254.xx.xx) on Mon 27 Feb 2006 at 19:01
[ Send Message ]
As 'root' isn't it possible to change the group of the CDROM? Or will that reset on a re-boot?

Sorry if this sounds stupid

V.

[ Parent | Reply to this comment ]

Posted by simonw (84.45.xx.xx) on Mon 27 Feb 2006 at 19:33
[ Send Message | View Weblogs ]
Not stupid at all, once upon a time this would have been all that was needed.

Root can change the permissions, but these days most *n?x boxes either recreate /dev/ entries, or check/correct them on reboot, which is what my reference to MAKEDEV is about. Afraid it has changed so often, I tend to work it out each time.

[ Parent | Reply to this comment ]

Posted by vaxxla (62.254.xx.xx) on Mon 27 Feb 2006 at 19:51
[ Send Message ]
Yeah, I'm quite new to Linux. So AFTER I posted I checked it out with my NTFS partition (Windoze). I can change it so any user can access it, but upon reboot it reverts back to 'root' for user and group.

[ Parent | Reply to this comment ]

Posted by summitwulf (72.130.xx.xx) on Wed 1 Mar 2006 at 06:18
[ Send Message | View Weblogs ]
If having the user belonging to 'disk' is a bad idea, why couldn't they belong to 'cdrom' instead? Wouldn't 'addgroup user cdrom' work? (I haven't had a chance to try it yet).

OK, let's see:

Kernel version:

> uname -a

Linux xxxxxxx 2.6.8-2-386 #1 Tues Aug 16 12:46:35 UTC 2005 i686 GNU/Linux

and Totem reports the drives as:

Sony CD-RW CRX216E

NEC DVD-RW ND-3540A

[ Parent | Reply to this comment ]

Posted by Utumno (60.248.xx.xx) on Thu 2 Mar 2006 at 09:18
[ Send Message | View Utumno's Scratchpad | View Weblogs ]
I have asked precisely this question in Debian-Devel some time ago: Why isn't /dev/hdd owned by 'CDROM' ? :

http://lists.debian.org/debian-devel/2004/11/msg00428.html

And got answers that

- /dev/hd* could be a harddrive as well
- when using udev, this problem disappears as udev figures out which of the /dev/hd* is a CD/DVD rom ( confirmed )
- current d-i runs 'chgrp cdrom /dev/hdX' if you installed from /dev/hdX CD device. ( weird, I could have sworn I installed it from /dev/hdc and upon installation I still had it belong to 'disk' , but maybe I am wrong or used to early an d-i. )

[ Parent | Reply to this comment ]

Posted by summitwulf (128.171.xx.xx) on Fri 3 Mar 2006 at 00:27
[ Send Message | View Weblogs ]
I'm afraid I have no idea what 'udev' is?

[ Parent | Reply to this comment ]

Posted by Utumno (60.248.xx.xx) on Fri 3 Mar 2006 at 04:09
[ Send Message | View Utumno's Scratchpad | View Weblogs ]
Udev is basically a userspace daemon that monitors your hardware and modifies entries in /dev/ dynamically; in this case, - on boot - it is going to detect that the gizmo which is a master of IDE 1 cable is a CDROM, and therefore it will create an entry /dev/hdc owned by 'root' groupowned by 'cdrom' . In Sarge, every user is a member of the 'cdrom' group by default, so problem would be solved.
The installer, as I was told in Debian-Devel, currently has no means to detect which one of IDE and SCSI block devices is a harddrive, which a CD/DVD ROM, and which yet something else like a tape, so it simply defaults to treating all those devices as harddrives and groupowns them to 'disk'.

http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html

for an more in-depth explanation.

[ Parent | Reply to this comment ]

Posted by summitwulf (72.130.xx.xx) on Fri 3 Mar 2006 at 06:23
[ Send Message | View Weblogs ]
Thank you for the explanation, that is very clear. I had never heard of udev before.

So it seems that being a member of group 'cdrom' is not enough for Totem or Gnomebaker (if as you say all users are automatically members of 'cdrom' by default), presumably because the actual devices in /dev/hd... don't below to cdrom themselves (they belong to 'disk').

This begs the question: what to do? If making your users members of group 'disk' is a bad idea? Somehow you have to associate the /dev/hd... devices with the cdrom group on a permanent basis....?

[ Parent | Reply to this comment ]

Posted by Utumno (211.75.xx.xx) on Fri 3 Mar 2006 at 19:25
[ Send Message | View Utumno's Scratchpad | View Weblogs ]
apt-get install udev --> problem solved.

Or, if you are hesitant to make such a change, just add another boot-up script 'my_script' in /etc/init.d:

#!/bin/sh

case "$1" in
start)
chgrp cdrom /dev/hdc
;;
stop)
;;
esac

'chmod a+x' it and 'update-rc.d my_script defaults'.

[ Parent | Reply to this comment ]

Posted by Utumno (211.75.xx.xx) on Fri 3 Mar 2006 at 19:38
[ Send Message | View Utumno's Scratchpad | View Weblogs ]
apt-get install udev --> problem solved.

Or, if you are hesitant to make such a change, just add another boot-up script 'my_script' in /etc/init.d:

#!/bin/sh

case "$1" in
start)
chgrp cdrom /dev/hdc
;;
stop)
;;
esac

'chmod a+x' it and 'update-rc.d my_script defaults'.

[ Parent | Reply to this comment ]

Posted by simonw (84.45.xx.xx) on Fri 3 Mar 2006 at 20:51
[ Send Message | View Weblogs ]
udev require 2.6.12 or better kernel - not a problem in Testing/Unstable, but a non-starter in Sarge.

[ Parent | Reply to this comment ]

Posted by summitwulf (128.171.xx.xx) on Sat 4 Mar 2006 at 02:52
[ Send Message | View Weblogs ]
Uhh... well, Synaptic installed it OK, so it must be in the Sarge repository??

[ Parent | Reply to this comment ]

Posted by simonw (84.45.xx.xx) on Sat 4 Mar 2006 at 10:18
[ Send Message | View Weblogs ]
Hmm the version in Sarge just says a "2.6" kernel, the version in testing "2.6.12" or newer. However neither has a dependency on kernel revision, so I guess you won't know till you reboot.

[ Parent | Reply to this comment ]

Posted by Anonymous (24.218.xx.xx) on Tue 18 Jul 2006 at 06:10
What are your permissions on /dev/hdc and /dec/hdd? You should make sure you are either the owner, or in the group that has permission to those devices.

[ Parent | Reply to this comment ]

User Login

Username:

Password:

[ Advanced Login ]

Register Account

Quick Site Search