cdrom_id: misdetects no media as audio CD

Bug #559723 reported by Evan Anderson
64
This bug affects 13 people
Affects Status Importance Assigned to Milestone
udev (Ubuntu)
Fix Released
High
Martin Pitt
Lucid
Fix Released
High
Martin Pitt

Bug Description

Binary package hint: nautilus

Sometime, in lucid, nautilus shows that n audio cd is inserted in a drive when there is nothing in the drive. There is no option to unmount the drive, and if you eject it , it doesn't go away.

Package:
nautilus

Version:
nautilus:
  Installed: 1:2.30.0-0ubuntu4
  Candidate: 1:2.30.0-0ubuntu4
  Version table:
 *** 1:2.30.0-0ubuntu4 0
        500 http://us.archive.ubuntu.com/ubuntu/ lucid/main Packages
        100 /var/lib/dpkg/status

Ubuntu version:
Description: Ubuntu lucid (development branch)
Release: 10.04

Expected:
The drive would show as empty

Actual:
Nautilus shows there is a cd in the drive.

Evan Anderson (evana)
description: updated
Changed in nautilus (Ubuntu):
status: New → Confirmed
Revision history for this message
Sebastien Bacher (seb128) wrote :

Thank you for your bug report, could you get gvfs-mount -li and udisks --dump logs when getting the issue?

Changed in nautilus (Ubuntu):
importance: Undecided → Low
Revision history for this message
Conscious User (conscioususer) wrote :

I'm having the same bug while testing Lucid in VirtualBox. Interesting enough, when I insert a real CD the phantom audio CD is replaced by it. Then when I eject the real CD, the phantom audio CD immediately comes back.

I'm attaching the requested information when the phantom CD is present.

Revision history for this message
Conscious User (conscioususer) wrote :
Revision history for this message
Conscious User (conscioususer) wrote :

Ops, sorry, disregard my last comment. The phantom CD is not replaced when I insert a real one. They exist side by side. I just didn't see it before.

Revision history for this message
frenchy82 (cartes) wrote :

I have the same problem with a real install.
I'm not sure that it's a nautilus issue because i have the same problem with thunar 1.1 and pcmanfm2.

Both show me an audio cd when there is no cd

Revision history for this message
Martin Pitt (pitti) wrote :

Conscious user,

when you created those logs, can you confirm that you did _not_ actually have an audio CD inserted into the drive? I. e. the "cdda://sr0/" one that we see in the log is the phantom drive, and not the one you were inserting for testing?

For further testing, please ensure that there is no media in the drive.

Can you please do

  udevadm info --export-db > /tmp/udev.txt

and attach /tmp/udev.txt here?

Also, can you please copy&paste the output of

  sudo /lib/udev/cdrom_id /dev/sr0

? Thanks!

Revision history for this message
Sebastien Bacher (seb128) wrote :

udisks lists sr0 as an audio cd, reassigning the bug to udisks

affects: nautilus (Ubuntu) → udisks (Ubuntu)
Revision history for this message
Conscious User (conscioususer) wrote :

Martin,

I'm 100% sure. I took the logs before the test.

cdda://sr0/ is indeed the phantom drive, I can confirm with the nautilus tooltip.

Attaching /tmp/udev.txt here and the output of "sudo /lib/udev/cdrom_id /dev/sr0" was:

ID_CDROM=1
ID_CDROM_DVD=1
ID_CDROM_MRW=1
ID_CDROM_MRW_W=1
ID_CDROM_MEDIA=1
ID_CDROM_MEDIA_CD=1
ID_CDROM_MEDIA_SESSION_NEXT=20224
ID_CDROM_MEDIA_SESSION_COUNT=16896
ID_CDROM_MEDIA_TRACK_COUNT=22528
ID_CDROM_MEDIA_TRACK_COUNT_AUDIO=79
ID_CDROM_MEDIA_TRACK_COUNT_DATA=16
ID_CDROM_MEDIA_SESSION_LAST_OFFSET=3308950255616

Revision history for this message
Martin Pitt (pitti) wrote :

Thanks, so cdrom_id is definitively wrong here.

Can you please do

  sudo strace -vvfo /tmp/cdrom_id.trace -s 1024 /lib/udev/cdrom_id /dev/sr0

and attach /tmp/cdrom_id.trace here?

summary: - "phantom" audio cd
+ cdrom_id: misdetects no media as audio CD
affects: udisks (Ubuntu) → udev (Ubuntu)
Changed in udev (Ubuntu):
status: Confirmed → Incomplete
Revision history for this message
frenchy82 (cartes) wrote :

