Ubuntu display bugs

Two weeks ago I have upgraded my laptop by replacing the HDD with an SSD and I can say that the improvement is massive. Everything feels very snappy and the improvement is most obvious while browsing.

However….Ubuntu (14.04)seems to have a problem with that. The issue was that the display manager used by Ubuntu – lightdm – did not start properly or at least didn’t finish the job it was supposed to do. After the boot the system displayed nothing but a black screen. TTY access was possible though and this is how the solution can be implemented.

I didn’t to an extensive search about this issue (mainly because I had already spent long hours installing and reinstalling video drivers, not knowing what the problem was) and therefore the fix is more of a workaround.

The cause of the problem seems to be a race condition involving GUI components. lightdm does not do everything in the correct order probably because it starts too quickly (because of the SSD), so the workaround is to delay its start by adding “sleep x” in the config file /etc/init/lightdm.conf where x is the time in seconds. It should be added right before lightdm call.

sudo vi /etc/init/lightdm.conf

sleep 2

(before exec lightdm)

Source: http://www.webupd8.org/2013/01/ubuntu-lightdm-black-screen-when-using.html

Truth be told, Ubuntu may not actually be at fault. The bug is in lightdm code that Ubuntu is simply using to provide higher functionality.


Display currently active video driver:

lshw -c video

Display information about openGL support:



Sound quality can be improved a little by using the pulseaudio equalizer.

sudo add-apt-repository ppa:nilarimogard/webupd8sudo apt-get updatesudo apt-get install pulseaudio-equalizer

Source: http://askubuntu.com/questions/597710/sound-quality-is-good-on-ubuntu-but-great-on-windows

Enabling two finger scroll did not work when used in rc.local but worked when used in .bashrc (synclient “TapButton2″=2).

Better workflow:

– Guake terminal

– Use of aliases for accessing folders very commonly used and replacing commands such as “exit” and “clear”

alias egc=”cd /home/username/Dropbox/EGC”

alias x=”exit”

alias c=”clear”


Unable to run script from ntfs partition. Cause: by default, when mounting a ntfs partition it is mounted with the option noexec. Solution: add the exec option to fstab file.

UUID=”101D6F1F3A07678B” /media/store ntfs-3g rw,users,exec,permissions 0 0

To get the UUID: blkid.

To find the location of a file: locate libXv.so.1



Get the package providing it: dpkg -S /usr/lib/x86_64-linux-gnu/libXv.so.1

Source: http://askubuntu.com/questions/453368/skype-error-while-loading-shared-libraries-libxv-so-1-cannot-open-shared-obje


DOSBox for Linux

Today I installed DOSBox on Ubuntu in order to learn some Assembly and prepare for the oncoming exams.

First step:

sudo apt-get install dosbox


First I needed to mount a drive using as location an already existing directory. So I made a directory called “dosprogs” in home folder and then ran in DOSBox environment:

mount D ~/dosprogs


Files needed for compiling and debugging: debug.exe, tasm.exe, tlink.exe. I found those on the Internet and uploaded them here.

To automate this process even more so I don’t have to do it every time DOSBox runs, I changed the configuration file from ~/.dosbox by adding the following lines at the end of it:

mount D ~/dosprogs

To make my Assembly programming more pleasant I created a Batch script that runs the assembler, linker and executable file for me:

D:\TASM\tasm %1
if ERRORLEVEL 1 exit \B
D:\TASM\tlink %1
if ERRORLEVEL 1 exit \B

Unfortunately the “exit” command will also close DOSBox even if I add ‘\b’ afterwards. I don’t know yet how to stop the execution of the script in case of error without also closing DOSBox so the script will actually look like:

D:\TASM\tasm %1
if ERRORLEVEL 1 echo Error
D:\TASM\tlink %1
if ERRORLEVEL 1 echo Error

[UPDATE] Found the solution:

D:\TASM\tasm %1
if ERRORLEVEL 1 goto end
D:\TASM\tlink %1
if ERRORLEVEL 1 goto end

The last line I wrote in the DOSBox configuration file makes it possible to run this script from anywhere using:

make assembyFileName

The file should be sent without its extension (helloW.asm => make helloW).

Linux configuration for laptop

After deciding to install Linux on my new laptop (Lenovo G50-70 i5)  I was surprised to find that the system was a lot more unstable than when running Windows 8.1. Unlike the desktop, the laptop install of Ubuntu had several problems.

1. First and worst of all, it froze after coming back from suspend (sleep) .

2. Battery was draining too fast.

3. No gestures such as two finger scrolling were available by default.

4. Screen backlight was always at maximum after boot

5. No image through HDMI but the wallpaper


1. In order to get Ubuntu to work at all, during installation I had to go to a console environment and install a general AMD graphics package (fglrx). However, this turned out not to be the best driver choice for my laptop, these drivers were the cause of crushes. The solution was downloading a Catalyst Package from AMD website which in turn created four different driver packages based on my configuration. After installing these (there were four because drivers were split between core functionality drivers, basic drivers, graphic acceleration drivers and developer package) the system stopped freezing.

2 days later I found out that sometimes when waking up from suspended/sleep the system crushed and I had to do a cool reboot. The bug appears in several threads such as:


From the error message I get: “RADEON dpm resume failed” or similar, I figure it has something to do with the dynamic power management of the GPU. This wiki page explains what dpm is:



Update: The following steps are the cause of the nasty buggy behaviour mentioned above. The power optimiser called “tlp” when set to run on battery mode will make the laptop fail to wake from suspend  after a second suspend or to shut down after a suspend.

Battery drainage proved to be a lot simpler to solve than I thought it would be.

