Sunday, February 8, 2015

Lenovo ThinkPad: The labtop does not wake up after suspending

I'm using Ubuntu 14.04 with Lenovo ThinkPad E440 and I'm having the issue that my labtop does not wake up after a suspend. I have to restart the machine. It's a bug of that model, reported here https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1340376. I fixed the issue by disabling USB 3.0 in BIOS (note that disabling USB 3.0 in BIOS will make the USB ports work as 2.0). This is not the real solution but it worked.



Reference
http://askubuntu.com/questions/489912/thinkpad-does-not-wake-from-sleep-14-04

Ubuntu: Enabling Hibernate

Hibernate is disabled by default on Ubuntu. To enable Hibernate in System Tray menu, please do as following:

1). Modify the permission of the directory below.
sudo chmod 755 -R /var/lib/polkit-1/

2). Open the file com.ubuntu.enable-hibernate.pkla or create it if it does not exist.
sudo nano /var/lib/polkit-1/var/lib/polkit-1/com.ubuntu.enable-hibernate.pkla
Add the following lines:
[Re-enable hibernate by default in upower]
Identity=unix-user:*
Action=org.freedesktop.upower.hibernate
ResultActive=yes

[Re-enable hibernate by default in logind]
Identity=unix-user:*
Action=org.freedesktop.login1.hibernate
ResultActive=yes

3). Restart your computer



Reference
http://ubuntuhandbook.org/index.php/2014/04/enable-hibernate-ubuntu-14-04/

Saturday, February 7, 2015

Ubuntu: Disabling mouse movement while typing

I'm using Ubuntu 14.04 on my labtop Lenovo ThinkPad E440. The problem is mouse is moving while I'm typing. I already disabled it in the Mousepad setting but it didn't work.

Here are the steps to solve it:

1). Kill syndamon processes
killall syndaemon
2). Disable touchpad while typing
syndaemon -i 0.6 -KRd
-i : How many seconds to wait after the last key press before enabling the touchpad. (default is 2.0s).
-K : Ignore modifier keys and Modifier+Key combos when monitoring keyboard activity.
-R : Use the XRecord extension for detecting keyboard activity instead of polling the keyboard state.
-d : Start as a daemon, ie in the background to avoid the command open your terminal.

3). Add the command to /etc/profile file
/usr/bin/syndaemon -i 0.6 -d -K -R

4). Uncheck the option to disable touchpad while typing in System Settings so they don't interfere with each other which may make your mouse not work sometimes.















Reference
http://askubuntu.com/questions/327166/disabling-trackpad-while-typing-does-not-work

Lenovo ThinkPad: Swapping action of the function keys

My labtop is Lenovo ThinkPad E440 and I'm using Ubuntu 14.04. To adjust the screen brightness or volume, I use F5/F6 or F2/F3, respectively. And if I want to refresh page in browser, I need to press Fn+F5. I want to remap the function key by just pressing F5 to refresh a page in browser and Fn+F5/F6 to adjust screen brightness instead.

To do that, I just press Fn key and tap Esc key and that's it. It invokes function lock. You'll see LED light up on the Fn key as indicator.



Reference
http://forums.lenovo.com/t5/11e-Windows-E-and-Edge-series/E540-Fn-Fx-remapping/m-p/1628646#U1628646

Ubuntu and Levono: Brightness is reset to maximum on every restart

I'm using Ubuntu 14.04 and my labtop is Lenovo ThinkPad. The brightness is reset to maximum every time I reboot my machine. I have fixed the problem by:

1. Adjust the brightness to the level you want (by pressing the brightness key, Fn and F5/F6 in my case).

2. Note the output value of the following command.
cat /sys/class/backlight/intel_backlight/actual_brightness
In my case, it's 1700. It's the current level of brightness. If you want to know the maximum value, you can adjust the brightness to maximum and then run the command.

3. Add the following line to the file /etc/rc.local
echo 1700 > /sys/class/backlight/intel_backlight/brightness
So the content of my file would be:
GNU nano 2.2.6                                  File: /etc/rc.local                                                                            

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
chmod 666 /sys/class/backlight/intel_backlight/brightness
echo 1600 > /sys/class/backlight/intel_backlight/brightness

exit 0

