PDA

View Full Version : CD and DVD drives



Markus
02-28-2005, 09:55 AM
First check which kernel you're running:
markus@mrk-fujibox:~$ uname -r
2.6.9-301004

##### For 2.6.x kernels:

Check the append line for the kernel in /etc/lilo.conf:
image=/boot/vmlinuz-2.6.9-301004
label="Linux-2.6.9"
append="ramdisk_size=100000 lang=us hda=scsi hdb=scsi nomce "
read-only

I have 2 hd's so I need hda and hdb=scsi, delete the ones for your cd/dvd-drives, I deleted hdc=scsi and hdd=scsi.
If you change lilo.conf you need to run lilo -v to update it.

If you use grub you edit the kernel line in /boot/grub/menu.lst instead.

Then check dmesg to see where the drives are attached to:
markus@mrk-fujibox:~$ dmesg |grep CD
hdc: TDK CDRW241040B, ATAPI CD/DVD-ROM drive
hdd: HL-DT-ST DVDRAM GSA-4163B, ATAPI CD/DVD-ROM drive
hdc: ATAPI 40X CD-ROM CD-R/RW drive, 2048kB Cache, UDMA(33)
Uniform CD-ROM driver Revision: 3.20
hdd: ATAPI 40X DVD-ROM DVD-R-RAM CD-R/RW drive, 2048kB Cache, UDMA(33)

They're attached to hdc and hdd.
markus@mrk-fujibox:~$ ll /dev/hd[cd]
brw-rw---- 1 root cdrom 22, 0 Nov 14 2003 /dev/hdc
brw-rw---- 1 root cdrom 22, 64 Nov 14 2003 /dev/hdd

If needed do:
root@mrk-fujibox:/# chmod 660 /dev/hd[cd]
root@mrk-fujibox:/# chgrp cdrom /dev/hd[cd]

Now you need make /dev/cdrom and /dev/dvd point to hdc and hdd:
root@mrk-fujibox:/# rm -rf /dev/cdrom /dev/dvd
root@mrk-fujibox:/# ln -s /dev/hdc /dev/cdrom
root@mrk-fujibox:/# ln -s /dev/hdd /dev/dvd
root@mrk-fujibox:/# chgrp cdrom /dev/cdrom /dev/dvd
markus@mrk-fujibox:~$ ll /dev/cdrom /dev/dvd
lrwxrwxrwx 1 root cdrom 8 Sep 21 23:06 /dev/cdrom -> /dev/hdc
lrwxrwxrwx 1 root cdrom 8 Sep 21 23:07 /dev/dvd -> /dev/hdd


##### For 2.4.x kernels:

Check the append line for the kernel in /etc/lilo.conf:
image=/boot/vmlinuz-2.4.26
label="Linux-2.4.26"
append="ramdisk_size=100000 lang=us hda=scsi hdb=scsi hdc=scsi hdd=scsi nomce "
read-only
The append line in /etc/lilo.conf should include hdc=scsi and hdd=scsi if those are your cd/dvd-drives.
If you change lilo.conf you need to run lilo -v to update it.

Then check dmesg to see where the drives are attached to:
markus@mrk-fujibox:~$ dmesg|grep CD
hdc: TDK CDRW241040B, ATAPI CD/DVD-ROM drive
hdd: LG DVD-ROM DRD-8160B, ATAPI CD/DVD-ROM drive
Vendor: TDK Model: CDRW241040B Rev: 57S2
Type: CD-ROM ANSI SCSI revision: 02
Type: CD-ROM ANSI SCSI revision: 02
Uniform CD-ROM driver Revision: 3.20
Attached scsi CD-ROM sr0 at scsi0, channel 0, id 0, lun 0
Attached scsi CD-ROM sr1 at scsi1, channel 0, id 0, lun 0

