[Guide] How to provide a LOGCAT - Sony Ericsson XPERIA X10 Mini

Here's how to use logcat..There are two main ways to do a logcat, within android, and through adb. Logcat within android can be done one of two ways, through a Logcat app..Here are two good examples are either aLogcat or CatLog I prefer catlog, because in my opinion it has a little bit nicer UI. Both of these programs can dump their logs to a txt file, which is very useful for debugging. Or, you can do it in terminal emulator (same rules as running through adb.
On the other hand, using adb to run logcat, in my opinion is much more useful, because you can start using it when android boots (i.e. once the boot animation appears.)
The code for logcat to output to a file is
Code:
adb logcat > name of problem.txt
you can also do
Code:
adb logcat -f name of problem.txt
how I prefer to do it is this way:
Code:
adb logcat -v long > name of problem.txt
with the -v flag & the long argument, it changes output to long style, which means every line of logcat will be on its own line (makes it a little neater, imo)
Note: When outputting to a file, you will see a newline, but nothing printed, this is normal. To stop logcat from writting to a file, you need to press ctrl+c.
Here's where using logcat (via adb makes life really easy)
Lets say you find a problem you're having after looking at a logcat.
For example:
When I was trying to use a different ramdisk, wifi wouldn't work so I got a logcat that's almost 1300 lines long (a lot of stuff happens in the background)
So if you are searching for an error in the logcat file (it's always e/ for error, f/ for fatal. Those are the two main things that will break a system.)
Code:
D/dalvikvm( 871): GC_CONCURRENT freed 472K, 6% free 10224K/10823K, paused 1ms+6ms
V/AmazonAppstore.DiskInspectorServiceImpl( 871): Available blocks: 21981, Block size: 4096, Free: 90034176, Threshold: 5242880, withinThreshold? true
D/AmazonAppstore.UpdateService( 871): Received action: null from intent: Intent { cmp=com.amazon.venezia/com.amazon.mas.client.framework.UpdateService }
W/AmazonAppstore.UpdateService( 871): Confused about why I'm running with this intent action: null from intent: Intent { cmp=com.amazon.venezia/com.amazon.mas.client.framework.UpdateService }
D/dalvikvm( 890): GC_CONCURRENT freed 175K, 4% free 9375K/9671K, paused 2ms+3ms
V/AmazonAppstore.ReferenceCounter( 871): Reference (MASLoggerDB) count has gone to 0. Closing referenced object.
E/WifiStateMachine( 203): Failed to reload STA firmware java.lang.IllegalStateException: Error communicating to native daemon
V/AmazonAppstore.UpdateService( 871): runUpdateCommand doInBackground started.
V/AmazonAppstore.UpdateService( 871): Running UpdateCommand: digitalLocker
V/AmazonAppstore.UpdateCommand( 871): Not updating key: digitalLocker from: 1334228488057
V/AmazonAppstore.UpdateService( 871): Finished UpdateCommand: digitalLocker
V/AmazonAppstore.UpdateService( 871): Running UpdateCommand: serviceConfig
V/AmazonAppstore.MASLoggerDB( 871): performLogMetric: Metric logged: ResponseTimeMetric [fullName=com.amazon.venezia.VeneziaApplication_onCreate, build=release-2.3, date=Wed Apr 11 13:10:55 CDT 2012, count=1, value=1601.0]
V/AmazonAppstore.MASLoggerDB( 871): onBackgroundTaskSucceeded: Metric logged: ResponseTimeMetric [fullName=com.amazon.venezia.VeneziaApplication_onCreate, build=release-2.3, date=Wed Apr 11 13:10:55 CDT 2012, count=1, value=1601.0]
W/CommandListener( 118): Failed to retrieve HW addr for eth0 (No such device)
D/CommandListener( 118): Setting iface cfg
D/NetworkManagementService( 203): rsp
D/NetworkManagementService( 203): flags
E/WifiStateMachine( 203): Unable to change interface settings: java.lang.IllegalStateException: Unable to communicate with native daemon to interface setcfg - com.android.server.NativeDaemonConnectorException: Cmd {interface setcfg eth0 0.0.0.0 0 [down]} failed with code 400 : {Failed to set address (No such device)}
W/PackageParser( 203): Unknown element under : supports-screen at /mnt/asec/com.android.aldiko-1/pkg.apk Binary XML file line #16
D/wpa_supplicant( 930): wpa_supplicant v0.8.x
D/wpa_supplicant( 930): random: Trying to read entropy from /dev/random
D/wpa_supplicant( 930): Initializing interface 'eth0' conf '/data/misc/wifi/wpa_supplicant.conf' driver 'wext' ctrl_interface 'N/A' bridge 'N/A'
D/wpa_supplicant( 930): Configuration file '/data/misc/wifi/wpa_supplicant.conf' -> '/data/misc/wifi/wpa_supplicant.conf'
D/wpa_supplicant( 930): Reading configuration file '/data/misc/wifi/wpa_supplicant.conf'
D/wpa_supplicant( 930): ctrl_interface='eth0'
D/wpa_supplicant( 930): update_config=1
D/wpa_supplicant( 930): Line: 4 - start of a new network block
D/wpa_supplicant( 930): key_mgmt: 0x4
(mind you, that's 29 lines out of 1300ish, just for example)
I then could do the following with logcat:
Code:
adb logcat WifiStateMachine:E *:S -v long > name of problem.txt
and this will only print out any errors associated with WifiStateMachine, and anything which is fatal, which makes it about a million times easier to figure out what's going on!
In WifiStateMachine:E, the :E = to look for Errors, the full list of options is as follows:
V — Verbose (lowest priority)
D — Debug
I — Info (default priority)
W — Warning
E — Error
F — Fatal
S — Silent (highest priority, on which nothing is ever printed)
You can replace the :E with any other letter from above to get more info.
In order to filter out anything other than what you are looking for (in this case, WifiStateMachine) you must put a *:S after your last command (i.e. WifiStateMachine:E ThemeChoose:V ... ... AndroidRuntime:E *:S)
Sources: http://developer.android.com/tools/help/logcat.html
http://developer.android.com/tools/help/adb.html
Please do NOTE: : I am just sharing. Original post is Here.
Don't be a noob. Be a newbie..!!
Details here.

Great guide! I am glad that I can help you by logcat. Thanks.
Sent from my E10i using xda app-developers app

How long take the. Logcat?
Sent from my E10i using xda premium

ruben21 said:
How long take the. Logcat?
Sent from my E10i using xda premium
Click to expand...
Click to collapse
Whatever you want.
Sent from my E10i using xda app-developers app

Well and how I finish the logcat because I leave them all the night and still run
Sent from my E10i using xda premium

ruben21 said:
Well and how I finish the logcat because I leave them all the night and still run
Sent from my E10i using xda premium
Click to expand...
Click to collapse
Just press CTRL + C

Thanks bro.
☜ Sent from my X10 MP U20i ☞

Related

[Kernel][AOSP][2.6.35.9][UV][OC] PureGinger Kernel 25-DEC-2010

This is my own compiled kernel for NEXUS ONE based on the latest source from stock git (http://android.git.kernel.org/)
The branch I use is: android-msm-2.6.35
As I am using my own compiled ROM (PureFroyo) daily, and I am using the stock Froyo camera, I cannot use the IR's kernel (as it is merged with 720p)
Therefore, this triggers my initiative to compile my own kernel. Referenced from intersectRaven's ; Wildmonks ; pershoot ; cyanogen and some other kernels, I have made various adjustments (merge as well). So, here are the features of this ROM:
- intersectRaven's suggested frequency table in acpuclock-qsd8x50.c
- UV to 950mV
- OC to 1152MHz
- All CPU power governors
- 21 MB memory hack (thanks to coolbho3k)
- Target for stock camera, no 720p camera
- No audio boost
- Some minor changes referenced from wildmonks and intersectRaven (thanks!)
- Wifi, Froyo portable hotspot and camera work perfectly
- Not HAVS, but SVS instead
- Battery life is good for my nexus one
- Best match with stock / AOSP ROM
So, here is the link to the kernel, I would be grateful if you could help to test it and feedback whether it works for you (thanks~ ^_^)
Change Log:
2010-12-25 (Merry X'mas )
======================
- Rename to PureGinger
- Tested under AOSP gingerbread for a few days, very stable!
- Changed back to 950mV because 925mV seems not stable in Gingerbread
- Cherry-pick many commits... refer to my github
Link: http://www.mediafire.com/?dawr4f99t4fwc35
Mirror: http://www.4shared.com/file/6pNfdRiQ/PureGinger_26359_AXI_UV_SVS_12.html
File: PureGinger_2.6.35.9_AXI_UV_SVS_122110_223513.zip
MD5: 775007F8C1B549AAF5E18E40B0C704F5
2010-11-26
=========
- Changed to 925mV (UV). Seems running smooth for a few days
- Cherry-pick many commits from various sources (thanks stock, pershoot, raven, redstar, cyanogen, etc...)
- Enhanced ds2784 battery driver
- Other changes could be seen from my github
Link: http://www.mediafire.com/?52aa1h265w1tfau
Mirror: http://www.4shared.com/file/eqA2z7nW/PF_26357_AXI_UV_SVS_112610_014.html
File: PF_2.6.35.7_AXI_UV_SVS_112610_014525.zip
MD5: B17904841A9114BBB453FF4A94676CF2
2010-11-17
=========
- Cherry-pick many commits from various sources
- Kernel scheduler improvement (http://forum.xda-developers.com/showthread.php?t=841599)
Link: http://www.mediafire.com/?lw7mfll6b88qtqx
File: PF_2.6.35.7_AXI_UV_SVS_111710_215623.zip
MD5: 3CD0C4976F5DA7BBFBD42FE95C6A44CE
2010-11-05
=========
- Apply IR's latest oom modifications
- Cherry-pick some latest IR's, pershoot's, cyanogen's & experimental commits
Link: http://www.mediafire.com/?vpb49te3rxpf11z
File: PF_2.6.35.7_AXI_UV_SVS_110510_230204.zip
MD5: F2C2DEE6DF9485B52A5973B243602F6D
2010-11-02
=========
- Merge with a few latest IR's & Wildmonk's commits
- Source push to github
Link: http://www.mediafire.com/?m407xyaub6wuiby
File: PF_2.6.35.7_AXI_UV_SVS_110310_002259.zip
MD5: 3CBF9EFD6A11680FB46253111941CE1E
2010-10-31
=========
- Fix USB mount problem
- Added AXI rate tweak for performance and battery savings (IR's commit: 03ca24721e278eca034f)
Link: http://www.mediafire.com/?xx2sf66sntcrf2r
File: PF_2.6.35.7_AXI_UV_SVS_103110_000825.zip
MD5: 5F4D54E6E3BA63CDA0D35DE4756CC82B
2010-10-27
=========
- First version
Link: http://www.mediafire.com/?t9w73l8qi773qm3
File: PF_2.6.35.7_UV_SVS_signed_102710_012826.zip
MD5: D1EEEA92276BE7965679B1AB173B10B2
---------------------------------------------------------------
Installation procedures are just like what you are flashing with any other kernels (please make backup first):
Instructions:
1.) Reboot to recovery and flash the update zip directly.
OR
Instructions for zImage and bcm4329.ko driver extracted from the update.zip(from command line):
1.) adb remount
2.) adb push bcm4329.ko /system/lib/modules
3.) adb reboot bootloader
4.) fastboot flash zimage zImage
5.) fastboot reboot
---------------------------------------------------------------
Last thing: Please flash the kernel at your own risk Enjoy it.
---------------------------------------------------------------
* I am using my own compiled ROM: PureFroyo
* Source finally push to github: http://github.com/ardatdat/PureFroyo-Kernel
* (OLD) - Link to the 1st version kernel source code:
Part 1
http://www.mediafire.com/?a4q78ux2yy8r8j4
Part 2
http://www.mediafire.com/?yy7t2i9hotq5hg5
---------------------------------------------------------------
You need to post a link to your source code, or make it available for people somehow, according to this.
http://www.xda-developers.com/android/general-public-license-gpl-for-android-kernels/
wdfowty said:
You need to post a link to your source code, or make it available for people somehow, according to this.
http://www.xda-developers.com/android/general-public-license-gpl-for-android-kernels/
Click to expand...
Click to collapse
This is true. Please comply.
EDIT: Thank you. Great work!
wdfowty said:
You need to post a link to your source code, or make it available for people somehow, according to this.
http://www.xda-developers.com/android/general-public-license-gpl-for-android-kernels/
Click to expand...
Click to collapse
overground said:
This is true. Please comply.
Click to expand...
Click to collapse
Just get myself in front of the computer ~
Sure, I am packing the source now and will post the link soon.
Thanks for your prompting
Thank you so much. Since several weeks my wifi at home didn't work very well. I try some kernel with the nightly. Your kernel solved my problem
Source codes finally uploaded to mediafire
THANKSS
Amazing Kernel, just what I was looking for. This overclocks it to 1.152 AWESOME while undervolted and stock!!! The best!
Everyone trying this new kernel, PLEASE REPORT WHICH ROM & VERSION YOU ARE USING?
atlast a custom-kernel for us non 720p, will try when i get home from work iam runnning Geo411´s FRG83 rom.
ardatdat said:
Just get myself in front of the computer ~
Sure, I am packing the source now and will post the link soon.
Thanks for your prompting
Click to expand...
Click to collapse
No problem, wouldn't want your thread to get locked/removed for something like that.
mrdemo007 said:
atlast a custom-kernel for us non 720p, will try when i get home from work iam runnning Geo411´s FRG83 rom.
Click to expand...
Click to collapse
Interested to hear your experience. This kernel seems like a great match for Geo's ROM.
wdfowty said:
No problem, wouldn't want your thread to get locked/removed for something like that.
Click to expand...
Click to collapse
thanks, source already uploaded and link updated in #1 post
Arcarsenal said:
Interested to hear your experience. This kernel seems like a great match for Geo's ROM.
Click to expand...
Click to collapse
Me too, waiting for your report
Arcarsenal said:
Interested to hear your experience. This kernel seems like a great match for Geo's ROM.
Click to expand...
Click to collapse
just flashed it on Geo's ROM it seems everything is fine just need a little more time for testing....
Edit : excellent with Geo's ROM
Rom become more responsive and snappy and battery life is little improved
Been running this kernel with a rooted stock FRG83 ROM for a day now. So far VERY NICE!
One thing...I seem to have a problem with WiFi cutting out for a couple seconds every minute or so when I'm in Airplane mode. I work in a basement and I use airplane mode to keep the radio from killing my battery.
I know this is probably somewhat unique to me, but thought I would let you know.
This is exactly what I'm looking for! Thanks a lot!
Edit: I'm using Geo's Completely Stock Deodexed with busybox, FRG83. I cannot connect to wifi after flashing this kernel, here are my logcat.
D/Tethering( 96): eth0 is not a tetherable iface, ignoring
D/WifiService( 96): ACTION_BATTERY_CHANGED pluggedType: 2
D/WifiService( 96): acquireWifiLockLocked: WifiLock{NetworkLocationProvider ty
pe=2 [email protected]}
V/WifiStateTracker( 96): Connection to supplicant established, state=DISCONNEC
TED
D/NetworkStateTracker( 96): setDetailed state, old =DISCONNECTED and new state
=DISCONNECTED
D/LocationMasfClient( 96): getNetworkLocation(): Location not found in cache,
making network request
I/wpa_supplicant( 686): CTRL-EVENT-STATE-CHANGE id=-1 state=2 BSSID=00:00:00:00
:00:00
I/wpa_supplicant( 686): WPS-AP-AVAILABLE
W/wpa_supplicant( 686): Failed to initiate AP scan.
V/WifiStateTracker( 96): Changing supplicant state: DISCONNECTED ==> SCANNING
D/NetworkStateTracker( 96): setDetailed state, old =DISCONNECTED and new state
=SCANNING
V/WifiMonitor( 96): Event [WPS-AP-AVAILABLE ]
D/ConnectivityService( 96): Dropping ConnectivityChange for WIFI: DISCONNECTED
/SCANNING
V/WifiMonitor( 96): Event [CTRL-EVENT-STATE-CHANGE id=-1 state=2 BSSID=00:00:0
0:00:00:00]
D/dalvikvm( 96): GC_FOR_MALLOC freed 24258 objects / 1295032 bytes in 118ms
D/NativeCrypto( 96): Freeing OpenSSL session
D/LocationMasfClient( 96): getNetworkLocation(): Number of prefetched entries
1
D/LocationMasfClient( 96): getNetworkLocation(): Returning network location wi
th accuracy 1467.0
D/WifiService( 96): releaseWifiLockLocked: WifiLock{NetworkLocationProvider ty
pe=2 [email protected]}
I/wpa_supplicant( 686): WPS-AP-AVAILABLE
V/WifiMonitor( 96): Event [WPS-AP-AVAILABLE ]
W/wpa_supplicant( 686): Failed to initiate AP scan.
I/wpa_supplicant( 686): WPS-AP-AVAILABLE
V/WifiMonitor( 96): Event [WPS-AP-AVAILABLE ]
D/SntpClient( 96): request time failed: java.net.SocketTimeoutException: Conne
ction timed out
W/wpa_supplicant( 686): Failed to initiate AP scan.
I/wpa_supplicant( 686): WPS-AP-AVAILABLE
V/WifiMonitor( 96): Event [WPS-AP-AVAILABLE ]
D/AK8973 ( 75): Compass Start
I/power ( 96): *** set_screen_state 0
D/WifiService( 96): ACTION_SCREEN_OFF
D/WifiService( 96): setting ACTION_DEVICE_IDLE timer for 120,000 ms
D/SurfaceFlinger( 96): About to give-up screen, flinger = 0x125b18
D/AK8973 ( 75): Compass CLOSE
W/wpa_supplicant( 686): Failed to initiate AP scan.
D/StatusBar( 96): DISABLE_EXPAND: yes
D/GoogleLoginService( 204): onBind: Intent { act=android.accounts.AccountAuthen
ticator cmp=com.google.android.gsf/.loginservice.GoogleLoginService }
I/wpa_supplicant( 686): WPS-AP-AVAILABLE
V/WifiMonitor( 96): Event [WPS-AP-AVAILABLE ]
D/dalvikvm( 204): GC_EXPLICIT freed 2276 objects / 120416 bytes in 70ms
D/dalvikvm( 411): GC_EXPLICIT freed 35 objects / 2000 bytes in 60ms
BTW, I hide the SSID of my wifi, and the encryption method is WPA2-PSK with AES. And when I connect my nexus one to laptop, there is no notification to ask me to mount the phone as a usb device or something like that. There should be an android, green or orange, depends on mounted or not, but I notice nothing happens when I connect.
Interesting.. Which radio are you using at the moment?
Using Geo411's latest ROM I get no USB SD mount notification, anyone else having this issue? I am using the latest Korean radio ROM as well.
Arcarsenal said:
Interesting.. Which radio are you using at the moment?
Click to expand...
Click to collapse
32.50.00.32U_5.12.00.08, the latest Korean radio.
niftydl said:
Using Geo411's latest ROM I get no USB SD mount notification, anyone else having this issue? I am using the latest Korean radio ROM as well.
Click to expand...
Click to collapse
Me.
For those of you with USB mount and WiFi issues are you all using the latest Korean radio? Have you tried downgrading the radio and seeing if the issues are resolved?
Is swap enabled or disabled?

