Upgrading to an SSD, moving from Kubuntu to Arch Linux and setting up KDE

This is a single post just to make notice of some points:

My home desktop PC, was running since 2009 the Kubuntu distribution. I’ve never reinstalled it and did always the upgrades from 8.10 to 9.04, 9.10 and so on until 14.04. Almost six (!) years with no virus, trojan horses, and a single initial installation. I’ve upgraded through the years the KDE desktop since the ill famed initial 4.0 release, to the latest 4.6 release.

But things where starting to go awry… At the beginning I had a ATI 4870 graphic board, but ATI dropped support for it on Linux (and Windows) and since I had so many troubles with the proprietary driver, and to add it up I had no support for the board, I sold it and bought an Nvidia GTX660.

But with both graphic boards, I had suffered from a long time problem: I could only do a sleep/resume a number of times before the system hanged. The symptoms starting from loosing network connectivity and then restoring right back, and some cycling of these symptoms to a complete lockup. At first I thought that was due to the network driver used by my motherboard, a Asus P6T with  a Realtek RTL8111/8168/8411 board, but with the correct driver for it, the issue continued.  Booting up was a painful two/three minute wait from BIOS to desktop.

But after a while I could pin point my issues not to the network board but to the Xorg and video driver combination. Some EQ buffer overflow, hanged X, and finally the machine.

Ubuntu and Kubuntu based distributions have PPA’s repositories where some alternative software and versions of mainstream software are available. I had trouble with some of these alternative PPA’s when upgrading, and had to remove them (with ppa-purge) to be able to upgrade the Kubuntu distribution. Anyway, there is an PPA, xorg-edgers,  where alternative and more recent versions of Xorg Software and Nvidia drivers are provided and that almost solved my sleep/resume problem. The problem was that after adding this PPA the Ubuntu/Kubuntu nvidia driver and the Xorg-edgers driver, after updates the X server was unable to find the nvidia driver, despite being installed, and had to reinstall the driver again to get my desktop working.

That was it. I had enough with Ubuntu/Kubuntu distributions. My bad and my issues, sure…

I’ve being testing Arch Linux on my work laptop for almost an year with great success. I’ve chosen Arch Linux because I didn’t had to loose an unknown number of hours per year upgrading to the next distribution version, and an rolling release version makes more sense. And Arch has the greatest Linux Wiki out there even solving problems that happen on the Ubuntu/Kubuntu line, and also mainly there are only one (well two) repositories. No PPA’s mess.

So I completely moved all my systems to Arch Linux, and my sleep/resume issue is 100% solved.

SSD on a SATA II based motherboard

My desktop computer has an Asus P6T motherboard. This motherboard only has SATA II (SATA 2) ports. Is it worth to use an SSD on such a board without upgrading to a SATA III board?

The answer is YES. If you have a SATA II based motherboard AND not buying an SSD because of that, do not wait any more. Buy it now. It is totally worth it.

Arch Linux is of course way lighter than Kubuntu, and with an SSD ( by the way it’s a Crucial MX100 256GB) my two/three minute boot to desktop time came down to 15s…

hdparm -Tt /dev/sdc
Timing cached reads:   16710 MB in  2.00 seconds = 8361.40 MB/sec
Timing buffered disk reads: 728 MB in  3.00 seconds = 242.59 MB/sec

Note the Samsung EVO 120GB that I have on my work computer, that has the flawed firmware that slows down with time, on a SATA III based motherboard:

Timing cached reads: 23864 MB in 2.00 seconds = 11943.41 MB/sec
Timing buffered disk reads: 164 MB in 3.01 seconds = 54.47 MB/sec

Compare this with my desktop old boot disk, an WD 640GB blue:
Timing cached reads: 16580 MB in 2.00 seconds = 8296.87 MB/sec
Timing buffered disk reads: 356 MB in 3.00 seconds = 118.59 MB/sec

I hadn’t yet had the time to upgrade the firmware on the EVO…

Making KDE looking good on Arch Linux

To end this rather long and tedious post, and also to my future reference, to make KDE looking good:

    • Make sure that the infinality modifications are installed: https://wiki.archlinux.org/index.php/Infinality. Make sure that you update.
    • Make sure that the DPI detected by your X server are correct for your monitor. Install xdpyinfo with pacman -S xorg-xdpyinfo. Figure out what might be your monitor dpi using this site: http://dpi.lv/ . Execute xdpyinfo | grep -B2 resolution and see if are similar. If not you need to set the correct dpi either in xorg.conf or in the Kde settings.
      In my case I have a dual monitor setup, and hence the weird dpi 95×96.screen

      #0: dimensions: 3200×1080 pixels (856×286 millimeters)

      resolution: 95×96 dots per inch

      So my font settings are:


  • While the above settings make my fonts look good, the taskbar fonts where awful and took me a while to figure out that was not the dpi settings but the Desktop Theme.
  • To solve this first install Krita with pacman -S calligra-krita . This will install the Krita color themes that are, in my opinion very good. And on KDE System Settings -> Workspace Appearance -> Desktop Themes select Get New Themes and get the AndroidBit theme.
  • That’s it:Selection_004
  • I’ve selected the Produkte Desktop Theme
  • And the colors:Selection_005