They're attached to sr0 and sr1 which point to scd0 and scd1:
markus@mrk-fujibox:~$ ll /dev/sr[01] /dev/scd[01]
brw-rw---- 1 root cdrom 11, 0 Nov 14 2003 /dev/scd0
brw-rw---- 1 root cdrom 11, 1 Nov 14 2003 /dev/scd1
lrwxrwxrwx 1 root cdrom 4 Apr 28 2004 /dev/sr0 -> scd0
lrwxrwxrwx 1 root cdrom 4 Apr 28 2004 /dev/sr1 -> scd1
If needed do:
root@mrk-fujibox:/# chgrp cdrom /dev/scd[01]

You can make /dev/cdrom and /dev/dvd point to scd0 and scd1:
rm -rf /dev/cdrom /dev/dvd
ln -s /dev/scd0 /dev/cdrom
ln -s /dev/scd1 /dev/dvd
chgrp cdrom /dev/cdrom /dev/dvd
markus@mrk-fujibox:/$ ll /dev/cdrom /dev/dvd
lrwxrwxrwx 1 root cdrom 9 Apr 28 19:58 /dev/cdrom -> /dev/scd0
lrwxrwxrwx 1 root cdrom 9 Aug 10 13:39 /dev/dvd -> /dev/scd1


##### For both kernels:

You should have lines like these in /etc/fstab, edit if needed:
/dev/cdrom /cdrom iso9660 defaults,ro,users,noexec,noauto 0 0
/dev/dvd /dvd udf,iso9660 defaults,ro,users,noexec,noauto 0 0

Then check your mountpoints:
markus@mrk-fujibox:~$ ll -d /cdrom /dvd
drwxrwx--- 2 root cdrom 4096 Sep 5 14:35 /cdrom
drwxrwx--- 2 root cdrom 4096 Aug 10 13:23 /dvd
If needed do
root@mrk-fujibox:/# mkdir /cdrom /dvd
root@mrk-fujibox:/# chgrp cdrom /cdrom /dvd
root@mrk-fujibox:/# chmod 770 /cdrom /dvd

And check that your user is in the group cdrom:
markus@mrk-fujibox:/$ groups
markus dialout fax voice cdrom floppy audio dip src video games users usb scanner
If needed do:
root@mrk-fujibox:/# adduser your_username cdrom

If the desktop icons aren't working you can delete them and create new ones or do:
- right-click the icon
- Properties
- Device
- choose /dev/cdrom or /dev/dvd
- click OK

sakiZ
05-13-2005, 08:42 PM
Marcus,

I'm going to have to see which ones might apply to me.

I have a weird problem with my external USB DVD drive.

The drive is always recognized upon bootup, or so it seems. I see the Mad Dog usb-storage message as the drive is found upon bootup and Knoppix always sees the usb entry where the drive is connected to the usb port.

I may use it a dozen times or more, than all of a sudden I will get a message to this effect:

"Wrong Medium. Make sure disk is inserted in drive correctly."

Then I'll have to fiddle with it. Then it works for a while then it eventually happens again. I really can't tell you if it starts working again is because it's something I've done or it just decides to start working again.

Strange huh?

I thought if it's a symlinks problem, wouldn't the drive just plain not work?

But it USUALLY does.

I do a "Modprobe usb-storage" and never get an error message.

and a general DMESG after boot up and don't see anything amiss.

sakiZ

Markus
05-13-2005, 09:33 PM
Do you see anything in dmesg when it stops functioning?
What does "hdparm /dev/something" say?

sakiZ
05-14-2005, 02:20 AM
I did try the hdparm trick -- hdparm -t /dev/scd2

It said it could not read the drive. Arrgh!

That was after I ran the rescan_scsi_bus.sh script, which found the drive just fine!! This echoed what I saw at boot time as well. Go figure.

So, I did what I have done in the past:

I unplugged the usb cable from the USB 2.0 host card and plugged it into the USB 1.0 port that is off the mobo. I rebooted. As usual, Knoppix sees the drive now because when I click on "Play DVD" in Kaffeine it starts. I immediately switch the cable back to the USB 2.0 port and reboot. Knoppix still sees the drive and plays the DVD.

I did run hdparm at this point and got a readout. We will see how long this works. :-)

sakiZ