This is mine

Revision history for this message
Conscious User (conscioususer) wrote :

Here we go. I think it would be interesting if me and frenchy82 both keep sending the requested logs, as he is with a real install and I am with a VirtualBox install, so all bases all covered.

Revision history for this message
Martin Pitt (pitti) wrote :

Thanks. So all ioctl()s succeed, but deliver totally bogus data, reassigning to kernel.

Do you have a chance to try this under karmic (Ubuntu 9.10) as well? (A live system booted from an USB stick should do fine). Could you do the same strace there and attach it for comparison?

affects: udev (Ubuntu) → linux (Ubuntu)
Changed in linux (Ubuntu):
status: Incomplete → New
Revision history for this message
frenchy82 (cartes) wrote :

Could it be the same isse as this one
https://bugs.launchpad.net/ubuntu/+source/udev/+bug/560469

For this user, go back to udev version 151-7 seems to solve this issue

Revision history for this message
Conscious User (conscioususer) wrote :

VirtualBox cannot boot from USB, so I'm doing the following: I've created a secondary virtual CD drive in my VirtualBox machine and I now have two phantom audio discs in Lucid, one per drive (sr0 and sr1). First I'll attach the traces for sr0 and sr1 in Lucid. Afterwards I'll attach the same for Karmic obtained through a LiveCD.

Revision history for this message
Conscious User (conscioususer) wrote :
Revision history for this message
Conscious User (conscioususer) wrote :

Here it goes, for Karmic. sr0 is the LiveCD itself, I suppose. There are no phantoms.

Revision history for this message
Conscious User (conscioususer) wrote :
Revision history for this message
Martin Pitt (pitti) wrote :

Uh, that's indeed interesting. -6 did introduce a regression (it often did not recognize audio and other CDs at all any more), but -7 should have fixed it again. I'll look into this more closely.

affects: linux (Ubuntu) → udev (Ubuntu)
Changed in udev (Ubuntu):
assignee: nobody → Martin Pitt (pitti)
importance: Low → Medium
status: New → In Progress
Martin Pitt (pitti)
Changed in udev (Ubuntu):
importance: Medium → High
Revision history for this message
Martin Pitt (pitti) wrote :

> For this user, go back to udev version 151-7 seems to solve this issue

Does it help for you? It would be great if you guys could test udev 151-5 on lucid. You can get the old .deb from here:

  i386: https://launchpad.net/ubuntu/+source/udev/151-5/+build/1514099/+files/udev_151-5_i386.deb
  amd64: https://launchpad.net/ubuntu/+source/udev/151-5/+build/1514097/+files/udev_151-5_amd64.deb

Revision history for this message
frenchy82 (cartes) wrote :

Installing udev 151-5 (386), reboot solve the problem.
No more audio cd if there is no cd.

(and of course it works inserting an audio cd)

Revision history for this message
Martin Pitt (pitti) wrote :

I just tried that in kvm, and while I do not get phantom drives, I do get some bogus data, too.

I'm more and more convinced that this isn't a direct cause of the code changes between -5 and -8, but pure coincidence. It looks like cdrom_id uses uninitialized data which just happens to be different with every build.

Revision history for this message
Martin Pitt (pitti) wrote :

I think this should help: http://git.kernel.org/?p=linux/hotplug/udev.git;a=commitdiff;h=816e6bf0fb0849d03696a4b4ec2334e35e819425

With this I get correct data in kvm.

I'll upload a new udev to lucid now (151-9). I'd appreciate if you could confirm/deny that this fixes the problem for you as well. Thanks!

Changed in udev (Ubuntu Lucid):
status: In Progress → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package udev - 151-9

---------------
udev (151-9) lucid; urgency=low

  * cdrom_id: In cases where cdrom_id does not go through the entire code path
    and one of the probing functions returns -1 or exits early, the remaining
    variables were never initialized. This caused effects like "phantom" audio
    CDs on empty drives, or bogus data like ID_CDROM_MEDIA_TRACK_COUNT=22528.
    Initialize the variables right away to avoid that. (LP: #559723) Patch
    committed to upstream git as well (816e6bf).
 -- Martin Pitt <email address hidden> Tue, 13 Apr 2010 10:56:38 +0200

Changed in udev (Ubuntu Lucid):
status: Fix Committed → Fix Released
Revision history for this message
Conscious User (conscioususer) wrote :

I was about to report that downgrading udev worked for me, but I guess I was too slow. :)

