Bug #8891

VirtualBox cannot use our ISO images when its size is not a multiple of 2048 bytes

Added by anonym 2015-02-11 21:27:02 . Updated 2015-05-12 18:44:07 .

Status:
Resolved
Priority:
Normal
Assignee:
Category:
Virtualization
Target version:
Start date:
2015-02-11
Due date:
% Done:

100%

Feature Branch:
bugfix/8891-iso-image-padding
Type of work:
Code
Blueprint:

Starter:
Affected tool:
Deliverable for:

Description

When adding our new isohybrid images (Feature #8510) to Virtualbox, it complains as follows:

Failed to open the optical disk file $PATH/tails-i386-devel-1.3-20150211.iso.
Could not get the storage format of the medium '$PATH/tails-i386-devel-1.3-20150211.iso' (VERR_NOT_SUPPORTED).

Result Code: VBOX_E_IPRT_ERROR (0x80BB0005)
Component: Medium
Interface: IMedium {05f2bbb6-a3a6-4fb9-9b49-6d0dda7142ac}
Callee: IVirtualBox {fafa4e17-1ee2-4905-a10e-fe7c18bf5554}
Callee RC: VBOX_E_OBJECT_NOT_FOUND (0x80BB0001)


And some extra info when run from the command line:

VBoxSDL: error: Context: "OpenMedium(bstrCdromFile.raw(), DeviceType_DVD, AccessMode_ReadWrite, FALSE , pMedium.asOutParam())" at line 1713 of file VBoxSDL.cpp

Apparently the Virtualbox code that tries to verify that the image is a legit ISO image is a bit too strict. One can fix the image by running either of the following:

  • isohybrid $ISO
  • isohybrid $ISO -h 253 -s 63
  • isohybrid $ISO -h 255 -s 62

For reference we now (after Feature #8510 was fixed) generate them with isohybrid $ISO -h 255 -s 63 so it seems that Virtualbox has an upper limit of how many sectors it thinks an ISO can have or something like that.

Would it be safe (e.g. w.r.t. BIOS-compatibility) to lower one of these values? We should ask the syslinux team.


Subtasks


Related issues

Related to Tails - Feature #8510: Distribute a hybrid ISO image Resolved 2015-01-03
Has duplicate Tails - Bug #9348: VirtualBox fails to load Tails 1.4~rc1 Duplicate 2015-05-05

History

#1 Updated by anonym 2015-02-11 21:27:19

#2 Updated by intrigeri 2015-02-11 21:57:38

  • Subject changed from Virtualbox cannot use our isohybrid images to Virtualbox cannot use our hybrid ISO images

#3 Updated by anonym 2015-02-12 01:41:29

  • Status changed from Confirmed to Rejected

This is embarrassing but good news. I just realized that I had (for testing purposes) manually downgraded to an older version of Virtualbox a few weeks ago. After re-installing the up-to-date 4.3.18, the issue isn’t there any more.

#4 Updated by intrigeri 2015-02-12 10:39:36

> This is embarrassing but good news. I just realized that I had (for testing purposes)
> manually downgraded to an older version of Virtualbox a few weeks ago.
> After re-installing the up-to-date 4.3.18, the issue isn’t there any more.

So Wheezy’s VirtualBox (4.1.18-dfsg-2+deb7u4) was the one affected?
If that’s the case, then we should document it.

#5 Updated by intrigeri 2015-02-12 11:54:13

  • Subject changed from Virtualbox cannot use our hybrid ISO images to Some versions of VirtualBox cannot use our hybrid ISO images
  • Status changed from Rejected to Confirmed
  • Assignee set to anonym
  • QA Check set to Info Needed

#6 Updated by anonym 2015-02-12 11:59:09

It seems I was wrong yet again. All versions I’ve tested, 4.1.18, 4.3.14 and 4.3.18, apparently can add the RC hybrid ISO image, but they cannot add e.g. a current experimental build’s hybrid ISO image. I suspect the image size in combination with our isohybrid parameters is the culprit, i.e.:

  • the RC’s crazy xz compression brings the size under 1 GiB which apparently is fine with our current isohybrid parameters, but
  • the >1 GiB image size when gzip compresseion is used makes Virtualbox reject the image with our current isohybrid parameters.

Perhaps we don’t care since stable/RC releases are ok, but it will discourage testing of our nightly builds for users that prefer Virtualbox. So we should keep the ticket open until we have a decision. If there’s no risk involved in tweaking the parameters like I discovered worked, we may want to do it.

#7 Updated by anonym 2015-02-12 12:11:41

  • Subject changed from Some versions of VirtualBox cannot use our hybrid ISO images to VirtualBox cannot use our hybrid ISO images when larger than 1 GB

The “larger than 1 GB” part is a bit of a guess, but it’s better than the old title.

#8 Updated by intrigeri 2015-02-12 12:16:47

> Perhaps we don’t care since stable/RC releases are ok,

ACK.

> but it will discourage testing of our nightly builds for users that prefer Virtualbox.

Why? Our nightly builds are compressed just like our releases.

Now, the Tails/Jessie nightly builds are dangerously close to 1GB, and maybe bigger (but that’s unrelated to the release vs. nightly topic). Do they work in VirtualBox?

#9 Updated by anonym 2015-02-16 12:05:31

  • Subject changed from VirtualBox cannot use our hybrid ISO images when larger than 1 GB to VirtualBox cannot use our ISO images when its size is not a multiple of 2048 bytes
  • Assignee changed from anonym to intrigeri

intrigeri wrote:
> > but it will discourage testing of our nightly builds for users that prefer Virtualbox.
>
> Why? Our nightly builds are compressed just like our releases.

Ah, bad assumption. Sorry!

> Now, the Tails/Jessie nightly builds are dangerously close to 1GB, and maybe bigger (but that’s unrelated to the release vs. nightly topic). Do they work in VirtualBox?

I downloaded tails-i386-feature_jessie-1.3-20150216T0511Z-9375b40.iso which is 1109866496 bytes in size, and it does not trigger the failure. For comparison, an image that failed for me was 1266693120 bytes in size.

I dug around in the VirtualBox sources and found the check that failed in src/VBox/Storage/RAW.cpp:388:

if (cbFile > 32768 && !(cbFile % 2048))
{
    *penmType = VDTYPE_DVD;
[...]


where cbFile is the size in bytes of the image. So, according to VirtualBox, a DVD image’s size (in bytes) must be a multiple 2048. As you can see, my bad image isn’t, but 1.3~rc1 and the feature/jessie build I downloaded are. I don’t think we do anything that guarantees that the images we care for (stable/RC releases, nightly builds) end up with a sizes as multiples of 2048, so this is something we actually may need to ensure.

VirtualBox is quite sensible here since the data part of each sector of an ISO image is 2048 bytes (see e.g. the Wikipedia page for ISO Image, so it seems isohybrid indeed can create hybrid ISO images that fail this requirement. I suppose isohybrid already is operating in the realm of non-standards, but filing a bug may be worth it. Still, since trailing data shouldn’t be of any consequence, we can fix our images by padding them with zeros so their sizes are multiples of 2048 bytes with:

--- a/auto/build
+++ b/auto/build
@@ -153,6 +153,7 @@ if [ -e "${BUILD_FILENAME}.${BUILD_FILENAME_EXT}" ]; then
          echo "Hybriding it..."
          isohybrid $AMNESIA_ISOHYBRID_OPTS \
                    "${BUILD_FILENAME}.${BUILD_FILENAME_EXT}"
+         truncate -s %2048 "${BUILD_FILENAME}.${BUILD_FILENAME_EXT}"
       fi
    else
       echo "Warning: image created, but lb build exited with code $RET"


What do you think? (And yes, I’ve tested that running truncate on any of my problematic images fixes them.)

#10 Updated by intrigeri 2015-02-17 11:08:44

> So, according to VirtualBox, a DVD image’s size (in bytes) must be a multiple 2048. As you can see, my bad image isn’t, but 1.3~rc1 and the feature/jessie build I downloaded are.

Wow, great research!

> […] I suppose isohybrid already operating in the realm of non-standards, but filing a bug may be worth it. Still, since trailing data shouldn’t be of any consequence, we can fix our images by padding them so their sizes are multiples of 2048 bytes with:
> […]
> What do you think? (And yes, I’ve tested that running truncate on any of my problematic images fixes them.)

I say we should do both:

  • pad our own images as you suggest: either for 1.3.1, or straight for 1.3 if the 1.3 ISO’s size isn’t a multiple of 2048
  • raise the issue on the syslinux mailing-list

I’m already on the syslinux mailing-list, so I can do the latter. anonym, wanna take care of the former?

#11 Updated by intrigeri 2015-02-17 11:09:04

  • Assignee changed from intrigeri to anonym

#12 Updated by anonym 2015-02-17 16:02:28

  • Assignee deleted (anonym)
  • QA Check changed from Info Needed to Ready for QA
  • Feature Branch set to bugfix/8891-iso-image-padding

intrigeri wrote:
> > What do you think? (And yes, I’ve tested that running truncate on any of my problematic images fixes them.)
>
> I say we should do both:
>
> * pad our own images as you suggest: either for 1.3.1, or straight for 1.3 if the 1.3 ISO’s size isn’t a multiple of 2048

Done, see the feature branch. To avoid “randomly” (or whatever) ending up with a problematic Tails 1.3 ISO image it’d be great to have this in that release.

So, what about side effects? As far as my understanding goes, padding is completely harmless w.r.t. functionality, so we shouldn’t see any BIOS/DVD-reader compatibility issues or anything like that. However, I guess some burning programs might detect and strip the padding so that one cannot verify the ISO image’s signature again /dev/sr0 or whetever. Not sure we care.

Anything else?

> * raise the issue on the syslinux mailing-list
>
> I’m already on the syslinux mailing-list, so I can do the latter. anonym, wanna take care of the former?

I’m happy with this plan.

#13 Updated by intrigeri 2015-02-17 16:27:34

  • Assignee set to intrigeri
  • % Done changed from 0 to 50

#14 Updated by intrigeri 2015-02-17 18:25:28

  • Type of work changed from Research to Code

intrigeri wrote:
> * pad our own images as you suggest: either for 1.3.1, or straight for 1.3 if the 1.3 ISO’s size isn’t a multiple of 2048

I’ll review (and quite likely, merge) this. Thanks for the branch!

> * raise the issue on the syslinux mailing-list

Done, Cc’d anonym as he’s the one who masters the gory details.

#15 Updated by intrigeri 2015-02-17 18:57:24

  • Assignee changed from intrigeri to anonym
  • QA Check changed from Ready for QA to Dev Needed

anonym, it seems you forgot to push that branch. Please reassign to me for QA once it’s done.

#16 Updated by intrigeri 2015-02-17 21:50:20

Already two answers on the thread :)

#17 Updated by Tails 2015-02-20 09:17:51

  • Status changed from Confirmed to In Progress

Applied in changeset commit:9e7301f3d5bdd238dd13e193e2bd5fdc2f168f41.

#18 Updated by anonym 2015-02-20 09:28:03

  • Assignee changed from anonym to intrigeri
  • QA Check changed from Dev Needed to Info Needed

intrigeri wrote:
> anonym, it seems you forgot to push that branch. Please reassign to me for QA once it’s done.

Pushed, however…

> Already two answers on the thread :)

Maybe we should post-pone dealing with this, preferably until it’s fixed in the most sensible way possible in isohybrid itself? It seems like I’m the only one that do development builds of Tails with gzip-compression and run them in Virtualbox occasionally => I’m the only one suffering from this issue. Or perhaps sajolida too? Any way, in that situation the image can be manually fixed with the truncate command which is simple enough for me (and sajolida). I’d hate for the padding to introduce some arcane issue that we and the nice people on the syslinux list haven’t thought about.

#19 Updated by intrigeri 2015-02-20 10:08:28

> Maybe we should post-pone dealing with this, preferably until it’s fixed in the most sensible way possible in isohybrid itself? It seems like I’m the only one that do development builds of Tails with gzip-compression and run them in Virtualbox occasionally => I’m the only one suffering from this issue. Or perhaps sajolida too? Any way, in that situation the image can be manually fixed with the truncate command which is simple enough for me (and sajolida). I’d hate for the padding to introduce some arcane issue that we and the nice people on the syslinux list haven’t thought about.

OK, let’s postpone to the 4.0 milestone, since that’s when we have chances to hit the problem again.

#20 Updated by intrigeri 2015-02-20 10:10:08

  • Priority changed from Elevated to Normal
  • Target version changed from Tails_1.3 to Tails_2.0
  • QA Check deleted (Info Needed)
  • Type of work changed from Code to Wait

Next step is to wait for isohybrid to fix that. See the aforementionned thread on the syslinux mailing-list.

#21 Updated by Tails 2015-02-25 13:34:31

Applied in changeset commit:d70b3bf18d797efea4df0d2551817037c36ce680.

#22 Updated by BitingBird 2015-05-04 10:36:20

  • Target version changed from Tails_2.0 to Tails_1.4

Users are unable to use 1.4rc1 because of this issue, let’s fix that for the real one :)

#23 Updated by BitingBird 2015-05-04 13:17:55

One user tested the nightly http://nightly.tails.boum.org/build_Tails_ISO_experimental/tails-i386-experimental-1.5-20150504T1744Z-27fb1b6%2bdevel%40725cd34.iso

It worked fine in VirtualBox, so I think the solution works :)