[Q] Actiivty won't launch from Eclipse

Hi all,
I have an elocity A7 Tablet running 2.2 Dexters ElocityA7 Modv1.2, full root access.
I managed to get usb ADB functionality working correctly after forcing the usb mode to client - i can run shell commands etc...
When I first attempted to launch applications from Eclipse I was getting messages stating /sbin/sh : am: not found. I finally managed to get that corrected by editing the am/pm files and creating the correct references with vi.
So now the applications finally install from Eclipse - HOWEVER - they do not launch when I attempt to run or debug. The Apps do get installed correctly, it just appears it Eclipse can't start the activity.
-USB debugging is enabled
Console output when I attempt to run:
==============================================
Code:
[2011-09-25 19:40:58 - test] Android Launch!
2011-09-25 19:40:58 - test] adb is running normally.
[2011-09-25 19:40:58 - test] Performing com.test.TestActivity activity launch
[2011-09-25 19:40:58 - test] Automatic Target Mode: using device '028041454220f4d7'
[2011-09-25 19:40:59 - test] Application already deployed. No need to reinstall.
[2011-09-25 19:40:59 - test] Starting activity com.test.TestActivity on device 028041454220f4d7
At this point nothing further happens - The logcat below just displays the debugger detaches but I don't know exactly why.
LogCat Output when I attempt to run:
==============================================
Code:
09-25 19:40:56.242: DEBUG/AndroidRuntime(12380): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
09-25 19:40:56.242: DEBUG/AndroidRuntime(12380): CheckJNI is OFF
09-25 19:40:56.242: DEBUG/dalvikvm(12380): creating instr width table
09-25 19:40:56.252: DEBUG/dalvikvm(12380): Unable to stat classpath element '/system/framework/com.nvidia.graphics.jar'
09-25 19:40:56.272: DEBUG/AndroidRuntime(12380): --- registering native functions ---
09-25 19:40:56.322: ERROR/BluetoothHidDeviceService.cpp(12380): register_android_server_BluetoothHidDeviceService: Registering HIDD Native Methods
09-25 19:40:56.402: DEBUG/AndroidRuntime(12380): Shutting down VM
09-25 19:40:56.402: DEBUG/dalvikvm(12380): Debugger has detached; object registry had 1 entries
09-25 19:40:56.412: INFO/AndroidRuntime(12380): NOTE: attach of thread 'Binder Thread #3' failed
09-25 19:40:56.592: DEBUG/dalvikvm(1331): GC_EXPLICIT freed 1088 objects / 60016 bytes in 35ms
Grateful if anyone has any ideas or can point me in a direction to determine what the cause may be? I know eclipse is configured correctly as I can launch and debug on my Sony Arc 2.3.3 - I think this might be related to a setting on the A7 system
I've narrowed it down to being a problem with my 'am' command - it's not actually doing anything. Anyone know the proper setup for the am command?
Currently this is what I have:
/sbin/am
--EMPTY-- I think this is the problem. If i delete this file however the am command is not found. Do i need to point this somewhere?
/system/bin/am
# Script to start "am" on the device, which has a very rudimentary
# shell.
#
#!/system/bin/sh
base=/system
export CLASSPATH=$base/framework/am.jar
exec app_process $base/bin com.android.commands.am.Am "[email protected]"
Wow as if - problem solved.
#!/system/bin/sh
Needs to be the FIRST line in the file.

