Fix: Android emulators not starting in Ubuntu

Often this happens when for some reason or the other your OpenGL config is broken. This is often an issue on Ubuntu 17.04.

To confirm this is your problem, (Assuming your Android SDK lives in ~/Android/Sdk)

Step 1
Get your emulator’s name:
~/Android/Sdk/emulator/emulator -list-avds

In my case it was Nexus_4_API_25

Step 2
Test running using system OpenGL
~/Android/Sdk/emulator/emulator -avd Nexus_4_API_25 -use-system-libs

If the emulator starts successfully we can make this solution semi-permanent by having a symbolic link in the android Sdk dirs to the system’s openGL

Step 3
cd ~/Android/Sdk/emulator/lib64/libstdc++/
mkdir backup
mv libstdc++.so.6 backup/
ln -sf /usr/lib/x86_64-linux-gnu/libstdc++.so.6 .

Voilà, you should now be able to launch your emulator from android studio or anywhere else. In the case of any future updates, you can just run the above commands again.

 

Source: Martin Revert (stackoverflow)

Best linux distro for daily use in 2017

A new year has begun. Time to format my disks. New windows install and more importantly, new Linux install. With windows, the choice is easy. Windows 10. With Linux, it’s a bit more complicated….

Here were the candidates

Ubuntu 16.04 LTS
Here’s a little history about my relationship with Ubuntu. Ubuntu was my first distro and all was right with the world, I would never have left… that is.. until the fire nation att… until unity. It was a bit of a messy breakup, something about it just didn’t resonate with my soul. A year or two ago I tried it again but I remember seeing amazon search results integrated by default and was instantly disgusted. But time has passed, seasons have changed and I believe people learn from their mistakes..so I wanted to give it another shot. so I did… Continue reading

How to speedup (stop lag) in Fedora 25

With Fedora 25 (as you probably already know) X was replaced with Wayland as the default display server. Now while I applaud Fedora for taking that giant step forward. The fact remains that X11 just performs better.

With Wayland i’ve noticed various flickers where there shouldn’t be. As well as a general feeling of… lag or slowness.

Luckily for us it’s pretty easy to go back to X.

  1. Logout (not yet!! Read the rest of the tutorial first)
  2. Click on your profile
  3. Look for the settings icon and select Gnome on XOrg.

Voila! you should now see an immediate difference.

How to fix ssh locale issues on Linux

So you ssh into your server and all over the place you see something like

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
 LANGUAGE = (unset),
 LC_ALL = (unset),
 LANG = "en_US.UTF-8"
 are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory

You search for the solution and everywhere keeps telling you to setup the locales but nothing works. Most likely what the problem is your ssh client is forwarding its locale-related environment variables and thats messing up stuff on the server end. To fix.

Edit /etc/ssh/ssh_config and comment out the line that says

SendEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES

Save, and restart your ssh service (or just restart)

How to install intel drivers on Fedora 24

fedora-24-intel-drivers-distribution

So Fedora 24 came out recently and just like me you ran and did yourself a fresh install. Now you want those video drivers and Intel Graphics installer tells you that your distribution is not supported.

To fix all we need to do is fool the installer into believing that we are still on fedora 23.

If you don’t already have it installed

for 64 bit

wget https://download.01.org/gfx/fedora/23/x86_64/intel-linux-graphics-installer-1.4.0-23.intel20161.x86_64.rpm

for 32 bit

https://download.01.org/gfx/fedora/23/i686/intel-linux-graphics-installer-1.4.0-23.intel20161.i686.rpm

 

then install with

sudo dnf install ./intel-linux-graphics-installer-1.4.0-23.intel20161.x86_64.rpm

 

Now to edit the file that tells the installer which version we are running

edit /etc/fedora-release with either nano or vim

vim /etc/fedora-release

and change

Fedora release 24 (Twenty Four)

to

Fedora release 23 (Twenty Three)

 

now we can run the installer with

sudo intel-linux-graphics-installer

it should detect Fedora 23. install the necessary files and ask to restart.

Restart, and on the next boot change your /fedora-release file back to the original

Fedora release 24 (Twenty Four)

 

Works for me. Enjoy!

How to fix .local dns resolution on Fedora 23

Most likely in your nsswitch file you have a line like

hosts:      files mdns4_minimal [NOTFOUND=return] dns myhostname mymachines

The default settings instructs the pc to resolve all .local addresses with multicast dns instead of normal dns.. which is not always what we want, plus if no result is found the NOTFOUND part just gives up. To fix we can just remove those parts. In my case I just use

hosts:      files dns myhostname mymachines

UPDATE (June 7th 2016)
Instead of removing the mdns part completely we can just move ‘dns’ to be before it. For example:

hosts:      files dns mdns4_minimal [NOTFOUND=return] myhostname mymachines

Restart your machine and your addresses should resolve properly

How to fix large chrome address bar and tabs in linux

Close ALL instances of chrome

In the terminal type

google-chrome --high-dpi-support=1 --force-device-scale-factor=1

you can add those flags in the necessary palaces to keep the change.

In my case, Xubuntu 16.04, i opened the Menu Editor, found chrome and changed the command from

/usr/bin/google-chrome-stable %U

to

/usr/bin/google-chrome-stable --high-dpi-support=1 --force-device-scale-factor=1 %U

 

How to run a command at startup in Linux

There are two main ways to do this

  1. Put commands or program in the rc.local file
nano /etc/rc.local

or 2. Use the special crontab @reboot

so, access crontab with

crontab -e

and add your command following the layout below

@reboot command

 

 

How to create a python virtual environment in Linux

Install pip

sudo apt-get install python3-pip
# replace apt-get with dnf or zypper or whatever your distro uses

Install the python virtualenv package

pip3 install virtualenv

Make your main virtualenv directory

mkdir ~/.virtualenvs

Create the Virtual Environment

virtualenv --python=`which python3` ~/.virtualenvs/myvenv

Activate the virtual Environment with

source ~/.virtualenvs/myvenv/bin/activate