#24 Updated by BitingBird 2015-05-05 22:26:17

  • has duplicate Bug #9348: VirtualBox fails to load Tails 1.4~rc1 added

#25 Updated by intrigeri 2015-05-07 16:19:54

So, I’ve read the full thread on the syslinux mailing-list, and:

  • Short-term, our truncate -based solution doesn’t seem that crazy; I think we should go for it.
  • isohybrid -h 128 -s 32 (enough for ISO images up to 2048 MiB) should make sure we get an ISO image whose size is a multiple of 2048 bytes, but it may introduce incompatibility when booting from USB installed with the cat/dd method.
  • Long-term, some more generic options based on -h 255 -s 63 are being discussed/developed in the aforementioned thread on the syslinux mailing-list. The best one so far should have an average additional waste of a bit less than 12 MB. We’ve been asked to test patches.

=> I’m going to try booting in various contexts an ISO built from testing + the proposed branch merged in, and if I experience no regression then I’ll ask for a review’n’merge.

#26 Updated by intrigeri 2015-05-07 19:09:07

  • Assignee changed from intrigeri to anonym
  • QA Check set to Ready for QA
  • Type of work changed from Wait to Code

> => I’m going to try booting in various contexts an ISO built from testing + the proposed branch merged in, and if I experience no regression then I’ll ask for a review’n’merge.

