Thursday, November 15, 2018

Raspbian Edimax USB WLAN Adapter

In order to get the Edimax USB WLAN Adapter working on Debian / Raspbian, proceed as follows.

(1) Use lsusb to list all USB devices:

$ lsusb

 Bus 001 Device 004: ID 7392:7811 Edimax Technology Co., Ltd EW-7811Un 802.11n Wireless Adapter [Realtek RTL8188CUS]

The Edimax USB WLAN Adapter uses the Realtek RTL8188CUS chipset.

(2) To figure out which driver is used and hence which module needs to be loaded, we can use the system message log:

$ dmesg | grep rtl

[   16.919884] usbcore: registered new interface driver rtl8192cu

Now we know the module name: 8192cu

(3) To load the module during system boot, create the following file with the given content:

$ sudo touch /etc/modprobe.d/8192cu.conf
$ sudo echo "options 8192cu rtw_power_mgnt=0 rtw_enusbss=0" > /etc/modprobe.d/8192cu.conf

(4) Enable the wlan0 device (eth0 will be disabled with this configuration):

#auto eth0
#iface eth0 inet dhcp
 

auto wlan0
iface wlan0 inet dhcp
wpa-ap-scan 1
wpa-scan-ssid 1
wpa-ssid "your-ssid"
wpa-psk "your-wlan-passphrase"


(5) Reboot your PI

Sunday, August 19, 2018

Install VirtualBox on Debian Stretch 9.5

Prerequisites

Add the backports repository to /etc/apt/sources.list:

deb http://ftp.de.debian.org/debian/ stretch-backports main contrib
deb-src http://ftp.de.debian.org/debian/ stretch-backports main contrib


Installation

$ apt-get update
$ apt-get install virtualbox
$ apt-get install virtualbox-ext-pack
$ apt-get install linux-headers-$(uname -r)


Build Kernel Module

dpkg-reconfigure virtualbox-dkms
$ dpkg-reconfigure virtualbox


Links

Saturday, April 28, 2018

Cleaning up Docker containers with xargs

The Linux/UNIX tools landscape is always worth investigating, while you're trying to find a solution for a problem. Because, if you're lucky you don't have to write a script or anything similar: you can just chain existing tools together to build up your custom solution.

Thanks to Dump Tiger and Bjørn, I got to know the xargs command.

One thing that I don't like so much, when I'm starting/stopping Docker containers quite often, is that they'll polute your disc space (depending on the image size).

docker ps -a | grep 'Exited (' | cut -d ' ' -f1 | xargs docker rm

The pipe shown above does the following:
  1. List all Docker containers
  2. Filter the list, so that only those lines that contain the string 'Exited (' will be returned
  3. From all returned lines, cut of the first row (the container ID) by splitting each line on all whitespaces
  4. Now that we've a list of container IDs, we can pipe each container ID into docker rm by using xargs

Friday, April 6, 2018

Debian: OpenVPN Client Config

Getting your OpenVPN client up and running on Debian is easy.

Prerequisites: The openvpn.conf file from your VPN provider.

  1. apt-get instal openvpn
  2. apt-get install resolvconf
  3. Make sure the following settings are enabled in your openvpn.conf:
    • script-security 2
    • up /etc/openvpn/update-resolv-conf
    • down /etc/openvpn/update-resolv-conf
  4. openvpn --config /path/to/openvpn.conf