Turning an existing phone into a virtual machine - General Questions and Answers

I have an older Samsung Galaxy SII phone that I'm using to 'play with', to get a better understanding of the android file-system and how everything works.
What I'm trying to do is converting this existing phone to a virtual machine. I already tried to following;
- I made a physical image of the device and got a nice .bin file.
- I converted the .bin file to a virtual disk in .vdi format
(Linux command; "VBoxManage convertdd galaxy-s2.bin galaxy-s2.vdi")
(I also tried the following command, for a VMWare virtual disk; "sudo qemu-img convert galaxy-s2.bin galaxy-s2.vmdk", same problem in VMWare when booting)
- Then I created a virtual machine in virtualbox and selected the .vdi image. Obviously it didn't work, because I guess it's missing a bootloader?
(Error message; "FATAL: No bootable medium found! System halted.")
The above steps were the easy way and I already had in mind that this was to easy and not going to work.
So my questions are;
- Does anyone have any feedback about the above steps I took? Was "vboxmanage" the right tool to use or did I miss something?
- Is there a way to add a bootloader to a raw .bin file and converting it to a bootable virtual harddisk?
- Does anyone already tried converting a used phone to a virtual machine, containing the original data of the physical phone, etc.?
Thanks! Looking forward learning more about virtualizing existing physical phones. :good:

What you are doing sounds super interesting. I still consider myself a novice at digital forensics but maybe I can help you out.
How did you image the device? Getting a physical image of a device is a bit tricky. From what I remember, you either have to root the device and then run dd on several files in /dev/mtd, or use special forensic tools (MPE, Cellebrite, XRY,…).

kolejnik said:
What you are doing sounds super interesting. I still consider myself a novice at digital forensics but maybe I can help you out.
How did you image the device? Getting a physical image of a device is a bit tricky. From what I remember, you either have to root the device and then run dd on several files in /dev/mtd, or use special forensic tools (MPE, Cellebrite, XRY,…).
Click to expand...
Click to collapse
Thanks! In this case I got a physical image of the phone with the "Universal Forensic Extraction Device" from Cellebrite. I think that tool does some sort of temporary rooting.
I also created a new virtual machine with a similar Android version iso file. I added the virtual hard-disk of the phone I imaged (the Galaxy SII) to that virtual machine. When I wanted to install Android to a blank virtual disk, it did recognize the Galaxy SII image, but I was unable to mount it.
At the "choose partition" menu, during the Android installation, it said;
- sdb1 == EFI GPT == VBOX HARDDISK
Then I got an error, saying; "Cannot mount /dev/sdb1", "Do you want to format it?"
Maybe we need to find a way to add something to that raw image, like a bootloader or something? Or maybe I'm missing something else. I'll keep trying to get the virtual machine to work.. Any feedback or comments are appreciated, thanks!

Related

Grub2win doesn't load when turning on tablet

Earlier this week, I posted a thread here asking for help with my hybrid android/windows tablet (Neo Shift N81) that wouldn't boot anymore into Windows. Nobody was able to help here and I ended up going back to the store where I got myself a windows recovery USB. After several attempts, it finally loaded the thumb drive. It reinstalled windows, but what the installation ended up doing was reformat the WHOLE disk on my tablet thereby effectively erasing the partition containing android as well. crying: FML)
So now I have the opposite problem. Windows boots and android doesn't. A little bit of googling led me to Android x86, which is able to run on Intel processors like the one on my tablet. I ended up downloading the 4.4 rc5 iso since it said that would compatible with my 32-bit EFI firmware. I created a 7gb partition by shrinking the main windows one and formatted it as ext4. I placed the iso onto a 2GB fat-32 USB using UNetbootin. I was able to boot it by going into the BIOS and force booting it. I tried testing it by running the live option, but it didn't boot although I suspect that may have also been because the thumb drive I used was ancient (from 2008). Then I installed it to the partition I created earlier. I initially tried to select "do not format", but when I got to the GRUB install windows it wouldn't proceed when I selected "yes" (it just started what looks like a command prompt, except no commands were accepted and would just continue creating multiple lines). Reboot and I selected it to format the partition into ext3. This time, it would proceed beyond "yes" and installed normally. Except it still didn't boot into Android. There was no grub menu or anything and the tablet just automatically boots into Windows 10. (I do have secure boot and fast boot disabled in BIOS) When I check the BIOS, it also doesn't have Grub as one of the options.
What I then tried was the instructions at this link where I select "skip" upon the grub install window during android installation. Grub2Win does show up upon the boot options, but even if I try to force boot that option, it doesn't do anything.
So what now? is there another bootloader I could try? Did I even install android correctly or did I select an .iso not compatible with my hardware?? (Prior to android being erased by the windows installation, the android on my tablet was 4.4) The info page mentioned that the "second" is an EFI image, does that mean I should download the .img file? Please help.
I followed instructions mostly from here.