All current libvirt+kvm tests have been run on current Debian sid.

Note that the tested ISO was built with the crazy-slow XZ options, and I’ve verified that the call to truncate did make it larger: 962242560 bytes before hybrid’ing, 962357760 bytes after hybrid’ing, 962359296 bytes after truncate.

Boots fine:

  • libvirt + kvm, ISO passed as a virtual DVD
  • libvirt + kvm, ISO installed to a virtual USB drive with dd
  • libvirt + kvm, ISO installed to a virtual USB drive with Tails Installer

=> please review’n’merge into testing and devel.

#27 Updated by anonym 2015-05-08 15:11:34

  • Assignee changed from anonym to intrigeri
  • QA Check changed from Ready for QA to Info Needed

From commit:936d444:

+# Clone all output, from this point on, to the log file
+exec >  >(tee -a "$BUILD_LOG")
+trap "kill -9 $! 2>/dev/null" EXIT HUP INT QUIT TERM
+exec 2> >(tee -a "$BUILD_LOG" >&2)
+trap "kill -9 $! 2>/dev/null" EXIT HUP INT QUIT TERM


Do we really have to kill with SIGKILL? We’ve had some bad experiences with such abrupt killing lately in the test suite, so I’m worrying about similar things (subprocesses/zombies beaing left, other stuff not being cleaned up, etc.). Did you try with SIGTERM?

