[HOW-TO] Modify system files without root - Nexus 5 General

I was experimenting how to modify system files on a stock system image without installing superuser and thought I'd share what I found:
What you need:
android platform tools (ADB and related files, FASTBOOT)
custom recovery (I used TWRP). You need to be able to gain adb root access, which is not possible using a 'production' image (to quote google's error message when I tried this) which is why you need to have a custom recovery. WARNING!! If you perform an oem unlock of your device to unlock the bootloader, you will be forced to wipe your device, proceed at your own risk! I am not responsible for what you do with your device.
Administrator access on your pc (if using windows)
In my example I was modifying /system/etc/gps.conf to use local time servers for faster GPS lock. To do this I rebooted into my custom recovery, mounted the system partition (rw) and used:
Code:
adb pull /system/etc/gps.conf
I then edited the file locally to use the desired NTP server with notepad++.
following this I used:
Code:
adb push gps.conf /system/etc/gps.conf
At this point I rebooted and used:
Code:
adb shell
to run the cat command on /system/etc/gps.conf and confirm my updates were now visible in the updated gps.conf file.

Hi friend! Can you help me?
C:\adb>adb push gps.conf /system/etc/gps.conf
failed to copy 'gps.conf' to '/system/etc/gps.conf': Read-only file system

reijr said:
Hi friend! Can you help me?
C:\adb>adb push gps.conf /system/etc/gps.conf
failed to copy 'gps.conf' to '/system/etc/gps.conf': Read-only file system
Click to expand...
Click to collapse
In TWRP mount system

I've used this before to change my build.prop
After updating to the latest build on Nexus 5, this no longer works.
I can pull and push the build.prop boot on reboot the original file returns.
Any ideas ?

Related

[RECOVERY][v500][CM12] Cyanogen Recovery

Cyanogen Recovery (20150313) for LG G Pad 8.3 v500. This custom recovery installation package is for v500 models only. Built from source on 2015-03-13 by Jenkins.
Installation: Flash zip file with any custom recovery and reboot into updated Cyanogen recovery.
v500-cyanogen-recovery-20150313-signed.zip
MD5: 7c63b9ecb88eb4bd49a7ef56e1ff137e
Note #1: An advantage to using the official Cyanogen Recovery with CM 12 is that the Cyanogen Recovery can be automatically updated with the CM Update tool, if "update recovery" is enabled in the CM 12 developer options.
Note #2: Cyanogen Recovery *requires* properly signed flashable zip packages in order for them to pass the signature verification integrity check and complete the install process. Below is an example of how flashable zip file packages must be signed in order to pass the verification integrity check within the Cyanogen Recovery:
Code:
java -jar signapk.jar -w testkey.x509.pem testkey.pk8 GApps.zip GApps-signed.zip
Notice that the "-w" option is required for properly signing zip file packages with signapk.jar.
Manual Installation (first time installing custom recovery):
1) Gain root permission (ie; with Stumproot) and install SuperSU and Busybox.
2) Install Terminal Emulator or use ADB for opening up a shell (this example is using ADB).
Note: If using Terminal Emulator, make sure root access is given via SuperSU.
3) Download Cyanogen Recovery installation zip file from the link above and manually extract it. Also, download the loki_tool binary from https://github.com/djrbliss/loki/archive/master.zip. The loki_tool binary is found in the "bin" folder of loki-master.zip after the file is extracted.
4) Copy recovery.img (contained in the Cyanogen Recovery installation zip file from step #3) and the loki_tool binary (contained in the loki-master.zip file from step #3) to /data/local/tmp on your LG G Pad 8.3 v500 tablet with either ADB or a root explorer application and make loki_tool executable.
Code:
adb push recovery.img /data/local/tmp
adb push loki_tool /data/local/tmp
adb shell
su
chmod 755 /data/local/tmp/loki_tool
Note: Since the command "su" was entered, the shell has root permissions to proceed.
5) Patch the recovery.img into recovery.lok using loki_tool:
Code:
dd if=/dev/block/platform/msm_sdcc.1/by-name/aboot of=/data/local/tmp/aboot.img
/data/local/tmp/loki_tool patch recovery /data/local/tmp/aboot.img /data/local/tmp/recovery.img /data/local/tmp/recovery.lok
Note #1: At this point in the installation procedure, there have been no permanent changes to the system. If there is an error or warning while patching recovery.img and creating recovery.lok, then stop this manual installation procedure. In most cases, the problem is that the version of aboot.img found on the device is probably not exploitable with loki_tool. This manual custom recovery installation procedure must be started over again from the beginning after flashing a loki exploitable aboot.img to the device (downgrading firmware should help).
Note #2: If recovery.lok is created successfully without any errors or warnings, then continue with the final step. The shell should still be open with root (su) permissions enabled from the previous steps.
6) Flash recovery.lok file with loki_tool and reboot to new custom recovery.
Code:
/data/local/tmp/loki_tool flash recovery /data/local/tmp/recovery.lok
exit
exit
adb reboot recovery
@Deltadroid You are really on fire! Nice work!
I understand this is official recovery, but what format is it?
Is it like TWRP?
Thank you for your great work! I'm now back from 'unofficial' releases to official.
Cal
It's just like cwm, but for cm12.
The only caveat is that all the packages you install must be signed properly to pass verification process.The signing signature is used like a md5sum to check the integrity.
I have an LG GPAD V410 Verizon that boots only to recovery. One of the things I did to try to get out of it was to install cm-12.1-20150901-SNAPSHOT-YOG4PAO23D-v410. From this I got a Cyanogen Recovery. Now adb devices command tells me that my Windows 7 computer is unauthorized for the tablet. I tried a factory reset and reboot and was still unauthorized. I thought if I got back to twrp, i could unlock adb. I used zipme apk to make TWRP_2.8.5.0_v410_bumped.img into a flashable zip, but it flunked Cyanogen's security check. All of the ways to get out of this involve using adb, like http://forum.xda-developers.com/lg-g-pad-83/help/soft-bricked-lg-g-pad-7-0-v410-boots-to-t3094137. I either need a way to get the proper signature on the zip file to install twrp, or I need a way to get adb authorized for my Windows 7 machine. Help!

