backup wifi configuration - Android General

You can use adb to backup wifi configuration:
1)backup the wifi configuration in the current folder:
adb pull /data/misc/wifi/wpa_supplicant.conf .
2)restore
after install your rom, you can restore the wifi by:
adb push wpa_supplicant.conf /data/misc/wifi/

Permission Issue
If wifi doesn't work after restore, most likely is permission issue:
The permission and ownership should be:
-rw-rw---- system wifi 503 2013-10-31 20:06 wpa_supplicant.conf
smgong said:
You can use adb to backup wifi configuration:
1)backup the wifi configuration in the current folder:
adb pull /data/misc/wifi/wpa_supplicant.conf .
2)restore
after install your rom, you can restore the wifi by:
adb push wpa_supplicant.conf /data/misc/wifi/
Click to expand...
Click to collapse

smgong said:
You can use adb to backup wifi configuration:
1)backup the wifi configuration in the current folder:
adb pull /data/misc/wifi/wpa_supplicant.conf .
2)restore
after install your rom, you can restore the wifi by:
adb push wpa_supplicant.conf /data/misc/wifi/
Click to expand...
Click to collapse
Would this restore only the configuration or all the saved networks/passwords as well?

Related

how do you change folder permissions???

hi
how does one change folder permissions? i have read that you cam do it with the root explorer app but is there a way to do it on the pc using the sdk? i connected my phone to the pc and issued the adb shell command and then attempted to use the chmod command but got a read only file system message.
dsMA said:
hi
how does one change folder permissions? i have read that you cam do it with the root explorer app but is there a way to do it on the pc using the sdk? i connected my phone to the pc and issued the adb shell command and then attempted to use the chmod command but got a read only file system message.
Click to expand...
Click to collapse
1) If you have ADB setup on your computer, hook your phone into the computer and connect into it via ADB.
2) Once in, "chmod" the directory or file(s) you wish to change permissions for.
IF you don't have ADB:
1) Download a terminal
2) su - to root
3) Change your directory
4) "chmod" to whatever pemissions you want
it means that folder/file you're chmod'ing was mounted ro. you cant change anything if its mounted as ro. to check just enter "mount" and you can see what are mounted as rw, ro etc
yantz
I would also suggest changing it back when you're done. This helps prevent you from accidently overwriting or deleting something and have to reflash if you're rooted.

[Q] [Lollipop] wpa_supplicant problem and wifi broken

I know this is a technical question and not a general question, but I can post only in this section because i'm a new xda user. :angel:
My device: NEXUS 4 with LOLLIPOP from AOSP, busybox, Rooted with Wugfresh Toolkit 1.9.8 and supersu chainfire, stock rom and stock kernel
I'm working on wpa_supplicant in /system/bin.
I want to replace this file with a version that i've compiled. I want to use wifi and at the same time call wpa_supplicant from wpa_cli.
Ok, normally I can't connect to this process (probably because this file is running, i don't know why), but if I replace wpa_supplicant with my version and reboot, wpa_cli is ok. But in this situation, the android's wifi connectivity is broken, also if i don't start wpa_cli! If i reboot the device the wifi connectivity is still broken!
FIRST QUESTION (THE MOST IMPORTANT): Which is the best and simple way to use wpa_supplicant, and when my work is done, restore the android's connectivity? For example processes to kill etc... and to restart with the correct terminal commands.
SECOND QUESTION (a real curiosity):
If I write in adb shell this:
Code:
$ su
# mount (to check the system partition: /dev/block/platform/msm_sdcc.1/by-name/system)
# mount -o remount,rw /dev/block/platform/msm_sdcc.1/by-name/system
# dd if=/system/bin/wpa_supplicant of=/system/bin/wpa_supplicant_copy //(or with cp)
# cd /system/bin
# chmod 755 wpa_supplicant_copy //(exactly like the original wpa_supplicant)
# chown 0.2000 wpa_supplicant_copy //(to set root and shell, exactly like the original wpa_supplicant)
# busybox touch -r wpa_supplicant wpa_supplicant_copy //(to set the modify/access...time equal to wpa_supplicant)
# mv wpa_supplicant wpa_supplicant_original_backup //(to create a backup of the original file for security reasons)
# ls -a (to check that is all ok)
# mv wpa_supplicant_copy wpa_supplicant
# reboot
In theory now i've exactly the same file (md5sum said to me that this files are equals), with the same authorizations, permission, timestamps etc... (checked with "stat filename").
But after the reboot the wifi is broken!!!
Really strange, but if delete the wpa_supplicant and type: "mv wpa_supplicant_original_backup wpa_supplicant" to restore the original wpa_supplicant and reboot....ohhh magic!! Now all is ok and the wifi connectivity is restored! BUT WHY??? IS THE SAME FILE!
I really don't understand.
PS: all the problems happen in the original rom, but also in a rom compiled by me from aosp original source. I never removed the wpa_supplicant.conf files, because the only things that I'm changing is.....mmm nothing........yep, the file is exactly the same, with the same infos and md5sum
Thank u very for the support and please save my life :crying:
Wait wait wait....
This situation happens only with lollipop.
With kitkat, no problem, i can replace wpa_supplicant without any problems.
How can i do the same thing in Lollipop without breaking the wifi connectivity?
After days of research and some help i solved the problem.
The problem was with selinux.
:victory::victory::victory::victory::victory::victory::victory::victory::victory::victory:

