Showing posts from June, 2018

Vancouver trip photos

Network interface does not show up with ifconfig and Internet does not work

If for some reasons your ethernet network interface does not show up with ifconfig command, you can do the following to find it and raise it up again:

1. Find the interface:

ifconfig -a

enp0s31f6 ... DOWN

2. Up the missing interface:

sudo ifconfig enp0s31f6 up

3. Call the DHCP client on the missing interface:

sudo dhclient enp0s31f6

After that, you will be able to access the Internet again.

Django DB migration when you're using a custom MySQL installation dir

For some reason, you installed MySQL in a different path than the default /etc/mysql/. Then if you run the Django's migrate command, it will fail because It cannot communicate with the MySQL process:

django.db.utils.OperationalError: (2002, "Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)")

If that's the case, you can use the following option in your Django's configuration to indicate the socket directory of MySQL:

    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'OPTIONS': {
'read_default_file': '/path/to/my.cnf',

That's it. Profit!!!

Virtualenv's env activated but still running system's python

I created a Virtualenv env and activated it but it still running the system's python

(myenv) dangtrinhnt@genius:~$ which python

So I did the following to fix that:

1. Delete the broken Virtualenv env:

sudo rm -rf /my/venv

2. Create a new one with "distribute" parameter:

virtualenv myenv --distribute

3. It works now

(myenv) dangtrinhnt@genius:~$ which python

"bower ESUDO Cannot be run with sudo" how to fix

I got this error trying to install bower the other day using root account:

bower ESUDO Cannot be run with sudo So to fix it, try the following:

echo '{ "allow_root": true }' > /root/.bowerrc

"make requirements" error when trying to install phantomjs

When the `make requirements` command trying to install phantomjs, it shows this error:

info lifecycle phantomjs@1.9.20~install: Failed to exec install script
verbose stack Error: phantomjs@1.9.20 install: `node install.js`
verbose stack Exit status 1

And this solves that problem in my Ubuntu 16.04:

sudo apt install nodejs-legacy

PIP error after upgraded to v10.0.1

After doing a PIP upgrade:

sudo pip install --upgrade pip

I got this error when running PIP:

Traceback (most recent call last):
  File "/usr/bin/pip", line 9, in <module>
    from pip import main
ImportError: cannot import name main

Here is the best way to fix that, clearing the hash in bash:

hash -d pip
or in dash (sh):

hash -r pip
The world is fine now.

My presentation at OpenStack Summit 2018 in Vancouver


Tacker team at OpenStack Summit 2018 in Vancouver

This is a very rare opportunity for us to meet each other in real life since most of the time we work remotely across the world (China, Japan, India, and South Korea to name just a few...)