неделя, 13 август 2017 г.

Sheltered won't load

After the last update of my system, Sheltered ran from Steam, wouldn't load. Which obviously left me devastated or at least very curious what the hell went wrong.
The error I got from running Steam from console was:
GameAction [AppID 356040, ActionID 2] : LaunchApp changed task to WaitingGameWindow with ""
ERROR: ld.so: object '~/.local/share/Steam/ubuntu12_32/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored.
GameAction [AppID 356040, ActionID 2] : LaunchApp changed task to Completed with ""

But later, after running the game from its directory with
 ./Sheltered.x86_64
it transformed into:
Set current directory to ~/Steam/steamapps/common/Sheltered
Found path: ~/Steam/steamapps/common/Sheltered/Sheltered.x86_64
Mono path[0] = '~/Steam/steamapps/common/Sheltered/Sheltered_Data/Managed'
Mono path[1] = '~/Steam/steamapps/common/Sheltered/Sheltered_Data/Mono'
Mono config path = '~/Steam/steamapps/common/Sheltered/Sheltered_Data/Mono/etc'
displaymanager : xrandr version warning. 1.5
client has 4 screens
displaymanager screen (0)(eDP1): 1920 x 1080
Using libudev for joystick management


Importing game controller configs

Oddly enough, the game would run in I'm offline. 
 So the solution, turned out to be, starting it with:
 ./Sheltered.x86_64 LIBGL_ALWAYS_SOFTWARE=1

After which, the  game started running also from Steam. Go figure.

In the meanwhile, I found this useful script for redirecting the errordump of Steam:
cd ~/.local/share/Steam/linux32
mv steamerrorreporter steamerrorreporter.bak
echo "#!/bin/bash" >steamerrorreporter
echo "exit 0" >>steamerrorreporter
chmod a+x steamerrorreporter
source 
And also, to speed up the game launch:
echo "" > /proc/sys/kernel/core_pattern
 
And also, note the great Arch Steam/Troubleshooting site.  
 
Also oddly enough, KSP starts ok with:
vblank_mode=0 optirun -b primus %command%
even though the suggested is: 
LD_PRELOAD="libpthread.so.0 libGL.so.1" __GL_THREADED_OPTIMIZATIONS=1 %command%_64 -force-gfx-direct 

Other suggested options:
 LD_PRELOAD="libpthread.so.0 libGL.so.1" __GL_THREADED_OPTIMIZATIONS=1 optirun steam
or 
find ~/.steam/root/ \( -name "libgcc_s.so*" -o -name "libstdc++.so*" -o -name "libxcb.so*" \) -print -delete 
or
Remove:

.local/share/Steam/ubuntu12_32/steam-runtime/i386/usr/lib/i386-linux-gnu/libstdc++.so.6

.local/share/Steam/ubuntu12_32/steam-runtime/i386/lib/i386-linux-gnu/libgcc_s.so.1

.local/share/Steam/ubuntu12_32/steam-runtime/amd64/lib/x86_64-linux-gnu/libgcc_s.so.1

.local/share/Steam/ubuntu12_32/steam-runtime/amd64/usr/lib/x86_64-linux-gnu/libstdc++.so.6

.local/share/Steam/ubuntu12_32/steam-runtime/i386/usr/lib/i386-linux-gnu/libxcb.so.1 
or
 rm ~/.local/share/Steam/ubuntu12_32/steam-runtime/i386/usr/lib/i386-linux-gnu/libstdc++.so.6
I did those and also, I did a reset of Steam and that made Steam stop loading for quite a while, so be careful with those.  
Location of the error dump:
/tmp/dumps     
or
LD_PRELOAD="libpthread.so.0 libGL.so.1" __GL_THREADED_OPTIMIZATIONS=1 optirun steam 

How to switch between PulseAudio outputs with a button

I have horrible problems with my audio, due to a faulted audio jack. Basically what happens is that the PulseAudio keeps on switching between Headphones (which are not plugged in, but it thinks they are) and the Speakers. So what I decided to do is to put a shortcut on my panel to the file:
change_to_speakers.sh with the content:
#!/bin/bash
pactl set-sink-port alsa_output.pci-0000_00_1b.0.analog-stereo analog-output-speaker

