Hardcore Linux

Anything about Ubuntu, Centos, openSuSe and Fedora

KVM guest not automatically starting at boot sequence

I don’t know but I encountered this problem using Ubuntu 12.04 as KVM host, even though I already added the guest VM in the /etc/libvirt/qemu/autostart as symlink  but during the host boot sequence it is still not automatically started (the guest machine).

Here’s a quickfix that works for me:

1. Modify the /etc/init/libvirt-bin.conf and look for the line with:

start on runlevel [2345]

2. Replace that with:

start on (runlevel [2345] and net-device-up IFACE=br0)

3. Done.

Please note that use your current bridge network device, in my example it is br0.


Hide network-manager applet in Ubuntu 12.04 when using ifup.

Wish to hide the nm-applet when decide to use conventional ifup instead of network-manager? Here’s how:

1. Install Gconf-Editor:

$> sudo apt-get install gconf-editor

2. Run gconf-editor and go to: Apps –> nm-applet

3. Uncheck the  setting called  show-applet

4. Done.

Ubuntu 12.04 /etc/resolv.conf implementation with dnsmasq

On the current version of Ubuntu (12.04), you might notice that the current /etc/resolv.conf file always record a nameserver which then resolv dns via dnsmasq, but most of the time after test few things, I found it more problematic. It always disregard my local DNS server, and goes directly to the DNS of my ISP.

If you’re having the same problem like mine, here’s a quickfix:

1. Modify the configuration /etc/NetworkManager/NetworkManager.conf

$> sudo gedit /etc/NetworkManager/NetworkManager.conf

2.  Comment the line that contain “dns=dnsmasq


3. Then restart the network-manager

$> sudo  service network-manager restart

4. Done



Installing KVM with OpenVSwitch on Ubuntu 12.04

Here’s a good article from http://blog.allanglesit.com/, I myself tried it my in test server and it’s working great, though I’m still new with OpenVSwitch.

The article has been released for Ubuntu 12.04 system. I also found out that the KVM version currently available in Ubuntu 12.04 has better performance compare to 10.04, which I think is a good sign when planning to deploy KVM host for your VMs.

The actual URL: http://blog.allanglesit.com/2012/03/linux-kvm-ubuntu-12-04-with-openvswitch/


Show Hidden Icons from the Ubuntu’s Unity System Tray

Initially, since Ubuntu 11.04, I tried Unity several time and force myself to like it, but I can’t. Done several tweak to make it useful then, but when 12.04 came out, Unity if getting more usable and faster.

And another thing about Unity, is that I hides several icons from the default system tray, most of them place under the messaging menu icon ( the one that looks like a mail envelope), which includes pidgin, a multi-platform instant messaging client. I’ve tried several howtos to show it back to the system tray, but still I failed. Then read this acticle from ask ubuntu (here), and it works!.

Here’s how:

1. Via the console/terminal while under your login account, invoke:

$> gsettings set com.canonical.Unity.Panel systray-whitelist "['all']"

2. You can also use dconf-editor, which is included in the dconf-tool package, install it using either the “Ubuntu Software Center” or via console with the command:

$> sudo apt-get install dconf-tools

3. On dconf-editor, go to Desktop -> Unity -> Panel, and replace the value of systray-whitelist to “[‘all’]”.

4. Done.

Folder Monitoring Script using Inotifywait

Though it is not failsafe nor flawless, but currently it is working great for me. Here’s a script that enables to monitor the events from a specified folder/directory.

First install the inotify-tools:

apt-get install inotify-tools

Here’s my current code, feel free to enhance.

# monitor file changes in a target directory

if [ "$*" = "" ]; then
 echo "File Monitoring"
 echo "USAGE: $0 <target directory>" | sed "s/.\///g"
 echo ""
 exit 0


if [ ! -d $LOGDIR ]; then
 mkdir -p $LOGDIR

LOGNAME="$LOGDIR/`date -I`.log"

inotifywait -m -r --format '%T %e %w%f' --timefmt '%F %T' -e modify -e move -e create -e delete $TARGET_DIR | while read line
echo "$line" >> $LOGNAME

exit 0

Converting Multiple Images via BASH Script