Okay, gonna wait until this new udev hits the repositories I use and report accordingly.

Revision history for this message
Martin Pitt (pitti) wrote :

On a closer look, this patch in -9 was actually a no-op, and it again is sheer luck. It rather seems that the difference seems to come from building with and without optimization, I'll investigate further.

Changed in udev (Ubuntu Lucid):
status: Fix Released → In Progress
Revision history for this message
Martin Pitt (pitti) wrote :

OK, more questions:

 * With current udev, if you get the phantom CD, please copy&paste the output of

    sudo /lib/udev/cdrom_id -d /dev/sr0

The -d option will provide some additional debug info.

 * One particular part where I can reproduce garbage with a real CD should be fixed in my PPA:

    sudo add-apt-repository ppa:pitti/ppa
    sudo apt-get update
    sudo apt-get install udev

This should install udev version 151-9pitti1. Can you please try with that one? Do you get phantom CDs still? Please do the strace dance/attachment again.

Thanks!

Revision history for this message
Conscious User (conscioususer) wrote :
Download full text (5.5 KiB)

Output of "sudo /lib/udev/cdrom_id -d /dev/sr0", current udev, seeing phantom.

main: probing: '/dev/sr0'
cd_media_compat: CDROM_DRIVE_STATUS != CDS_DISC_OK
cd_inquiry: INQUIRY: [VBOX ][CD-ROM ][1.0 ]
cd_profiles: GET CONFIGURATION: number of profiles 20
cd_profiles: current profile 0x08
cd_media_toc: READ TOC: len: 770
cd_media_toc: track=0 info=0x0(audio) start_block=0
cd_media_toc: track=0 info=0x0(audio) start_block=0
cd_media_toc: track=0 info=0x0(audio) start_block=0
cd_media_toc: track=0 info=0x0(audio) start_block=0
cd_media_toc: track=0 info=0x0(audio) start_block=0
cd_media_toc: track=0 info=0x0(audio) start_block=0
cd_media_toc: track=0 info=0x0(audio) start_block=0
cd_media_toc: track=0 info=0x0(audio) start_block=0
cd_media_toc: track=0 info=0x0(audio) start_block=0
cd_media_toc: track=0 info=0x0(audio) start_block=0
cd_media_toc: track=0 info=0x0(audio) start_block=0
cd_media_toc: track=0 info=0x0(audio) start_block=0
cd_media_toc: track=0 info=0x0(audio) start_block=0
cd_media_toc: track=0 info=0x0(audio) start_block=0
cd_media_toc: track=0 info=0x0(audio) start_block=0
cd_media_toc: track=0 info=0x0(audio) start_block=0
cd_media_toc: track=0 info=0x0(audio) start_block=0
cd_media_toc: track=0 info=0x0(audio) start_block=0
cd_media_toc: track=0 info=0x0(audio) start_block=0
cd_media_toc: track=0 info=0x0(audio) start_block=0
cd_media_toc: track=0 info=0x0(audio) start_block=0
cd_media_toc: track=0 info=0x0(audio) start_block=0
cd_media_toc: track=0 info=0x0(audio) start_block=0
cd_media_toc: track=0 info=0x0(audio) start_block=0
cd_media_toc: track=0 info=0x0(audio) start_block=0
cd_media_toc: track=0 info=0x0(audio) start_block=0
cd_media_toc: track=0 info=0x0(audio) start_block=0
cd_media_toc: track=0 info=0x0(audio) start_block=0
cd_media_toc: track=0 info=0x0(audio) start_block=0
cd_media_toc: track=0 info=0x0(audio) start_block=0
cd_media_toc: track=0 info=0x0(audio) start_block=0
cd_media_toc: track=0 info=0x0(audio) start_block=0
cd_media_toc: track=0 info=0x0(audio) start_block=0
cd_media_toc: track=0 info=0x0(audio) start_block=0
cd_media_toc: track=0 info=0x0(audio) start_block=0
cd_media_toc: track=0 info=0x0(audio) start_block=0
cd_media_toc: track=0 info=0x0(audio) start_block=0
cd_media_toc: track=0 info=0x0(audio) start_block=0
cd_media_toc: track=0 info=0x0(audio) start_block=0
cd_media_toc: track=0 info=0x0(audio) start_block=0
cd_media_toc: track=0 info=0x0(audio) start_block=0
cd_media_toc: track=0 info=0x0(audio) start_block=0
cd_media_toc: track=0 info=0x0(audio) start_block=0
cd_media_toc: track=0 info=0x0(audio) start_block=0
cd_media_toc: track=0 info=0x0(audio) start_block=0
cd_media_toc: track=0 info=0x0(audio) start_block=0
cd_media_toc: track=0 info=0x0(audio) start_block=0
cd_media_toc: track=0 info=0x0(audio) start_block=0
cd_media_toc: track=0 info=0x0(audio) start_block=0
cd_media_toc: track=0 info=0x0(audio) start_block=0
cd_media_toc: track=0 info=0x0(audio) start_block=0
cd_media_toc: track=0 info=0x0(audio) start_block=0
cd_media_toc: track=0 info=0x0(audio) start_block=0
cd_media_toc: track=0 info=0x0(audio) start_block=0
cd_media_toc: track=0 info=0x0(audio) start_block=0
cd_med...