– install powertop utility to check for main power consumers and for tunables.

sudo apt-get install powertop

sudo powertop

– install tlp optimisation application, a very capable and smart program with plenty of functionality to be found online

sudo apt-get install tlp

run with sudo tlp start


sudo add-apt-repository ppa:linrunner/tlpsudo 
apt-get update
sudo apt-get install tlp tlp-rdw smartmontools ethtool

tlp will check if the laptop runs only on battery and optimises the system accordingly. If the laptop is plugged then tlp runs in AC mode. I noticed the power optimisations are greatest when power comes from battery alone and tlp runs in “bat” mode (tlp bat).

After running tlp bat, powertop no longer displays unsolved tunables.

To start tlp at startup add tlp start or tlp bat or better /usr/sbin/tlp start ( or bat) in /etc/rc.local before the “exit 0” line.


There seems to be a bug related to Lenovo trackpads that caused the issue but I am not sure.

I installed tpconfig and tried several solutions from the internet but I kept encountering the error :

Couldn’t find synaptics properties. No synaptics driver loaded?

So I actually have no synaptics drivers installed, only the generic evdev Linux drivers. What is worse is that synaptiks package was maintained only until version 13.10 (I am running 14.04) si it will not solve my problem.

Basically I have the exact same problem with the one described here: https://bbs.archlinux.org/viewtopic.php?id=176279 and at the current time the is no answer given.

I found a possible solution here:


After upgrade to 3.18.1 kernel everything worked as expected, although for some reason the sensitivity of the trackpad was very very low.

This brought it to a normal state:

xinput set-prop "ETPS/2 Elantech Touchpad" "Synaptics Finger" 1 10 256

xinput set-prop "ETPS/2 Elantech Touchpad" "Synaptics Pressure Motion" 1 160

xinput set-prop "ETPS/2 Elantech Touchpad" "Synaptics Pressure Motion Factor" 0. 65 0.65

To upgrade the kernel:

Download the Linux kernel (3.18.*) from official website and Linux headers from here:




And then install all packages:

sudo dpkg -i linux-headers-3.18.1-031801*.deb linux-image-3.18.1-031801-generic_3.18.1-031801.201412170637_*.deb

Another useful script for trackpad configuration:


xinput --set-prop --type=int --format=32 "ETPS/2 Elantech Touchpad" "Synaptics Two-Finger Pressure" 1

# Below width 1 finger touch, above width simulate 2 finger touch. - value=pad-pixels
xinput --set-prop --type=int --format=32 "ETPS/2 Elantech Touchpad" "Synaptics Two-Finger Width" 10

# vertical scrolling, horizontal scrolling - values: 0=disable 1=enable
xinput --set-prop --type=int --format=8  "ETPS/2 Elantech Touchpad" "Synaptics Two-Finger Scrolling" 1 1

# vertical, horizontal, corner - values: 0=disable  1=enable
xinput --set-prop --type=int --format=8  "ETPS/2 Elantech Touchpad" "Synaptics Edge Scrolling" 0 0 0

# stabilize 2 finger actions - value=pad-pixels
xinput --set-prop --type=int --format=32 "ETPS/2 Elantech Touchpad" "Synaptics Jumpy Cursor Threshold" 250


I have also added the script to the startup list.

Good source for trackpad tweaking:


To simulate middle click with with two finger tap:

synclient "TapButton2"=2

source: http://askubuntu.com/questions/306412/how-can-i-setup-my-touchpad-multi-finger-tapping-functionality


Enabling the horizontal scroll my cause a buggy behaviour in Java based programs such as NetBeans. To disable horizontal scrolling change this line like this:

xinput --set-prop --type=int --format=8  "ETPS/2 Elantech Touchpad" "Synaptics Two-Finger Scrolling    " 1 0

4. Added this command to rc.local

echo 200 > /sys/class/backlight/intel_backlight/brightness

Where 200 is how bright the screen should be.

5. Found the solution here:


Check the available displays with


xrandr --output eDP1 --off

Where eDP1 is my laptop’s display.

Cubieboard2 headless radio

Using cubieboard2 connected to the internet and a pair of speakers to play internet radio. It can be controlled through ssh from anywhere, currently using android tablet (with terminal emulator).

Terminal music player: cmus
sudo apt-get install cmus

Basic usage:
– open cmus with cmus command
– press “5” for entering browse mode
– open .pls or .m3u or any other live streaming/music file and enjoy

The internet radio files .pls and .m3u files are actually metafiles like HTML or XML files, with an address inside pointing to the actual stream. However, the player will not be able to play any BBC radio station. Their radio streams use mms protocol which is not supported by cmus.

The only problem about this is that the players process will be killed if ssh connection is broken. To avoid this use tmux.

Terminal multiplexor – tmux
sudo apt-get install tmux
Useful links:

Basic usage:
– create a new tmux session: tmux new -s radiostream
– from within this tmux session start cmus
ssh connection may now be interrupted and reattached at a later time (to change the radio for example) using tmux a -t radiostream.

Project idea: alarm clock using radio.

E: Sub-process /usr/bin/dpkg returned an error code (1)

Linux errors I encountered today:

Errors were encountered while processing:




E: Sub-process /usr/bin/dpkg returned an error code (1)

After trying several thing I found a post on Ubuntu forum forum: link; which offered the answer.

To make dpkg forget about those partially installed packages I had to delete the files they created in this folder:


cd /var/lib/dpkg/info

sudo rm man-db.*

sudo rm phpmyadminman-db.*

sudo rm libapache2-mod-php5.*

And finally I managed to uninstall phpmyadmin.

sudo apt-get remove –purge phpmyadmin


ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)