Regroup android tips, and add docs on runit logging

This commit is contained in:
lhark 2021-04-08 23:32:48 +02:00
parent db4844fbc6
commit 753824bc15

192
how_to
View file

@ -703,9 +703,121 @@ Better Bibtex, Zotero:
Bumblebee runit fix:
sed -i 's/Driver=$/Driver=nvidia/' /etc/bumblebee/bumblebee.conf
Uncompress android .ab backup files:
# https://stackoverflow.com/questions/18533567/how-to-extract-or-unpack-an-ab-file-android-backup-file
( printf "\x1f\x8b\x08\x00\x00\x00\x00\x00" ; tail -c +25 backup.ab ) | tar xfvz -
Runit logging:
socklog
* syslogd replacement
* gets messages sent via syslog() (into /dev/log)
svlogd
* builtin log rotation
* needs to be setup for each service (/etc/runit/sv/<service>/log/run)
`exec chpst -u log svlogd -tt /var/log/<service>`
$ sudo mkdir /var/log/<service>
$ sudo chown -R :log /var/log/<service>
$ sudo chmod g+w /var/log/<service>
runsvdir
* sends its stdout to /dev/console
* sends its stderr to its own command line (ps aux | grep runsvdir)
runsv
* if <service>/log exists, redirects service's stdout to logger's stdin
* by default, runsv's stderr, stdout (and stdin?) are redirected to /dev/console
Android:
Uncompress android .ab backup files:
# https://stackoverflow.com/questions/18533567/how-to-extract-or-unpack-an-ab-file-android-backup-file
( printf "\x1f\x8b\x08\x00\x00\x00\x00\x00" ; tail -c +25 backup.ab ) | tar xfvz -
Setup udev for android device with adb:
# Solves "adb: error: failed to get feature set: insufficient permissions for device"
# https://wiki.archlinux.org/index.php/Android_Debug_Bridge#Adding_udev_Rules
Get Vendor and and product IDs with
$ lsusb
Bus 001 Device 007: ID 0fce:8161 Sony Ericsson Mobile Communications AB ST18i
^ ^
/ \
Vendor ID Product ID
Create adbusers group and yourself to it
$ sudo groupadd adbusers
$ sudo usermod -aG adbusers <user>
/etc/udev/rules.d/51-android.rules:
SUBSYSTEM=="usb",ATTR{idVendor}=="<your vendor id>", MODE="0660", GROUP="adbusers" # Or sdkusers
SUBSYSTEM=="usb",ATTR{idVendor}=="<your vendor id>",ATTR{idProduct}=="<your product id>",SYMLINK+="android_adb"
SUBSYSTEM=="usb",ATTR{idVendor}=="<your vendor id>",ATTR{idProduct}=="<your product id>",SYMLINK+="android_fastboot"
$ sudo udevadm control --reload-rules
Setup android emulator:
trizen -S android-emulator \
android-google-apis-x86-system-image-23 \
android-sdk-cmdline-tools-latest # Some tools are borked in the original package
source /etc/profile # Update PATH
# avdmanager will complain about permissions at first start but will
# happily put AVDs in /root/.android/avd if you let it have it for too long
/opt/android-sdk/cmdline-tools/latest/bin/avdmanager create avd \
--force \
--name <your AVD name> \
--package 'system-images;android-23;google_apis;x86' # Match path in /opt/android-sdk/system-images/
# AVD is stored in ~/.android/avd/
# Enable using the hardware keyboard, and switch layout to azerty
sed -i -e 's/\(hw.keyboard=\).*/\1yes/' \
-e 's/\(hw.keyboard.charmap=\).*/\1azerty/' \
~/.android/avd/<your AVD name>.avd/config.ini
# If you have issues running image from different arch, try checking the PATH or
# https://www.bram.us/2017/05/12/launching-the-android-emulator-from-the-command-line/
emulator -avd <your AVD name>
Android diagnostic debug phone codes:
# https://www.itworld.com/article/2708985/debug-your-phone-with-these-hidden-android-secret-codes.html
# https://www.redmondpie.com/hidden-android-secret-codes-for-samsung-htc-motorola-sony-lg-and-other-devices/
*#06# IMEI number
*#0*# Enter the service menu on newer phones like Galaxy S III
*#*#4636#*#* Phone information, usage statistics and battery
*#*#34971539#*#* Detailed camera information
*#*#273282*255*663282*#*#* Immediate backup of all media files
*#*#197328640#*#* Enable test mode for service
*#*#232339#*#* Wireless LAN tests
*#*#0842#*#* Backlight/vibration test
*#*#2664#*#* Test the touchscreen
*#*#1111#*#* FTA software version (1234 in the same code will give PDA and firmware version)
*#12580*369# Software and hardware info
*#9090# Diagnostic configuration
*#872564# USB logging control
*#9900# System dump mode
*#301279# HSDPA/HSUPA Control Menu
*#7465625# View phone lock status
*#*#7780#*#* Reset the /data partition to factory state
*2767*3855# Format device to factory state (will delete everything on phone)
##7764726 Hidden service menu for Motorola Droid
*#*#7594#*#* Enable direct powering down of device once this code is entered
*#*#273283*255*663282*#*#* Make a quick backup of all the media files on your Android device
*#*#232338#*#* Shows Wi-Fi MAC address
*#*#1472365#*#* Perform a quick GPS test
*#*#1575#*#* For a more advanced GPS test
*#*#0283#*#* Perform a packet loopback test
*#*#0*#*#* Run an LCD display test
*#*#0289#*#* Run Audio test
*#*#2663#*#* Show devices touch-screen version
*#*#0588#*#* Perform a proximity sensor test
*#*#3264#*#* Show RAM version
*#*#232331#*#* Run Bluetooth test
*#*#232337#*# Show devices Bluetooth address
*#*#7262626#*#* Perform a field test
*#*#8255#*#* Monitor Google Talk service
*#*#4986*2650468#*#* Show Phone, Hardware, PDA, RF Call Date firmware info
*#*#1234#*#* Show PDA and Phone firmware info
*#*#2222#*#* Show FTA Hardware version
*#*#44336#*#* Show Build time and change list number
*#*#8351#*#* Enable voice dialing log mode, dial *#*#8350#*#* to disable it
##778 (+call) Show EPST menu
These codes are specific to HTC devices only:
*#*#3424#*#* Run HTC function test program
*#*#4636#*#* Show HTC info menu
##8626337# Run VOCODER
##33284# Perform field test
*#*#8255#*#* Launch Google Talk service monitor
##3424# Run diagnostic mode
##3282# Show EPST menu
##786# Reverse Logistics Support
Android wpa_supplicant conf file path:
/data/misc/wifi/wpa_supplicant.conf
Fix: Failed to activate service 'org.freedesktop.login1': timed out:
If dbus has been restarted, don't forget to restart elogind/systemd-logind
@ -780,24 +892,6 @@ Image/photo sorting with feh:
feh --action1 'mv -v %F "/path/to/target/"%N' \
--action[2-9] [...] /dir/to/sort
Setup udev for android device with adb:
# Solves "adb: error: failed to get feature set: insufficient permissions for device"
# https://wiki.archlinux.org/index.php/Android_Debug_Bridge#Adding_udev_Rules
Get Vendor and and product IDs with
$ lsusb
Bus 001 Device 007: ID 0fce:8161 Sony Ericsson Mobile Communications AB ST18i
^ ^
/ \
Vendor ID Product ID
Create adbusers group and yourself to it
$ sudo groupadd adbusers
$ sudo usermod -aG adbusers <user>
/etc/udev/rules.d/51-android.rules:
SUBSYSTEM=="usb",ATTR{idVendor}=="<your vendor id>", MODE="0660", GROUP="adbusers" # Or sdkusers
SUBSYSTEM=="usb",ATTR{idVendor}=="<your vendor id>",ATTR{idProduct}=="<your product id>",SYMLINK+="android_adb"
SUBSYSTEM=="usb",ATTR{idVendor}=="<your vendor id>",ATTR{idProduct}=="<your product id>",SYMLINK+="android_fastboot"
$ sudo udevadm control --reload-rules
Get original windows key from linux:
# From: https://twitter.com/BrandonPrry/status/1038269038881898498
# Not guaranted to work
@ -819,62 +913,6 @@ MSI ge62 webcam not found:
Air Canada PNR access:
https://services.aircanada.com/ServicingPNR/Ancillary/ACO/
Android diagnostic debug phone codes:
# https://www.itworld.com/article/2708985/debug-your-phone-with-these-hidden-android-secret-codes.html
# https://www.redmondpie.com/hidden-android-secret-codes-for-samsung-htc-motorola-sony-lg-and-other-devices/
*#06# IMEI number
*#0*# Enter the service menu on newer phones like Galaxy S III
*#*#4636#*#* Phone information, usage statistics and battery
*#*#34971539#*#* Detailed camera information
*#*#273282*255*663282*#*#* Immediate backup of all media files
*#*#197328640#*#* Enable test mode for service
*#*#232339#*#* Wireless LAN tests
*#*#0842#*#* Backlight/vibration test
*#*#2664#*#* Test the touchscreen
*#*#1111#*#* FTA software version (1234 in the same code will give PDA and firmware version)
*#12580*369# Software and hardware info
*#9090# Diagnostic configuration
*#872564# USB logging control
*#9900# System dump mode
*#301279# HSDPA/HSUPA Control Menu
*#7465625# View phone lock status
*#*#7780#*#* Reset the /data partition to factory state
*2767*3855# Format device to factory state (will delete everything on phone)
##7764726 Hidden service menu for Motorola Droid
*#*#7594#*#* Enable direct powering down of device once this code is entered
*#*#273283*255*663282*#*#* Make a quick backup of all the media files on your Android device
*#*#232338#*#* Shows Wi-Fi MAC address
*#*#1472365#*#* Perform a quick GPS test
*#*#1575#*#* For a more advanced GPS test
*#*#0283#*#* Perform a packet loopback test
*#*#0*#*#* Run an LCD display test
*#*#0289#*#* Run Audio test
*#*#2663#*#* Show devices touch-screen version
*#*#0588#*#* Perform a proximity sensor test
*#*#3264#*#* Show RAM version
*#*#232331#*#* Run Bluetooth test
*#*#232337#*# Show devices Bluetooth address
*#*#7262626#*#* Perform a field test
*#*#8255#*#* Monitor Google Talk service
*#*#4986*2650468#*#* Show Phone, Hardware, PDA, RF Call Date firmware info
*#*#1234#*#* Show PDA and Phone firmware info
*#*#2222#*#* Show FTA Hardware version
*#*#44336#*#* Show Build time and change list number
*#*#8351#*#* Enable voice dialing log mode, dial *#*#8350#*#* to disable it
##778 (+call) Show EPST menu
These codes are specific to HTC devices only:
*#*#3424#*#* Run HTC function test program
*#*#4636#*#* Show HTC info menu
##8626337# Run VOCODER
##33284# Perform field test
*#*#8255#*#* Launch Google Talk service monitor
##3424# Run diagnostic mode
##3282# Show EPST menu
##786# Reverse Logistics Support
Android wpa_supplicant conf file path:
/data/misc/wifi/wpa_supplicant.conf
Grub2 theme customization:
theme.txt reference:
http://wiki.rosalab.ru/en/index.php/Grub2_theme_/_reference#Main_file_syntax