Markus
05-14-2005, 11:51 AM
I was thinking more along the lines of disabling dma on the drive, but more important would be any errors in dmesg when it stops working.

sakiZ
05-17-2005, 05:57 PM
Marcus,

I think I am getting a handle on what is happening. Twice now the following happens:

The screen goes completely blurry for a second or two. Then returns to normal. Immediately I check the DVD drive and suddenly it doesn't work. I do a dmesg and get these messages:

usb-uhci.c: Host controller halted, trying to restart.
usb-uhci.c: Host controller halted, trying to restart.
usb-uhci.c: Host controller halted, trying to restart.
apm: suspend: Power management disabled
usb-ohci.c: USB continue: usb-00:09.0 from host wakeup
usb-ohci.c: USB continue: usb-00:09.1 from host wakeup
ehci_hcd 00:09.2: resume
hub.c: new USB device 00:04.2-1, assigned address 3
scanner.c: USB scanner device (0x04b8/0x0110) now attached to scanner0
cdrom: pid 2081 must open device O_NONBLOCK!
cdrom: open failed.
cdrom: pid 2081 must open device O_NONBLOCK!
cdrom: open failed.

I was "fortunate" that this happened once while I was actually playing a DVD. Is power management some related to this? I have all power management options disabled in the menus.

sakiZ

Markus
05-17-2005, 08:44 PM
apm might well be the culprit. Have a look at the append line in lilo.conf and if you find apm=power-off or some such, remove it or change it to noapm, run lilo, reboot and check if you still can power down ;)

Most modern bioses use acpi anyway so apm isn't needed. http://www.anandtech.com/guides/viewfaq.html?i=116
If your bios is acpi capable and you compile your own kernel, I'd suggest removing apm support and only leaving support for acpi. Also check the bios options.
Perhaps also try disabling PnP OS from the bios.

sakiZ
05-18-2005, 02:03 AM
Man, how do I get permissions to modify this file?

I mean I'm in Super User File manager, root , and it won't let me do it.

I even tried doing this trick: "Knoppix single" booting to the command line then "startx".

Usually that lets me do anything.

Not now. What's the trick to this one? The modified lilo.conf file is in my Home directory right now. All I have to do is move it.

Is there some special chmod code I need for this file?

Anyway, I made a small change in my bios in the power management section. I changed a setting to "video always on." It had been using a suspend setting, which I had not realized. Perhaps that's it. Maybe I should see if that fixed it before I do anything else.

PNP has always been turned off so that was not it.

The weird thing about this problem is that I can boot the computer for dozens of times and everything will be fine. But if the screen goes kablooey for a second or two then comes back.... I know the usb is gone.

I noticed on the boot CD that there is some sort of interactive relationship between usb and apm according to the messages I see on screen. I have not noticed this while booting from my HD installation.

sakiZ

sakiZ
05-18-2005, 03:04 AM
Sometime back I had done a:

chattr +i /etc/lilo.conf as a security measure.

Hey it worked. Even couldn't get into it. :-)

Anyway, I changed it back to -i and then ran all the steps.

So far so good. I can shut down just fine.

We will see if this fixes the problem. It was probably a good idea in any case.

Thanks for all your help!

sakiZ

Markus
05-19-2005, 08:39 AM
Yeah, I used to set chattr on lilo.conf as well. I don't anymore as I'm not that paranoid with linux nowadays. After all, I'm sitting behind a hardware firewall and iptables and don't keep any listening services on :)
You might also want to check that the apm modules aren't loaded on bootup.
Although I suspect that removing the power off for video in BIOS might have solved this already.

sakiZ
06-02-2005, 02:01 PM
Hi Markus,

I thought I'd touch base with you and tell you that (knock on wood) the DVD problem seems to be resolved.

While I think the noapm addition to the lilo.conf file was necessary, a few weeks later the screen went blurry for a second or two and then lost the usb-DVD drive.

I changed the memory timings in the bios to their most conservative settings. I had read somewhere one should do that to ensure the host USB card works properly. Willing to try anything, I did that and so far...... no more problems.

Nice to know the problem was not really Knoppix, but resided at a deeper level.

