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

Android setup for USB Wi-Fi adapter

Purpose: make the Cubieboard2 running Android use the USB Wi-Fi adapter. By default, the Android images I found available did not have the required driver or better said, it was not being used.


Really good tutorial:

One Android images source:

Linux tools:


1. I used Android 4.2_v1.08 image.
2. Inpack the .img file with imgrepacker

./imgrepacker .img

imgrepacker (version 2.05 linux)
LiveSuit’s & PhoenixSuit’s firmware image unpacker/packer

(c) RedScorpio, Moscow, 2012-2014

==========================[ START ]==========================

— Firmware unpacking —

PhoenixSuit image format detected

– image.cfg creating –
image.cfg created

– Files extracting –
“/sys_config.fex” extracted (format: unknown)
“/sys_partition.fex” extracted (format: unknown)
“/split_xxxx.fex” extracted (format: unknown)
“/boot0_nand.fex” extracted (format: Allwinner BOOT0 file)
“/boot0_sdcard.fex” extracted (format: Allwinner BOOT0 file)
“/u-boot.fex” extracted (format: unknown)
“/fes1.fex” extracted (format: Allwinner BOOT0 file)
“/usbtool.fex” extracted (format: Windows PE file)
“/aultls32.fex” extracted (format: Compiled lua file)
“/aultools.fex” extracted (format: Compiled lua file)
“/cardtool.fex” extracted (format: Windows PE file)
“/cardscript.fex” extracted (format: unknown)
“/sunxi_mbr.fex” extracted (format: unknown)
“/dlinfo.fex” extracted (format: unknown)
“/bootloader.fex” extracted (format: FAT16 image)
“bootloader.fex.iso” created
“/Vbootloader.fex” extracted (format: unknown/empty?)
“/env.fex” extracted (format: unknown)
“/Venv.fex” extracted (format: unknown/empty?)
“/boot.fex” extracted (format: Android boot image)
“/Vboot.fex” extracted (format: unknown/empty?)
“/system.fex” extracted (format: sparse image)
“/Vsystem.fex” extracted (format: unknown/empty?)
“/recovery.fex” extracted (format: Android boot image)
“/Vrecovery.fex” extracted (format: unknown/empty?)
“/diskfs.fex” extracted (format: unknown)

==========================[ STOP ]==========================

3. Copy these files is a separate folder:

4. Rename boot.fex and recovery.fex to boot.img and recovery.img.

5. Use the slpit_booting.pl script from the linux tools archive:

./split_bootimg.pl boot.img

Now in the folder containing the split_bootimg script there are two new files. Unzip the ramdisk archive to a new folder.

mkdir ramdisk
cd ramdisk
gunzip -c ../boot.img-ramdisk.gz | cpio -i

6. Edit the file init.sun7i.rc by adding this line:
insmod /system/vendor/modules/rtl8192cu.ko


To get info about modules:

To see the modules already loaded in the kernel:

To access the system itself thee steps are needed:

1. Convert from .fex to .img:
./simg2img system.fex system.img

2. Make a new directory for the system and mount it
mkdir system
sudo mount -o loop system.img system

3. Restore the image to fex
sudo ./mkuserimg.sh -s system new-system.fex ext4 ../tmp 500M
The 500M part tells how much memory should be allocated for the image, if 500M does not work check the size of the orginal .img and use something similar, otherwise just increase until it executes successfully.

I was surprised to find a lot of drivers already included in the system.

system/vendor/modules$ ls
8188eu.ko gc0307.ko mali.ko scsi_wait_scan.ko
8189es.ko gc0308.ko mcs7830.ko sp0838.ko
8192cu.ko gc0309.ko mma7660.ko stk831x.ko
8723as.ko gc0329.ko mma8452.ko sun7i-ir.ko
8723au.ko gc2015.ko mma865x.ko sun7i-keypad.ko
afa750.ko gc2035.ko Module.symvers sun7i_tvd.ko
al3010.ko gpio-sunxi.ko mt9d112.ko sunxi_csi0.ko
asix.ko gspca_main.ko mt9m112.ko sunxi_csi1.ko
bcm20710a1.hcd gt2005.ko mt9m113.ko sunxi-ps2.ko
bcm4330.ko hdcp.ko mxc622x.ko sunxi-ts.ko
bma250.ko hi253.ko nand.ko sw_device.ko
camera.ko hi704.ko nvram_ap6210.txt ump.ko
cdc_ether.ko hid-logitech-dj.ko ov2643.ko usbnet.ko
dmard10.ko i2c_device_debug.ko ov2655.ko usb-storage.ko
example.ko kxtik.ko ov5640.ko uvcvideo.ko
fw_bcm40181a2_apsta.bin leds-sunxi.ko qf9700.ko videobuf-core.ko
fw_bcm40181a2.bin lis3de_acc.ko rtl8150.ko videobuf-dma-contig.ko
fw_bcm40181a2_p2p.bin lis3dh_acc.ko s5k4ec.ko


Ok… nothing worked!!!

After trying a lot to get the wi-fi adapter to work on Android I didn’t manage to do it, BUT AGAIN, the experience gave me an idea about browsing so I ended up here:

where I found the long lost Android image containing the driver. It worked flawlessly. (TODO: open it up and see how it was made)

Source: http://cubiuntu.com/2014/09/14/help-needed-cb_a20_android42_v1-05_8192cu-ddr432-en_us-img-lost/

Download link: http://www.4shared.com/file/EtaZ2Lisba/android-cb2-v105_sugar-8192cu.html

Further Android setup

First problem:
The only layer that truly works and supports perfectly hardware acceleration on the board was MXPlayer. However, due to licencing problems no more AC3 audio decoding software was included so it needs to be added manually.
Solution found here: http://forum.xda-developers.com/apps/mx-player/mx-player-custom-codec-dts-support-t2156254
Download the all-in-one zip pack of codecs then using MXPlayer’s settings (custom codec) point it to the location of the archive.


Second problem: the NAND memory is too small for video caching so I need to make Android 4.2.2 write to external USB hard-drive.
Solution found here: http://www.cnx-software.com/2012/08/26/how-to-allow-apps-to-write-files-to-usb-mass-storage-devices-in-android/

1. connect through adb to the board
2. mount the system
mount -o remount,rw /system
3. Make a copy of the file and edit it by adding in the body of android.permission.WRITE_EXTERNAL_STORAGE

cd /system/etc/permissions/
busybox cp platform.xml platform-old.xml
busybox vi platform.xml


Now the video streaming app can use an external device as cache storage place.