# Invisible CD drive, possibly a unique problem

## 1eyeJohnson

OK, first the background info:

I recently got a new laptop-- Prostar, Core Duo, "piix" SATA/IDE controller, internal SATA hard drive, some kind of removable CDRW/DVD drive in a bay. I'm currently running Gentoo (for Getting Stuff Done) and Windows XP (for some specific games). My HD is partitioned as follows:

/dev/sda1 NTFS, contains XP

/dev/sda2 /boot EXT3 contains GRUB and the kernel

/dev/sda3 swap

/dev/sda4 / XFS contains everything else

I used the CD drive once, the first day I got it, to install a game. I then used it again to boot a minimal Gentoo livecd. A day or so later I tried to mount a cd and--surprise-- there was simply no CD drive visible to the kernel.

Now this is where it gets disturbing: It's completely invisible to XP as well. I can boot off of the CD drive, and the drive works perfectly. I can boot from a CD into either one of my OSes on the hard drive via grub-on-a-CD and the drive works perfectly. 

I'm at work right now, so I can't exactly quote cut-and-paste dmesg, but basically when I boot from the hard drive there is no mention of a CD drive; when I boot from a CD it shows up as a standard ATAPI CD under /dev/hdd. /proc/sys/cdrom shows 0 in every category when the drive isn't working, but accurately reflects the drive when it is working.

I'm pretty sure that this might be a BIOS issue, but I can't find an updater for it and am unwilling to crack open my warrantied laptop to clear the cmos. Any suggestions?

----------

## NeddySeagoon

1eyeJohnson,

PIIX SATA chipset - that sets the alarm bells ringing.

If lspci shows you have a ICH6 or ICH7 Intel chipset, turn off IDE support in the kernel altogether and add SCSI CD ROM support and SCSI Generic support.

Your CD will become a SCSI Generic device. /dev/sr0 and /dev/sg0 - you can only mount one of them and I forget which.

You will get DMA at no extra charge. You need a recent kernel too. 2.6.16 is ok I'm not sure about earlier kernels.

The problem is that the IDE and SATA interfaces share some controls.

----------

## cyrillic

 *NeddySeagoon wrote:*   

> Your CD will become a SCSI Generic device. /dev/sr0 and /dev/sg0 - you can only mount one of them and I forget which. 

 

You can mount the block device /dev/sr0.

The character device /dev/sg0 is only used for low level stuff like CD burning and flashing the drive's firmware.

----------

## 1eyeJohnson

Hey all, thanks for the replies.

After compiling a bunch of different kernels ranging from no ide support to full ide support and everything in between , I can conclude that nothing really worked when using the bootloader on the hard drive.

However, dmesg | grep -i ata does show one interesting thing:

```
libata version 1.20 loaded.

ata_piix 0000:00:1f.2: version 1.05

ata1: SATA max UDMA/133 cmd 0

x1F0 ctl 0x3F6 bmdma 0x18B0 irq 14

ata1: dev 0 cfg 49:0f00 82:746b 83:7f69 84:4063 85:7469 86:3d49 87:4063 88:203f

ata1: dev 0 ATA-7, max UDMA/100, 195371568 sectors: LBA48

ata1: dev 0 configured for UDMA/100

scsi0 : ata_piix

  Vendor: ATA       Model: HTS721010G9SA00   Rev: MCZO

ata2: SATA max UDMA/133 cmd 0x170 ctl 0x376 bmdma 0x18B8 irq 15

ATA: abnormal status 0x7F on port 0x177

ata2: disabling port

scsi1 : ata_piix

ieee80211: 802.11 data/management/control stack, 1.1.13

```

Obviously, "abnormal status 0x7f" is a bit of an issue. 

In contrast, dmesg | grep -i ata says:

