Archive for the ‘Ubuntu’ Category

Ubuntu 17 uses resolved for DNS resolution. This does not always work very well with OpenVPN. When your DNS is not resolved correctly (always externally instead of internal addresses), try to use this fix here.

Update the line in /etc/nsswitch.conf:

`hosts: files mdns4_minimal [NOTFOUND=return] resolve [!UNAVAIL=return] dns myhostname`

into

`hosts: files mdns4_minimal [NOTFOUND=return] dns resolve [!UNAVAIL=return] myhostname`

This changes the order in which the calls are resolved.

Advertisement

When Ubuntu refuses to mount an encrypted harddisk, try the following on the command-line:  (just in case: modprobe dm-mod)

sudo vgchange -ay
sudo lvscan

Then mount the disk to somewhere:

sudo mount /dev/computer-name-vg/root x

Ubuntu 16.04 ships an OpenSSH version which does no longer support DSA keys out of the box. If you want to use DSA keys, you can add the following line to the SSH config file:

echo "PubkeyAcceptedKeyTypes +ssh-dss" >> /etc/ssh/ssh_config

Since a couple of days, I was plagued by some DNS problems when using Docker 1.10+. Seems that the dnsmasq process is writing the address 127.0.1.1 into the resolv.conf. The purpose of the dnsmasq is to cache DNS queries. Unfortunately, it was no longer available in my Docker containers. The only solution for now (maybe it is a workaround) is to throw dnsmasq out. You can do this by editing the file:

/etc/NetworkManager/NetworkManager.conf

Open the file with an editor and comment out the line

dns=dnsmasq   ---> #dns=dnsmasq

After that, kill dnsmasq and restart the network-manager. You should see the changes in the resolv.conf after that:

sudo killall dnsmasq
sudo service network-manager
restart cat /etc/resolv.conf

When you checked out multiple git-repositories and you want to update them all at once, you can execute the following line:

$ ls -d */ | xargs -I{} git -C {} pull

When you’re running Ubuntu 15.04 with Docker, you must use systemctl to enable/disable your Docker service. Unfortunately, the old /etc/default/docker configuration file is not read. You must change the docker.service file and add these lines:

....

[Service]
EnvironmentFile=-/etc/default/docker
ExecStart=/usr/bin/docker -d -H fd:// $DOCKER_OPTS
MountFlags=slave
LimitNOFILE=1048576
LimitNPROC=1048576
LimitCORE=infinity

....

(On my Ubuntu 15.04 system, the file resides at /etc/systemd/system/multi-user.target.wants/)

Restart Docker with:

$ sudo systemctl restart docker 

Ubuntu 15.04 and Handbrake

Posted: May 2, 2015 in Ubuntu
Tags: , , ,

And again, when watching DVDs does not work on Ubuntu 15.04, you must install the restricted codecs (ubuntu-restricted-extras). After that you must install libdvdcss2 which is not in the repositories (for some strange reason). Even though I installed it in 14.10, after the upgrade it was not installed anymore. You have to run the following command on a terminal:

$ sudo /usr/share/doc/libdvdread4/install-css.sh

This fixed Handbrake for me once again.

Ubuntu 15.04 and Docker 1.6.0

Posted: April 27, 2015 in Docker, Ubuntu
Tags: , , ,

When you upgrade to Ubuntu 15.04 and install docker using the get.docker.io script, you’ll probably run into an error like “Are you trying to connect to a TLS-enabled daemon without TLS?”.

Ubuntu 15.04 changed to systemd and you should enable docker with this command:

$ systemctl enable docker

Restart your computer, and it should be working.

OpenVPN on 14.10

Posted: March 23, 2015 in Ubuntu
Tags: ,

When you run into the issue that the NetworkManager is not starting your connection (nothing happens when you click on the VPN connection in the applet), you’ll see the following line in the syslog:

No agents were available for this request

When you start the connection from the CLI, you get the following error

$ sudo nmcli -p con up id YourConnection

Error: Connection activation failed: no valid VPN secrets.

Now, there are solutions available for password connection, but none when you work with certificates. You can use a workaround by editing the configuration file yourself. You can find it here:

/etc/NetworkManager/system-connections/YourConnection

Open the file and add or overwrite the following lines:

[vpn]

service-type=org.freedesktop.NetworkManager.openvpn
connection-type=tls
username=YourName

auth=SHA1
remote= ######
cipher=AES-256-CBC
comp-lzo=yes
cert-pass-flags=0
port= ######
cert=path-to-your.p12
ca=path-to-your.p12
key=path-to-your.p12

[vpn-secrets]
cert-pass=YourPasswordForThisConnection

Restart your command, and VPN should be up and running.

The best DROP-script for Mysql!

Posted: July 30, 2013 in MySQL, SQL, Ubuntu

There are many situations in which you want to drop all tables in a MySQL database. You can easily drop the schema, but then all the permissions are lost too. There are several solutions out there, but they all require some manual effort. I wanted to get rid off it once and for all and constructed this easy script. With the following evil shell script you can easily drop all tables in your database.

Premisse: it uses a group on table_catalog which may not always be the correct grouping in your database. Please, feel free to adapt!

Just create a textfile like drop.sh and give it appropriate rights to execute. The paste the following content in the file and save it.

#!/bin/bash
echo Dropping database usr:$1, pwd:$2, db:$3
echo "set group_concat_max_len = 5000; select concat('set foreign_key_checks=0; ', group_concat(concat('drop table if exists ', table_name, ';') separator ' ')) from information_schema.tables where table_schema = '"$3"' group by table_catalog;" | mysql -u $1 -p$2 --disable-column-names $3 | mysql -u $1 -p$2 $3

Use ./drop.sh root root my_db et voilá…. all tables are gone.

Off course, things can be improved. I need to check the parameters and add some documentation…