OpenVPN help for galaxy s 2 I9100G

Hello guys
so i got openvpn and installed it and everything but somehow when i click the .ovpn file it doesn't work, it doesn't put a tick mark next to it, it says that it was granted superuser permission but nothing else happens.
so what could be the problem if anyone had this before and was able to fix it
any help would be greatly appreciated thank you in advance.
Can you post your .ovpn file? Be careful not to post anything that could compromise your privacy!
Please also post a screenshot of the 'OpenVPN Settings' App when clicking Menu -> Advanced.
Which Vpn are you using ?, when i tried using open vpn on mine it didnt work, The vpn provider told me to set it up through the vpn settings in the phone itself and that worked fine for me, could be worth a try
Thaw.Bytes said:
Which Vpn are you using ?, when i tried using open vpn on mine it didnt work, The vpn provider told me to set it up through the vpn settings in the phone itself and that worked fine for me, could be worth a try
Click to expand...
Click to collapse
He is using OpenVPN, not "part of the phone".
Ahhh sorry my mistake i misread his post
Sorry for the delay in replying, but here are 2 images of the settings but i don't think the .ovpn files has any issues i think its only the phone or openvpn itself.
Well, if you think your .ovpn file is fine and certificate(s) and key(s) are at correct locations then you should take a look at the log.
To do this use 'adb' with the 'logcat' command. As soon as 'logcat' is running try to tick your OpenVPN configuration and check the log for any errors.
This is what I get when the status bar asks me to enter the certificate password (did some manual formatting for better reading ):
Code:
D/OpenVPN-DaemonMonitor[/sdcard/openvpn/VPNTEST.ovpn]-mgmt(12164): attach(): using management port at 27460
E/OpenVPN-DaemonMonitor[/sdcard/openvpn/VPNTEST.ovpn]-mgmt(12164): attaching to OpenVPN daemon: failed to connect to /127.0.0.1 (port 27460): connect failed: ECONN REFUSED (Connection refused)
W/OpenVPN-DaemonMonitor[/sdcard/openvpn/VPNTEST.ovpn](12164): start(): choosing random port for management interface: 39157
[B]D/OpenVPN-DaemonMonitor[/sdcard/openvpn/VPNTEST.ovpn]-daemon(12164): invoking external process: /system/xbin/su[/B]
D/OpenVPN-DaemonMonitor[/sdcard/openvpn/VPNTEST.ovpn]-daemon(12164): invoking command line: /system/xbin/openvpn --cd '/sdcard/openvpn' --config 'VPNTEST.ovpn' --writepid '/data/data/de.schaeuffelhut.android.openvpn/files/com.d/_sdcard_openvpn_VPNTEST.ovpn-pid' --script-security 1 --management 127.0.0.1 39157 --management-query -passwords --verb 3
D/OpenVPNDaemonEnabler(12164): Received OpenVPN daemon state changed from Unknown to Startup
D/OpenVPN-DaemonMonitor[/sdcard/openvpn/VPNTEST.ovpn]-daemon-stdout(12164): Mon Apr 30 16:22:11 2012 OpenVPN 2.1.1 i686-pc-linux-gnu [SSL] [LZO2] [EPOLL] built on Jan 6 2012
D/OpenVPN-DaemonMonitor[/sdcard/openvpn/VPNTEST.ovpn]-daemon-stdout(12164): Mon Apr 30 16:22:11 2012 MANAGEMENT: TCP Socket listening on 127.0.0.1:39157
D/OpenVPN-DaemonMonitor[/sdcard/openvpn/VPNTEST.ovpn]-daemon-stdout(12164): Mon Apr 30 16:22:11 2012 WARNING: No server certificate verification method has been enabled. See http://openvpn.net/howto.html#mitm for more info.
D/OpenVPN-DaemonMonitor[/sdcard/openvpn/VPNTEST.ovpn]-daemon-stdout(12164): Mon Apr 30 16:22:11 2012 NOTE: OpenVPN 2.1 requires '--script-security 2' or higher to call user-defined scripts or executables
[B]D/OpenVPN-DaemonMonitor[/sdcard/openvpn/VPNTEST.ovpn]-daemon-stdout(12164): Mon Apr 30 16:22:11 2012 Need password(s) from management interface, waiting...[/B]
D/OpenVPN-DaemonMonitor[/sdcard/openvpn/VPNTEST.ovpn]-mgmt(12164): started
D/OpenVPN-DaemonMonitor[/sdcard/openvpn/VPNTEST.ovpn]-mgmt(12164): attach(): using management port at 39157
V/OpenVPN-DaemonMonitor[/sdcard/openvpn/VPNTEST.ovpn]-mgmt(12164): Successfully attached to OpenVPN monitor port
D/OpenVPN-DaemonMonitor[/sdcard/openvpn/VPNTEST.ovpn]-daemon-stdout(12164): Mon Apr 30 16:22:11 2012 MANAGEMENT: Client connected from 127.0.0.1:39157
V/OpenVPN-DaemonMonitor[/sdcard/openvpn/VPNTEST.ovpn]-mgmt(12164): Socket IO established
D/OpenVPNDaemonEnabler(12164): Received OpenVPN daemon state changed from Unknown to Enabled
D/OpenVPN-DaemonMonitor[/sdcard/openvpn/VPNTEST.ovpn]-mgmt(12164): >INFO:OpenVPN Management Interface Version 1 -- type 'help' for more info
D/OpenVPN-DaemonMonitor[/sdcard/openvpn/VPNTEST.ovpn]-daemon-stdout(12164): Mon Apr 30 16:22:11 2012 MANAGEMENT: CMD 'state'
D/OpenVPN-DaemonMonitor[/sdcard/openvpn/VPNTEST.ovpn]-daemon-stdout(12164): Mon Apr 30 16:22:11 2012 MANAGEMENT: CMD 'state on'
D/OpenVPNDaemonEnabler(12164): Received OpenVPN network state changed from Unknown to Connecting
V/OpenVPN-DaemonMonitor[/sdcard/openvpn/VPNTEST.ovpn]-mgmt(12164): onState("1335795731,CONNECTING,,,")
D/OpenVPN-Settings-getprop(12164): invoking external process: /system/bin/sh
D/OpenVPN-DaemonMonitor[/sdcard/openvpn/VPNTEST.ovpn]-daemon-stdout(12164): Mon Apr 30 16:22:12 2012 MANAGEMENT: CMD 'bytecount 0'
D/OpenVPN-Settings-getprop(12164): invoking command line: getprop net.dnschange
D/OpenVPN-Settings-getprop-stdout(12164): 66
I/OpenVPN-Settings-getprop-stdout(12164): terminated
I/OpenVPN-Settings-getprop-stderr(12164): terminated
D/OpenVPN-DaemonMonitor[/sdcard/openvpn/VPNTEST.ovpn]-mgmt(12164): =============> 0 == 66 resetting dns, leaving dns alone
D/OpenVPN-DaemonMonitor[/sdcard/openvpn/VPNTEST.ovpn]-mgmt(12164): SUCCESS: real-time state notification set to ON
D/OpenVPN-DaemonMonitor[/sdcard/openvpn/VPNTEST.ovpn]-mgmt(12164): SUCCESS: bytecount interval changed
D/OpenVPNDaemonEnabler(12164): Received OpenVPN network state changed from Connecting to Connecting
Note: OpenVPN is waiting here for the password. I did not enter it yet.
From what you said you do not even reach this 'checkpoint' so for now there is no need to debug any further.
This is what i get:
Code:
D/OpenVPN-DaemonMonitor[/sdcard/openvpn/VPN-Server.ovpn]-mgmt(30883
): attach(): using management port at 24475
E/OpenVPN-DaemonMonitor[/sdcard/openvpn/VPN-Server.ovpn]-mgmt(30883
): attaching to OpenVPN daemon: /127.0.0.1:24475 - Connection refused
W/OpenVPN-DaemonMonitor[/sdcard/openvpn/VPN-Server.ovpn](30883): st
art(): choosing random port for management interface: 41258
D/OpenVPN-DaemonMonitor[/sdcard/openvpn/VPN-Server.ovpn]-daemon(308
83): invoking external process: /system/bin/su
D/OpenVPN-DaemonMonitor[/sdcard/openvpn/VPN-Server.ovpn]-daemon(308
83): invoking command line: /system/xbin/openvpn --cd '/sdcard/openvpn' --config
'VPN-Server.ovpn' --writepid '/data/data/de.schaeuffelhut.android.
openvpn/files/com.d/_sdcard_openvpn_VPN-Server.ovpn-pid' --script-
security 1 --management 127.0.0.1 41258 --management-query-passwords --verb 3
E/su (31797): sudb - Opening database
E/su (31797): sudb - Database opened
E/su (31797): sudb - Database closed
D/su (31797): 10198 de.schaeuffelhut.android.openvpn executing 0 /system/bi
n/sh using shell /system/bin/sh : sh
D/OpenVPN-DaemonMonitor[/sdcard/openvpn/VPN-Server.ovpn]-daemon-std
out(30883): Options error: Unrecognized option or missing parameter(s) in VPN-Server.ovpn:12: dhcp-renew (2.1.1)
D/OpenVPN-DaemonMonitor[/sdcard/openvpn/VPN-Server.ovpn]-daemon-std
out(30883): Use --help for more information.
I/OpenVPN-DaemonMonitor[/sdcard/openvpn/VPN-Server.ovpn]-daemon-std
out(30883): terminated
I/OpenVPN-DaemonMonitor[/sdcard/openvpn/VPN-Server.ovpn]-daemon-std
err(30883): terminated
D/OpenVPn Settings(30883): Closing log file /sdcard/openvpn/VPN-Ser
ver.log
I/WindowManager( 1650): CREATE SURFACE Surface(name=Toast, identity=1061, mNat
iveSurface=0) IN SESSION [email protected]: pid=30916 format=
-3 flags=0x0 / Window{40555140 Toast paused=false}
D/PowerManagerService( 1650): acquireWakeLock flags=0xa tag=KEEP_SCREEN_ON_FLAG
uid=1000 pid=1650 myUID=1000 myPID=1650 myTID=1845
D/OpenVPNDaemonEnabler(30883): Received OpenVPN daemon state changed from Unknow
n to Startup
D/OpenVPNDaemonEnabler(30883): Received OpenVPN daemon state changed from Unknow
n to Disabled
thank you
Seems to be a problem with root. From your log:
Code:
E/su (31797): sudb - Opening database
E/su (31797): sudb - Database opened
E/su (31797): sudb - Database closed
If I'm not mistake OpenVPN must be executed as superuser. From my log:
Code:
[B][COLOR="SeaGreen"]D/OpenVPN-DaemonMonitor[/sdcard/openvpn/VPNTEST.ovpn]-daemon(12164): invoking external process: /system/xbin/su
[/COLOR][/B]D/OpenVPN-DaemonMonitor[/sdcard/openvpn/VPNTEST.ovpn]-daemon(12164): invoking command line: /system/xbin/openvpn --cd '/sdcard/openvpn' --config 'VPNTEST.ovpn' --writepid '/data/data/de.schaeuffelhut.android.openvpn/files/com.d/_sdcard_openvpn_VPNTEST.ovpn-pid' --script-security 1 --management 127.0.0.1 39157 --management-query -passwords --verb 3
Look at the green bold line: it is running su, only afterwards OpenVPN is invoked.
From your log (same location as in mine) I can see that there is a problem with root access.
To test this you can use 'adb' and the 'shell' command. Enter 'su' yourself to get root access. Then enter the command line from your log. I bet if 'su' succeeds, i.e. you get root access, then OpenVPN will start .
I'm sorry if this seems stupid but what exactly i should enter from my log
i got to the part where it says
su
#
but i just need to know what exactly should i enter afterwards
thank you so much
No, not stupid, I was just going way too fast. If one does not understand an explanation this is usually due to the explanation not being accurate, in short: my mistake
It took me some time but I think I found a better way to examine your problem.
First we need an alternative possibility to enter the password of the key file when starting OpenVPN manually from the adb console. OpenVPN is supposed to ask for the password on stdin if started with option '--askpass' without any file to lookup passwords. Though this dos not work on my phone, hence I have created a file name 'test.passwd' containing only one line with my OpenVPN key password. This file must be located in the same directory as the 'ovpn' file.
When your done with this you are ready to start OpenVPN 'manually' by doing this:
1) run 'adb shell'
2) type 'su'
3) type 'whoami' and make sure you are root (userid 0)
4) type
Code:
/system/xbin/openvpn --cd '/sdcard/openvpn' --config VPN-Server.ovpn --askpass test.passwd
Assuming you named the file holding your password 'test.passwd'
OpenVPN should now connect to your server and you should see something similar to this:
Code:
Tue May 1 10:55:03 2012 OpenVPN 2.1.1 i686-pc-linux-gnu [SSL] [LZO2] [EPOLL] built on Jan 6 2012
Tue May 1 10:55:03 2012 WARNING: file 'test.passwd' is group or others accessible
Tue May 1 10:55:03 2012 WARNING: No server certificate verification method has been enabled. See http://openvpn.net/howto.html#mitm for more info.
Tue May 1 10:55:03 2012 NOTE: OpenVPN 2.1 requires '--script-security 2' or higher to call user-defined scripts or executables
Tue May 1 10:55:03 2012 WARNING: this configuration may cache passwords in memory -- use the auth-nocache option to prevent this
Tue May 1 10:55:03 2012 WARNING: file './[email protected]_one_cares.p12' is group or others accessible
Tue May 1 10:55:03 2012 LZO compression initialized
Tue May 1 10:55:03 2012 UDPv4 link local: [undef]
Tue May 1 10:55:03 2012 UDPv4 link remote: xxx.yyy.zzzz.wwww:1194
Tue May 1 10:55:04 2012 [openvpn.myvpn.server] Peer Connection Initiated with xxx.yyy.zzzz.wwww:1194
Tue May 1 10:55:06 2012 TUN/TAP device tun0 opened
Tue May 1 10:55:06 2012 /system/bin/ifconfig tun0 192.168.101.6 pointopoint 192.168.101.5 mtu 1500
Tue May 1 10:55:06 2012 Initialization Sequence Completed
At this point you should invoke another 'adb shell' and type 'busybox ifconfig'. If you see a tun0 device then the OpenVPN connection is established.
On my system this looks like this:
Code:
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:171 errors:0 dropped:0 overruns:0 frame:0
TX packets:171 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:11713 (11.4 KiB) TX bytes:11713 (11.4 KiB)
[B]tun0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:192.168.101.6 P-t-P:192.168.101.5 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)[/B]
wlan0 Link encap:Ethernet HWaddr 12:34:56:78:9A:BC
inet addr:xyz.vw.11.32 Bcast:xyz.vw.11.255 Mask:255.255.255.0
inet6 addr: f370::6sd6:f891:fz8e:9qqb/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:8185 errors:0 dropped:271 overruns:0 frame:0
TX packets:9578 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2058632 (1.9 MiB) TX bytes:1000224 (976.7 KiB)
If not check the output of the other shell, it will tell you about where to search for the problem (hopefully ).
Unfortunately this didn't work, i get this when i enter that command
Code:
Options error: Unrecognized option or missing parameter(s) in VPN-S
erver.ovpn:12: dhcp-renew (2.1.1)
Use --help for more information.
and when i do the 'whoami' command i get this
Code:
whoami: unknown uid 0
but I think the password is not the issue because when I click on the server to open it in openvpn( put a tick next to it) it doesn't put a tick it doesn't even reach the password point i think its an issue much earlier than the password point.
I just get the superuser message 'OpenVPN Settings has been granted superuser permissions' and nothing else happens at all.
I can tick/start the main button on the top 'OpenVPN' but I can't start the server.
just to note that i used doom lord rooting tool kit version 4 to root the phone if the issue is root related or something.
Thank you again.
xdaian948 said:
Unfortunately this didn't work, i get this when i enter that command
Code:
Options error: Unrecognized option or missing parameter(s) in VPN-S
erver.ovpn:12: dhcp-renew (2.1.1)
Use --help for more information.
Click to expand...
Click to collapse
As I said in my very first post: please provide the contents of your .ovpn file. Even if you believe it is correct it seems to contain options that do not work, as stated by the error message!
and when i do the 'whoami' command i get this
Code:
whoami: unknown uid 0
Click to expand...
Click to collapse
This is fine, you are root.
but I think the password is not the issue because when I click on the server to open it in openvpn( put a tick next to it) it doesn't put a tick it doesn't even reach the password point i think its an issue much earlier than the password point.
Click to expand...
Click to collapse
I did not say (and to tell the truth I don't believe) it is a problem with the password since, as I described in my last post, you do not even reach the point where OpenVPN could ask you for the password.
I just get the superuser message 'OpenVPN Settings has been granted superuser permissions' and nothing else happens at all.
I can tick/start the main button on the top 'OpenVPN' but I can't start the server.
Click to expand...
Click to collapse
The method I proposed for debugging boils things down to the bare minimum and therefore reduces the chance of any other misconfiguration then the one of OpenVPN. You better don't use the 'graphical interface' until OpenVPN runs fine from the command line.
just to note that i used doom lord rooting tool kit version 4 to root the phone if the issue is root related or something.
Click to expand...
Click to collapse
Don't know what this is but sounds cool , anyway it seems rooting is ok.
Thank you again.
Click to expand...
Click to collapse
You are welcome, but please consider that your .ovpn configuration file could have an error. The error reported in your log is due to a misconfiguration in your .ovpn file I believe. This is why OpenVPN exits.
Alright i'll send you the .ovpn files in a PM now
Thank you.
this is the rooting method i was talking about btw
Code:
http://forum.xda-developers.com/showthread.php?t=1321582
Ok, got your files by PM.
Besides the remote destination you would connect to and perhaps the names of the certificate and key file there is no security relevant information you could not post here I think.
Anyway: the files look like you are connecting to a VPN server that is not your server, i.e. you have no control of the OpenVPN server, correct? In this case I can't really help you, you should ask the VPN provider.
If the VPN server was your own server I would have suggested to radically comment options until you manage to establish a basic connection. Your log clearly shows that there seems to be problem with the option 'dhcp-renew' but as you are not running the VPN server I do not know if you can comment this or any other option, sorry .
My .ovpn file looks like this:
Code:
; OpenVPN client configuration for
; access to xyz enterprise
;
client
dev tun
proto udp
remote xxx.yyy.zzz.www 1194
nobind
comp-lzo
pkcs12 ./p12_ca_cert_private_cert_and_key_bundle.p12
verb 1
This configuration works perfect including routing and DNS resolution by the internal DNS servers of xyz enterprise.
You can try to eliminate (comment) options in your .ovpn file yourself hoping you get a result having no offending option left, but this might be tedious without knowledge of the server end . If you try this please note that your configuration uses 3 individual files, one for the CA cert, one for your cert and one for the key while my configuration uses only one file (certs and key bundled). You must keep your 'three file' configuration.
Well, i'll just ask the support of the VPN provider and see what they can do there might be a problem on their end, and i want to thank you so much for everything you have done

resolve dns as root (uid 0) ?

I have nexus4 and nexus7 (both are 4.3), I noticed all apps resolve dns connection as root (uid 0).
I want to know/ask, why on android, all apps resolve dns connection as root?
I block dns connection as root, then all apps can not resolve dns.
(iptables -I OUTPUT -p udp --dport 53 -m owner --uid-owner 0 -j DROP)
I also noticed, my nexus7 will resolve dns as root, if the connection blocked, then the apps will not resolve dns.
but my nexus4 will resolve dns as root first, if it blocked, then apps will resolve dns as apps-id.
why will that?
anyone have this problem?
both n4/n7 is running stock andorid 4.3 (donwload from google)
thanks.
I can confirm that something very strange is going on in Android 4.3, I'm runing the Slimrom mod and the same thing is true for me, all dns request are done as root. But to make things even stranger the dns props are set but not used, it seems like something is really broken within bioinc that makes it impossible to change dns servers on the fly.
Mine is running android stock rom for both, downloaded from google.
I still not understand, why will that.
Thanks.
Sent from my Nexus 4 using xda app-developers app
Browsing through the AOSP sources, I noticed that Android 4.3 incorporated a somewhat confusing series of commits under the heading of "dns cache per interface," which effectively causes all Bionic DNS requests to be proxied through netd. This commit is the most important element.
Here is the old implementation from Android 4.2.2:
Code:
static struct hostent *
gethostbyname_internal(const char *name, int af, res_state res)
{
const char *cp;
char *bp, *ep;
int size;
struct hostent *hp;
struct resolv_cache* cache;
[b]res_static rs = __res_get_static();[/b]
static const ns_dtab dtab[] = {
NS_FILES_CB(_gethtbyname, NULL)
{ NSSRC_DNS, _dns_gethtbyname, NULL }, /* force -DHESIOD */
{ 0, 0, 0 }
};
assert(name != NULL);
switch (af) {
case AF_INET:
size = INADDRSZ;
break;
case AF_INET6:
size = IN6ADDRSZ;
break;
default:
h_errno = NETDB_INTERNAL;
errno = EAFNOSUPPORT;
return NULL;
}
rs->host.h_addrtype = af;
rs->host.h_length = size;
[...]
h_errno = NETDB_INTERNAL;
if (nsdispatch(&hp, dtab, NSDB_HOSTS, "gethostbyname",
default_dns_files, name, strlen(name), af) != NS_SUCCESS) {
return NULL;
}
h_errno = NETDB_SUCCESS;
return hp;
Note the use of the libc resolver. The library is issuing the DNS requests directly.
By contrast, here is the new Android 4.3 implementation:
Code:
// very similar in proxy-ness to android_getaddrinfo_proxy
static struct hostent *
gethostbyname_internal(const char *name, int af, res_state res, const char *iface)
{
[b]const char *cache_mode = getenv("ANDROID_DNS_MODE");[/b]
FILE* proxy = NULL;
struct hostent *result = NULL;
[b]if (cache_mode != NULL && strcmp(cache_mode, "local") == 0) {[/b]
res_setiface(res, iface);
return gethostbyname_internal_real(name, af, res);
}
proxy = android_open_proxy();
if (proxy == NULL) goto exit;
/* This is writing to system/netd/DnsProxyListener.cpp and changes
* here need to be matched there */
if (fprintf(proxy, "gethostbyname %s %s %d",
iface == NULL ? "^" : iface,
name == NULL ? "^" : name,
af) < 0) {
goto exit;
}
if (fputc(0, proxy) == EOF || fflush(proxy) != 0) {
goto exit;
}
result = android_read_hostent(proxy);
So by default, Android 4.3 will proxy the requests through netd (owned by UID 0). This can be verified by setting DBG to 1 in system/netd/DnsProxyListener.cpp, then watching logcat:
Code:
D/DnsProxyListener( 146): argv[0]=getaddrinfo
D/DnsProxyListener( 146): argv[1]=omg.yahoo.com
D/DnsProxyListener( 146): argv[2]=^
D/DnsProxyListener( 146): argv[3]=1024
D/DnsProxyListener( 146): argv[4]=0
D/DnsProxyListener( 146): argv[5]=1
D/DnsProxyListener( 146): argv[6]=0
D/DnsProxyListener( 146): argv[7]=^
D/DnsProxyListener( 146): GetAddrInfoHandler for omg.yahoo.com / [nullservice] / [nulliface] / 1489
D/DnsProxyListener( 146): GetAddrInfoHandler, now for omg.yahoo.com / (null) / (null)
D/DnsProxyListener( 146): argv[0]=getaddrinfo
D/DnsProxyListener( 146): argv[1]=l1.yimg.com
D/DnsProxyListener( 146): argv[2]=^
D/DnsProxyListener( 146): argv[3]=1024
D/DnsProxyListener( 146): argv[4]=0
D/DnsProxyListener( 146): argv[5]=1
D/DnsProxyListener( 146): argv[6]=0
D/DnsProxyListener( 146): argv[7]=^
D/DnsProxyListener( 146): GetAddrInfoHandler for l1.yimg.com / [nullservice] / [nulliface] / 1489
D/DnsProxyListener( 146): GetAddrInfoHandler, now for l1.yimg.com / (null) / (null)
As seen in the Android 4.3 code snippet, it is possible to temporarily revert to the old behavior by setting ANDROID_DNS_MODE to "local", causing Bionic to send the request through gethostbyname_internal_real(), the old implementation. On this system, the shell user is blocked from sending network traffic via netfilter, but the root user (which owns netd) has full network access:
Code:
[email protected]:/ $ id
uid=2000(shell) gid=2000(shell) groups=1003(graphics),1004(input),1007(log),1009(mount),1011(adb),1015(sdcard_rw),1028(sdcard_r),3001(net_bt_admin),3002(net_bt),3003(inet),3006(net_bw_stats) context=u:r:shell:s0
[email protected]:/ $ ANDROID_DNS_MODE= telnet google.com 80
telnet: can't connect to remote host (74.125.227.135): Connection refused
1|[email protected]:/ $ ANDROID_DNS_MODE=local telnet google.com 80
telnet: bad address 'google.com'
1|[email protected]:/ $
In the former case (proxied request), the application was able to look up the hostname via netd, but could not send data traffic. In the latter case (direct request), the application was not able to look up the hostname at all.
It is possible to change the systemwide default by making a tweak to system/core/rootdir/init.rc and rebuilding your kernel image:
Code:
diff --git a/rootdir/init.rc b/rootdir/init.rc
index b6d7335..d0efc46 100644
--- a/rootdir/init.rc
+++ b/rootdir/init.rc
@@ -47,6 +47,7 @@ loglevel 3
export ANDROID_ASSETS /system/app
export ANDROID_DATA /data
export ANDROID_STORAGE /storage
+ export ANDROID_DNS_MODE local
export ASEC_MOUNTPOINT /mnt/asec
export LOOP_MOUNTPOINT /mnt/obb
export BOOTCLASSPATH /system/framework/core.jar:/system/framework/core-junit.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/telephony-common.jar:/system/framework/voip-common.jar:/system/framework/mms-common.jar:/system/framework/android.policy.jar:/system/framework/services.jar:/system/framework/apache-xml.jar
Maybe there is a better way to patch existing ROMs in place.
So, any easyway to deny some apps, to resolve dns?
How apps connect to netd to resolve dns? Unix socket? Or inet socket?
Ok, what I want to do is, some apps connect through tor network and prevent dns leaks.
Thanks.
Sent from my Nexus 4 using xda app-developers app
Ok, I found it in android_open_proxy().
It look like use unix socket "/dev/socket/dnsproxyd".
So I can not use iptables to deny some apps connect to dnsproxy? right?
Any idea to prevent some apps/uid (but not all), connect to dnsproxy?
Thank you.
Sent from my Nexus 4 using xda app-developers app
I tried export ANDROID_DNS_MODE=local
but it make no different on my nexus 4
(my nexus 4 use android stock room 4.3, download from google)
[email protected]:/ $ id
uid=2000(shell) gid=2000(shell) groups=1003(graphics),1004(input),1007(log),1009(mount),1011(adb),1015(sdcard_rw),1028(sdcard_r),3001(net_bt_admin),3002(net_bt),3003(inet),3006(net_bw_stats) context=u:r:shell:s0
[email protected]:/ $ telnet google.com
telnet: bad address 'google.com'
1|[email protected]:/ $ set |grep -i dns
1|[email protected]:/ $ export ANDROID_DNS_MODE=local
[email protected]:/ $ set |grep -i dns
ANDROID_DNS_MODE=local
_='ANDROID_DNS_MODE=local'
[email protected]:/ $ telnet google.com
telnet: bad address 'google.com'
any idea why will that?
thank you.
johnw.xda said:
I tried export ANDROID_DNS_MODE=local
but it make no different on my nexus 4
(my nexus 4 use android stock room 4.3, download from google)
[email protected]:/ $ id
uid=2000(shell) gid=2000(shell) groups=1003(graphics),1004(input),1007(log),1009(mount),1011(adb),1015(sdcard_rw),1028(sdcard_r),3001(net_bt_admin),3002(net_bt),3003(inet),3006(net_bw_stats) context=u:r:shell:s0
[email protected]:/ $ telnet google.com
telnet: bad address 'google.com'
1|[email protected]:/ $ set |grep -i dns
1|[email protected]:/ $ export ANDROID_DNS_MODE=local
[email protected]:/ $ set |grep -i dns
ANDROID_DNS_MODE=local
_='ANDROID_DNS_MODE=local'
[email protected]:/ $ telnet google.com
telnet: bad address 'google.com'
any idea why will that?
thank you.
Click to expand...
Click to collapse
Hmm, it looks like this change removed the logic that populates the nameserver list from the system properties. So with ANDROID_DNS_MODE=local, libc will search /system/etc/hosts but it won't actually be able to contact any nameservers:
Code:
[email protected] / $ ANDROID_DNS_MODE=local RES_OPTIONS=debug ping -c1 localhost
;; res_setoptions("debug", "env")..
;; debug
PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=1.85 ms
--- localhost ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 1.852/1.852/1.852/0.000 ms
[email protected] / $ ANDROID_DNS_MODE=local RES_OPTIONS=debug ping -c1 google.com;; res_setoptions("debug", "env")..
;; debug
;; res_nquerydomain(google.com, <Nil>, 1, 1)
;; res_query(google.com, 1, 1)
;; res_nmkquery(QUERY, google.com, IN, A)
;; res_send()
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 28372
;; flags: rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
;; google.com, type = A, class = IN
;; res_query: send error
;; res_nquerydomain(google.com, , 1, 1)
;; res_query(google.com., 1, 1)
;; res_nmkquery(QUERY, google.com., IN, A)
;; res_send()
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 41613
;; flags: rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
;; google.com, type = A, class = IN
;; res_query: send error
ping: unknown host google.com
[email protected] / $
There's some code in _resolv_set_nameservers_for_iface() that might help, but I don't think this gets run from ordinary command-line utilities.
Any idea to prevent some apps/uid (but not all), connect to dnsproxy?
Click to expand...
Click to collapse
You could try applying filesystem ACLs or SELinux rules to /dev/socket/dnsproxyd
Compiling setfacl with Bionic is a hassle, but you could boot e.g. a Debian ARM image in QEMU and build a binary that is statically linked with glibc. You might also need to build a kernel with CONFIG_TMPFS_POSIX_ACL=y; this setting is currently disabled on the CM10.2 grouper builds.
Other possibilities include:
Modify Bionic to reinstate the old nameserver list behavior, and modify /init.rc as above
Modify netd; you could try calling setresuid() to send out each request under the UID of the client instead of UID 0
Write a daemon that intercepts DNS requests intended for netd; this could use a modified version of the netd DnsProxy logic or it could pass the request through to the real netd
Sorry, I forgot to mention before, maybe the reason is, my busybox/telnet is compiled on debian use glibc with -static flags, so telnet/busybox does not use android's libc, and does not use dnsproxy too.
Anyway, is it possible to compile owner libc for android? Where can download android 4.3 libc source code? Do I need to setup ndk to compile it? or can I use gcc to compile it.
Did you do that before?
Thank you again.
Sent from my Nexus 4 using xda app-developers app
I'm using pppwidget to access the network and I think that is affected by this DNS issues. As specific way to get network, is not aware of all this new stuff and thus unable to resolv dns queries.
johnw.xda said:
Sorry, I forgot to mention before, maybe the reason is, my busybox/telnet is compiled on debian use glibc with -static flags, so telnet/busybox does not use android's libc, and does not use dnsproxy too.
Anyway, is it possible to compile owner libc for android? Where can download android 4.3 libc source code? Do I need to setup ndk to compile it? or can I use gcc to compile it.
Did you do that before?
Thank you again.
Sent from my Nexus 4 using xda app-developers app
Click to expand...
Click to collapse
johnw.xda said:
Anyway, is it possible to compile owner libc for android? Where can download android 4.3 libc source code? Do I need to setup ndk to compile it? or can I use gcc to compile it.
Did you do that before?
Click to expand...
Click to collapse
I've been building my Android 4.3 ROMs from the CM10.2 sources.
You can try building from AOSP directly (instructions here). CM builds aren't difficult, but they did require a few extra steps.
I'm not aware of a way to build Bionic standalone. Trying the obvious stuff like running "ndk-build" in that directory, or using crosstool-ng, didn't work for me. Others can jump in if they know...
cernekee said:
Hmm, it looks like this change removed the logic that populates the nameserver list from the system properties. So with ANDROID_DNS_MODE=local, libc will search /system/etc/hosts but it won't actually be able to contact any nameservers:
Code:
[email protected] / $ ANDROID_DNS_MODE=local RES_OPTIONS=debug ping -c1 localhost
;; res_setoptions("debug", "env")..
;; debug
PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=1.85 ms
--- localhost ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 1.852/1.852/1.852/0.000 ms
[email protected] / $ ANDROID_DNS_MODE=local RES_OPTIONS=debug ping -c1 google.com;; res_setoptions("debug", "env")..
;; debug
;; res_nquerydomain(google.com, <Nil>, 1, 1)
;; res_query(google.com, 1, 1)
;; res_nmkquery(QUERY, google.com, IN, A)
;; res_send()
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 28372
;; flags: rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
;; google.com, type = A, class = IN
;; res_query: send error
;; res_nquerydomain(google.com, , 1, 1)
;; res_query(google.com., 1, 1)
;; res_nmkquery(QUERY, google.com., IN, A)
;; res_send()
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 41613
;; flags: rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
;; google.com, type = A, class = IN
;; res_query: send error
ping: unknown host google.com
[email protected] / $
There's some code in _resolv_set_nameservers_for_iface() that might help, but I don't think this gets run from ordinary command-line utilities.
You could try applying filesystem ACLs or SELinux rules to /dev/socket/dnsproxyd
Compiling setfacl with Bionic is a hassle, but you could boot e.g. a Debian ARM image in QEMU and build a binary that is statically linked with glibc. You might also need to build a kernel with CONFIG_TMPFS_POSIX_ACL=y; this setting is currently disabled on the CM10.2 grouper builds.
Other possibilities include:
Modify Bionic to reinstate the old nameserver list behavior, and modify /init.rc as above
Modify netd; you could try calling setresuid() to send out each request under the UID of the client instead of UID 0
Write a daemon that intercepts DNS requests intended for netd; this could use a modified version of the netd DnsProxy logic or it could pass the request through to the real netd
Click to expand...
Click to collapse
Hi,
Thanks for this analysis.
It certainly does look like 4.3 is ignoring net.dns1 value as the nameserver.
I'm running my custom dns server inside Android and now I suddenly find that it's not being queried.
I may have a small step towards solving this problem.
iptables -t nat -I OUTPUT -p udp -d 192.168.1.1 --dport 53 -j DNAT --to-destination 192.168.1.5:53
iptables -t nat -I OUTPUT -p tcp -d 192.168.1.1 --dport 53 -j DNAT --to-destination 192.168.1.5:53
This works by intercepting the DNS requests meant for the remote nameserver and redirecting it to the local DNS server.
Hope this helps someone figure it out.
There may be a way to programmatically change the active interface DNS server?
Or a way to perhaps disable the DNS proxy completely (ANDROID_DNS_MODE=local doesn't work any more as mentioned)?
cernekee said:
Write a daemon that intercepts DNS requests intended for netd; this could use a modified version of the netd DnsProxy logic or it could pass the request through to the real netd
Click to expand...
Click to collapse
This is what I wound up doing: I copied the DnsProxyListener and Bionic resolver code into an experimental new program called "dnsproxy2", and then tweaked the logic a little bit. Sources are posted here and I'm attaching binaries to this message.
Currently it allows you to pass in a single DNS server address which will unconditionally override the OS-provided DNS servers, and when it proxies requests on behalf of an application it will change the thread's UID (Linux fsuid) to match the caller so that the traditional netfilter app/UID restrictions will be honored.
To see it in action, just do:
Code:
adb push libs/armeabi-v7a/dnsproxy2 /data/local/tmp
adb shell "su -c '/data/local/tmp/dnsproxy2 -v 8.8.8.8'"
The "-v" flag will show the DNS requests on the console.
This was tested with CM10.2. Note that Firefox appears to bypass the DNS proxy.
If this proves useful it may be worth writing a GUI installer/settings app. Another possible improvement would be to allow selectively overriding the DNS server based on the active connection.
cernekee said:
This is what I wound up doing: I copied the DnsProxyListener and Bionic resolver code into an experimental new program called "dnsproxy2", and then tweaked the logic a little bit. Sources are posted here and I'm attaching binaries to this message.
Currently it allows you to pass in a single DNS server address which will unconditionally override the OS-provided DNS servers, and when it proxies requests on behalf of an application it will change the thread's UID (Linux fsuid) to match the caller so that the traditional netfilter app/UID restrictions will be honored.
To see it in action, just do:
Code:
adb push libs/armeabi-v7a/dnsproxy2 /data/local/tmp
adb shell "su -c '/data/local/tmp/dnsproxy2 -v 8.8.8.8'"
The "-v" flag will show the DNS requests on the console.
This was tested with CM10.2. Note that Firefox appears to bypass the DNS proxy.
If this proves useful it may be worth writing a GUI installer/settings app. Another possible improvement would be to allow selectively overriding the DNS server based on the active connection.
Click to expand...
Click to collapse
Is this method still going strong? At this moment there is no app on the market that can change DNS (mobile data access).
hardKNOXbz said:
Is this method still going strong? At this moment there is no app on the market that can change DNS (mobile data access).
Click to expand...
Click to collapse
I'd suggest reading the last few pages of the CrossBreeder thread. I don't think dnsproxy2 is in the official release yet but a number of people have been experimenting with it and posting their results.
cernekee said:
I'd suggest reading the last few pages of the CrossBreeder thread. I don't think dnsproxy2 is in the official release yet but a number of people have been experimenting with it and posting their results.
Click to expand...
Click to collapse
Thank you, I'll do that.
I have created a bug for AOSP regarding broken ANDROID_DNS_MODE=local behavior:
https://code.google.com/p/android/issues/detail?id=75232
Plz try this to connect throo vpn.
This is not my work i just take it from cm11 and put it to stock rom and it work.
sshtunnel_support.zip
https://docs.google.com/file/d/0BzL6ekv_OuX2cE9uY3pfYzNmdWs/edit?usp=docslist_api

[Q] SDK: Install_Failed_Dexopt. Solution?

Hello all
I am having some trouble with SDK installing apps to my Android. I've tried to find many forums about my issue, but I've hit a brick wall every time. My rooted device is an LG Optimus C running Android 2.2 (ancient lol). My issue is that I'm getting the error: Failure [INSTALL_FAILED_DEXOPT] for every app I try to install. I've wiped the device twice and then found out that this error happens every time after I've installed a good amount of apps...which I read somewhere that this will happen because of not having enough space in Dalvik..or in the data area and won't allow the install to write anything else..correct me if I'm wrong on this I've also cleared all caches multiple times, including Dalvik.
I've also tried the work around where you try and skip that all together and put the app straight into /system /app. That came up with no resolution, even with the correct properties selected (read/write/execute etc). So now, I really have no other avenues left but to come here and ask.
Here is the Logcat results I get using adb install -r app.apk no matter what app it is. I will use tumblog.apk (compatible with device) for this example:
D/AndroidRuntime( 4201):
D/AndroidRuntime( 4201): >>>>>> AndroidRuntime START com.android.internal.os.Run
timeInit <<<<<<
I/AndroidRuntime( 4201): Heap size: -Xmx32m
D/AndroidRuntime( 4201): CheckJNI is OFF
D/AndroidRuntime( 4201): Calling main entry com.android.commands.pm.Pm
W/ActivityManager( 1356): No content provider found for:
W/ActivityManager( 1356): No content provider found for:
D/PackageParser( 1356): Scanning package: /data/app/vmdl-166230949.tmp
D/PackageManager( 1356): Scanning package com.luckydroid.tumblelog
E/PackageManager( 1356): Package com.luckydroid.tumblelog has mismatched uid: 10
060 on disk, 10061 in settings
I/PackageManager( 1356): Linking native library dir for /data/app/com.luckydroid
.tumblelog-1.apk
D/installd( 1256): DexInv: --- BEGIN '/data/app/com.luckydroid.tumblelog-1.apk'
---
D/dalvikvm( 4211): Zip inflate: partial write (will retry): (24536 of 32768)
E/dalvikvm( 4211): Zip inflate: write failed: No space left on device
W/dalvikvm( 4211): DexOptZ: extraction of classes.dex from /data/app/com.luckydr
oid.tumblelog-1.apk failed
W/installd( 1256): DexInv: --- END '/data/app/com.luckydroid.tumblelog-1.apk' --
- status=0xff00, process failed
E/installd( 1256): dexopt failed on '/data/dalvik-cache/[email protected]@com.luckydroid.
[email protected]' res = 65280
W/PackageManager( 1356): Package couldn't be installed in /data/app/com.luckydro
id.tumblelog-1.apk
D/AndroidRuntime( 4201): Shutting down VM
I/AndroidRuntime( 4201): NOTE: attach of thread 'Binder Thread #3' failed
D/jdwp ( 4201): adbd disconnected
I really have no clue what any of this means lol...pretty new to logcat. I am aware of the file name not matching the original name of the apk..shouldn't matter considering I've installed many apps with shortened names. Any help would be greatly appreciated! Thanks
EDIT: Looks like "E/dalvikvm( 4211): Zip inflate: write failed: No space left on device" is the problem. Not enough space in Dalvik. Still have no idea how to work around.
Bump
Is this not posted in the correct forum? I'm just guessing no one knows of a solution?
Çözüme Yakın
Sizin sorununuz apk~classes.dex~.smali dosyalarının içinde gereksiz kodları siliniz. "Ayrıca Facebook klasörünü bulup siliniz (her clasess.dex'te bulunmaz)" ayrıca kimi classes.dex boyutu 9MB iken yükleniyor bazı clasess.dex dosyaları ise 7,8*MB olunca yüklenmiyor. Tabikide kodlar içinde dexOpt= dex options ayarı vardır ama ben bulamadım sadece bunları biliyorum. Umarım çözüm bulan çıkar. TR

Categories

Resources