I also added the command to modify the permission of the file to be writable by all users. I experienced the problem that even though I already modified the file's permission to be writable by all users, it was reset back to not writable even if for root user after reboot.

4. Add acpi_osi=Linux acpi_backlight=vendor to the value of the GRUB_CMDLINE_LINUX_DEFAULT variable inside /etc/default/grub file. Below is the file's content snippet after I've updated.
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
#   info -f grub -n 'Simple configuration'

GRUB_DEFAULT=0
#GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi_osi=Linux acpi_backlight=vendor"
...

5. Run the following command:
sudo update-grub
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.13.0-24-generic
Found initrd image: /boot/initrd.img-3.13.0-24-generic
Found memtest86+ image: /memtest86+.elf
Found memtest86+ image: /memtest86+.bin
Found Windows 8 (loader) on /dev/sda1
done


Please note that step 1, 2 and 3 keep the screen brightness level remain the same after reboot but it will be reset to maximum if the machine is suspended or the screen is lock. Step 4 and 5 will fix this.



Reference
http://askubuntu.com/questions/151651/brightness-is-reset-to-maximum-on-every-restart
http://askubuntu.com/questions/138386/the-brightness-gets-reset-after-unlocking

Tuesday, February 3, 2015

Ivy Issue: Unresolved Dependencies - java.lang.NullPointerException at java.util.Hashtable.put()


You might encounter the following error while building your project and Ivy is unable to resolve dependencies.
[ivy:retrieve] 
[ivy:retrieve] :: problems summary ::
[ivy:retrieve] :::: WARNINGS
[ivy:retrieve]   ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:retrieve]   ::          UNRESOLVED DEPENDENCIES         ::
[ivy:retrieve]   ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:retrieve]   :: org.mortbay.jetty#jetty;6.1.26: java.lang.NullPointerException at java.util.Hashtable.put(Hashtable.java:514)
[ivy:retrieve]   ::::::::::::::::::::::::::::::::::::::::::::::
[ivy:retrieve] 
[ivy:retrieve] :: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS

BUILD FAILED

It's probably because of some files, for example the checksum file, was corrupted so to solve the error, just delete the library from Ivy's cache so Ivy will download the library again when you rebuild. I used Ubuntu and I deleted it with the following command:

rm -rf ~/.ivy2/cache/org.mortbay.jetty/jetty 


MariaDB Installation Error: The following packages have unmet dependencies

You might encounter the following error while trying to install MariaDB on Ubuntu:
> sudo apt-get install mariadb-server-5.5
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 mariadb-server-5.5 : Depends: mariadb-client-5.5 (>= 5.5.41+maria-1~trusty) but it is not going to be installed
                      Depends: mariadb-server-core-5.5 (>= 5.5.41+maria-1~trusty) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

It's said here Version Mismatch Between MariaDB and Ubuntu/Debian Repositories that:
It is rare for the version numbers of mysql-common or libmysqlclient to be higher in the official Ubuntu or Debian repositories than they are in the MariaDB repositories, but it has happened. Whenever it has it has been because of critical bug fix releases for bugs that existed in the version of MySQL in the distribution repositories but which had already been fixed in the version of MariaDB in the MariaDB repositories.
If a situation as described above exists when you try to install MariaDB you will get an error like this:

The following packages have unmet dependencies:
 mariadb-server : Depends: mariadb-server-5.5 but it is not going to be installed
E: Unable to correct problems, you have held broken packages

A way to fix this is to specify the exact version of the two packages that you want to install. To do this, first determine the full version numbers of the affected packages. An easy way to do so is with 'apt-cache show'


You need to do as following:


1. Show version of mysql-common
> apt-cache show mysql-common | grep Version
Version: 5.5.41+maria-1~trusty
Version: 5.5.41-0ubuntu0.14.04.1
Version: 5.5.35+dfsg-1ubuntu1
2. Show version of libmysqlclient18
> apt-cache show libmysqlclient18 | grep Version
Version: 5.5.41+maria-1~trusty
Version: 5.5.41-0ubuntu0.14.04.1
Version: 5.5.35+dfsg-1ubuntu1
3. Install MariaDB
sudo apt-get install mariadb-server-5.5 mariadb-client-5.5 \
> libmysqlclient18=5.5.41+maria-1~trusty \
> mysql-common=5.5.41+maria-1~trusty