In Host-only networking mode, VirtualBox creates a virtual network interface called Host-only Ethernet Adapter on the host system. It is particularly useful when VMs not only want to talk to each other, but to the host system, too. Also, the traffic going through such an interface can be intercepted by binding a packet sniffer like Wireshark. Unlike other modes of networking supported, a static or dynamic IP can be set to this adapter.

A bug I stumbled upon in VirtualBox v4.3.20 running on Windows 7 Ultimate x64 is the IP of a freshly created host-only adapter getting reset every time it is configured manually. Surprisingly, I did not experience this bug on Windows 8.1 Enterprise x64 running the same version of VirtualBox. After quick googling, I discovered that bug#8796 and bug#11155 have already been reported. The video records the bug and the solution to it.

You can bind a static IP to the interface from Oracle VM VirtualBox Manager UI => File => Preferences => Network => Host-only Networks tab => Select the adapter => Click on the third button (Edit) on the right sidebar. Here, what you can see is, I have tried setting the IP and netmask to the host-only adapter several times. Every time I confirmed the IP-netmask pair by clicking ‘OK’ twice. Immediately after, when I reopened same dialog box, the IP and netmask get set to some random value.

To solve this issue, you need to set the adapter to obtain its IP address dynamically.

Navigate to Windows 7 Start Menu => Network => Network and Sharing Center => Change Adapter Settings => Right click on the host-only adapter interface => Properties => Select ‘Internet Protocol Version 4 (TCP/IPv4)’ => Click on ‘Properties’ button => Select ‘Obtain IP address dynamically’ radio button => Click ‘OK’. Now, you can set the IP-netmask of the adapter from inside VirtualBox and it won’t get reset any more.

Oracle VirtualBox’s is a robust virtualization solution and pretty much self-complete. So far, most probably you have used its built-in networking support without worrying about setting up an external DHCP server, e.g. TFTPD32 to supply network parameters to dynamic guest interfaces. The virtual machine receives its network address and configuration on the private network from a DHCP server integrated into VirtualBox. The server can be managed using VBoxManage dhcpserver command from command line or from the GUI, too. So far, so good.