```

libata version 1.20 loaded.

ata_piix 0000:00:1f.2: version 1.05

ata1: SATA max UDMA/133 cmd 0x1F0 ctl 0x3F6 bmdma 0x18B0 irq 14

ata1: dev 0 cfg 49:0f00 82:746b 83:7f69 84:4063 85:7469 86:3d49 87:4063 88:203f

ata1: dev 0 ATA-7, max UDMA/100, 195371568 sectors: LBA48

ata1: dev 0 configured for UDMA/100

scsi0 : ata_piix

  Vendor: ATA       Model: HTS721010G9SA00   Rev: MCZO

ata2: SATA max UDMA/133 cmd 0x170 ctl 0x376 bmdma 0x18B8 irq 15

ata2: dev 1 cfg 49:0b00 82:0000 83:0000 84:0000 85:0000 86:0000 87:0000 88:0407

ata2: dev 1 ATAPI, max UDMA/33

ata2: dev 1 configured for UDMA/33

scsi1 : ata_piix

ieee80211: 802.11 data/management/control stack, 1.1.13

```

and lets me mount /dev/sr0 when I boot the exact same kernel using a grub cd. I tried re-emerging grub and even installing the old version on the CD that I use with no results.

So, in summary, If anybody knows what "abnormal status 0x7f" means, or how using a cd at boot-time might let it work later on, I'd really appreciate it-- I've got a workable workaround, but it's kinda galling to need a disk for full functionality in a new computer.

[/code]

Edit-- I just realized that this same error code was just posted a while ago, and it essentially means that there is nothing connected to the controller. Could it possibly be related to the drive itself or to the BIOS?

----------

## NeddySeagoon

1eyeJohnson,

Its a kernel or kernel install issue not a grub issue. Grub has completed its task when it has loaded the kernel and the optional initrd and passed control to the newly loaded kernel. The kernel is in control of the system now, it starts by decompressing itself..

----------

## DirtyHairy

Possibly, this is a problem of kernel options. Try passing

```
libata.atapi_enabled=1 
```

as kernel parameter (alhough I think this is enabled by default in gentoo-sources).

----------

## 1eyeJohnson

Hey all-- Thanks for the input. It turns out that, actually, booting with LILO allows the drive to work perfectly. Booting with LILO (or NTLDR, if it counts), I can mount the device as /dev/hdd or /dev/sr0 depending on my atapi support. So basically this is an issue with GRUB, and as such doesn't really belong here any more. Sucks, I really like GRUB's framebuffer effects:P I'll play with it after I can type again.

----------

## DirtyHairy

Good you found a solution  :Smile:  But I really think (for the reasons NeddySeagoon already pointed out), that this has absolutely nothing to to with the choice of grub or lilo, but with a configuration option passed along with your lilo configuration and not passed along with your grub configuration. Your dmesg output shows that this is a PATA drive which isn't a real SATA drive, but an ATAPI drive driven over the SATA bus. The SATA driver needs to be told to support this kind of drive explicitely with the kernel option mentioned above (it can also be activated in the libata sources in the kernel tree).

----------

## Eldrin

Many people are experiencing this problem.  It never ceases to amaze me that people are always pointing to something within Linux as the cause of the problem.

The fact is, on these machines which include anything based on the Clevo m570U, the Clevo m575U and several others, this problem exists.

The trigger for the problem is in fact, GRUB.  Whether grub is at fault, I do not know.  Everyone seems to forget when trying to diagnose this problem that the simple act of installing GRUB on the MBR causes the drive to disappear from BOTH WINDOWS AND LINUX.

If you boot with your windows cd, drop to console mode and do a FIXMBR followed by a FIXBOOT, your drive will magically reappear in windows.  No other Linux changes required.  Of course, this is not a fix as you can no longer boot Linux.

I've heard this problem reported so far with Mepis, Suse, Ubuntu, Kubuntu, Mandrake, and Gentoo.

There are a few things that I can tell you about this problem.  

1) If you pass acpi=off to the kernel via GRUB, the drive will show up, but only in PIO mode.  This also causes a kernel panic sometimes after mounting the drive.  The last message is something to the effect of the ata controller responding too slowly.

2) In all cases that I've seen where the problem manifests, the optical drive is set to slave and there is no master on the channel (it is impossible to change this setting on my machine).  

3) If you have a second HDD that you can exchange for the optical drive and you set it to master, everything usually works fine.  However, if you set it to slave as well you end up with the same problems that you had with the optical drive.

4) There are two consecutive lines in the output of dmesg...

    PCI: BIOS BUG #81[49435024] found

    ata2: disabling port

The BIOS bug message may or may not be related as it always appears.  If you pass acpi=off to the kernel the

second line does not appear.  This is when the drive works.