Dump an entire Surface RT to external memory

Hi There.
I need to be able to dump and restore a Surface RTs main block device.
I am aware of the secure boot issue (OS needs to be signed, cannot be disabled)
Ideas that I had to solve this issue:
1. boot a Windows RT Recovery from Stick
(try dd for Windows http://www.chrysocome.net/dd or WinDD https://sourceforge.net/projects/windd/ , maybe via win86emu http://forum.xda-developers.com/windows-8-rt/rt-development/win86emu-0-6-windows-rt-8-1-t3237587)
2. boot a Windows RT PE (same as Recovery)
3. find a signed ARM-Linux
Problems I face:
1. I found a recovery Image (even exploitable 8.0), but no shell access to execute arbritrary commands
2. WinPE ARM is not available to the public. Even though "Windows ADK" offers the Option "arm", the files are not shipped with the tool publically
3. Seems like this does not exits:
http://www.dailytech.com/Microsoft+...ing+on+Windows+8+ARM+Devices/article23785.htm
http://forum.xda-developers.com/showthread.php?t=2655398
Any ideas, folks?
thank you for reading.

Dualboot Android/Linux for Yoga Tab 2 830F

ALARM: the device could be bricked if something will go wrong.
Actually should work for 10' and 13' as well
Introduction
The Yoga Tab 2 devices are built on the Intel Baytrail SOC, which makes them not very different from cheap Intel Atom laptops and idea to make them run something more serious than Android is too tempting to resist. Even more interesting, the Windows version of the devices do exist, so running of the full desktop OS is definitely possible.
Beginning
The easiest method to boot Linux on the Yoga is to unlock bootloader and replace standard EFI loader with GRUB. To do it, use the set of files, available here.. Unzip the file, put the tablet into fastboot mode, connect to PC and use script hack.cmd to flash the ESP with GRUB. Now, the system will be booting the GRUB, which will normally boot Android (if no buttons is pressed). The volume buttons are configured as hotkeys in grub.cfg, so it is possible to load arbitrary system, supported by GRUB.
To modify the grub.cfg from Android, mount the ESP partition:
Code:
su
mkdir /esp
busybox mount /dev/block/by-name/ESP /esp
vi /esp/boot/grub.cfg
Kernel
The device is able to boot mainline Linux kernel in the described way, but due to erroneous ACPI tables majority of hardware won't work. I did my best to repair the tables to make system usable. Still, not everything is working, mainly screen brightness control and sound. The kernel development info is available at https://github.com/Trel725/yoga2linux
System
I've chosen Manjaro Linux as a distro to work with because of my own taste. It shouldn't be a problem to run any other distro with modified kernel, but I provide rootfs only for Manjaro.
How to get it working
1. Flash the modified ESP as desribed above.
2. Download the archive, create folder /factory/manjaro (folder /factory should be already present in the tablet) and unzip archive to that folder. It is necessary because GRUB can't access the external SD, so kernel need to be loaded from internal memory and then find SD card. /factory is just a partition, used for storing tablet configuration, and as it is usually empty for 90-99 % it is convenient to use it to store the kernel and initramfs.
3. Find a good SD card, format it to the ext3 or ext4 FS and unzip RootFS to the SD card. Insert card to the tablet.
4. Reboot and press Volume+ to boot Linux.
Some ideas
1. After tablet has booted Linux and USB is initialized, it keep it's state on reboot. This means that following trick is possible:
boot linux -> reboot -> get to GRUB (by pressing Volume-) -> USB keyboard should work as it was initialized -> go to the GRUB command line (press c) -> type exit, press enter -> should get to BIOS with working keyboard -> if USB flash disk was inserted before entering the BIOS (usb hub is needed as device has only one port) it is possible to boot from it.
2. TODO
Hello, do you have any Linux tutorials installed here?
Wordowg's post failed
Thanks for this, @Trel725.
No problem with 5.2 kernel? isn't it too new for such an old device?
Also -- maybe some stuff from here is relevant? e.g., WM5102.
NaEpoch said:
Hello, do you have any Linux tutorials installed here?
Wordowg's post failed
Click to expand...
Click to collapse
Which tutorials do you mean? Linux usage in general?
raenye said:
Thanks for this, @Trel725.
No problem with 5.2 kernel? isn't it too new for such an old device?
Click to expand...
Click to collapse
Linux is very good in backward compatibility, even support for 80386 (released in 1985) was discontinued only in kernel 3.8. Moreover, I am particularly interested in mainline kernel without need to support ancient code (like for majority of android devices).
raenye said:
Also -- maybe some stuff from here is relevant? e.g., WM5102.
Click to expand...
Click to collapse
Thank you for the suggestion. I didn't try the patch for WM5102 from github, hopefully it will work for mainline kernel. I will try to find some time for it in the future.
sorry,my bad
i mean install linux for yoga tablet2 ' tutorials.
The tutorials in the forums all failed.
If you are free, can you teach me how to install it?
Thanks very much.
Unfortunately I don't have time for complete guidance, but if you have any questions I will readily answer them. The more details you provide the easier to help you.
alright, Thank you all the same.
But if you have time, please help.
My E-mail is [email protected]
Just a simple tutorial.
thank you
I can get Manjaro to boot but it can't load LightDM. I'm on 1050L.
I cant get this to work... All i get is a shell command line. no dual boot. Doesnt default into Android if nothing is imputed.
I tried connecting a keyboard. And cant type anything in.
I feel some steps have been skipped.
Tried this and now can't do anything but sit in empty shell. Can't type, volume buttons do nothing

Android X-86 Guide for multi-boot with Windows 10 (dont do what i did)

So it has been a hectic few days for me as I had alas managed to wipe my system reserved partition thinking that installing android x86 as multi-boot would actually boot windows for me. Wrong!!! My first poor encounter was the fact that when I had installed windows it had created the system reserved partition as ntfs... I had not realized this when attempting to install android x-86 as multi-boot. I will tell you the result, when booting it would appear to go to grub, however instead it just booted the first menu on the list without hesitation and gave no menu at all. To remedy this I had to use the windows 10 usb i had created for my initial install. I am still not sure how i managed to get it to boot the first time I think it may have just been dumb luck. When windows booted up i went to Disk Management (right click the windows menu and select from the drop down) where I then proceeded to delete the system reserved partition and reformat it fat32. At this point I was satisfied that android would point the out the windows boot, boy was I wrong. After installing Android x86 (_64 8.1 r3) I finally achieved the grub menu boot correctly. I also noted that when installing android x86 the only way it gave me option to add windows to grub was if i had installed without formatting first. (this can be done a few ways including just reinstalling much the same way you would dirty flash a rom on a phone) or you could use a tool to format the partition such as gparted or a linux live cd/usb. I suggest ext4. Oh wait my nightmare hadn't finished yet... Android x86 install had no problems at all (select partition to install(ext4)... do not format... install grub... yes to windows... yes read write... and then reboot) on reboot windows was in the grub menu and I selected it... oops there is no operating system!!! Well that is unsettling... ( I managed to get back into windows using the install media) and not so sure how. At this point i notice that my system reserved partition was now sda 3) So my next objective was to create a boot record for windows which could have been done easily from windows had I considered using bcdedit tool for windows. But since i knew that the partition was sda 3 I figured I could just point the grub menu to the correct drive... again wrong (there was still no boot mbr on that partition *sigh) Well I found that when i went into command line from the windows repair tool it would say I do not have permission to fixboot... wow nice job microsoft... after doing a bit more research I learned that the newer builds give this error when attempting to fix boot. I found a video on youtube which helped me alot but took quite a while to download the older working repair tool(installation media) but his video was fairly well put together. link here (https://www.youtube.com/watch?v=lRCyb7FzWFY). I followed his guide and this time with the repair tool that he shared in the description of his video, I was able to perform the fixboot (bootrec /fixboot) however one of his commands required the copying of bcd to the system reserved partition. The copy failed, however at this time running all the other bootrec commands seemed to go fine. So I exited command and went to the automatic startup repair, which to my surprise worked perfectly... (after a whopping 30 some hours of pulling my hair out of my head over this mess) And windows began to boot. At this point I gave my thanks to the poster of the video and shared my experience with his video in the comments below.) Now When windows booted up I downloaded the bcdedit tool. Personally I used the multi boot tool from this site (https://www.boyans.net/dual-boot-repair-windows-10.html) and selected repair mbr and boot record. This fixed my boot issue windows would boot normal at reset. However now my android was gone but thats okay.
At this point I just reinstalled the android x86 again over the same ext4 partition without formatting and added the windows to grub. This was perfect however when selecting windows did not boot. To fix this I had to edit the grub menu.lst and change the drive from hd(0,0) to hd(0,2) to point to the fat32 partition which had been somehow displaced to sda3. In order to do this I ran android in debug... when debug is running just hit enter and it give you a prompt... from prompt type without quotes "cd /mbr/grub" when the next prompt comes up you should be in the grub directory where the menu.lst is. Now type without quotes "vi menu.lst" this will take you into a text editor (note you can also change your monitors and resolution permanently in grub menu this way) using the arrow keys navigate to the line you want to edit, in my case the last entry which was windows entry when you get to where you need to edit hit the "i" key this will allow you to now enter and edit the text. After making changes hit "esc" to save changes type ":w!" then hit enter. To exit type ":q!" this will take you back to prompt. Now reboot your system and finally the results I had originally hoped for a multi-boot system with windows 10 and android. Now if you are attempting to do this and are looking for a guide to install I will make this just a little longer to make sure you dontt make the same mistakes I made.
1a) before you attempt to install a dual boot with grub... make sure your system reserved partition is fat32 if it is not you need to change it to fat32. as grub will not boot on ntfs partitions.
1b)you will need to have a blank partition, if you have spare room on the drive you can shrink your volume and create a new one. There are plenty of tools out there to format ext4 even from windows. Make sure you format it before installing. (if you are lazy like me you can format ext 4 from the installation, but there is a chance that you would need to reinstall again and choose not format to get the windows entry in grub)
1c)once your partitions looks the way you need and you have a working fat32 system reserved partition you are ready to move on. ( If you have to change a ntfs partition to fat32 I highly suggest you dont install anything until you have repaired the boot menu and tested it first to make sure it works)
2)create your install media... I prefer to use rufus as it is quick and easy, and I prefer the official android x86 as the 8.1 r3 is stable and works great, you can use whatever image you want though, lord knows i test newer versions as they come out. when you have rufus and the android x86 iso of your choice load rufus select your usb drive and select the iso with the browse button. then just hit start allow it to format and when it is done you can boot into your usb
3)To boot into your usb you may actually need to edit your bios and enable virtualization and make sure safeboot is not enabled, also you need a uefi system for x64 distros so if you have an older legacy bios you will need the x86 version instead or the system wont boot
4)When you finally get it to boot you will find the menu to use it as a live cd or install, select the install.
5a) You will now be asked where to install to. Pick the ext 4 partition you created for it.
5b) Now it will ask you to format choose do not format (again if you hadn't formatted the partition ext4 you may do it now, but you may have to reinstall and not format the next time to add windows to the grub menu)
6) You will now be asked to install grub answer yes, if you do not answer yes you wont be able to get back into your android partition again until you do.
7) Now it will tell you that it found a windows partition and asks you if you want to add an entry, select yes... if you do not you will have to make your own grub entry to get back into windows later or completely delete grub from the partition later.
8) Finally it will ask you if you want to make the system read write... select yes, if you select no i can not guarantee you will be able to install anything inside of the system.
10) The end... Installation finishes but do not click launch... instead click reboot. The reason for this is that I have noticed if you launch at the end of installation the grub somehow manages to disappear and you end up having to completely start over.
Enjoy your android x86 / windows multi-boot system.
make sure your system reserved partition is fat32
Click to expand...
Click to collapse
There is no system reserved partition on my laptop since I have a UEFI laptop.
Should I proceed ?