Using KDE Kate editor as an Arduino IDE

The Arduino IDE is the tool of choice for building and programming for the Arduino platform. It has all that is need for casual programming, namely a simple way to choose and select the Arduino board and serial port, a simple interface, and a simple editor.

But those of us used to other tools for programming, like NetBeans, IntelliJ IDEA (I use it as the Android Studio version) or Eclipse, can find the editor lacking in little things that makes programming easier.

Anyway I was able to use NetBeans for programming and deploying arduino sketchs, with a great feature that is/was command auto completion for the Arduino C “language”. But Netbeans is big, and all it does is to call the Atmel tools for compiling and uploading sketchs into the arduino boards.

So I’m a KDE user, and KDE has a great extensible editor named Kate. Why not use it for programming for the Arduino?

As I said, Kate is a powerful extensible editor and  there are two plugins for making Kate “friendlier” in this task as a replacement for the Arduino IDE.

What we need to accomplish this? We need the following files/software:

Syntax highlighting for ino and pde files: https://github.com/jeroendoggen/Arduino-KDE-syntax-highlighting/blob/master/ArduinoKate.xml

Base project at: https://github.com/jeroendoggen/Arduino-KDE-syntax-highlighting

Just download the ArduinoKate.xml file and as root copy it to the /usr/share/kde4/apps/katepart/syntax folder. Just make sure that on your distribution that the path is correct.

Now if opening an .ino or .pde file with the Kate editor, we should have syntax highlight.

Next we need to download an Arduino Make file from https://github.com/sudar/Arduino-Makefile. Just download it and unzip it to a directory that won’t be deleted or moved. You also need the Arduino IDE to make this work, as this make file will get the tools and libraries from the Arduino IDE installation directory.

Second, change the .bashrc file so the following environment variables are added:

# Base directory where the arduino IDE is installed. Change to suit your directory
export ARDUINO_DIR=/home/pcortex/arduino
# Base directory where the Sudar Arduino Makefile files where installed
export ARDUINO_DIR=/home/pcortex/00.Develop/Arduino-Makefile-master
# Base Arduino tools directory
export AVR_TOOLS_DIR=/usr

We have almost everything ready:

Just launch now the Kate editor and goto Settings->Configure Kate->Plugins and enable the Build and Project plugin.

We are now ready. Let’s develop:

1) Create a directory for your project: mkdir ~/Arduino-project

2) Change to that directory and create a makefile. The content is simple:

#include $(ARDMK_DIR)/Arduino.mk
include /home/pcortex/00.Develop/Arduino-Makefile-master/Arduino.mk

Save the file. This makefile is for the Arduino Uno. To compile for other boards, on this directory and with this make file saved, just run the command make show_boards to see the available boards. Then change the BOARD_TAG appropriately to your board. For example, for the Arduino Mini Pro 5v the BOARD_TAG is pro5v328 and not uno.

3) Create the Kate project file:  This file MUST be named .kateproject :

"name": "My Arduino Project Name"
, "files": [ { "git": 1 }, {"directory": ".", "filters": ["*.ino","*.pde","*.c","*.cpp", "*.h" ] } ]
, "build": {
                  "directory": "."
                   , "build": "make all"
                   , "clean": "make clean"
                   , "upload": "make upload"    

The JSON “name” tag will define the name that shows up at the Kate Project dropdown box selector.

4) If using Git (as I do) just add a .gitignore file where the *.o and *.d files are ignored.

That’s it.

Create your main.ino file and add code.

To compile, just go to Build->Build Default Target.  This is equivalent to Verify on the Arduino IDE.

To upload, on the Build plugin window, just select (or add) the make upload option, and the Makefile will upload the sketch/program to the board.

If any errors happen, clicking on the Build plugin output tab, on the lines with errors and line numbers, will jump to the exact location of the error.

For more information refer to Sudar documentation for the Makefile.

Happy coding!


Monit and KDE Desktop notifications

I’m running a Monit based monitoring solution, but I do not have an email server (that I can use), so when something goes wrong and Monit Alerts is raised, I have no way receive a notification that something is wrong.

So I built a quick notification system, done in Python, that when a Monit detects an error, it notifies me by activating a KDE Notification on my desktop…

The solution that I use is quite simple and quick (Warning it’s an hack…):

My solution uses a python based network server running on my desktop listening for messages, and a python client deployed on the Monit server that sends messages, when called.

In short, the running server on my KDE desktop waits for a connection on a specific port, and when one connection is established it reads any text that comes on the connection payload and displays it using the KDE notification system:


## Monit Desktop Notification Network server
import socket
import sys
import knotify
import dbus

## Constants definition
HOST = ''    # Host IP Address. Empty means that we are the host
PORT = 29876    # Listening port. Choose any above 1024. The client must use the same port...
BUFSIZE = 4096