sakiZ

Markus
06-02-2005, 09:30 PM
Glad you got it sorted out. One more thing to try would have been removing usb legacy support in bios, but if it works now, don't tweak it ;)

Keithj
06-10-2005, 09:57 PM
Markus - MANY thanks! Cured my CDROM woes at a stroke. Brilliant.

sakiZ
09-24-2005, 02:47 AM
Hi Markus,

Long time since I checked in with you. Over the course of many weeks and months, I've been plumbing the depths of my Knoppix install and found the offending APM driver that I've sent posts to you about.

It's:

/usr/X11R6/lib/modules/drivers/apm_drv.o

Whenever this driver would activate, it would bring down my USB storage so I could not read my external USB DVD drive as you may remember.

Apparently there are different levels to apm, the one above being geared toward working the GUI environment.

To make a long story short, I disabled this driver by renaming it. Now I have no more errant apm problems that bring down my USB DVD drive. No more cheat codes needed for apm. I only use acpi=force now.

The screen still goes blank after sitting a long time and I have no problems on shut down so I wonder how critical that driver is. Apparently not very. And of course, I have no problems with my DVD drive. I can't say to this day I understand the connection.

An unexpected thing happened after I disabled it. My HD performance went up. Buffered disk reads went from 38 to 42+ mbytes. The whole system seems a little snappier.

I hope this helps someone else.

sakiZ

Markus
09-24-2005, 11:04 AM
If you do a "locate apm" you'll find stuff like /etc/apm/event.d/20hdparm and /etc/devfs/conf.d/apm
The first one possibly explains hd performance.
I suppose you don't have power control in kcontrol -> Peripherals -> Display? Finally, some monitors have their own power saving. Can't really be of much help there.
A few more thing to try is "xset s off", see man xset for what it does, and "setterm -blank 0". If one works, add to some x startup script or where you wish. They're really workarounds and not taking care of whatever powers down the display, but OTOH it shouldn't matter as long as it works like you want ;)

sakiZ
10-06-2005, 06:27 PM
Well, first the good news. After tinkering with my module conf file for the 2.6.9 kernel I am able to boot into the 2.6.9 kernel on my Knoppix 3.7 HDD install. Wow. I never thought that would happen. I about fell off my chair.

I wanted to see if my external USB DVD-rw drive could be found. After doing a "lsusb" I discovered Linux does see the USB External DVD-rw drive as an "sda" mass storage device. I was expecting an "scr2" or similar. Hmm.

Although I went ahead and made a mount point for the drive called "DVD-USB-Storage" in fstab, and I can mount and read the drive like this, it's not what I was really looking for as K3b does not see it as a writeable drive. So, it is usable to pull info off the DVDs I have made as backups. But no more than that.

So, for the time being I'll just keep using the 2.4 kernel.

Any thoughts on this?

sakiZ

Markus
10-06-2005, 07:51 PM
That could be just a problem with scsi devices on 2.6.9, note that on 2.6.8 cdrecording itself is quite broken. I'd try a newer kernel as 2.6.9 is old anyway. If you have an older 2.6.7 lying around it should work as well. Nothing wrong with 2.4 series of course.

sakiZ
10-06-2005, 09:48 PM
That could be just a problem with scsi devices on 2.6.9,

Yeah, I was wondering if that was the case.

Well, I won't be putting much energy into it.

The 2.4 kernel is doing everything I want for now.

sakiZ

maxIT
12-24-2005, 02:18 PM
Thanks Markus this post is very useful. Just a question...



If the desktop icons aren't working you can delete them...

I'm unable to make it permanent, after every reboot old icon reappear, how to avoid that :?:

Markus
12-24-2005, 08:34 PM
quick and dirty but works: chmod 0 /usr/bin/mkdesktophdicons

pjo
04-14-2006, 12:18 AM
Hi Markus, thanks for your information on cd and dvd drive.
I am a Linux and Knoppix newbee, trying to read write DVD-RAM media with udf.


Knoppix is 4.0.2 Kernel is 2.6.12 which is installed in hard disk /dev/sdb1.