5)  If GRUB is installed on the MBR, the only way to make the drive reappear in windows is to pop out the optical drive, and pop the second HDD (set to master) into the slot.  Windows will find the second HDD on boot.  Use the tray icon to "Safely remove hardware".  After the second HDD spins down, pop it out and pop the optical drive back in.  Go to device manager, find the entry for the HDD that used to be there, right click it and click "Scan for hardware changes".  This will case the drive to appear.  However, it's set to PIO only mode after this procedure and will disappear on reboot.  I can't test it but I suspect that if the optical drive was set to master, this problem would not occur at least in Windows, possibly not in Linux either.

I hope this helps someone figure out what the hell is really going on here.  IMHO, installing LILO, while it may work, is not a solution.  There is a deeper problem somewhere.

----------

## NeddySeagoon

Eldrin,

Can you make a clear bug report at bugs.gentoo.org please. You seem to have a better understanding of it than other people.

----------

## Eldrin

I apologize if my previous post comes across as short and/or snappy.  This is a very irritating problem especially since it's been so well defined by myself and others and yet there seems to be no real solution.

People tend to ignore the facts when faced with this problem.  They try to point figers at libata or the kernel when it's obvious that the problem exists when you take both of those out of the picture.  If you install grub then whack your Linux partition and just let Grub boot windows, the problem still exists.  It's can't possibly be anything but grub.  Again, I don't know if grub is at fault, but it is most certainly the catalyst.

My suspicion is that we're facing an obscure BIOS bug that grub somehow brings to the front.

----------

## Eldrin

Sure Neddy, I'll be glad to.  I never considered doing that as it's not a Gentoo specific problem.  But I'll do anything I can to help get this problem solved.

Thanks!

----------

## NeddySeagoon

Eldrin,

If its not a Gentoo bug it will be passed upstream somewhere, so a gentoo bug report is a good place to start.

----------

## Eldrin

I just want to confirm, that using any bootloader other than GRUB does solve this problem.

It sucks not being able to use GRUB, but we'll have to put up with it for now.  Just install LILO and get it over with  :Very Happy: .

Eldrin

----------

## vmpn

I have to second that it is unlikely to be just Linux issue, because if I boot Windows through grub it is unable to see my DVD. If I boot using windows native MBR, the drive works.

Does anyone know how stable GRUB2 is?

----------

## RJQuackQuack

When I boot into windows with GRUB, the drive is recognized just fine. My problem has been exclusively with linux, where I just can't get the drive recognized at all.

----------

## pratyeka

I have a similar issue.  

I have a single SATA drive plugged in to the secondary port on the motherboard, and a single IDE / ATAPI CDROM.

While booting the minimal 2007.0-r1 install CD, the CDROM fails to be detected.

dmesg output...

ata_piix 0000:00:1f.2: version 2.00ac6

ata_piix 0000:00:1f.2: MAP [ P0 P2 P1 P3 ]

ACPI: PCI Interrupt 0000:00:1f.2[A] -> GSI 19 (level, low) -> IRQ 19

PCI: Setting latency timer of device 0000:00:1f.2 to 64

ata1: SATA max UDMA/133 cmd 0x2438 ctl 0x2456 bmdma 0x2410 irq 19

ata2: SATA max UDMA/133 cmd 0x2430 ctl 0x2452 bmdma 0x2418 irq 19

scsi0 : ata_piix

ATA: abnormal status 0x7F on port 0x243F

scsi1 : ata_piix

ata200: ATA-6, max UDMA/133, 156301488 sectors: LBA48 NCQ (depth 0/32)

ata2.00: ata2:dev 0 multi count 16

ata2.00: configured for UDMA/133

After this only the SATA disk is detected, I can mount it fine, but the minimal install CD cant find the CDROM medium to boot off (limiting me to a broken 'ash' shell).  I have also tried booting from USB after modifying the minimal install CD to run on that, but can't get that to boot either (just says 'boot error').

I think its the kernel driver's fault.  Obviously the hardware is working OK as using BIOS to boot and read from the CD works perfectly.

My BIOS has a few disk-related options (legacy, SATA->AHCI, etc.) .. I have tried all of them, and none effect the boot-time detection of the ATAPI CDROM.

----------

