Dual Boot Windows-Android on PC: How to switch OS programmatically? - android

In Windows, are there some command lines that would make the machine understand that Android should be the next boot (for one boot only -so once I reboot from Android I fall back into Windows)?
I am working on a notebook ASUS X200CA, UEFI-based machine, dualboot: Windows 8.1 and Android 7.1 (two different partitions).
When Android is installed, I get Grub2, so at reboot I can manually choose between Windows or Android. However, I want to be able to switch OS programmatically.
Basically, I am looking for the equivalent of Linux - efibootmgr -n xxxx or grub-reboot x before using reboot - that I could implement on Windows.
I tried to use bcdedit /enum firmware to check the ID associated to Android then ran bcdedit /bootsequence {ID}. At reboot, this led to an error like:
File: \efi\Android\BOOTx64.EFI Status:0xc000000d Info: The application
or operating system couldn't be loaded because a required file is
missing or contains error
(NB: secure boot disabled, fastboot disabled)
I tried to use EasyBCD, but since this is an UEFI-based machine I
didn't get very far.
I added Android to Windows Boot Loader using BOOTMGR, restarted, got
to Windows Boot Loader, found the Android option, manually picked it
and got the same error message (see above).
I tried Grub2win, you can modify the EFI boot order with it, but it
seems that it's not for one boot only.
I know that some tablets dual boot Windows-Android have wintoand.exe that allows to switch but I am not sure what's behind. Moreover, I would prefer to not have to use any software: I want to know what command lines can achieve what I need.
If you have some ideas of how to solve this or anything to read that could guide me, Thanks for sharing in advance!

I believe Grub2Win has the function you are looking for. Documentation will be found in the Grub2Win help under keyword Reboot.
The command format is:
C:\grub2\grub2win reboot x
where x is the menu selection number. This can be run from the Windows command line or a .bat file.
You will receive a message that the reboot has been scheduled.
If you wish to cancel a previously scheduled reboot, use this command:
C:\grub2\grub2win reboot none
Hope this helps.
Dave

Related

Nexus 7 developer build

I've been fighting Nexus Root Toolkit for a while and decided I must be missing something obvious. I have a Nexus 7 2013 edition. I flashed it 6 mos ago and the result was a fully-rooted device that, when I opened an adb shell, the shell opened as root. I recently flashed it up to Marshmallow and I no longer have root when the shell opens. For the life of me, I cannot figure out how to get that back.
When I do adb root, I get a warning that adbd cannot run as root in production builds, so clearly I have a production build and need to change it, but I'm not sure how or to what.
I have figured this out - took a while to remember. NRT comes with a "modified boot.img" which can be used, according to the tool, to "temporarily boot a modified boot.img to enable running privileged commands". Last time around, I replaced the boot image with this temporary image.
I'd do that now, but the current modified boot image never fully boots. I get full device access via adb (including shell which defaults to root), but the OS won't fully load.
I will update this answer when a new boot image is released which actually works. Meanwhile, it'll be tedious but I'll just keep putting it into 'temp boot image" mode when I need this access.

Galaxy Note 1 not listed under adb devices

I just installed android sdk. And trying to follow these steps to detect my device. Because my phone was disconnected & dead during an unfortunate/accidental/unwelcome software upgrade.
It's frozen on Samsung start up screen. I was able to use volume + power + home buttons to get into another black screen with now send the package you want to apply to the device with adb sideload <file name>. But not sure how to sideload from adb when I can't even detect my device. All I want is to retrieve my data & start up my device as normal.
Within the Command Prompt under platform tools, I typed adb devices. But no device listed. I am currently installing the Samsung Galaxy Note MTB device driver.
Can someone please guide me to the correct steps? There has to be a way to retrieve the data from the internal memory right?
Edit 1:
According to this article, I am not sure if my phone is bricked or trap in a bootloop...First of all, lets get something straight. Most people use the term "bricked" improperly. A bricked phone means one thing: your phone won't turn on in any way, shape or form, and there's nothing you can do to fix it. It is, for all intents and purposes, as useful as a brick. A phone stuck in a boot loop is not bricked, nor is a phone that boots straight into recovery mode. These are things you can usually fix, and they're a lot more common than a truly bricked phone. If your phone is actually bricked, you won't be able to fix it yourself (but there are things you can do—see the end of this article)
Edit 2:
PC specs : Win Vista, 32-bit
After installing MTP drivers I am at this point. However within adb devices command I only see <aserial number> recovery. It doesn't say <serial number> device
Do I still have a hope to get to my data?
Your phone may be stuck in a BootLoop It wont get detected using adb try using FastBoot if not you should contact your samsung service center to reload software . Your data is lost in this case.
UPDATE
try downloading sp flash tool check your phone is detected if so you can have some hope in data recovery