[Guide] How to edit build.prop without Root (fix memory management)

We are fighting a losing battle against Google's Safety Net via Systemless Root and various mods which mask root.
For those of us who enjoy Android Pay this may be a worthy alternative to systemless root, which has and will continue getting blocked by Google:
-Ensure adb and fastboot is installed on your PC
-Boot to fastboot and install TWRP if you haven't already
Code:
fastboot flash recovery filename.img
-Reboot to Recovery (TWRP); select Mount -> check System and enable editing System when it prompts you
-Connect device to PC:
Code:
cd C:\Users\YourUsernameHere\Desktop
Code:
adb pull /system/build.prop
-The build.prop will be downloaded to your desktop
-Save a copy of the build.prop just in case and make the desired changes via Notepad++ (recommended). To fix the memory utilization look for the line which shows:
Code:
ro.sys.fw.bg_apps_limit=32
and change the 32 to a value between 32 and 100. I find with it set to 90 I can best utilize the 6GB of RAM. I am seeing between 4.1 to 4.4GB utilization in normal use and as high as 4.9 when I'm trying to fill the RAM.
-Once done, run this command to push the file back to phone:
Code:
adb push build.prop /system/
-Fix permissions as not to trip Safety Net (Android Pay):
Code:
adb shell
cd system
chmod 644 build.prop
-you can leave TWRP installed if you want but you can only take OTA with stock recovery. To install stock recovery reboot to fastboot and do:
Code:
fastboot flash recovery recovery.img
I take zero credit for the above. I wanted a solution for having proper memory utilization without root (Android Pay without the hassle) and found the commands on androiding.how
The only problem with the above setup is no adblock (AdAway). I chose to purchase an AdGuard license (root-less adblock) as a workaround.
Setting ro.sys.fw.bg_apps_limit=90 seems a bit high.......I noticed most Build.Prop on Custom ROMs are lower than that (between 40 and 60).
But what's the point of this when you have to unlock the bootloader to do so?

[GUIDE] Upgrade 4.5.15 rooted & encrypted -> 5.0.2 WITHOUT DATA/SETTINGS LOSS