Built-in server is a basic one, yet sufficient to meet the need of most of the applications unless you are into some advanced stuffs, viz. you may want to pass a dhcpd-option to the DHCP client sitting inside VM guest. One workaround is to set the VM to use Host-Only Adapter, disable the built-in DHCP server and run an external one. Ideally, the solution should work out-of-the-box. Probably due to a bug in VirtualBox 4.3.10 (on both Windows 7 Professional x64), it does not. Essentially, even after disabling the built-in DHCP server ( and running a TFTFD32 server bound to VirtualBox Host-Only adapter ( on host network, Ubuntu VM still receives DHCP OFFER packets from, i.e. the built-one. Attached is a transcript of DHCP cycle as captured by Wireshark.

The workaround I found is as follows:

  1. Remove built-in Host-Only Ethernet Adapter from Oracle VM VirtualBox Manager UI => File => Preferences => Network => Host-Only Networks tab => Select the adapter to be removed => Click on the second button on the right sidebar => Confirm removal
  2. Add a new adapter by clicking on the first button on the right sidebar of the same page. If asked, browse  VBoxNetAdp.sys driver. On my system, it is located at C:\Program Files\Oracle\VirtualBox\drivers\network\netadp.
  3. Set appropriate IP (here and netmask (here for the adapter by clicking the third button on the right sidebar of the same page. If you face the problem of IP and/or netmask getting reset, please refer to this post.
  4. Make sure built-in DHCP server bound to newly created interface is disabled from the ‘DHCP Server’ tab. ‘Enable Server’ check-box must be unchecked.
  5. Verify that built-in DHCP server not running from command line by issuing ‘VBoxManage list dhcpservers‘ command.
  6. Set appropriate parameters in TFTPD64 DHCP settings. Don’t forget to bind it to the IP (here of the new adapter.
  7. Boot up VM and verify the IP assigned to the guest interface by running ifconfig ethX (X = appropriate interface number). Also, the DHCP server offering the lease can be identified by running cat /var/lib/dhcp/dhcp/dhclient.ethX.leases | grep dhcp-server-identifier (X = appropriate interface number) command.
  8. Verify the same from the MAC <=> IP binding as displayed by TFTP64 main console.

What is Link2SD?

Link2SD is an app for Android 2.0+ users on their phone to move applications to the SD card by dual-partitioning the card. First partition gets mounted as external SD and remains available for general use, while the second partition (preferably formatted with an *NIX type file-system, e.g. ext2, ext3, ext4 etc.) holds executable(.apk), data, dalvik-cache(.dex) and library files(.so) for linked/moved application.Link2SD mounts the second partition of your SD card as /data/sdext2 and makes OS mounts it at boot time. When you select an application and press “Create Link” button you can select which files of the application will be linked and moved to SD card. Apk, dex and lib files can be moved and you can select all three or any two of three or even only one of them. Depending on what you select, Link2SD moves apk file, dalvik-cache (.dex) file and lib files (.so) to SD card’s second partition and creates symbolic links in original directories. Phone must be Rooted, of course.

How does mounting of second SD partition work?

After the partitioned SD card is put in the phone, Link2SD asks you to select the file-system of the second partition on SD, just chose the one you used. Once /system/etc/init.d/11link2sd script is created, you have to restart the phone.

What is init.d support and why is it needed?

init.d directory is the container of start-up scripts in a *NIX type system. These scripts are execute during system boot.Link2SD relies on the execution of /system/etc/init.d/11link2sd script which, in turn, mounts the second partition of SD card as /data/sdext2.

What is the Boot-Loop problem?

The SD card storage is dual-partitioned and put in the phone. Then, Link2SD generates mount script for the second partition of SD card and phone needs to be re-started. Some phones, e.g. Sony Xperia-L runs into infinite boot-sequence a.k.a. boot-loop. In this state, phone boot sequence starts, manufacturer logo is displayed proceeds for a few seconds and restarts. Only solution is to long press the power button or taking out the battery to switch the phone off. Interestingly, if the dual-partitioned SD card is taken out and the phone is booted without SD card inserted, it boots normally.

What did I do with my Xperia-L so that it started boot-looping?

  1. Rooted Xperia using Rootkit method. It leaved /system/etc/ and /system/etc/init.d/00stop_ric scripts on the phone’s file-system. (Script code listed below). I am using the rooted phone for months without any trouble.
  2. Using an un-partitioned 32GB microSD card, formatted with FAT32, in the phone.
  3. Deciding to give a try to Link2SD, I dual-partitioned the SD using Minitool Partition Manager. First partition was formatted with FAT32 while the second one was formatted with ext4. Sizes of partitions were around ~25GB and ~4.5GB respectively.
  4. Installed Link2SD on phone.
  5. Switched the phone OFF.
  6. Put the dual-partitioned SD back in the phone slot.
  7. Switched the phone ON.
  8. Opened Link2SD app.
  9. Link2SD immediately recognized the second partiton, asking me for its file-system type.
  10. Selected ext4 from the list.
  11. Link2SD generated the mount script and prompted for restart.
  12. Restarted the phone.
  13. Boot-Loop!!!
  14. Switched the phone OFF by taking out battery.
  15. Took the dual-partitioned memory card out.
  16. Switched the phone ON.
  17. Phone starts normally!!!

How did I solve the problem?

  1. I installed Init.d Toggler app as described here.
  2. As described here, I experienced the problem of first partition not being mounted. The error was related to SD Card being empty or the file-system damaged.
  3. I re-formatted the first partition of SD with NTFS.
  4. Installed Paragon exFAT, NTFS & HFS+ app.
  5. Now, the first partition got mounted.

What does Init.d Toggler do?

  1. Appends the following command at the end of /system/etc/ /system/bin/sysinit
  2. Creates /system/bin/sysinit script.
  3. Creates /system/etc/init.d directory to put the start-up scripts in.

Does REALLY lack of init.d support cause boot-loop problem?

As the Init.d Toggler solution says,

One of the requirements to use the Link2SD is the support to init.d scripts. Most of the custom roms support this, but not the stock one, giving a boot loop.

I doubt that to be the “real” problem underlying the hood. Why?

  1. How come lack of init.d support cause the mount script /system/etc/init.d/11link2sd malfunction? At most, what could have happened is, it would NOT mount the second partition, that’s it. Right? But, isn’t it surprising to crash or the like during boot?
  2. As stated, even prior to installing Link2SD, there always existed /system/etc/init.d/00stop_ric, which contains almost similar set of commands as that of mount script /system/etc/init.d/11link2sd created by Link2SD. It used to work like a charm. I guess, because of init.d support not being there in stock ROM, the script had never been executed before I used Init.d Toggler.
  3. Had the lack of init.d support been the reason of boot-loop, how did the phone manage itself to boot normally with the dual partitioned SD card taken out? Please note that, the mount script was still residing in init.d directory.
  4. To be noted that, Xperia L (Stock ROM) boots fine with a dual-partitioned SD card put in, though it never mounts the second partition.

Please find the relevant scripts below.

Those who have played Jewel Mania (by TeamLava Games) on Android know how addictive it is! To cheat Jewel Mania for unlimited coind and gold, you need to have the following:

Now follow the steps below:

  1. Start Game-Killer, minimize it to the top left corner of the screen.
  2. Start Jewel-Mania.
  3. Bring Game-Killer in front. Type in the current count of coins from the game to the search item field of Game-Killer. (In this guide, the value is 60,090)
  4. Hit ‘Search’.
  5. Select ‘DWORD’ in the next step as the type of memory location to search for.
  6. Game-Killer will list out the memory locations where the value occurs.
  7. Modify the values of all the listed locations to some high number, say 99999999 until the correct one is found. When the correct location is found, the count of coins in the game changes, too, instantaneously. So, keep an eye on that.
  8. Now, you are the proud owner of virtually unlimited coins. But, it is not of much use unless you earn gold, too, right? So, what I did is, I repeated the same procedure as described above for gold, listed down a number of memory locations, then played the game a little bit, spent a few gold and searched for the reduced count of gold from the memory locations already listed in Game-Killer. Every time I tried doing the same, I found a generic pattern! The memory location holding the count of gold is 0x50 (HEX) offset smaller than that holding the count of coins.
  9. So, here goes my recipe. You need not do anything but simply calculate the memory address of gold by subtracting 0x50 from the memory address you have already found for coins. (In this guide, the address is 0x61FEDFDC). Switch over to RealCalc’s HEX mode to perform this calculation.
  10. Go back to Jewel-Mania and Game-Killer once again. This time, as you know the exact memory location, you need no search it over again. Instead, click on “Add Item” and select “Add Address (HEX)”. Feed the address you have calculated in RealCalc. (In this guide, the address is 0x61FEDF8C)
  11. Again, modify the values of all the listed locations to some high number, say 99999999, to obtain unlimited gold.
  12. A word of caution, every time you connect to Internet, Jewel-Mania will refresh game data and the values will be lost. You progress will remain saved though. You may need to repeat all the steps above sometimes once you disconnect from Internet. However, despite having new memory locations for gold and coin as the game is re-strarted or game-data is reloaded, those will always differ by an offset of 0x50.

Good luck and happy hacking!