torsdag 8 maj 2014

About that virtual factory reset...

... it did work out in the end, after a few problems. The DVD images worked great all the way to the subsequent reboot. Then all one got was a black screen with a non-blinking low cursor in the upper-left corner of the screen. Thanks a lot - I guess the factory reset never bothered to install any MBR...

Oh well, let's boot up the virtual machine again, but this time with a Linux live CD iso image attached (Linux Mint 16 "Petra"), so that we can - from the trustworthy Linux prompt - install the mbr package ('sudo apt-get install mbr') and use it to install an MBR on the harddrive of the virtual machine (/dev/sda in my case, checked in the output of dmesg): 'sudo install-mbr-i n -p D -t 0 /dev/sda' (check the man-page of install-mbr to identify the details of those standard options, they're basically no interaction, use first bootable partition, and use a timeout of zero). (We could have used other Linux means as well, for example the mbr.bin image provided by the syslinux package.) Now let's try another reboot.

Well, it was a so called "fall forward". Instead of the solid, low-cursor it now stood "MBR" in the upper-left corner and then we got to an error screen, complaining about winload.exe being 
missing or corrupt ("Status 0xc000000e", "Windows failed to start. A recent hardware or software change might be the cause.", "File: \Windows\System32\winload.exe", "Info: The selected entry could not be loaded because the application is missing or corrupt."). Bugger... Out of ideas, I turned to Google and found this eminent guide. By luck, I already had a Windows XP virtual guest system I could attach the new machine's virtual harddrive to - otherwise, I would probably not been able to get any further. Now, I could, from XP, follow the guide, i.e., in my case, the new harddrive was mapped as E:, so I could run E:\Windows\System32\bcdedit /store F:\Boot\BCD /enum to check if I suffered from the same situation as he had. I sure did. with three unknowns. I changed them all to "boot" according to his recipe (E:\Windows\System32\bcdedit /store F:\Boot\BCD /set {X} Y boot, where (X, Y) were (bootmgr, device), (default, device), and (default, osdevice), respectively.

Upon next boot, the new machine started-up and begun configuring up itself, completing the factory reset. Cool! 

onsdag 7 maj 2014

I Stand Humbly Corrected...

So, I've been dabbing with trying to boot a set of "XYZ" recovery DVDs in a VirtualBox guest, to see if I can get a virtual factory reset running.

The first problem I ran into is that it seems that my USB-hub cannot support both the external USB-harddrive the virtual host resides on and the USB DVD reader at the same time - and, of course, I have too little space left on my internal drive and too few USB ports to have them directly attached (well, I could direct attach one with the inconvenience of unplugging the external mouse and keyboard, but we can't have that, can we?).

Thus, I needed to convert the 4.2 GB DVD to an ISO-image - but both Copy Disk in Brasero and old, honsest dd only gave me a 120 MB small image - probably the actual boot image on the DVD or something, while mkisofs gave me a full 4.2 GB image but a non-bootable one. How annoying!

By despair (or to be systematical), I also tried a tip I had up to that point considered too naive and fault-prone: to just cat the DVD-reader device to a file (i.e., 'cat /dev/sr0 > /tmp/recovery1.iso') and do you know what? It worked! VirtualBox booted the virtual host right of it and let me choose to do a factory reset (It is currently at 65%, so I don't know if it ultimately will work yet.)

Who would have thought that simple cat would be so true to the underlying bit device that it rendered the copied image as such a perfect copy? I am sure that given the right options to mkisofs, I could get the image bootable (it has a ton of different options to set this-and-that type of bootable disk to boot from a certain file, but I would rather not have to learn how to analyse the configuration of the DVD at hand enough to be able to pick all the right mkisofs options to make a one-to-one copy of it. Shouldn't mkisofs really be able to do that itself?

Video Woes

In McGuff's and Little's excellent "Body by Science", they advocate for strength-training with slow lifts (to remove any helping momentum) and to measure the Time Under Load rather than just number of repetitions, to get a more fine-grained control over your progress (or lack thereof). However, to concentrate on the weights and the clock at the same time is, of course, a drag. Better to film oneself and analyse the video after the workout - and which is the most ubiquitous movie camera around these days? Right, your mobile phone.

This scheme worked well for a number of workouts until the camera app in my phone crashed while recording, giving me a video no player will play. Why? Because the 3gp format of my phone (basically a mp4 variant with more compression) slaps on the frame index and codec information last in the file - and when the app crashes in mid-recording, no such index is added and the file ends up an inaccessible pile of junk data...

So, would I be forced to write-off the workout as a session without any data to track? Not without a fight. Some googling revealed that Federico Ponchio's Untrunc and Grau's Video Repair Software were the two most promising candidates. Both produced something from my broken video - unfortunately, Untrunc slapped on some codec all my players were missing (and that wasn't easily installable) but, luckily, Grau's program worked well, at least for the video - the audio become unsynced.

Alas, not only are the video and audio out of sync, it seems the video is somewhat in slow motion as well, so it turned out to be unusable for my post-workout analysis anyway. Too bad, but at least I got a story to tell out of it...