lsweb.euhttps://blog.lsweb.eu/blog/2024-03-28T16:55:32+00:00Weblog by Lars SteinkeManual restore of Android databases fails2011-11-04T16:11:37+00:002024-03-28T16:55:32+00:00Lars Steinkehttps://blog.lsweb.eu/blog/author/lss/https://blog.lsweb.eu/blog/manual-restore-of-android-databases-fails/<p>As described in my earlier <a href="https://blog.lsweb.eu/blog/android-firmware-updates-for-the-lg-gw620">post</a>, it is wise to create regular backups of your apps and data to SD card.</p>
<p>This can be accomplished using <code>adb shell</code> or the local Android terminal:<br/> <code>busybox tar cvf /mnt/sdcard/Backup/Full_`busybox date +%Y%m%d`.tar /system /data</code><br/> The correspondent command to for example restore your text messages would be:<br/> <code>cd /;busybox tar xvf /mnt/sdcard/Backup/Full_20111101.tar data/data/com.android.providers.telephony/databases/mmssms.db</code><br/> This worked fine up to Android 2.2, provided that you check file ownership and permissions afterwards, e.g.:<br/> <code>busybox chown radio:radio /data/data/com.android.providers.telephony/databases/mmssms.db<br/> busybox chmod 660 /data/data/com.android.providers.telephony/databases/mmssms.db</code><br/> After the restore has completed, <u>reboot</u>.<br/> <br/> This no longer worked when upgrading to OpenEve <a href="https://web.archive.org/web/20120421193224/http://forum.openetna.com:80/index.php?board=1.0">2.3.7</a>...<br/> With Android Gingerbread some changes seem to have been introduced for the central databases:<br/> Gingerbread will only pick up the restored databases, if the accompanying files *-shm and *-wal have been deleted before the final reboot (they seem to be recreated when not present).<br/> Thanks to Marius Strompen for the crucial <a href="https://web.archive.org/web/20110716031945/http://www.marius-strompen.de:80/wordpress/?p=130">hint</a>.</p>Android firmware updates for the LG GW6202011-06-21T14:36:00+00:002024-03-28T13:10:11+00:00Lars Steinkehttps://blog.lsweb.eu/blog/author/lss/https://blog.lsweb.eu/blog/android-firmware-updates-for-the-lg-gw620/<p>The OpenEtna community provides firmware updates for the GW620 phone by LG, which originally came with Android 1.5.</p>
<p>After using the Korean Android 2.2 (Froyo) update provided by LG for a while, I then took the leap to OpenEVE Android 2.3 (Gingerbread) for usability reasons<br/> (2.2 was pretty laggy sometimes).</p>
<ol>
<li>Make a backup of your apps and data to SD card (this assumes you start off a rooted Froyo firmware with <code>busybox</code> installed) using <code>adb shell</code> or the local Android terminal:<br/><code>busybox tar cvf /mnt/sdcard/Backup/Full_20110621.tar /system /data</code></li>
<li>Reboot your device in fastboot mode (please note that mode might not be available, if you have upgraded to Froyo V20 using the offical LG KDZ updater for WIndows): Remove battery, then hook up USB cable while pressing <code>Menu+Space</code></li>
<li>Backup your old boot and system images using fastboot and a recovery image: <code>fastboot boot gb-recovery.img</code></li>
<li>Reset the device settings: <code>fastboot -w</code></li>
<li>Flash the boot image: <code>fastboot flash boot boot234.img</code></li>
<li>Flash the system image: <code>fastboot flash system system234.img</code></li>
<li>Apply ZIP patches from SD card using fastboot to ClockWork Mod recovery image: <code>fastboot boot gb-recovery.img</code><br/>Apply gapps-gb-20110307-signed.zip & boot-gb234-110509-rndis-224mb.zip</li>
<li>Untar your backup from SD card locally and push back data, as required, e.g.:<br/> <code>adb push contacts2.db /data/data/com.android.providers.contacts/databases</code><br/> <code>adb push calendar.db /data/data/com.android.providers.calendar/databases</code><br/><code>adb push mmssms.db /data/data/com.android.providers.telephony/databases</code><br/><code>adb push note_pad.db /data/data/org.openintents.notepad/databases</code><br/><code>adb push shopping.db /data/data/org.openintents.shopping/databases</code><br/><code>adb push mytracks.db /data/data/com.google.android.maps.mytracks/databases</code><br/><code>adb push safe /data/data/org.openintents.safe/databases</code><br/><code>adb push database /data/data/com.timsu.astrid/databases<br/></code>...</li>
</ol>
<p>Depending on the image used, you might have to change the permissions for the files to be able to overwrite them: <code>chmod 666 ...</code> (and back to <code>chmod 660 ...</code> after the push). Also check that the uid/gid combination still agrees with the app directory and adjust using <code>busybox chown app_xy:app_xy ...</code> (unless you are doing a device shell restore via <code>busybox tar</code>, but even then the uid/gid combination might have changed for the new installation)!<br/> For more details please refer to the <a href="https://web.archive.org/web/20120421193224/http://forum.openetna.com:80/index.php?board=1.0">OpenEtna</a> forum.<br/> Infos on manual backups of Android databases may be found <a href="http://wiki.dandascalescu.com/howtos/android#How_to_backup_Android_SMSes.2C_MMSes.2C_Contacts.2C_Call_Logs.2C_User_dictionary_etc._manually">here</a>.</p>How to dual-boot Windows physically and virtually2010-11-30T09:22:55+00:002024-03-28T16:02:30+00:00Lars Steinkehttps://blog.lsweb.eu/blog/author/lss/https://blog.lsweb.eu/blog/how-to-dual-boot-windows-physically-and-virtually/<p>While this is no longer possible with Windows Activation Technologies in Win 7, Windows XP allows using Hardware Profiles for a shared installation that can be run either physically or virtually (e.g. using the KVM virtualization stack built into recent Linux kernels, which is a lot more convenient than VMWare Player with its kernel module dependencies, at the price of 3D graphics acceleration).<br/> <br/> The recommended sequence for such a setup:</p>
<ol>
<li>Install Windows XP physically (where applicable, using the IDE mode of your SATA host controller)</li>
<li>Create a second Hardware Profile for virtualization, reboot using that new Hardware Profile and let hardware detection run its course</li>
<li>Swap the hard disk controller drivers to VirtIO (for KVM) and AHCI (if you have a SATA host controller, that is)<br/><b>The Details:</b><br/><br/>
<ol>
<ol>
<li>Installing Windows using the standard IDE driver allows for being able to boot the same installation in KVM as well.</li>
<li>The separate Hardware Profile ensures that Windows doesn't go through lengthy hardware detection after each switch from physical to virtual boot-up and back.</li>
<li>The somewhat tricky bit is swapping to the right hard disk controller drivers afterwards, for decent I/O performance. For KVM VirtIO that is relatively easy - simply add a small VirtIO device to the configuration and let hardware detection install the drivers from the KVM driver vfd floppy image at <a href="http://alt.fedoraproject.org/pub/alt/virtio-win/latest/images/bin/">Fedora</a>.<br/> You may then use <code>virsh edit</code> to change the original disk configuration from <code><target dev='hda' bus='ide'/></code> to <code><target dev='vda' bus='virtio'/></code> (and drop the dummy device).<br/>
<p><br/> Switching the physical Windows setup from IDE to AHCI cannot be achieved in that easy way, if you have an AMD SB800 south bridge that has different PCI device IDs for IDE (4390) and AHCI (4391) mode (consequently thwarting parallel installation). There, some registry <a href="http://www.wikihow.com/Install-Ahci-Support-for-Ati-Sb600-Sata-Controllers-on-Existing-Windows-Installations">tweaking</a> is required after you have copied <code>ahcix86.sys</code> from the unpacked AMD driver package to <code>system32/drivers</code>:<br/> <code><br/> [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CriticalDeviceDatabase\pci#ven_1002&dev_4391]<br/> "Service"="ahcix86"<br/> "ClassGUID"="{4D36E97B-E325-11CE-BFC1-08002BE10318}"<br/> <br/> [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ahcix86]<br/> "Type"=dword:00000001<br/> "Start"=dword:00000000<br/> "ErrorControl"=dword:00000001<br/> "Tag"=dword:00000021<br/> "ImagePath"="system32\\drivers\\ahcix86.sys"<br/> "Group"="SCSI Miniport"<br/> "DisplayName"="ATI AHCI Compatible RAID Controller"<br/> <br/> [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ahcix86\Parameters\PnpInterface]<br/> "5"=dword:00000001<br/> </code><br/> With the AHCI driver thus enabled, you may reboot and switch the BIOS SATA setting from IDE to AHCI without facing the typical "Unknown boot device" BSOD in result.</p>
</li>
</ol>
</ol>
</li>
</ol>How to repair an ext3 filesystem after mkdosfs format2009-02-05T20:42:44+00:002024-03-27T17:30:07+00:00Lars Steinkehttps://blog.lsweb.eu/blog/author/lss/https://blog.lsweb.eu/blog/how-to-repair-an-ext3-filesystem-after-mkdosfs-format/<p>After shrinking a large <a href="http://en.wikipedia.org/wiki/Ext3">ext3</a> partition using <tt>gparted</tt> to make space for an additional partition, I did not take sufficient care to notice the leading partition I newly created with <tt>cfdisk</tt> subsequently was denoted as <tt>sdc<u>2</u></tt> instead of <tt>sdc1</tt>, as one might expect.</p>
<p><br/> Thus woe ensued when I issued a <tt>mkdosfs -F 32 /dev/sdc1</tt> command without a closer look at the new partition numbering.</p>
<p><br/> So the interesting question now was, what can be salvaged from an ext3 filesystem with overwritten superblock (as well as a few of the inodes)?Luckily, the erroneous reformatting was FAT32, not ext3, which would have caused the inode block pointers to be zeroed, to quote the ext3 <a href="http://batleth.sapienti-sat.org/projects/FAQs/ext3-faq.html">FAQ</a>:<br/> <q>In order to ensure that ext3 can safely resume an unlink after a crash, it actually zeros out the block pointers in the inode, whereas ext2 just marks these blocks as unused in the block bitmaps and marks the inode as "deleted" and leaves the block pointers alone.</q><br/> <br/> What could be done was this:</p>
<ol>
<li>Find out the location of the backup superblocks, either using<br/>
<ul>
<li><tt>mke2fs -n /dev/sdc1</tt> or</li>
<li><tt>testdisk</tt> (Advanced>Choose sdc2><a href="http://www.cgsecurity.org/wiki/Advanced_Find_EXT2_EXT3_Backup_SuperBlock">Superblock</a>)</li>
</ul>
</li>
<li>Call <tt>e2fsck -b 163840 -B 4096 /dev/sdc1</tt> (for a blocksize of 4096 that backup superblock at 163840 should be in the list you produced in the step before)</li>
<li>Check <tt>lost+found</tt> for what has been be salvaged by <tt>e2fsck</tt> - not bad at all, without having had to resort to file scrubbing tools like <tt>foremost</tt> or <tt>magicrescue</tt> (both available in <a href="https://help.ubuntu.com/community/DataRecovery#Extract_individual_files_from_recovered_image">Ubuntu</a>)</li>
<li>At actual loss were the inodes directly overwritten by the two FATs - sort of a black eye I came away with, really...</li>
</ol>How to boot a real harddisk in VMWare2007-01-08T19:53:00+00:002024-03-28T09:44:04+00:00Lars Steinkehttps://blog.lsweb.eu/blog/author/lss/https://blog.lsweb.eu/blog/how-to-boot-a-real-harddisk-in-vmware/<p>The knack is to install the VMWare SCSI driver (included with VMWare Tools) <u>before</u> booting the SATA or PATA harddisk.</p>
<p>Then configure it in the VMX config file as follows:<br/> <code><br/> scsi0:0.present = "TRUE"<br/> scsi0:0.fileName = "win_raw.vmdk"<br/> scsi0:0.deviceType = "rawDisk"<br/> scsi0.present = "TRUE"<br/> scsi0.virtualDev = "buslogic"<br/> </code>Here's the contents of <code>win_raw.vmdk</code> for my harddrive:<br/> <code><br/> # Disk DescriptorFile<br/> version=1<br/> CID=adf9ef51<br/> parentCID=ffffffff<br/> createType="fullDevice"<br/> <br/> # Extent description<br/> RW 625142448 FLAT "/dev/sda" 0<br/> <br/> # The Disk Data Base<br/> #DDB<br/> ddb.virtualHWVersion = "3"<br/> ddb.geometry.cylinders = "38913"<br/> ddb.geometry.heads = "255"<br/> ddb.geometry.sectors = "63"<br/> ddb.geometry.biosCylinders = "38913"<br/> ddb.geometry.biosHeads = "255"<br/> ddb.geometry.biosSectors = "63"<br/> ddb.adapterType = "buslogic"<br/> ddb.toolsVersion = "6404"<br/> </code><br/> And how to get those parameters? Exents und geometry can for instance be deduced from <code>hdparm /dev/sda</code>:<br/> <code><br/> /dev/sda:<br/> IO_support = 0 (default 16-bit)<br/> readonly = 0 (off)<br/> readahead = 256 (on)<br/> geometry = 38913/255/63, sectors = 625142448, start = 0<br/> </code></p>