## Send notification for the KDE notification system
def notify(title, text):
   knotify = dbus.SessionBus().get_object("org.kde.knotify", "/Notify")
   knotify.event("warning", "kde", [], title, text, [], [], 0, 0,

print 'Server Started'
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
print 'Socket created'
# Bind socket to local host and port
  s.bind((HOST, PORT))
except socket.error as msg:
    print 'Bind failed. Error Code : ' + str(msg[0]) + ' Message ' + msg[1]
print 'Socket bind complete'

#Start listening on socket
print 'Socket now listening'

#now keep talking with the client
while 1:
  #wait to accept a connection - blocking call
  conn, addr = s.accept()
  print 'Connected with ' + addr[0] + ':' + str(addr[1])
  # Read the message that comes from the monit server.
  data = conn.recv(1024)
  # Send the message to the KDE notification system
  notify("Monit Alarm!", data)


At the Monit server, I placed the following files at the Monit bin directory: notify.py and notify.sh:


from socket import *
import sys
from datetime import datetime

HOST = ''       # My machine IP. Change to the IP where the NotifyServe.py is running
PORT = 29876       

cli = socket( AF_INET,SOCK_STREAM)
print len(sys.argv)
if ( len(sys.argv) > 1 ):
  message = str(datetime.now().strftime('%Y-%m-%d %H:%M:%S')) + ": " + sys.argv[1]
  cli.send( message )
  cli.send("Undefined Alert!")

Notify.py receives a message passed as a command line parameter and sends it to the NotifyServer running on the desktop machine.

The notify.sh shell script is a wrapper for the Monit server to call the monit.py script. Keep in mind that you must use absolute paths in every single file, otherwise it won’t work.

/usr/bin/python2      /home/monitor/monit/bin/notify.py   $1

Now on the monitrc file we can change the alert lines from (for example):

check program System_status with path "/home/monitor/ShMonitor/SystemStatus.sh"
  if status !=0 then alert


check program System_status with path "/home/monitor/ShMonitor/SystemStatus.sh"
  if status !=0 for 15 cycles then exec "/home/monitor/monit/bin/notify.sh SystemStatus_Problem"

I added the for 15 cycles to avoid being flooded with notifications while I solve the issue… But it really depends of the monitoring pooling cycle. Adjust as required.

So, there it is, some code snippets gather across the web, allows me to have Monit notifications right at my desktop :)




Synology Cloudstation on Kubuntu/KDE Desktop

One of the softwares available for the Synology is Cloudstation that mimics Dropbox functionality but with your own server (in this case your Synology device). For the Cloustation server there are several clients available, and one of them is CloudStation for Linux.

But I run Kubuntu version of Ubuntu with the KDE desktop, and during installation of the CloudStation for Linux/Ubuntu, one of the installation steps by the Cloudstation install program  is to run apt-get where Nautilus, Brasero and a lot of other supporting libraries are required to be installed.

But, as I’ve found out, those packages are only needed for file manager integration, not for the functionality of the CloudStation software.

So just answer NO to the request of packages (you may want to keep a copy of the package list for future installation), and let CloudStation install.

On my KDE 4.11.3 it CloudStation works fine, and it has the Status icon on the Systray, without the required Nautilus libraries. Of course there is no Dolphin integration.

KDE device notifier and Konqueror/Dolphin file manager

This may seem a simple issue, but it took me a while to find why “Open with File Manager” on the device manager opened up the Konqueror file manager instead of Dolphin…

To change it’s easy. Just go to System Settings and Default Aplications. Choose File Manager, and there choose your File Manager of preference.

That’s it.

Kubuntu upgrade from 12.04 to 13.04

Despite Kubuntu 12.04 being a LTS release, and after some weeks upgrading to 13.04 on my personal desktop computer, I decided to do the same on my Work Laptop.

Things didn’t ran as expected…

First the upgrade from 12.04 to 12.10 deleted a bunch of packages, by my command :( and I ended up with no graphical display… A quick look at Xorg.0.log file showed me that my Xorger’s driver for my Intel graphic card was gone.

Anyway, I’ve installed the xservers-xorg-video-intel package and proceeded to upgrade to 13.04.

At the end despite having a graphical desktop, after login on KDE, a qdbus error appeared… qdbus package was missing… (apt-get install qdbus).

Also on 12.04 the transition from the login greeter to the desktop is silky smooth (it is on my desktop), on my laptop it blanks showing a black screen with a mouse cursor, but the desktop shows up abruptly. I don’t have now the KDE logon progress icons…

And finally, DNS settings from my DHCP servers didn’t worked, I had to manually add the dns servers IP to resolv.conf…  This issue was also a missing package, namely dnsmaq. After adding up the nameserver to my /etc/resolv.conf file, everything is up….

Let’s see what is waiting again in the dark…

Firefox Open Download Directory Action on KDE/KUbuntu

I had a bit of a strange issue with FireFox and Kde 4.7 on Kubuntu 11.X.

After downloading a file with Firefox, on the Dowloads Firefox windows, right clicking the downloaded file for the Open Download Directory action, instead of opening the Dolphin File Manager, it opened the KdeSVN application… Very, very annoying.

To solve this you need to reconfigure KDE, probably due to the fact that KDESvn was installed:

1) Goto System Settings
2) Select Default Applications
3) Select FileManagers
4) Deselect and select Dolphin
5) Apply
6) Restart Firefox

It should work now.