Extract (dump) all partition images from Huawei e8372h under GNU/Linux

Hi there everyone, how would one go about checking what partitions are present on devices such as Huawei e3372h or e8372h and how to dump them using gnu/linux. I am OK with terminal/shell scripting, I've done some basic Arduino/Raspberry projects, but I want to get more into firmware (binwalk, repackaging, etc). Where would one start? What tools shall I look to familiarize myself with? I very much want to avoid using blobs like pre-compiled windows tools that are difficult to inspect. Is it possible to dump firmware (incl. boot partitions) using standard gnu/linux toolset (like dd) or at least tools that have source code available?
I have been looking for resources both here and on Russian/German fora, unfortunately most of posted solutions are based on Windows *.exe files and knowing a bit about Linux I am 100% sure that whatever these programs are doing is also possible to be done on Linux in a cleaner more transparent and reproducible manner (that is better for educating oneself).
Any hints much appreciated
If device's Android is rooted, if Android is version 6 and higher, then you can dd the partitions in question.
Thank you for your response! Is there an Android running on USB modems/routers such as Huawei e8372h? I am looking to dump all partitions from such device and to be able to restore them before I start any modifications. This way I should be able to restore devices to their original "factory" state if anything goes sideways (except if I hard-brick them).
I have a number of e3372h(-153) and e8372h(-153) devices that I can experiment with (they have different versions of firmware on them and the very-very first thing I want to do is to extract all images (including boot partition if possible) and test if I can restore from these backups). Only then I want to start modding them or checking other people's modifications...
So far I have managed to switch modes of these devices. For example for e8372 I can have it on the host machine (Ubuntu GNU/Linux laptop) visible as
virtual CD-ROM (/dev/sr0)
hi-link device (accessible from 192.168.8.1)
3 x TTY device (one of which can execute AT commands)
emergency boot mode with one TTY device
With the last one i have executed
balong-usbdload -p /dev/ttyUSB0 usblsafe-8372.bin (following https://gist.github.com/ValdikSS/323bcdfceb2f09d9c6ef02db1bc573e2 and https://github.com/forth32/balong-usbdload.git)
expecting to gain telnet acces to device and possibly dump the remaining partitions to the microDS card (using nanddump) but for some reason I still cannot log in using telnet
BTW Using Windows based tools that I have no source code for is pointless for me as my main goal is to learn the structure and functioning of these devices and be able to modify them myself.
If successful I intend to publish these images and tutorialize my notes on how to backup/restore, but for now I need a direction myself
IMO all tools, either compiled for Windows OS or Mac OS or Linux OS, in background simply run Android shell scripts.

Categories

Resources