as usual, if anything goes wrong, no responsibility etc
The official update tutorial for rooted users doesn't keep app data, only internal storage! This tutorial keeps EVERYTHING
This method allows updating from 4.5.15 (unlocked, encrypted, rooted) to 5.0.2 without any data (sys settings + app data + user data) loss
A FAQ section is present at the end of this post and will be regularly updated.
List of files to download while doing the following steps:
OOS 5.0.2 ROM
Codeworkx TWRP recovery
Latest Magisk
Terms and software used in this guide:
Fastboot / Bootloader = bootloader of the phone, it's a very low level mode of the phone that allows booting into recovery. Can be accessed by using the advanced reboot menu (enable in dev options) or by "adb reboot fastboot".
Recovery = a small operating system on the phone that allows you to do various operations even when the main OS (Android) is broken. This includes flashing ROMs, modifying stuff on the storage, etc. It's the Android swiss army knife. If you can get a phone to boot TWRP, then you can do almost anything.
Magisk = rooting software that uses a systemless method to keep SafetyNet working. Systemless = instead of modifying the system, every change is put in a separate image that is mounted "over" the system. When the system tries to access a file modified by Magisk, instead of reading it from the partition, it reads it from Magisk. It's recommended to use Magisk instead of SuperSU as of 2018.
ADB = tool that allows controlling the phone from your PC through USB. You can use it when you're in Android if USB debugging is enabled in the settings, or when you're in TWRP. Here, we mostly use it for transferring files directly (without MTP) and running commands (using "adb shell")
Note: For this guide you will be required to download and install Magisk. If you don't want your phone to be rooted, then at the end of this guide reboot into TWRP, wipe both caches and re-flash the OS. This will uninstall Magisk and any other root patch. Beware: it will reflash stock recovery, so if you ever want to re-root, you'll need to reboot to fastboot and flash TWRP manually.
Convention for commands that you will have to run:
a command line starting with "C:" means that it should be run on your PC
a command line starting with "~ #" means that it should be run on your phone (through adb shell) while in TWRP
a command line starting with "OnePlus5:/ $" means that it should be run on your phone (through adb shell) while in OxygenOS
Although the commands start with "C:", this is just for readability purposes. You should run everything from inside an empty directory with enough disk space and writing access.
Your phone will have to be plugged in to your PC from the beginning to the end. Also, make sure it has at least 80% battery before beginning, just in case.
I know, the tutorial is huge. This is simply due to the fact that if I just wrote "make a nandroid backup of this and that, flash, and restore the backup while doing this", then some people may encounter problems because not everyone knows how to do a nandroid backup, restore it, etc. Also, there are a lot of things that need to be done precisely that way and not another way, which explains why the tutorial is huge. Also, you may notice that there is a lot of commands to run throughout the tutorial, this is because that way, I'm sure that at the end, you will have done everything like I did it on my phone, so that if you have a problem it's much easier to figure out where it comes from.
Summary of what you need to do (this is only a SUMMARY to give you a preview of what the whole thing looks like, you shouldn't follow it except if you're really an expert since a lot of things need to be done precisely, instead you should follow the easier complete steps below):
Make a Nandroid backup of /data
Backup files on internal storage
Wipe everything (internal storage + /data + system + caches), and then format data (important!)
Push and flash the OOS zip
Wipe caches and reboot (to Oreo!)
When it reboots, make sure everything (features, like Wi-Fi and fingerprint sensor) works. Don't "save anything" though, everything you do will be erased when we'll restore your backup. This is just a "test drive" for Oreo.
Reboot to TWRP, wipe Data and restore the /data backup
Run the three commands to fix Wi-Fi and fingerprints
Reboot (to System) and check everything works (don't do anything, don't change any setting, just make sure it works)
Reboot to TWRP, rename the "Android" folder to "Android_oreo" on sdcard, delete everything else on sdcard and restore your internal files
Rename the freshly restored Android (nougat) folder to "Android_nougat" and rename "Android_oreo" to "Android".
Flash Magisk, wipe dalvik+cache and reboot to System
When in Android, everything should work except some apps won't have their data. This is normal. Open a terminal (either on your phone using Termux or from your PC using adb shell), elevate using su and rename "Android" to "Android_oreo" and "Android_nougat" to "Android" (this is so that it correctly restores permissions)
If everything works fine, delete the "Android_oreo" folder
First, if you have Xposed Framework (systemless or not) installed, uninstall it. Next, if needed, uninstall any Magisk module that is "Nougat-only" to prevent any problems afterwards.
Boot the phone to bootloader/fastboot (either using advanced reboot, or by using volume down button when you start your phone) and boot to the TWRP recovery by doing
Code:
C:\> fastboot boot twrp-3.2.1-0-oreo-8.1-codeworkx-cheeseburger.img
from your PC.
Next, in TWRP, make a backup of /data (using the Backup button). Then, still while in TWRP, run the following commands:
Code:
C:\> adb shell
~ # cd /sdcard
/sdcard # tar cvf twrp.tar TWRP
/sdcard # md5sum twrp.tar
<< md5 checksum of twrp.tar >>
/sdcard # exit
C:\> adb pull -p /sdcard/twrp.tar
When the above command has finished, make sure that the checksum of the received twrp.tar file matches the one previously displayed.
If it doesn't match, delete the file and run adb pull again. Don't continue following this guide until you have received a 1:1 (checksum-wise) backup of /data.
Code:
C:\> adb shell
<< WARNING: dangerous command! double check the following line is correct before pressing enter! >>
~ # rm -rf /sdcard/TWRP
~ # rm /sdcard/twrp.tar
That was for /data. Now, the backup for the internal storage:
Code:
~ # cd /sdcard
/sdcard # du -csh
<< you should see here the total size of sdcard, that'll give you an idea of how long it'll take >>
/sdcard # tar cvf sd.tar element1 element2 element... elementN
<< in the command above, replace "element1..N" by a space-separated list of what you want to have in the backup.
Keep in mind that your list HAS to contain the element "Android" (case is important). It contains the app data.
Let's say for example you want to keep only the photos you have taken (and nothing, nothing else that was on internal storage).
The photos are in the folder DCIM, so the command will look like this:
tar cvf sd.tar Android DCIM
(because you want DCIM, and Android has to be in the list, no matter where)
>>
/sdcard # md5sum sd.tar
<< md5 checksum of sd.tar >>
/sdcard # exit
C:\> adb pull -p /sdcard/sd.tar
When the above command has finished, make sure that the checksum of the received sd.tar file matches the one previously displayed.
If it doesn't match, delete the file and run adb pull again.
Keep in mind that anything you don't put in that list will not be backed up and will be lost!
Now, you have a backup for all the important stuff so we can start doing the real sh*t.
Now, the important step:
Go back to the TWRP home screen, press "Wipe", "Advanced Wipe" and there check "Dalvik / ART Cache", "Cache", "System", "Data" and "Internal Storage". Confirm using the slider at the bottom of the screen. Press the home button, then "Reboot" and "FastBoot". Now, type the same fastboot command as in the previous step to boot the recovery image. You'll enter the recovery as before.
Now, on your PC, in the terminal, type
Code:
adb push -p OnePlus5Oxygen_23_OTA_029_all_1801292040_d71af3d.zip /sideload
(note: here, we are not using "adb sideload", we are really using "adb push"). In TWRP, click Install, in the file manager go to /sideload and select the OOS zip file. Confirm by sliding. If you get an error, go back to home, click Mount and ensure System is not checked. Then try installing again. If it still does not work, reboot to fastboot, type command again, get to the recovery and install again.
When the zip-file is installed, go home, click "Wipe", "Advanced Wipe" and check both caches and confirm. Then, go home, click "Wipe" and then "Format Data". Then, go home, click "Reboot" and then "System". Your phone will now reboot to Oreo. It will take a long time, but do not turn off the phone. Let it run. On my phone, it took on average 2 minutes for that boot.
You'll be greeted by the "first boot" page. It'll ask you if you want to restore a backup or start anew, choose start anew. Connect to your Wi-Fi network and Google account. Follow all the instructions until you get to the home screen. There, make sure everything works (especially Wi-Fi and fingerprint sensor). Don't save your fingerprints yet, they will be erased afterwards. If everything works, you can continue following these instructions. If not, post a comment down there.
Now that you're at the home screen, go in the settings, About Android and click the build number 8 times to enable Developer Options. Go in there and enable advanced reboot. Then, reboot your phone into fastboot/bootloader using the power button. Type the exact same command as before to start TWRP. Once that you are in TWRP, run the following commands:
Code:
C:\> adb push -p twrp.tar /sdcard/
C:\> adb shell
~ # cd /sdcard
/sdcard # tar xvf twrp.tar
/sdcard # cp /data/misc/wifi/WifiConfigStore.xml /sdcard/
In TWRP, click "Wipe", "Advanced Wipe" and check only the "Data" partition. Confirm. Press home, then "Restore" and choose the backup in the list. Confirm to restore. Back to the terminal, we need to run the following commands otherwise Wi-Fi and fingerprints won't work:
Code:
/sdcard # cp WifiConfigStore.xml /data/misc/wifi/
/sdcard # rm /data/misc/wifi/wpa_supplicant.conf
<< WARNING: dangerous command! double check the following line is correct before pressing enter! >>
/sdcard # rm -rf /data/system/users/0/fpdata
/sdcard # rm /data/system/users/0/settings_fingerprint.xml
Note: the command above are ran from your PC in an adb shell while the phone is still in TWRP.
Reboot the phone to system and ensure Wi-Fi and fingerprints are still working. Right now you should already see your old home screen and all your apps, but the internal storage isn't there yet. Reboot in fastboot, run the command to get in TWRP.
Once TWRP has booted, run the following commands:
Code:
C:\> adb push -p sd.tar /sdcard/
C:\> adb shell
~ # cd /sdcard
<< WARNING: dangerous command! double check the following line is correct before pressing enter! >>
/sdcard # rm -rf Alarms Albums DCIM Download Movies Music Notifications Pictures Podcasts Ringtones
/sdcard # ls
<< now, look at the list of files that were printed, and rm anything left that is not called "Android" or "sd.tar"
<< WARNING: dangerous command! double check everything is correct before pressing enter! >>
if when you do rm <the thing> it tells you it's a directory, then do: rm -rf <thething>
if there's a folder called SomeFolder, do "rm -rf SomeFolder"
next, run this:
/sdcard # ls
Android sd.tar <-- expected output
/sdcard # mv Android Android_oreo
/sdcard # tar xvf sd.tar
/sdcard # mv Android Android_nougat
/sdcard # mv Android_oreo Android
If you don't have Magisk somewhere on your sd card, download it and upload it using MTP or adb. Then flash it using the Install button. Clear dalvik/cache and reboot to system.
When the phone has booted (again, it might take time), make sure USB debugging is enabled and run the following commands:
Code:
C:\> adb shell
OnePlus5:/ $ su
<< here, you might see a Magisk screen asking for superuser access. Allow. >>
OnePlus5:/ $ cd /sdcard
OnePlus5:/sdcard $ mv Android Android_oreo && mv Android_nougat Android
Now, try some apps and make sure all the data is there (especially games and Netflix/Hulu/etc). If everything is there, and the phone works properly, go back in the terminal and type:
Code:
OnePlus5:/sdcard $ rm -rf Android_oreo
Optionally, start the TWRP app and flash it, it can always be useful. You can also reboot to fastboot to do that.
Now reboot your phone (normal reboot) one last time.
There, working OOS 5.0.2 / Android 8.0.0 phone with no data loss.
Frequently Asked Questions
How long does the whole thing take?
Highly depends on the amount of data you have on your phone. Since it the USB port only supports USB 2.0, it may take 4 or 5 hours in total.
Will doing this void my warranty?
No.
Will I be able to install future OTA updates using the regular download-reboot-flash-twrp procedure?
Yep. Just use the regular method as you would have on Nougat.
Will I lose my data?
If you follow all the instructions, no. Even if you don't follow them, as soon as you have made a backup of /data and internal storage, then no matter how bad you screw up you could always get a working phone back.
I followed the instructions and now my phone doesn't work
Boot in TWRP, wipe everything, reflash.
questions will be added there in the future
Having WiFi and fingerprint issues
You sure it is a good idea to just delete those files? I would have guessed that I need to replace these (nougat version from backup) with the oreo version to have it working just like before the restore.
Code:
/sdcard # rm /data/misc/wifi/wpa_supplicant.conf
/sdcard # rm -rf /data/system/users/0/fpdata
/sdcard # rm /data/system/users/0/settings_fingerprint.xml
I'm having the issues with wifi and fingerprints. Neither one is working. I'll try to figure out how to fix this.
@zdimension Thanks for this guide, I don't have time to test it yet, but I have a question
pdluke said:
Code:
/sdcard # rm /data/misc/wifi/wpa_supplicant.conf
/sdcard # rm -rf /data/system/users/0/fpdata
/sdcard # rm /data/system/users/0/settings_fingerprint.xml
Click to expand...
Click to collapse
At this point in the procedure, adb shell is still using root (before flashing magisk) ? How is that possible ? Does the adb /sideload preserve root ?
olivier380 said:
@zdimension Thanks for this guide, I don't have time to test it yet, but I have a question
At this point in the procedure, adb shell is still using root (before flashing magisk) ? How is that possible ? Does the adb /sideload preserve root ?
Click to expand...
Click to collapse
These commands should be run while the phone is in TWRP. Also note that adb /sideload is not used here, only adb push.
pdluke said:
You sure it is a good idea to just delete those files? I would have guessed that I need to replace these (nougat version from backup) with the oreo version to have it working just like before the restore.
Code:
/sdcard # rm /data/misc/wifi/wpa_supplicant.conf
/sdcard # rm -rf /data/system/users/0/fpdata
/sdcard # rm /data/system/users/0/settings_fingerprint.xml
I'm having the issues with wifi and fingerprints. Neither one is working. I'll try to figure out how to fix this.
Click to expand...
Click to collapse
If you delete them, they will be generated automatically at the next system boot. But you could also make a backup of those three files before wiping /data, store that somewhere, restore Nougat /data and then restore your backup of those three files. The result would be the same.
Note: actually, not exactly. Erasing the first file won't change anything since it's not used anymore in Oreo, but the two other files contain the fingerprint configuration (list of saved fingerprints). So,
Either you remove the files and you have to save your fingerprints again at next boot
Either you restore them from an Oreo backup and you'll get the fingerprints you had saved during the "first boot" procedure when you rebooted the phone right after flashing the OS
But the result is mostly the same: everything works. Deleting the files ensures you get something clean. If you restore from an Oreo backup I can't guarantee the result (as it may interfere with other files from the Nougat backup).
10 bucks to make a script to do this all for me haha.
@zdimension Thanks for the clarification Another thing you might add to the files to download would be Magisk (optionally). In this kind of guide, I've always find it useful to download everything first.
olivier380 said:
@zdimension Thanks for the clarification Another thing you might add to the files to download would be Magisk (optionally). In this kind of guide, I've always find it useful to download everything first.
Click to expand...
Click to collapse
Oops, forgot to add it
I added the link, and also instructions for how to un-root afterwards for those who would want it.
To improve the guide, here are some ideas :
- You should highlight that rm -rf is a very dangerous command, and that it needs to be checked twice (especially the targeted folder)
- It could be useful to use the du -csh command to check the size of a folder (to estimate the backup time for example).
- As a safety measure, one could md5sum the tar file before and after using adb pull
What do you think ?
olivier380 said:
To improve the guide, here are some ideas :
- You should highlight that rm -rf is a very dangerous command, and that it needs to be checked twice (especially the targeted folder)
- It could be useful to use the du -csh command to check the size of a folder (to estimate the backup time for example).
- As a safety measure, one could md5sum the tar file before and after using adb pull
What do you think ?
Click to expand...
Click to collapse
Thanks for the ideas! I updated the post (and I added a changelog at the bottom for future reference).
Followed guide for successful upgrade from 4.5.15 encrypted, unlocked bootloader w/ Magisk root.
One note, after the first complete wipe and flash of the full ROM, it was getting stuck on first boot and never completed. Discovered that I needed to not just wipe the Data partition but Format it in TWRP, to clear out the old encryption I think. Magisk wouldn't install either until I did this.
@debork thanks for the positive feedback (all the merit goes to @zdimension of course)
@zdimension there are many people in the other thread https://forum.xda-developers.com/oneplus-5/how-to/official-oxygenos-4-5-2-7-1-1-ota-t3627003 that tried (unsucessfully) to upgrade from 4.5.15 to 5.0.1, maybe a link to this topic could be useful for them (if it's not too late).
Regarding the
Go back to the TWRP home screen, press "Wipe", "Advanced Wipe" and there check "Dalvik / ART Cache", "Cache", "System", "Data" and "Internal Storage".
Click to expand...
Click to collapse
I think it should be highlighted in red, since it is the actual "clean flash" (AFAIU, correct me if I'm wrong).
if we only have the BL unlocked non root and stock recovery can we only ota without any loss of data ?
debork said:
Followed guide for successful upgrade from 4.5.15 encrypted, unlocked bootloader w/ Magisk root.
One note, after the first complete wipe and flash of the full ROM, it was getting stuck on first boot and never completed. Discovered that I needed to not just wipe the Data partition but Format it in TWRP, to clear out the old encryption I think. Magisk wouldn't install either until I did this.
Click to expand...
Click to collapse
Thanks for feedback, I will add that to the guide (although it worked with just Wipe for me )
zdimension said:
Thanks for feedback, I will add that to the guide (although it worked with just Wipe for me )
Click to expand...
Click to collapse
Have you rooted the 4.5.15 with Magisk or SuperSU (which is not compatible with Oreo anymore) ?
olivier380 said:
Have you rooted the 4.5.15 with Magisk or SuperSU (which is not compatible with Oreo anymore) ?
Click to expand...
Click to collapse
I stopped using SuperSU when it was sold to that shady company. Also, Magisk is better imo.
quick05 said:
if we only have the BL unlocked non root and stock recovery can we only ota without any loss of data ?
Click to expand...
Click to collapse
Official OnePlus support said that nothing is guaranteed if your bootloader is unlocked. But since you're on stock recovery + non rooted, you could always try. But backup everything first. Some people here on XDA have reported that it doesn't work, though.
Just followed your guide with no problems. Thank you very much!! I can confirm also that you need to format data after the wipe otherwise it gets stuck in a bootloop!
Thanks so much for this. I was able to successfully follow the guide and get upgraded to 5.0.1 without losing any data. In fact, I even messed up one step by failing to include the Android directory in the sdcard.tar backup (perhaps that should be more explicit), but it doesn't seem to have affected everything; all of my apps seem to have retained their data.
A few notes:
1. The file size of twrp.tar was ~14GB but when executing the pull command, it recognized it as only ~1.3 GB. As a result, the pull was not complete until it reached over 1000%. All the more reason to do the md5 check.
2. As others stated, I needed to format the data partition, not just wipe it.
3. I might recommend also including a "summary" version somewhere on what this guide does. Scrolling through the guide the first time, it seemed pretty daunting, but really all that you're doing is: backing up data partition and internal storage; wiping device; flashing Oreo ROM; tweaking a few files; and restoring backed up data and internal storage.
Thank you again so much! Glad to finally be on Oreo.
elight3 said:
Thanks so much for this. I was able to successfully follow the guide and get upgraded to 5.0.1 without losing any data. In fact, I even messed up one step by failing to include the Android directory in the sdcard.tar backup (perhaps that should be more explicit), but it doesn't seem to have affected everything; all of my apps seem to have retained their data.
A few notes:
1. The file size of twrp.tar was ~14GB but when executing the pull command, it recognized it as only ~1.3 GB. As a result, the pull was not complete until it reached over 1000%. All the more reason to do the md5 check.
2. As others stated, I needed to format the data partition, not just wipe it.
3. I might recommend also including a "summary" version somewhere on what this guide does. Scrolling through the guide the first time, it seemed pretty daunting, but really all that you're doing is: backing up data partition and internal storage; wiping device; flashing Oreo ROM; tweaking a few files; and restoring backed up data and internal storage.
Thank you again so much! Glad to finally be on Oreo.
Click to expand...
Click to collapse
Thanks for the feedback! I'll add a summary to the guide.

Is there a way to save a modified boot image from within the booted ROM which is rooted with magisk

I don't have the original boot.img. I want to unroot temporarily. But want to re-root afterward.
I was wondering if I can save a modified_boot.img somehow and flash that later once I am done. Is it possible?
devsk said:
I don't have the original boot.img. I want to unroot temporarily. But want to re-root afterward.
I was wondering if I can save a modified_boot.img somehow and flash that later once I am done. Is it possible?
Click to expand...
Click to collapse
What ROM and device are you using?
How did you root it in the first place?
What OS are you running?
Heres my 30 second version of how id do it on my Pixel 2 XL an a/b device....ymmv, depending on device
Download latest platform tools from Google for your OS, if necessary: https://developer.android.com/studio/releases/platform-tools
Next you'll need dd, if you're on Linux, you can skip ahead
For Windows....go to http://gnuwin32.sourceforge.net/packages/coreutils.htm
Download Binaries & Dependencies zips
Extract dd.exe from coreutils-5.3.0-bin.zip /bin to platform tools path
Extract all .dll's from coreutils-5.3.0-dep.zip /bin to platform tools path
Enable USB Debugging & ABD access on device
Boot device to recovery (usually TWRP)
on PC and prompt in platform tools folder:
if you have recovery (usually TWRP) installed:
adb reboot recovery
if you DONT have recovery (usually TWRP) installed, but instead fastboot it via bootloader (as i do on my Pixel 2XL):
adb reboot bootloader
fastboot boot twrp-xxx.img
swipe into twrp
back to PC prompt:
adb shell
dd if=/dev/block/bootdevice/by-name/boot of=/sdcard/boot.img
adb pull /sdcard/boot.img magisk_boot.img
Uninstall magisk
When you need to flash magisk boot image back:
Boot to bootloader..
on PC and prompt in platform tools folder:
adb reboot bootloader
fastboot flash boot magisk_boot.img
fastboot reboot
Note: You can of course use the same first process to backup (and extract) the stock boot.img before rooting ....and the latter to reflash it if needed if rooting goes wrong
Sorry, I should update my profile. My device is OnePlus 8 Pro.
> dd if=/dev/block/bootdevice/by-name/boot of=/sdcard/magisk_boot.img
@73sydney why would this not work from within a rooted device? Its not like some process is holding a read lock on that partition or something else is also writing to it. Its a partition persisted in the NAND, which is not being touched by anything.
The only thing is that there are 2 partitions on the NAND: boot_a and boot_b. I need to know which one is the current one.
And this tells me slot B:
cat /proc/cmdline | tr ' ' '\n' | grep --color slot
androidboot.slot_suffix=_b
For flashing back, I obviously need to be in bootloader because I won't have the root to write to the partition.

How To Guide Extract Boot Image (for Root) - the DSU-Sideloader Method (and Other Tutorials)

Very nice to see Y700 get it's own place on XDA! I myself had just bought the 12GB version and have been very satisfied. The tutorials and info related to this model had been very difficult to come by and mostly in other languages, so I had to do my own research and exploration. So far I was able to flash ROM and extract it's boot image for root thanks to the following tutorial (in Japanese)
boot.imgを入手できない機種でMagiskを導入する方法【DSU Loader】
Android端末のカスタマイズやRoot権限の使用が可能となる「Magisk」ですが、一部例外を除き、導入に…
smartasw.com
The boot image extraction part is trickier as Y700's roms come in GSI form. But with a workaround we can still achieve the same goal. (I heard that you can also use QFIL to do that but I haven't been able to make the tool work, so if someone else can make a tutorial that'd be great)
First you need to prepare:
- DSI-Sideloader from https://github.com/VegaBobo/DSU-Sideloader/releases
- Magisk Manager from topjohnwu's GitHub repo
- a GSI ROM with built in root permission. The one the tutorial was using: https://github.com/phhusson/treble_experimentations/releases/tag/v402 --> go download "system-squeak-arm64-ab-vanilla.img.xz" (~600MB, smallest needed to fulfill the task)
- turn on developer mode and ADB debugging. Get Google SDK platform tools ready and USB drivers installed.
Connect your Y700 to a computer. Check if ADB works.
Next, install the DSI-Sideloader app. Also extract the .xz package you downloaded above to get the .img image (should be ~1.7GB in size)
Copy the image to your Y700 tablet. Open the DSI-Sideloader app, load the image, set userdata size to default (2GB). You can leave image size unchanged.
NOTE: if you have an SD card inserted, click on "config" and check "Unmount SD", or just eject your SD card from tray. Failing to do so will result in error in the install step.
After you're done, click "Install". Once finished there will be a pop-up with commands you need to enter in the terminal of your choosing. On your computer navigate to the directory containing executables of Google SDK platform tools, fire up terminal, enter the 1st command (says non-root) as instructed, and run it.
You will see a progress bar in the drop-down notification area which will complete in a moment and prompt you to reboot. Do that from there.
After reboot you will be running the modded Project Treble ROM, with root access. It's a full fledge OS but once you shutdown / reboot you will go back to your own OS. Treat it as a LiveCD of some sort.
While still connected, turn on dev mode + ADB debugging and go back to terminal for some ADB work. Next we will be extracting boot image under the current environment, made possible by it's built-in root permission.
Run the following line by line:
Bash:
adb shell
Bash:
su
Bash:
cd /dev/block/bootdevice/by-name/
Bash:
mkdir /sdcard/backup_img
Bash:
for file in *; do
if [[ "${file}" = boot* ]]; then dd if=/dev/block/bootdevice/by-name/"${file}" of=/sdcard/backup_img/"${file}".img ; else continue ; fi
done
The 4th command creates a new directory storing extracted boot image, in our case /SD card/backup_img; and the 5th command is the meat of the entire process. It consists of 3 lines, key in one at a time and press "Enter". First line is "for...do", second is "if [[..." to "fi", third is just "done".
After some time the extracted boot image will be stored under the directory specified by the 4th command, in our case /sdcard/backup_img . They are stored in the temporary user space and once you reboot to your original OS you won't be able to access them again. So you need to turn on File Transfer mode, go to the actual directory on your PC and move them to your computer. They have the filenames "boot_a.img" and "boot_b.img" . After you're done, just reboot as usual and you'll get into your old OS.
Now you have the boot images, all that's left is to use Magisk Manager to patch them, enter fastboot mode, and flash the patched images using the following commands:
fastboot flash boot_a patched_img_A.img
fastboot flash boot_b patched_img_B.img
(Rename as needed)
And now your Y700 is rooted.
The linked Japanese webpage also talks about working Android 12 / 13 GSI flavors, patches, and ways to set up your Y700.

Categories

Resources