Read more...

Revision history for this message
Martin Pitt (pitti) wrote :

I just updated udev in my PPA to version 151-9pitti2, which now has a more complete fix for the uninitialized variables than pitti1.

Please try this version. Thanks!

Revision history for this message
Conscious User (conscioususer) wrote :

Martin, good news, 151-9pitti1 didn't solve the problem but 151-9pitti2 seems to! :)

Not seeing phantoms currently. Attaching strace.

Revision history for this message
Martin Pitt (pitti) wrote :
Changed in udev (Ubuntu Lucid):
status: In Progress → Fix Committed
Revision history for this message
James Schriver (dashua) wrote :

151-9pitti2 has also fixed the CD-ROM not detecting blank media. Working good now :).

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package udev - 151-10

---------------
udev (151-10) lucid; urgency=low

  * cdrom_id: Turns out that some ioctls do not actually touch the result
    buffer in some cases, so we need to zero the result buffers to avoid
    interpreting random da CD properties. (LP: #559723, LP: #561585) Patch
    also committed to upstream (2b861)
 -- Martin Pitt <email address hidden> Tue, 13 Apr 2010 15:34:40 +0200

Changed in udev (Ubuntu Lucid):
status: Fix Committed → Fix Released
Revision history for this message
frenchy82 (cartes) wrote :

Thanks a lot, i can confirm too.

Revision history for this message
Conscious User (conscioususer) wrote :

Confirming the fix with the latest updates. Thank you very much for your quick efforts, Martin.

Revision history for this message
frenchy82 (cartes) wrote :

I'm not able now to mount all my usb mass storage now but not sure that is "linked " with this update

Revision history for this message
John Yates (andyfranyates) wrote :

I still have a phantom blank cd-rom disk showing on the desktop with udev_151-10.

Revision history for this message
Martin Pitt (pitti) wrote : Re: [Bug 559723] Re: cdrom_id: misdetects no media as audio CD

John Yates [2010-04-13 18:02 -0000]:
> I still have a phantom blank cd-rom disk showing on the desktop with
> udev_151-10.

Can you please give me the straces and cdrom_id -d outputs as
described above? Did you restart the computer after the upgrade, just
to be sure?

Revision history for this message
John Yates (andyfranyates) wrote :

/lib/udev/cdrom_id -d /dev/sr0
main: probing: '/dev/sr0'
cd_media_compat: CDROM_DRIVE_STATUS != CDS_DISC_OK
cd_inquiry: INQUIRY: [SONY ][CD-RW CRX230ED ][4YS1]
cd_profiles: GET CONFIGURATION: number of profiles 184
cd_profiles: profile 0x0a
cd_profiles: current profile 0x02
cd_media_toc: READ TOC: len: 2
cd_media_info: disk type 00
ID_CDROM=1
ID_CDROM_CD_R=1
ID_CDROM_CD_RW=1
ID_CDROM_MRW=1
ID_CDROM_MRW_W=1
ID_CDROM_MEDIA=1
ID_CDROM_MEDIA_STATE=blank

Revision history for this message
John Yates (andyfranyates) wrote :

Oh, Yes I did restart.

Revision history for this message
Mike Brudevold (puffy-taco) wrote :

I have now been able to reproduce the problem on 151-7. The issue here is that it is transient. Running cdrom_id on /dev/sr1 gave me differing values of ID_CDROM_MEDIA_STATE, including "appendable", "complete", "other" and "blank." On a hunch, I ran "sudo udevadm trigger" 9 times. On the 9th time, the blank cd icon appeared (it was not present for the previous 8). I ran it once more, and the blank cd icon disappeared.

Revision history for this message
Mike Brudevold (puffy-taco) wrote :

I took a look at the profiles that are being reported from the "GET CONFIGURATION" command, and none of them report that they are the current profile, and yet the header reports 0x02 as the current profile. I also submitted a patch (hopefully) to the hotplug mailing list that fixes the enumeration of cd profiles, as the bounds checking was off.

Revision history for this message
Mike Brudevold (puffy-taco) wrote :

I wonder if the best way to solve this is to actually go through the profile list yourself?

The following output is of the format (profile [profile number] [current bit]):

This is my profile list with no CD (Active profile in header is 0x02):

profile 0x0a 0x00
profile 0x09 0x00
profile 0x08 0x00
profile 0x02 0x00

And with a cd (Active profile in header is 0x09):

profile 0x0a 0x00
profile 0x09 0x01
profile 0x08 0x00
profile 0x02 0x00

Revision history for this message
Martin Pitt (pitti) wrote :

Mike,

Mike Brudevold [2010-04-14 0:55 -0000]:
> I have now been able to reproduce the problem on 151-7.

Can you please retry with -10?

Martin
--
Martin Pitt | http://www.piware.de
Ubuntu Developer (www.ubuntu.com) | Debian Developer (www.debian.org)

Revision history for this message
Martin Pitt (pitti) wrote :

John,

thanks for the trace. I have a rough idea why this happens for you, but since it's a totally different root cause, would you mind opening a new bug, since this is closed? Thanks!

Revision history for this message
Elfy (elfy) wrote :

Still have this issue here - not sure if it is the same thing though .

Output of sudo /lib/udev/cdrom_id -d /dev/sr0 is

main: probing: '/dev/sr0'
cd_media_compat: CDROM_DRIVE_STATUS != CDS_DISC_OK
cd_inquiry: INQUIRY: [LITE-ON ][COMBO SOHC-5232K][NK0J]
cd_profiles: GET CONFIGURATION: number of profiles 240
cd_profiles: profile 0x2b
cd_profiles: profile 0x10
cd_profiles: profile 0x0a
cd_profiles: current profile 0x00
cd_profiles: no current profile, assuming no media
ID_CDROM=1
ID_CDROM_CD_R=1
ID_CDROM_CD_RW=1
ID_CDROM_DVD=1
ID_CDROM_DVD_PLUS_R_DL=1
ID_CDROM_MRW=1
ID_CDROM_MRW_W=1

sudo /lib/udev/cdrom_id -d /dev/sr1
main: probing: '/dev/sr1'
cd_media_compat: CDROM_DRIVE_STATUS != CDS_DISC_OK
cd_inquiry: INQUIRY: [LITE-ON ][CD-RW SOHR-5238S][4S06]
cd_profiles: GET CONFIGURATION: number of profiles 184
cd_profiles: profile 0x0a
cd_profiles: current profile 0x02
cd_media_toc: READ TOC: len: 2
cd_media_info: disk type 00
ID_CDROM=1
ID_CDROM_CD_R=1
ID_CDROM_CD_RW=1
ID_CDROM_MRW=1
ID_CDROM_MRW_W=1
ID_CDROM_MEDIA=1
ID_CDROM_MEDIA_STATE=blank

Revision history for this message
Elfy (elfy) wrote :

sorry - this would appear to be completely the wrong thing - this is nothing to do with an audio cd

Revision history for this message
Martin Pitt (pitti) wrote :

forestpiskie, this looks similar to John Yate's problem. So perhaps you can subscribe to John's new bug, or you file a new one and John subscribes to it. You don't get a phantom media for sr0, though, just for sr1, right?

Revision history for this message
Mike Brudevold (puffy-taco) wrote :

My issue is the blank cd problem, and yes it happens on 151-10. 151-10 just solidified the problem where it gets detected as blank because you initialize everything now, and there's no chance for it to be random (unless you get random back).

Revision history for this message
Elfy (elfy) wrote :

"forestpiskie, this looks similar to John Yate's problem. So perhaps you can subscribe to John's new bug, or you file a new one and John subscribes to it. You don't get a phantom media for sr0, though, just for sr1, right?"

It would appear so - at least I only get on on the desktop :)

If and when I can find out what new bug number is I will subscibe add to that one.

Revision history for this message
Martin Pitt (pitti) wrote :

forestpiskie, it's probably bug 562978 (I still need some debug data from Mike Brudevold to be 100% sure).

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.