Previously, I posted a flawed script that be able to convert images and lower their resolution as well, though it works for me, but found it very problematic sometimes. Here’s another script I made to perform same purpose: Convert the image to either jpg|png|pdf|tif and has an option to modify the quality [1% to 100%].


converting all images in /home/user/Desktop/rawimg to PDF with 50% quality

$> convert2.sh /home/user/Desktop/rawimg pdf 50

Here’s my script:


if [ "$1" = "" ] ; then
 echo "$0 <image location> <image type> [quality] "
 echo "convert a specific folder that contains images to different format and quality"
 echo "[imagetype] - can be either pdf jpg png tif"
 echo "[quality] - from 1 to 100%, default is 100%"
if [[ $2 =~ jpg|png|pdf|tif ]] ; then
 echo "please select image type from jpg,png,pdf or tif"
if [ "$3" = "" ]; then
find $TARGET_LOCATION -maxdepth 1 -type f > /tmp/tmpfile
cat /tmp/tmpfile | \
while read FILENAME; do
# echo "convert '$FILENAME' -quality $QUALITY '$FILENAME.$TARGET_TYPE'"
 BARENAME=$(echo "$FILENAME" | cut -d'.' -f1)
 EXTENSIONNAME=$(echo ${FILENAME: -4} | tr '[A-Z]' '[a-z]')
 if [[ $EXTENSIONNAME =~ jpg|png|pdf|tif ]]; then
rm -f /tmp/tmpfile
exit 0



keyboard: can’t emulate rawmode for keycode 240

Installing fresh Ubuntu 11.10 and check out what Unity and Gnome-shell has to offer, everything works great until I found something..syslog error message appears very frequent: “keyboard: can’t emulate rawmode for keycode 240“.  I remember having this problem in my previous Ubuntu 11.04 installation on my Lenovo z370 laptop, thought it’s gone back then..but to the point on installing newer kernel which is Linux kernel 3.1.

As I’m going to compile Linux kernel again to make everything work. I found a much simplier solution. Here’s how:

1. Install dkms (Dynamic Kernel Module Support Framework)

$> sudo apt-get install dkms 

2. Download the ideapad-laptop package which supposed to be fore natty narwhal but still working greate on oneiric.

$> cd ~/Downloads

$> wget https://launchpad.net/~lexical/+archive/ideapad/+build/2529783/+files/ideapad-laptop-dkms_0.1-1ubuntu1~foshan2_all.deb

$> sudo dpkg -i  ideapad-laptop-dkms_0.1-1ubuntu1~foshan2_all.deb

3. Reboot for everything to work in effect.

4. Done.


Change Gnome3 Background via script.

Previously using gconftool-2 to replace the current desktop wallpaper via a script (normally a starting bash script). But with Gnome3 its not working anymore. As an alternative or should I say the proper way to do it in Gnome3 is via dconf-tools. Here’s the sample command via console:

$> gsettings list-recursively

will list all known schema and keys

$> gsettings list-keys org.gnome.desktop.background

will list all keys under the defined schema.

$> gsettings get org.gnome.desktop.background picture-uri

to change the value, enter this command:

$> gsettings set org.gnome.desktop.background picture-uri "file:///path/filename"


Lxpanel freeze after closing LibreOffice document.

As of Ubuntu 11.04, the package lxpanel 0.5.6 and Libreoffice 3.3.x, the bug still exist, freezing lxpanel after saving and closing current  ODF files. I suspected lxpanel bug, looking it over the Internet and haven’t found any confirmation that it actually does the freezing. While seeking answers over the Internet I’ve found this bug thread: (click here), which fixes my problem, I’m not 100% sure it will work on all cases though, but good enough to give it a try.

1. Install the necessary libraries and tools to compile the lxpanel 0.5.8 from  source.

sudo apt-get install libgtk2.0-dev libmenu-cache1-dev intltool

2.  Download the lxpanel 0.5.8 source from here, of check the newest version here.

3. Compile the source code. Go to the folder of lxpanel source and perform the following command:

./configure --prefix=/usr
sudo make install

4. Logout the current session or reboot your machine to confirm.

5. Done.



Get every new post delivered to your Inbox.

Join 358 other followers

%d bloggers like this: