Terminology as terminal emulator

I was using E16 in the beginning of 21st century, waiting for E17 to come along…

The E17 project has some nice stuff going on, one of them being the terminal emulator (on steroids) Terminology.

How to install it, and make it the default alternative for x-terminal-emulator:

sudo add-apt-repository ppa:enlightenment-git/ppa
sudo apt-get update
sudo apt-get install terminology
sudo update-alternatives --install /usr/bin/x-terminal-emulator x-terminal-emulator /usr/bin/terminology 50
sudo dpkg-divert --local --rename --add /usr/bin/gnome-terminal
sudo ln -s /usr/bin/terminology /usr/bin/gnome-terminal

Read more here [ubuntuhandbook.org].

I haven’t found any way to change which terminal emulator is launched when right clicking on the desktop and choosing ‘Open Terminal’.

You can open System Settings, Keyboard, Shortcuts, Custom Shortcuts and add a new one binding it to ctrl + alt + t:

Name: Open Terminology
Command: terminology

Installing Ubuntu on Dell XPS 13

Today I got my new Dell XPS 13. Being an Macbook user for the past 5-6 years, this was quite exciting for me; I finally got to run Linux on the desktop again!

So, I created the USB installation stick in Windows and booted to the Live system.

First “bump” was the Dell Wireless network interface that the laptop came with. It’s a Broadcom BCM4352 chip which has a properitary driver.

root@ubuntu:~# lspci -v | grep -i bcm
02:00.0 Network controller: Broadcom Corporation BCM4352 802.11ac Wireless Network Adapter (rev 03)

The required packages is included on the USB installation stick, so it’s just a matter of installing them (this would have to be repeated once booting into the freshly installed system):

sudo dpkg -i /cdrom/pool/main/d/dkms/dkms_2.2.0.3-2ubuntu3_all.deb
sudo dpkg -i /cdrom/pool/restricted/b/bcmwl/bcmwl-kernel-source_6.30.223.248+bdcom-0ubuntu2_amd64.deb

After the installation and restarting the laptop it couldn’t find any bootable devices(!). Reading the release notes, this is a known problem. The bug 1499323 has a workaround.

To enable palm detection, which should have a similar effect as above:

sudo apt-get install xserver-xorg-input-libinput

Then create /etc/X11/xorg.conf.d/99-libinput.conf:

Section "InputClass"
    Identifier "libinput"
    Driver "libinput"
    MatchDevicePath "/dev/input/event*"
    MatchIsTouchpad "true"
    Option "Tapping" "true"
    Option "TappingDragLock" "true"
    Option "ClickMethod" "none"
    Option "NaturalScrolling" "false"
EndSection

The above settings should make the touchpad behave “similar” to an Apple touchpad.

To improve battery life you can install TLP:

TLP brings you the benefits of advanced power management for Linux without the need to understand every technical detail. TLP comes with a default configuration already optimized for battery life, so you may just install and forget it. Nevertheless TLP is highly customizable to fulfil your specific requirements.

As of 15.10, tlp is part of the official repositories, if you’re running an earlier release:

sudo add-apt-repository ppa:linrunner/tlp

It is easy as:

sudo apt-get update
sudo apt-get install tlp tlp-rdw gsmartcontrol smart-notifier

Bluetooth does not work out-of-the box. To get it working, we need a firmware file from the Windows driver. Good guy hg8 has it available on github.com for us.

wget https://github.com/hg8/bluetooth-firmware-XPS13-9343/blob/master/BCM20702A0-0a5c-216f.hcd
sudo mv BCM20702A0-0a5c-216f.hcd /lib/firmware/brcm/
sudo ln -s /lib/firmware/brcm/BCM20702A0-0a5c-216f.hcd /lib/firmware/brcm/BCM20702A1-0a5c-216f.hcd

Change the bluetooth device name with:

sudo -i
echo "PRETTY_HOSTNAME=$HOSTNAME" > /etc/machine-name
systemctl restart bluetooth.service

Additional resources:

Building the Darwin Streaming Server in Ubuntu

Me and a colleague tried building the Darwin Streaming server on Ubuntu Server 13.10 with the help of this guide [instructables.com].

It did not go as well as we were hoping due to build errors. After some troubleshooting (all credit goes to my colleague), it turned out that the linking of libraries was not done recursively. So even though the correct libraries was included in LDFLAGS it wouldn’t work.

With the following two changes, we got rid of the build errors:

$ cd lstoll*
$ find . -name "Makefile.*" -exec sed -i 's/-lQTFileExternalLib/-lQTFileExternalLib -lpthread/' {} \;
$ sed -i 's/-lQTFileLib/-lQTFileLib -ldl/' Makefile.POSIX

Installing Ubuntu on a Macbook Air (late 2010, 3.1)

I was craving running Linux on the desktop again, and the netbook I had lying around did not have proper support for the graphics card. This resulted in Unity not being that smooth, and the LVMPIPE mode really sucked.

So, I did something “drastic” and removed Mac OS X and installed Ubuntu 13.04 instead.

The Macbook Air (late 2010) has a Nvidia GeForce 320M graphics card and there is proprietary drivers for it. However, these does not work in EFI mode and by default Ubuntu is installed in EFI mode. I read some guides on how to convert the GPT partition table before installing, men turned out that it was still a GPT partition table after the installation finished. Therefor I had to convert it after the installation, following these [ubuntu.com] instructions. After converting to legacy BIOS, I installed the proprietary Nvidia drivers.

Other than the official tips in the Ubuntu community documentation [ubuntu.com], I also made the following changes to get the keyboard to work as similar as in Mac OS X (Settings, Keyboard Layout, Options):

  • Win keys (and the usual ctrl): To use cmd + c/v to copy, paste etc.
  • Key to choose 3rd level, Any Alt key: to get /, | and \ to work like in Mac OS X

After installing the Linux version of Spotify, I wanted the multimedia buttons on the keyboard to control Spotify. I found the following information [mabishu.com] that Spotify had built in support for dbus, så it was just a matter of writing a small script:

#!/usr/bin/env bash
dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.$1

Then you’d have to create keyboard shortcuts for Audio Play (argument “PlayPause”), Audio next (argument “Next”) and Audio previous (argument “Previous”) which would execute the script.

Automagically build load modules when updating the kernel

I bought a new wireless network card to my parents, and it turned out that there wasn’t support in the generic Ubuntu kernel for it. The last month they haven’t been able to use their computer since the card stopped working after updating the kernel, and hence missing the custom built load module.

After rebuilding the load module I was following the output when installing about 200 updates and saw that after updating the kernel there were some scripts from /etc/kernel/postinst.d running.

I then realized that it should be possible to solve the problem by adding a custom script that would rebuild the load module when updating the kernel.

Step 1 was to create a script in both /etc/kernel/postinst.d and /etc/kernel/header_postinst.d that I named build_wifi_driver:

#!/bin/bash
# We're passed the version of the kernel being installed
inst_kern=$1

cd /root/DPO_RT3070_LinuxSTA_V2.3.0.4_20100604/
make KERNEL_VERSION=$inst_kern
make KERNEL_VERSION=$inst_kern install

The second problem was that the Makefiles for the load module had to be updated to use $(KERNEL_VERSION) instead of $(shell uname -r). I had to update three different Makefiles:

DPO_RT3070_LinuxSTA_V2.3.0.4_20100604/Makefile:

--- DPO_RT3070_LinuxSTA_V2.3.0.4_20100604/Makefile    2009-12-28 13:38:34.000000000 +0100
+++ DPO_RT3070_LinuxSTA_V2.3.0.4_20100604.new/Makefile    2011-01-05 19:17:14.000000000 +0100
@@ -117,11 +117,14 @@
endif

ifeq ($(PLATFORM),PC)
+ifndef KERNEL_VERSION
+    KERNEL_VERSION := $(shell uname -r)
+endif
# Linux 2.6
-LINUX_SRC = /lib/modules/$(shell uname -r)/build
+LINUX_SRC = /lib/modules/$(KERNEL_VERSION)/build
# Linux 2.4 Change to your local setting
#LINUX_SRC = /usr/src/linux-2.4
-LINUX_SRC_MODULE = /lib/modules/$(shell uname -r)/kernel/drivers/net/wireless/
+LINUX_SRC_MODULE = /lib/modules/$(KERNEL_VERSION)/kernel/drivers/net/wireless/
CROSS_COMPILE =
endif

@@ -234,7 +237,7 @@
endif

cp -f os/linux/Makefile.4 $(RT28xx_DIR)/os/linux/Makefile
-    $(MAKE) -C $(RT28xx_DIR)/os/linux/
+    $(MAKE) KERNEL_VERSION=$(KERNEL_VERSION)-C $(RT28xx_DIR)/os/linux/

ifeq ($(OSABL),YES)
cp -f os/linux/Makefile.4.netif $(RT28xx_DIR)/os/linux/Makefile
@@ -279,7 +282,7 @@
ifeq ($(PLATFORM),FREESCALE8377)
$(MAKE) ARCH=powerpc CROSS_COMPILE=$(CROSS_COMPILE) -C  $(LINUX_SRC) SUBDIRS=$(RT28xx_DIR)/os/linux modules
else
-    $(MAKE) -C $(LINUX_SRC) SUBDIRS=$(RT28xx_DIR)/os/linux modules
+    $(MAKE) -C $(LINUX_SRC) SUBDIRS=$(RT28xx_DIR)/os/linux KERNEL_VERSION=$(KERNEL_VERSION) modules
endif
endif

DPO_RT3070_LinuxSTA_V2.3.0.4_20100604/os/linux/Makefile.4

--- DPO_RT3070_LinuxSTA_V2.3.0.4_20100604/os/linux/Makefile.4    2009-12-30 02:12:06.000000000 +0100
+++ DPO_RT3070_LinuxSTA_V2.3.0.4_20100604.new/os/linux/Makefile.4    2011-01-05 19:01:56.000000000 +0100
@@ -13,6 +13,9 @@

OBJ := $(MOD_NAME).o

+ifndef KERNEL_VERSION
+KERNEL_VERSION := $(shell uname -r)
+endif

#ifdef CONFIG_STA_SUPPORT
RT28XX_STA_OBJ := \
@@ -200,9 +203,9 @@
cp $(RT28xx_DIR)/$(DAT_FILE_NAME) $(DAT_PATH)/.
install -d $(LINUX_SRC_MODULE)
install -m 644 -c $(addsuffix .o,$(MOD_NAME)) $(LINUX_SRC_MODULE)
-    /sbin/depmod -a ${shell uname -r}
+    /sbin/depmod -a $(KERNEL_VERSION)

uninstall:
#    rm -rf $(DAT_PATH)
rm -rf $(addprefix $(LINUX_SRC_MODULE),$(addsuffix .o,$(MOD_NAME)))
-    /sbin/depmod -a ${shell uname -r}
+    /sbin/depmod -a $(KERNEL_VERSION)

DPO_RT3070_LinuxSTA_V2.3.0.4_20100604/os/linux/Makefile.6

--- DPO_RT3070_LinuxSTA_V2.3.0.4_20100604/os/linux/Makefile.6    2009-12-30 02:12:13.000000000 +0100
+++ DPO_RT3070_LinuxSTA_V2.3.0.4_20100604.new/os/linux/Makefile.6    2011-01-05 19:02:29.000000000 +0100
@@ -12,6 +12,10 @@

obj-m := $(MOD_NAME).o

+ifndef KERNEL_VERSION
+KERNEL_VERSION := $(shell uname -r)
+endif
+

#ifdef CONFIG_STA_SUPPORT
rt$(CHIPSET)sta-objs := \
@@ -198,9 +202,9 @@
cp $(RT28xx_DIR)/$(DAT_FILE_NAME) $(DAT_PATH)/.
install -d $(LINUX_SRC_MODULE)
install -m 644 -c $(addsuffix .ko,$(MOD_NAME)) $(LINUX_SRC_MODULE)
-    /sbin/depmod -a ${shell uname -r}
+    /sbin/depmod -a $(KERNEL_VERSION)

uninstall:
#    rm -rf $(DAT_PATH)
rm -rf $(addprefix $(LINUX_SRC_MODULE),$(addsuffix .ko,$(MOD_NAME)))
-    /sbin/depmod -a ${shell uname -r}
+    /sbin/depmod -a $(KERNEL_VERSION)

I’m no expert when it comes to Makefiles, but these changes solved the issue and the load module now builds automagically every time the kernel was updated.