Otherwise it looks good (didn’t test yet).

#28 Updated by intrigeri 2015-05-08 15:47:56

  • Assignee changed from intrigeri to anonym
  • QA Check changed from Info Needed to Ready for QA

> Do we really have to kill with SIGKILL? We’ve had some bad experiences with such abrupt killing lately in the test suite, so I’m worrying about similar things (subprocesses/zombies beaing left, other stuff not being cleaned up, etc.).

Thanks for raising this topic!

The specific problem you’re referring too only applies to killing processes that fork child processes (and then cannot clean them up when killed with SIGKILL). This doesn’t apply here, since tee does not fork any child process AFAICT.

In the specific case at hand, I think it’s safer to kill tee with SIGKILL, to increase the chances that tee is indeed killed, and hence to lower the chances that the build process leaves dangling processes behind it. Note that tee’s output to file is not buffered (POSIX 1003.1), and IIRC shell redirection is line-buffered in the worst case, so killing tee with SIGKILL should not lead to lost messages. So, I’m inclined to keep the code as-is (SIGKILL) and revisit if it causes problems later on.

> Did you try with SIGTERM?

I did not.

#29 Updated by anonym 2015-05-08 19:44:36

  • Status changed from In Progress to Fix committed
  • % Done changed from 50 to 100

Applied in changeset commit:5b642ad26d83632ed72631b886e4cb4827270e51.

#30 Updated by anonym 2015-05-08 19:45:51

  • Assignee deleted (anonym)
  • QA Check changed from Ready for QA to Pass

Fair enough. Let’s revisit if we notice lost messages. Merged!

#31 Updated by BitingBird 2015-05-12 18:44:07

  • Status changed from Fix committed to Resolved