Importing WiFi profiles from an old device / backup

Hi guys!
As I'm not a developer, but did not find a proper section to post this, feel free to edit / move / remove this topic if you feel it necessary / that does not comply.
Short story: updated my HTC One M8 Verizon phone with Viper OneM8 ROM, had some issues during various setups, and at final install I disalowed Google to restore my infos (contacts, apps, wifi settings etc) automatically at initial setup. Did almost all of the restore manually at a later time. But without my saved wifi profiles (arround 200 saved).
As I did not find a proper way to get them from Google, I had to do it old way. Had an older HTC One S, sync'd with Google backup, having full list of all my wifi profiles.
Disclaimer: I cannot take credits for this, as I just double checked and adapted the code found here for my needs (I am a lazy guy, and - as the original code was written to be used "as is" on a linux machine - I did not wanted to reboot to Mint, do the job and revert to Windows afterthat ).
So please make backups and don't do it if you don't understand what you are doing! As I take no credit, I also take no responsibility!
The goal: copy relevant info from wpa_supplicant.conf on old phone and put it in wpa_supplicant.conf in the new phone and make it load the new info correctly.
What you need:
- rooted device (rw access to /data/misc/wifi/),
- a backup of wpa_supplicant.conf from the above folder (a previous version) - might be from another device (like in my case).
- working adb tools on a windows computer (for linux see the above disclaimer).
- some basic skills in adb
The job:
1. Get the wpa_supplicant.conf from BOTH devices on your desktop.
This can be done in various ways, I will not get too deep into it. The easiest way is to just copy the wpa_supplicant.conf from /data/misc/wifi/ somewhere on sdcard on devices (using root explorer or similar app - remember, you need root on your device!), and after that just get it with windows explorer or whatever tool you are using to copy files from device to computer.
the adb should look like (I assumed you did copy the file(s) from /data/misc/wifi to the root of your sdcard(s) ):
(from old device)
Code:
adb pull /mnt/sdcard/wpa_supplicant.conf wpa_supplicant.FULL
(from new device)
Code:
adb pull /mnt/sdcard/wpa_supplicant.conf wpa_supplicant.EMPTY
2. Make a backup of BOTH files you just got! Especially of the EMPTY file, in case you run troubles.
3. Open the wpa_supplicant.FULL with a text editor on your computer and clear the headers. Save afterthat:
Don't use notepad, it's not handling well *nix new lines. You can use notepadd++, wordpad etc.
You need to delete everything in the begining of the .FULL file down to first
Code:
network={
ssid="hro-M"
(DON'T delete the network={ part or anything bellow it!)
Save the file. Open it again to check headers are gone.
4. Get the content from just saved wpa_supplicant.FULL into wpa_supplicant.EMPTY
Can be done in various ways. Easiest:
Code:
more wpa_supplicant.FULL >> wpa_supplicant.EMPTY
Check that now wpa_supplicant.EMPTY is full (filled with original new file headers and your networks info from the FULL file).
5. Put the new file back to new device sdcard and rename it with correct filename:
Again multiple options here (explorer, cloud etc).
Adb should look like:
Code:
adb push wpa_supplicant.EMPTY /mnt/sdcard/wpa_supplicant.conf
Check on your device that file is indeed there (also check it's contents with a text editor).
6. Turn off device WiFi
7. Make a backup of /data/misc/wifi/wpa_supplicant.conf:
Adb stuff:
Code:
adb shell
su
cd /data/misc/wifi
cp wpa_supplicant.conf wpa_supplicant.conf.backup
Check on device that both wpa_supplicant.conf AND wpa_supplicant.conf.backup are in place, and they have the same size.
8. Overwrite wpa_supplicant.conf in /data/misc/wifi/ with wpa_supplicant.conf from sdcard:
I prefered to delete the file and copy my version instead of overwriting it:
Code:
rm wpa_supplicant.conf
cp /mnt/sdcard/wpa_supplicant.conf .
9. Change permissions for wpa_supplicant.conf:
Code:
chown system.wifi wpa_supplicant.conf
10. Turn on wifi on device (restart device recommended):
In my case it worked after device reboot, but I did it with wifi turned-on.
Check your saved wifi networks in Settings - WiFi!
Most probably this will not apply to all devices (I remember I saw a wpa_supplicant.conf with encrypted passwords at some point on my device (different ROM, probably original Verizon One M8 ROM), but in some cases might help, as there are few references of how to recover previously saved network details (except Google backup and some apps, that sometimes do not work).
Hope this helps someone!
Thanks!

[Q] Create a .img file of the system partition

I bought a Moto G(XT1031) last week. I rooted it, and before removing any system apps, created a backup in TWRP of the system and boot partitions.
Now, I have the 8GB model(couldn't find a 16GB one cheap enough) and so I would like to create a .img of the system and boot partitions. I still have the TWRP backup, however I want to remove it from my phone as it's eating up almost a GB of precious space.
I've seen some assorted stuff on how to pull .img files from the phone, but I' m not sure which ones will work with mine. Any help would be appreciated!
You could use: adb pull /sdcard/TWRP c:/MotoG_Backup/TWRP
Now you can delete that folder from phone.
Then if you want to restore TWRP Backup: adb push c:/MotoG_Backup/TWRP /sdcard/TWRP/
Alternatively:
ADB Dumping Methods: *ROOT REQUIRED*
You need to grant the SuperSU permission popup that will appear on your phone.
System:
adb shell su -c "dd if=/dev/block/platform/msm_sdcc.1/by-name/system of=/sdcard/system.img"
adb pull /sdcard/system.img​
lost101 said:
You could use: adb pull /sdcard/TWRP c:/MotoG_Backup/TWRP
Now you can delete that folder from phone.
Then if you want to restore TWRP Backup: adb push c:/MotoG_Backup/TWRP /sdcard/TWRP/
Alternatively:
ADB Dumping Methods: *ROOT REQUIRED*
You need to grant the SuperSU permission popup that will appear on your phone.
System:
adb shell su -c "dd if=/dev/block/platform/msm_sdcc.1/by-name/system of=/sdcard/system.img"
adb pull /sdcard/system.img​
Click to expand...
Click to collapse
Why, thank you sir! I was unaware that you can push files to your device while in the recovery! That is why I wanted a system image file.
Thanks again!

Fix for Wifi not working after flashing custom ROM

Hello
As some users, I experienced a not working Wifi after flashing a custom ROM (LineageOS in my case) and wiping /data. The Wifi MAC address shows as
02:00:00:00:00.
After investigating, it turns out that libwcnss_qmi.so is unable to write to /data/opponvitems/4678. It's a small binary file containing the MAC address in reverse order binary.
To fix this problem:
Flash your custom ROM (wipe data if you want)
Boot the custom ROM at least one time and check that your Wifi is not working
Reboot to recovery (TWRP in my case)
Open an adb shell
Enter the following commands:
touch /data/opponvitems/4678
chcon -t wcnss_service /data/opponvitems/4678
This will create the destination file and set proper permissions so that libwcnss_qmi.so can write into it.
Reboot your phone.
Your Wifi should be working.
Please note that we manually change the SELinux context on /data/opponvitems/4678, so if you use restorecon or use TWRP's Fix context feature, the library won't be able to write to the file and your Wifi won't work.

Categories

Resources