Adb stops detecting my phone after a while

I am developing for android on a linux machine and I have already created a udev rule for android and it works. After a while if I unplug the device and plug it back in again, adb doesn't recognize the device if I run lusb or dmesg to get information about the device. I tried reload the udev rules and it does not work, I even tried to kill the adb process but it still does not work.
Can someone help?
Anyway, thank you.
This appears to be a real problem on linux, at some point in time a device will no longer be seen by the ADB. What I should really say is almost never be seen by the ADB. In my case I have a Samsung Galaxy Tab 10.1 that was given to attendees of Google I/O 2011. My Ubuntu 10.10 development system was working just fine with this device. Sometime near September 19th the ADB stopped seeing the device! In fact there have been breif moments in time when the device was detected by the ADB. What needs to be made clear about the problem that I and I believe pharaoh are having is not the permissions issue where executing
$adb devices
returns ?????????? for a device. The device simply does not show up in the list. One more important fact is that at no point in time has this device not been detected on my Windows based development machines.
It appears to me that the mechanism that the ADB uses to determine if a device on the USB is in fact a adb_device is fragile and some change in either our devices or our development systems has broken this detection.
Due to some reason sometimes adb gets disconnected, so in that case you have to restart the adb.
Go to DDMS->Devices and you will see Reset adb option in View Menu besides Screen Capture option.
I usually have this problem due to I have installed the adb plugin on Chrome. If I close Chrome and re-connect the device, it appears listed with adb. Hope this helps.
I just had this problem as well with my OnePlus 2.
It was working the previous day. I had then set up port-forwarding using the 'device inspector' dialog in Chrome DevTools. It's supposed to be kept open for it to work, so I kept it open in a tab permanently.
The next day when I connected my device via USB, adb devices didn't list anything. I closed the device inspector dialog in my devtools and suddenly adb recognized my device again. I re-enabled port forwarding after this, but my device is stll being detected.
tl;dr: Close your port-forwarding dialog in Chrome DevTools if it had been kept open even after you removed your device.
I've had this happen before. I disable, and then re-enable debugging on the phone (Setting -> Applications -> Development -> USB debugging, uncheck, then re-check) to get it recognized by adb again.
Try adb kill-server to stop the adb and use another command 'adb devices' to restart it. It should work and it should detect your device again. ( For those who can edit my post: any other commands will start the server not just adb start-server, so don't edit without to leave a comment at least)
May be stupid, but I have been had similar problem right now and after an hour I noticed that the problem was that my USB hub, in which such devices are connected, were not actually connected to the PC.
In fact, the USB wire WAS connected, but they may not being doing good contact for some reason, so it failed randomly from time to time.
Same problem here, using mac os. However connected devices are recognized by Android File Transfer application. It all started with S3 phone (rooted), I thought something wrong with the phone, because Nexus 7 (stock) worked as intended. After 3 days of connecting/reconnecting it stopped being recognized by adb too. Tried to perform a hard reset - didn't help.
adb list - empty list
android file transfer - works perfectly
I'll run out of devices soon
Same problem observed on ubuntu, I tried the following and it worked:
Reference: link
Use the command udevadm from the above reference for ex:
"sudo udevadm test --action="SUBSYSTEM=="usb", ENV{ID_VENDOR_ID}=="[vendor_id]", ENV{ID_MODEL_ID}=="[model_id]" MODE="0666", SYMLINK+="[Device_Name]"" $(udevadm info -q path -n /dev/bus/usb/001/[DevNum])"
This seems to fix some link files and that solved the problem of adb not detecting device after a while.

"Unable to open log device '/dev/log/main': No such file or directory"

I am new to Android development and bought a cheap Huawei Sonic (U8650 apparently) so I could test my first attempts at making an app on an actual device.
However, whenever I try to use 'adb logcat' or 'adb shell' then 'logcat' on the device I get:
Unable to open log device '/dev/log/main': No such file or directory
I have already enabled Usb debugging in Settings -> Developer.
I just don't know enough about Android to know if this is something I can even fix.
I have found two other questions with similar problems:
/dev/log/main not found
??-?? ??:??:??.???: INFO/<unknown>(<unknown>): Unable to open log device '/dev/log/main': No such file or directory
...but they both turned out to be using some kind of non standard kernel that had logging disabled. Mine is a stock phone out of the box.
It's a very cheap but snappy Android 2.3 phone, so hopefully it wasn't a total waste of money.
Any help would be greatly appreciated.
Dial this: *#*#2846579#*#*
Service menu will appear.
Go to "ProjectMenu" -> "Background Setting" -> "Log Setting"
Open "Log switch" and set it to ON.
Open "Log level setting" and set the log level you wish.
Reboot the phone.
Open: /system/etc/init.d/××× (not the same file on different ROMs, find the right file)
Find the line that says: rm /dev/log/main
Change the line to: # rm /dev/log/main (comments out the line, rm = remove, in case you were wondering)
Save and reboot
I'm sharing my case and solution:
My cellphone had a jellybean version oriented to performance (To be exact a Slim Bean ROM) with a Semaphore kernel (You can recognize it because when the cellphone is starting, the semaphore logo is shown). These kind of ROM have by default disabled the logging so I had to download the Semaphore Manager application (You can download it from here). After that, in the section "Modules" I had to turn on the Logger option as it is shown in the picture
Restart and the logcat should be working now!
I have actually found an answer for this finally!
I was having another aimless look to see if anything had been updated about this anywhere and came across a post on xda-developers about a slightly different Huawei device with the same problem.
http://forum.xda-developers.com/showpost.php?p=17774398&postcount=93
It actually worked. I have complete logcat logging on my Huawei Sonic (U8650) now.
Three cheers for not giving up.
Solution, copied from the xda (in case it is removed etc):
There is a hidden service-menu where you can set loggin up. The
service-menu is started by "dialing" this phone number:
*#*#2846579#*#*
I have a custom rom on my Samsung Captivate, but my approach may work for others as well:
Open up CMD or Terminal and type:
adb shell
logcat-enable
reboot
The rom I have is Continuum v6.1, but this still may work for others.
If you have the terminal emulator on the phone, you also may be able to do:
logcat-enable
and then just reboot the phone. I didn't try that, but it probably would work too. My phone is also rooted - don't know if that makes a difference.
it was enough to restart the Huawei device
adb shell
reboot
I'm having exactly the same problem.
Someone from xda-developers wrote something as follows in msg #33
http://forum.xda-developers.com/showthread.php?t=1169869&page=4
One of the reason it can't be rooted is this phone had removed the
"Logcat" mechanism from android. So, this makes most of rooting ways
malfunction.
Maybe right maybe wrong i don't know.Anyway it gives some idea about the case.

Can you get to a command line on the G1 phone?

I understand the Android OS is based on Linux. Does that mean the G1 phone has a terminal emulator and you can open a console and use commands like cd, ls, etc? Or failing that, would it be possible to write a terminal emulator for it?
On a related note, would it be possible to run a ssh server on the G1 and log into it over a wifi connection?
Actually, until recently everything you typed on the keyboard got echoed to a root shell. Nasty bug.
That said, you want PTerminal, from the Android Market.
As for SSH, yep. You can even install Debian on the phone.
Currently there are a few terminal emulators in the market and elseware on the web (quick google search and you'll see), but if you are running the latest OS patch level (RC30) you will no longer be able to get root at all. The shell's are still somewhat useful to poke around the file system and see the results of ps and top for example.
In case you don't know, it's worth pointing out that android has a fairly secure application sandbox. Each installed app runs as it's own user. Not many binaries on the phone are world-executable, and a lot of files aren't even world-readable.
However, I don't think anything is preventing you from copying executables to the phone and running them as a non-privileged user.
The android SDK comes with a tool that lets you run a shell from your development machine over USB. The su command does not work on the TMobile phone but does work on the unlocked phone that comes direct from google.
Very easy to flash back to RC29 and get root, I did and have Terminal Emulator running good. I just don't know many commands.

Categories

Resources