Bug 434455

Summary: inconsistent scsi_id results for emulated disk in VirtualBox
Product: [openSUSE] openSUSE 11.1 Reporter: Bernhard Walle <bwalle>
Component: InstallationAssignee: Kay Sievers <kasievers>
Status: RESOLVED DUPLICATE QA Contact: Jiri Srain <jsrain>
Severity: Critical    
Priority: P5 - None CC: hare
Version: Factory   
Target Milestone: ---   
Hardware: i686   
OS: Other   
Whiteboard:
Found By: Development Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: Console session
Output of "ls -l /sys/class/block"

Description Bernhard Walle 2008-10-10 18:43:22 UTC
Created attachment 244939 [details]
Console session

The following problem happens on VirtualBox 2.0.2 (Host: Linux, Guest: openSUSE 11.1 Beta 2 i386). It happens with YaST installation, but I also can reproduce it manually.

The problem is that not all persistent device name links in /dev/disk/by-id/ are created when I create a partition. YaST chooses the link
scsi-1ATA_VBOX_HARDDISK_VB49544707-9defca96 as disk, also in bootloader configuration, but then GRUB fails to install because the
scsi-1ATA_VBOX_HARDDISK_VB49544707-9defca96-part1 is missing.

Steps to reproduce:
  1. Create a new VM with default settings and openSUSE as type,
     512 MiB RAM, 8 GiB disk (or less).
  2. Insert the CD openSUSE 11.1 Beta 2 Live CD KDE4.
  3. Launch the VM.
  4. Start installation.
  5. When KDE4 is up, open an X-Terminal.
  6. Try following session (see attachment).


Result:
Only the link scsi-1ATA_VBOX_HARDDISK_VB49544707-9defca96 has no "-part1" link.

Expected result:
The link scsi-1ATA_VBOX_HARDDISK_VB49544707-9defca96-part1 should exist like
ata-VBOX_HARDDISK_VB49544707-9defca96-part1 and scsi-SATA_VBOX_HARDDISK_VB49544707-9defca96-part1 are there.

Reproducability:
Always.

Problems:
 - Bootloader installation fails (because the device map contains
   the scsi-1ATA_VBOX_HARDDISK_VB49544707-9defca96 device).
 - (maybe) Partition is not activated (not bootable), so when the
   bootloader is not installed into MBR (which is the default if you
   install in non-primary partition), then the system is unbootable
   even when /boot/grub/device.map is fixed up.
Comment 1 Kay Sievers 2008-10-11 00:20:52 UTC
Before you run anything that re-requests a partition table scan, like fdisk does, at the point you miss the partitions, what does:
  ls -l /sys/class/block
print?
Comment 2 Bernhard Walle 2008-10-11 14:55:06 UTC
Created attachment 244974 [details]
Output of "ls -l /sys/class/block"

(Used an attachment to avoid line automatic breaks.)
Comment 3 Kay Sievers 2008-10-11 15:07:31 UTC
There is no sda1 device known by the kernel at that time, therefore no /dev/sda1, or any link to it. The vbox driver interaction of the emulated disk needs to be fixed, or a manual partition scan needs to be requested. Nothing that could be fixed from udev's side.
Comment 4 Bernhard Walle 2008-10-11 15:13:55 UTC
Of course. Because there's no sda1 device before I create a partition.
Comment 5 Kay Sievers 2008-10-11 15:46:41 UTC
Ah sorry, I see, you miss a specifically named link. Still, looks like a emulated block driver issue to return different results on scsi inquiries, like:
  1ATA_VBOX_HARDDISK_VB49544707-9defca96
  SATA_VBOX_HARDDISK_VB49544707-9defca96

What does:
  /lib/udev/scsi_id --whitelisted -p0x80 -d /dev/sda
and:
  /lib/udev/scsi_id --whitelisted -p0x83 -d /dev/sda
print?

Comment 6 Bernhard Walle 2008-10-11 16:11:14 UTC
linux:/home/linux # /lib/udev/scsi_id --whitelisted -p0x80 -d /dev/sda
SATA     VBOX HARDDISK  VB3664379b-b804dda6
linux:/home/linux # /lib/udev/scsi_id --whitelisted -p0x83 -d /dev/sda
SATA     VBOX HARDDISK  VB3664379b-b804dda6
Comment 7 Kay Sievers 2008-10-11 16:21:40 UTC
Seems, the disk returned a different result in the very first query.

Before you partition it, what does scsi_id print?