DVD-RAM drive is ATAPI HL-DT-ST GSA-4163B

dmesg | grep 'DVD' displays:
hda: HL-DT-ST DVDRAM GSA-4163B, ATAPI CD/DVD-ROM drive

I think I followed your method to enable this DVD-RAM drive.

ll /dev/dvd displays:

lrwxrwxrwx 1 root root 8 2006-04-14 07:33 /dev/dvd -> /dev/hda





If needed do
root@mrk-fujibox:/# mkdir /cdrom /dvd
root@mrk-fujibox:/# chgrp cdrom /cdrom /dvd
root@mrk-fujibox:/# chmod 770 /cdrom /dvd

In this part, shall I do
chgrp cdrom /dvd
chmod 770 /dvd
?

fstab is edited as follows:
/proc /proc proc defaults 0 0
/sys /sys sysfs noauto 0 0
/dev/pts /dev/pts devpts mode=0622 0 0
/dev/fd0 /mnt/auto/floppy auto user,noauto,exec,umask=000 0 0
/dev/cdrom /mnt/auto/cdrom auto user,noauto,exec,ro 0 0
# Added by KNOPPIX
/dev/sda5 /mnt/sda5 ntfs noauto,users,exec,ro,umask=000,uid=knoppix,gid=kno ppix,nls=euc-jp 0 0
# Added by KNOPPIX
/dev/sda6 /mnt/sda6 ntfs noauto,users,exec,ro,umask=000,uid=knoppix,gid=kno ppix,nls=euc-jp 0 0
# Added by KNOPPIX
/dev/sda7 /mnt/sda7 vfat noauto,users,exec,umask=000,uid=knoppix,gid=knoppi x,iocharset=euc-jp,codepage=932 0 0
# Added by KNOPPIX
/dev/sdb1 /mnt/sdb1 ntfs noauto,users,exec,ro,umask=000,uid=knoppix,gid=kno ppix,nls=euc-jp 0 0
# Added by KNOPPIX
/dev/sdb5 /mnt/sdb5 auto noauto,users,exec 0 0
# Added by KNOPPIX
/dev/sdb6 /mnt/sdb6 ntfs noauto,users,exec,ro,umask=000,uid=knoppix,gid=kno ppix,nls=euc-jp 0 0
# Added by KNOPPIX
/dev/sdc1 /mnt/sdc1 ntfs noauto,users,exec,ro,umask=000,uid=knoppix,gid=kno ppix,nls=euc-jp 0 0
# Added by KNOPPIX
/dev/sdc5 /mnt/sdc5 ntfs noauto,users,exec,ro,umask=000,uid=knoppix,gid=kno ppix,nls=euc-jp 0 0
# me
/dev/dvd /dvd udf,iso9660,ext3 defaults,rw,users,noexec,noauto 0 0



And I tried to mount DVD,
mount -t udf /dev/hda /mnt/dvd

mount: /devhda is not normal block device

How do I mount the DVD-RAM drive ?

BTW mount displays:
/dev/root on / type ext2 (rw)
/ramdisk on /ramdisk type tmpfs (rw,size=1643952k)
/UNIONFS on /UNIONFS type unionfs (rw,dirs=/ramdisk=rw:/KNOPPIX=ro,delete=whiteout)
/dev/sdb1 on /cdrom type ntfs (ro,uid=1000,gid=1000,fmask=0177,dmask=077,nls=euc-jp,errors=continue,mft_zone_multiplier=1)
/dev/cloop on /KNOPPIX type iso9660 (ro)
/UNIONFS/dev/pts on /UNIONFS/dev/pts type devpts (rw)
/proc/bus/usb on /proc/bus/usb type usbfs (rw,devmode=0666)
automount(pid2876) on /mnt/auto type autofs (rw,fd=4,pgrp=2876,minproto=2,maxproto=4)
/UNIONFS/dev/sda7 on /mnt/common type vfat (rw)

hard disk sdb1 where the Knoppix image is located, is mounted on /cdrom

Thanks in advance.
pjo