then I created a .desktop file with the content:
#!/usr/bin/env xdg-open
[Desktop Entry]
Encoding=UTF-8
Name=Speakers
Type=Application
Comment=Speakers
Exec="~/scripts/change_to_speaker.sh"
Icon=
GenericName=Speakers

After giving permission to run to the sh file with:
$chmod+x change_to_speaker.sh
I can switch to the speakers with just one click. Of course, that doesn't help with my faulty jack but at least makes the situation one idea more bearable.
They say you can also edit:
/etc/pulse/default.pa to: load-module module-stream-restore restore_device=false
to turn off the automatic switching upon detecting new plugged in device but I'd rather not do it, because I don't want it to affect my usb speakers. Though I might do it one day.
Another way to stop the interference of the faulty jack is trough
$hdajackretask 
which is part of alsa-tools-gui.
I tried this once, the effect was total loss of sound on my laptop. So I decided this might be a bit too brutal for my tast.
Also, note I'm not using pactl set-sink-port as in pactl set-sink-port 1 analog-output-speaker because for some reason I get an error when I do it. Maybe because I have more than one sound cards.
Also useful commands to check what sound cards you have and the names of the sinks (or sources) are:
#pactl list sinks 
#pactl list sources
#pactl list cards

понеделник, 5 декември 2016 г.

How to root Xperia X8 trough Linux and export mmssms.db

To backup the sms from my old phone, it turned out I have to first root it. Which I never did for unknown reasons. Anyway, because my ex-phone is with some ridiculously old Android (not even Gingerbread), I had to root it in the konsole adb way. I found this great tutorial how to do it.
1. Download SuperOneClickv2.3.3-ShortFuse.zip and extract it to a folder
2. Cd into SuperOneClickv2.3.3-ShortFuse/
3. Turn on USB Debugging mode (Settings --> Applications --> Development --> USB Debugging)
4. Unmount the SD Card (Settings --> SD Card --> Unmount SD Card)
5. Connect your phone to the computer using the USB lead, when the phone asks chose "Charge Phone".
6. Go to your konsole (BASH):
Execute the following commands:
$adb push Exploits/psneuter /data/local/tmp/psneuter
$adb push Root/su-v2 /data/local/tmp/su                      
$adb push Root/Superuser.apk /data/local/tmp/superuser.apk
$adb shell
$cd /data/local/tmp
$chmod 755 psneuter
.$/psneuter

$adb shell
$cd /data/local/tmp
$mount -o remount,rw -t yaffs2 /dev/block/mtdblock0 /system
$cat su > /system/bin/su
$cat superuser.apk > /system/app/superuser.apk
$chmod 06777 /system/bin/su
$chmod 777 /system/app/superuser.apk
$reboot

Then you should have "su" on your phone. You can test this by typing:
$adb shell
$su
If you don't get an error, you're good to go. If you get an error, get to the link above and see possible solutions.

Then on to copying your text messages.
You need the following file: /data/data/com.android.providers.telephony/databases/mmssms.db
 I tried pulling it as it is, but I got permission error.
So what I did is the following:
$adb shell
$su
$chmod 777 /data/data/com.android.providers.telephony/databases/mmssms.db
$exit
$cd ~/Downloads
$adb pull /data/data/com.android.providers.telephony/databases/mmssms.db
And the file was in ~/Downloads.
To import this file to your new phone, you need to do:
$adb push mmssms.db /data/data/com.android.providers.telephony/databases/
Obviously, your new phone will have to be rooted, which is somewhat inconvenient if your phone is brand new. But in principle you can.
This is a database file. You can play with it using sqlite. For example: 
$sqlite3 -header mmssms.db 'select address from sms' | sort -n | uniq -c | sort -n
will tell you who is the person you communicated with the most.
$sqlite3 mmssms.db
$ SELECT * FROM sms WHERE read=1;
will show you all the read messages and read=0 will show you the unread messages.
The same funtion without entering sqlite
$ echo 'select address,body from sms;' | sqlite3 -csv mmssms.db
If you want to, you can export them to a file (db.txt) with:
$echo 'select address,body from sms;' | sqlite3 -csv mmssms.db >> dx.txt
Then you can replace all the phones with names and happily read your sms.