Which by-id/ links are created for the disk, before it is partitioned?
Comment 8 Bernhard Walle 2008-10-11 16:27:14 UTC
(In reply to comment #7 from Kay Sievers)
> Before you partition it, what does scsi_id print?

Comment 6 is before the partitioning.

> Which by-id/ links are created for the disk, before it is partitioned?

That is visible in attachment 244939 [details] (in the initial description).

Comment 9 Kay Sievers 2008-10-11 16:35:04 UTC
Ok, the vbox disk emulation logic seems to have a problem. The 1ATA* vendor query result does not happen anytime later, only for the very first query maybe.
Comment 10 Bernhard Walle 2008-10-11 20:34:43 UTC
FYI, Ubuntu (ubuntu-8.10-beta-desktop-i386.iso) only creates these links:

ata-VBOX_HARDDISK_VB3664379b-b804dda6 -> ../../sda
ata-VBOX_HARDDISK_VB3664379b-b804dda6-part1 -> ../../sda1
scsi-1ATA_VBOX_HARDDISK_VB3664379b-b804dda6 -> ../../sda
scsi-1ATA_VBOX_HARDDISK_VB3664379b-b804dda6-part1 -> ../../sda1

Comment 11 Bernhard Walle 2008-10-12 09:36:16 UTC
Also, the installed system doesn't have that "1ATA" links.
Comment 12 Bernhard Walle 2008-10-12 14:17:37 UTC
And the installation DVD works without any problems. So that problem is special to the "installable Live CD". 
Comment 13 Kay Sievers 2008-10-13 01:56:37 UTC
It looks like the behavior of the emulated Vbox disk changes, regarding what repeated reading of SCSI mode pages return? Sounds like a bug in the Vbox device emulation.

SUSE is the only distro using by-id/ links in fstab, as far as I know, and all other use the UUID's if the filesystems. So it might be, that this behavior never caused a problem for anybody else.

Did you always recreate the guest before your tests? I wonder, if only the first query after creating the Vbox guest has this problem, because the initrd of the later installed system should also not be able to find it's disk, if they always return different results, like in the installer, for the first query.
Comment 14 Bernhard Walle 2008-10-13 07:26:36 UTC
(In reply to comment #13 from Kay Sievers)
> It looks like the behavior of the emulated Vbox disk changes, regarding what
> repeated reading of SCSI mode pages return? Sounds like a bug in the Vbox
> device emulation.

But I cannot report that as bug at Sun when I have nothing more than
"that happens only with openSUSE Live CD in Beta 2 i386".

> Did you always recreate the guest before your tests?

No. I always used the same VM, but did reset the disk with parted mklabel
for the fdisk test.

Of course, in Ubuntu, I did not install (which would not cause the problem to happen because of UUIDs), but I started the live CD and did the fdisk test. So the problem would have shown up if it would be there.

Also, I did the fdisk test in the installation DVD (with Ctrl+Alt+X opening a Terminal in YaST). So that would be exactly the same case as with the bootable
Live CD.
Comment 15 Kay Sievers 2008-10-14 11:26:19 UTC
Maybe it's the scsi-passthrough for ATA disks, we got a similar bug on real hardware:
  https://bugzilla.novell.com/show_bug.cgi?id=435093
Comment 16 Kay Sievers 2008-10-15 08:47:16 UTC
The current speculation is, that we miss /etc/scsi_id.config in the installer/installer initramfs, which could explain the differences in the queries.
Comment 17 Kay Sievers 2008-10-15 11:42:12 UTC
(In reply to comment #10 from Bernhard Walle)
> FYI, Ubuntu (ubuntu-8.10-beta-desktop-i386.iso) only creates these links:
> 
> ata-VBOX_HARDDISK_VB3664379b-b804dda6 -> ../../sda
> ata-VBOX_HARDDISK_VB3664379b-b804dda6-part1 -> ../../sda1
> scsi-1ATA_VBOX_HARDDISK_VB3664379b-b804dda6 -> ../../sda
> scsi-1ATA_VBOX_HARDDISK_VB3664379b-b804dda6-part1 -> ../../sda1

I tried that too, and ubuntu does not ship scsi_id.config in the installer/live cd, therefore the results (as expected) of SCSI mode page 0x83.

Looks like a problem in our installation system, but we have currently no idea what's going wrong.
Comment 18 Christoph Thiel 2008-10-16 11:33:31 UTC
Kay, could this be caused by bug 435093 as well?
Comment 19 Kay Sievers 2008-10-16 12:07:12 UTC
(In reply to comment #18 from Christoph Thiel)
> Kay, could this be caused by bug 435093 as well?

If the image is built by kiwi, it's definitely the same bug. I'm pretty confident, that it is caused by a missing scsi_id.config.
Comment 20 Christoph Thiel 2008-10-16 13:18:52 UTC
It was built using kiwi. So I bet it's a dup. Please give a try, as soon as I have a Build0075 LiveCD ready for testing.

*** This bug has been marked as a duplicate of bug 435093 ***
Comment 21 Bernhard Walle 2008-10-17 23:32:12 UTC
I tested openSUSE-11.1-Beta3-Build0075-KDE4-LiveCD-i386.iso and everything is fine.

Quite cool how "problems of [...] vbox disk emulation logic" (comment 9) can be fixed in our LiveCDs. ;-)