SiKing

October 8, 2009

Installing Eclipse on Linux Mint (Ubuntu)

Filed under: linux — siking @ 9:21 pm
Tags:

Even thought Eclipse is available in the standard Ubuntu repos, it is not as easy or straightforward to install as other packages. Here is what I did to install the latest Eclipse + Pydev + Subclipse on my Mint 5 :mrgreen: (Ubuntu 8.04 equivalent).

Step 1: Install and update Eclipse

  1. sudo apt-get install eclipse-pydev, or you can just install the package eclipse-pydev from Synaptic. Pydev has Eclipse (and a bunch of other stuff) as a dependency, so you will get both. Subclipse is not available in the repos; no idea why; we will handle that separately below.
  2. Eclipse has it’s own package manager, which is not exactly compatible (in form or function) with APT (note that Synaptic is just a graphical front end for APT). Once the install completes lock the eclipse and eclipse-pydev packages: in Synaptic select the package and then select Package > Lock Version. This will ensure that Synaptic knows it is installed (in case it is a dependency for something else), but it should never mess with trying to update it.
    Eclipse pinned
  3. Start up Eclipse as a normal user, and enter your default working directory. This step will ensure that all the work files that Eclipse needs will be created, and they will be created with the correct permissions and in correct places.
  4. Next you want to update Eclipse. What Eclipse does not do for you, and you just simply have to know, is that you need to do this with root privileges – majority of Eclipse lives in /usr/lib/eclipse. If you skipped the previous step (creating all the work files), then the work files are going to be created with wrong privileges, and subsequently nothing is going to work right; even after I chowned all the ownership on ~/workspace I still had problems. Start Eclipse from a terminal with sudo eclipse. When it asks you where you want to keep your workspace, this time it does not really matter what you tell it – I normally tell it in /tmp.
  5. To update Eclipse, select Help > Software Updates > Find and Install, and follow Scenario 1 from the Eclipse wiki.

Step 2. Update Pydev

  1. Still as root in Eclipse, again select Help > Software Updates > Find and Install. This time select the second option “Search for new features to install”. Pydev was sold and re-licensed, and I suspect the new owners are not interested in keeping Pydev in the repos. So the new version is actually a new product.
  2. I was presented with three sites to search. I did not find anything I was interested in on Callisto Discovery Site. Pydev Extensions is what you want. The Eclipse Project Updates did find things, but I think they buggered up my install, so from now I just avoid them.
    install sites
  3. When presented with the available updates, select Pydev. The Pydev Extensions are a paid feature, and I am not using Mylyn.
    updates
  4. Another restart. If you check, you will notice that the Pydev Extension site has been removed. This means that from now on, to update Pydev, you can go through “Search for updates of the currently installed features” and not the “Search for new features to install” route.

Step 3. Install Subclipse

  1. Subclipse is a new feature, so still as root in Eclipse go to “Search for new features to install”.
  2. This time you have to add a New Remote Site. You get the necessary information from the Subclipse site.
  3. After that continue through the wizard. From the presented choices, I only selected Subclipse, minus the Revision Graph which I could not get some dependencies for.
    subclipse updates
  4. You need that JavaHL stuff, and contrary to the way things look above, you did not just install it. :( sudo apt-get install libsvn-javahl
  5. Now it gets complicated! Start up Eclipse, and see if it cluedin and figured out what you just did. From the menus select Window > Preferences, and in the popup window select Team > SVN. Under the SVN Interface, you need to see a version of some kind. If you see “Not Available”, Eclipse did not figure it out.
    Eclipse preferences
  6. If it is not right, first check you got the correct version of everything. There is a Subversion server – Subclipse version compatibility, and then Subclipse – JavaHL version compatibility. So, as an example, I am trying to connect to SourceForge which supports Subversion v1.5. So I will need Subclipse at least v1.4, which needs JavaHL v1.5. I am using Mint5 – Ubuntu Hardy – and according to this, I will need to grab JavaHL from their backports repository. If you are running Intrepid – Mint 6 – or later, you should be fine. Including additional repos in your system I will leave as an exercise to the reader.
  7. If after all of that it is still not working :eek: , you will need to edit your eclipse.ini. I did not have to do this, and I suspect that newer versions of Mint will be the same.

Last word

To remove this mess from your system:

$ sudo bash
# apt-get purge eclipse
# apt-get autoremove
# rm -rf /usr/lib/eclipse

Maybe I’m just spoiled, but all this should not be this difficult!

Update 09/10/26: So apparently I forgot an important step. After doing all these updates you have to rm -rf ~/.eclipse to reset everything on your account. Also, Pydev has been restructured (again), and re-released as version 1.5. Unfortunately, they forgot to notify the update manager, and you have to do it manually – note the ‘Quick Install’ cutesie note on the right hand side.

Did I mention that is beyond-stupid complicated?

June 8, 2009

Installing VMware Server on Linux Mint (Ubuntu)

Filed under: iotal, linux, virtualization — siking @ 8:52 pm
Tags:

Installing VMware Server is not your typical point-and-click procedure. However, it is quite easy even for those who are a little squeamish with the command line.

Here I will be talking about installing VMware Server version 1.0.9 on Linux Mint 5 – I don’t do the latest’n'greatest anymore. Linux Mint is fully compatible with Ubuntu 8.04, so I would expect this procedure to be very similar, if not identical, for most derivatives and close versions.

VMware are very good at hiding all the useful stuff on their website! :roll: Here are all the pieces you are going to have to download:

  • VMware Server will require you to build kernel modules. You will need kernel header files for that. On Mint/Ubuntu you already have them at /lib/modules/$(uname -r)/build/include. The installer, further below, will be able to figure it out automatically, assuming you have all the defaults for your system.
  • To build stuff, you will need tools. I just grabbed the build-essential package and that had everything.
  • The VMware install guide is linked here – you want the Admin Guide, starting somewhere around page 36. I once accidentally found a much more succinct Install Guide on their page, but I can’t find it again. :( Below is only the relevant distill; however, I would still recommend that you have at least a browse through theirs in case you run into problems. There is also a detailed guide here, which may be of some use if you run into problems.
  • VMware is pushing the newer 2.0 version; older version are here – you want to get the “VMware Server for Linux. TAR Binary.” Right on that same page, notice the register for your free serial number(s) link. The server is free, but they will need an e-mail address where they can push more stuff on you.

First you will need to unpack the TAR Binary. You will only need this once, so you might as well do it in /tmp – which gets automatically emptied each time you reboot. Open up a terminal:

cd /tmp
tar xvf ~/Downloads/VMware-server-1.0.9-156507.tar.gz

And continue with the install:

cd vmware-server-distrib
sudo ./vmware-install.pl

I took defaults for everything except the following:

In which directory do you want to install the binary files?
[/usr/bin] /usr/local/bin

On Ubuntu, or any system that has a package manager, it is good idea to keep stuff you install manually somewhere else. The Linux file system has a place specifically for this purpose, and that place is /usr/local.

If you screw the install up, you can run sudo /usr/local/bin/vmware-uninstall.pl so that it cleans up, and then start again.

Next is the configuration. The installer will prompt you, or you can just run explicitly sudo /usr/local/bin/vmware-config.pl. Any time afterwards you want to change something, you will need to rerun this program. For Linux Mint 6 (Ubunt 8.10) or perhaps later, you might need this patch before you configure the VMware – suggestion is to run the configuration program, if it fails install the patch, if it passes just move on. Again, I took defaults except:

You can safely ignore the complaints about the extensions on the Icons, as well as the wrong version of the gcc compiler.

For networking, make sure you bridge all interfaces (ethernet and wireless). I did not use NAT.

In which directory do you want to keep your virtual machine files?
[/var/lib/vmware/Virtual Machines] /home/vmware/machines

The way I have my disk partitions set up, I had to override where the machine images will be kept. The images will be big, make sure the place you tell it has enough space.

If everything worked fine, you should get a new menu entry Applications > System Tools > VMware Server Console. The first time you try to run it, it will not work. :( If you run vmware from the command line, you will get:

/usr/local/lib/vmware/bin/vmware: /usr/local/lib/vmware/lib/libgcc_s.so.1/libgcc_s.so.1: version `GCC_3.4' not found (required by /usr/lib/libcairo.so.2)
/usr/local/lib/vmware/bin/vmware: /usr/local/lib/vmware/lib/libgcc_s.so.1/libgcc_s.so.1: version `GCC_4.2.0' not found (required by /usr/lib/libstdc++.so.6)
/usr/local/lib/vmware/bin/vmware: /usr/local/lib/vmware/lib/libgcc_s.so.1/libgcc_s.so.1: version `GCC_3.4' not found (required by /usr/lib/libcairo.so.2)
/usr/local/lib/vmware/bin/vmware: /usr/local/lib/vmware/lib/libgcc_s.so.1/libgcc_s.so.1: version `GCC_4.2.0' not found (required by /usr/lib/libstdc++.so.6)
/usr/local/lib/vmware/bin/vmware: /usr/local/lib/vmware/lib/libgcc_s.so.1/libgcc_s.so.1: version `GCC_3.4' not found (required by /usr/lib/libcairo.so.2)
/usr/local/lib/vmware/bin/vmware: /usr/local/lib/vmware/lib/libgcc_s.so.1/libgcc_s.so.1: version `GCC_4.2.0' not found (required by /usr/lib/libstdc++.so.6)

According to the Gentoo team, this file is useless. Once you delete that, the VMware console should come up normally.

Update 09/06/18:

I just tried to do the above on Ubuntu 8.10 64bit. I did need the patch as mentioned above, and I did not get the error about libgcc_s.so.1 when starting vmware. However, I did run into an issue starting up my virtual machine. At first you get a blank error (as in: “The process exited with an error: End of error message.”), but if you turn on debugging in the advanced options you can see the actual error:

Version mismatch with vmmon module: expecting 138.0, got 137.0.
You have an incorrect version of the `vmmon' kernel module.
Try reinstalling VMware Server.

And they’re not kidding. The fix is that you have to configure vmware twice! :shock:

Then there was a second surprise: my arrow keys (along with a bunch of others) did not work inside vmware. There is an explanation as well as a solution, at the VMware Knowledge Base.

Every once in a while the keyboard will stop responding to mapped keys – things like Crtl-Alt-LArrow to switch desktops – you can run setxkbmap to fix it.

Update 09/06/24:

For some other reasons, I updated my box to Ubuntu 9.04 AMD64. When recompiling vmware I hit some SSL key errors.

Update 09/07/22: Bottom line: If you are going to go with VMware 1.x do not go over Ubuntu 8.04 (Mint 5). After several months of running it on 9.04×64, I feel it is quite unstable! Also, if you do want to virtualize 64bit operating systems, make sure your BIOS supports this thing … upfont. :evil:

May 22, 2009

Linux Backup & Reinstall

Filed under: iotal, linux — siking @ 3:38 pm
Tags:

Last week I spent some time playing with DreamLinux (again), trying to get it onto a thumb-drive / memory-stick / whatever-you-call-those-things (again). Dream hosed my system (again). This time I lost my swap?!?! I’m sorry guys, but that installer sucks! It’s just as well, there were a few changes that I had been wanting to do to my system anyways which would require a complete reinstall.

The procedure that I basically follow is:

  1. Backup home. You have to do this as root, so that hoses the ownership of all the files. I know there is a way to do it correctly and preserve the ownership, but it actually does not matter that much – see further below.
  2. Install the system wiping the drive(s) clean.
  3. Install critical updates. In the case of Mint I do only levels 1 and 2. I am running Mint 5, which is based on Ubuntu 8.04, so at this point I also install the top bugs from Ubuntu 8.04.2.
  4. Clean the system – remove things that you definitely do not want. Install restricted drivers.
  5. Create a second “administrator” account, log in to populate the home.
  6. Crete all other users, log in to each to populate their home. I have an (apparently) weird habit of putting all my users into the group “users” as opposed to the default group == username, and giving their home 700 permissions.
  7. Log in as the “administrator” and restore backups. Can’t restore (or backup for that matter) my own home when I am using it. I used to get around this by running a live-CD, but this seems like so much less work. Change owner and group of all the user’s files to themselves.
  8. Install all apps.
  9. Get my kids to install all games. :lol:

There is one app that, IMHO, should get special attention: Eclipse. Eclipse has it’s own package management built in. I normally install Eclipse along with any plugins that I want through Synaptic, and then I “pin” them – lock that version – so that Synaptic or Mint Update will not try to update these. I then go into Eclipse – have to run it as root in this case – and update the whole thing from within Eclipse.

April 10, 2009

Getting Linux distro name and version

Filed under: iotal, linux — siking @ 9:56 am
Tags:

It appears that I am not the only one that would like a consistent way of getting the Linux distribution name and version number for any and all distros. And it appears there is no solution to this dilemma. The following is my attempt at such a solution.

The script will currently give you correct results for only about 60% of ditros out there. Anyone want to add the algorithm for their fav distro, please do so in the comments. I will try to maintain this up-to-date.

#!/bin/bash

if [ -e /etc/*-version ]; then
	if [ $(egrep -q '[[:alpha:]]' /etc/*-version) ]; then
		# the file contains only the version, not the name
		pushd /etc &> /dev/null
		name=$(ls *-version)
		popd &> /dev/null
		printf ${name%-version}
	fi
	cat /etc/*-version

elif [ -e /etc/lsb-release* ]; then
	# This is probably the most reliable method, if it is available.
	description=$(lsb_release -d)
	echo ${description#Description:}

elif [ -e /etc/issue ]; then
	# This is quite unreliable, as admins are encouraged to edit this file to their heart's desire.
	head -1 /etc/issue | sed {'s/ [@\][[:alpha:]]//g'}

fi

April 5, 2009

Setting up CVS|SVN+SSH

Filed under: tech — siking @ 12:38 pm
Tags:

I have to go through this procedure every time I start someplace. Normally only once, and by the time I have to go through it again I usually forget the steps. :sad: The following are my notes on how to do this next time – hopefully nobody at $JOB is reading this. :twisted: If you finds this useful, then great! If you are doing this on *NIX-*NIX machines, the you probably already know how to do this. The following information is for Windows-*NIX setup; surprisingly, I have not been able to find this anywhere else on the net. :roll:

The Windows client for accessing a repository that I prefer is either TortoiseSVN or TortoiseCVS. The procedure for setting up both is similar; differences are noted below. Some hints are here and here.

You are going to need PuTTY with TortoiseSVN; with TortoiseCVS it is bundled already. Although you do not need the entire package it is quite a useful tool for other things as well, and therefore you might as well grab the “Windows installer for everything except PuTTYtel” from the download page.

PuTTYgen

  1. Generate the access keys using PuTTYgen. The program will be in either C:\Program Files\TortoiseCVS\puttygen.exe, or C:\Program Files\PuTTY\puttygen.exe. Ask your admin what encryption and strength you should use, or just take the defaults. Click “Generate”, move your mouse around, if you need help: RTFM.
  2. Check with your admin if you need to password protect the keys. It’s a good idea to do, I personally do not bother as it is an inconvenience and I am lazy.
  3. Save the private key in a directory of your choice with a filename of your choice. Ideally, it would be in a location that only you have read-access; a suggestion is to place it right in C:\Documents and Settings\<your.login>\, not in My Documents where you often make changes to stuff.
  4. The server that you are going to access is in all likelihood some sort of a UNIX-like system; if you are stuck with a Windows server, then I feel sorry for you and I cannot help you. You need to move the public key over to that machine and appended it to your ~/.ssh/authorized_keys file, probably. Your admin can change the default filenames – check with him. Do not ever give out your private key; that is the equivalent of giving out your password! Start up PuTTY, and connect to your server (you will have to login with your password this time). You can copy-paste from a Windows window to the PuTTY terminal any text, so:
    1. On the PuTTY Key Generator page, highlight the entire Public key, and copy it to the clipboard (Ctrl-C).
    2. In the terminal navigate to the right directory. Type echo " now right-click and select Paste, and continue typing " >> authorized_keys; you need the quotes.
  5. Exit everything. You can test the connection at this point using these instructions.
  6. This step is TortoiseCVS specific: Go to the TortoiseCVS Preferences and select the tab Tools. On the line “SSH parameters”, leave what is there and append: -2 -i "C:\Documents and Settings\<your.login>\<private_key_file>.ppk", quotes included. Save everything. Go to the repository browser for TortoiseCVS (you will have to get the URL from your admin; it will start with something like CVS+SSH://) and see if you can browse the repository without being prompted for a password – if in step 2 you did put in a password, then you should be prompted only the first time you connect (after each time you reboot).
  7. This step is TortoiseSVN specific: Start up Pageant, and add you key to it – if you specified a password in step 2, you will be prompted for it now (and every time Pageant starts after a reboot). Go to the repository browser for TortoiseSVN (you will have to get the URL from your admin; it will start with something like SVN+SSH://) and see if you can browse without being prompted for a password – you should never be prompted for the password at this point.

Some additional notes (troubleshooting?):

  • I have had limited luck with “Save public key” and transferring that mess over to the *NIX machine. I think there is some issue with Windows-CRLF versus UNIX-CR character conversion, and the Windows client seems to add more than what is needed. If you need to, you can always Load you private key into the PuTTY Key Generator, and it will show you the public key again.
  • There appears to be some version dependency between the SSH client and the SSHD server, however I do not know what it is. :sad: I have had at least one case, where a newer version of PuTTY created keys that were refused by an old server, but using an older version of PuTTY (exact same encryption and strength of keys) worked on the first try.
  • SSH is quite finicky about file permissions everywhere – which makes sense, as you would want this to be secure. Basically, you need to have at least read permissions to all the keys, and other users must not have any permissions to any of the keys.
  • I used to think that you had to create a separate key-pair per machine that you will be connecting from (the client). Apparently this is not the case, you can use the same one key-pair on every client machine. Just be careful about where you put the private key. Personally I have never tested this.
  • There is a great article OpenSSH key management, part 1 by Daniel Robbins.

February 18, 2009

Launchpad.net PPA changes

Filed under: iotal, linux, ooo — siking @ 10:30 am
Tags:

I got a few third-party repos on my Linux box, and for like the past month I have been getting some errors when refreshing my packages:

W: GPG error: http://ppa.launchpad.net hardy Release: The following
signatures couldn't be verified because the public key is not
available: NO_PUBKEY 60D11217247D1CFF
W: GPG error: http://ppa.launchpad.net hardy Release: The following
signatures couldn't be verified because the public key is not
available: NO_PUBKEY FCA4A9D8F45955CE

All this comes from outdated GPG keys due to some changes at Launchpad.net: info and alternate solution.

The first one comes from OpenOffice.org3 – full instructions here. All you have to do is update your key with: sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 247D1CFF.

Update 09/09/24: OpenOffice.org3 is no longer available for Hardy / Elyssa.

The second one is from Transmission – again, full instructions. For that one, I did two things: 1) update the repo source to http://ppa.launchpad.net/transmissionbt/ppa/ubuntu (from http://ppa.launchpad.net/bortis/ppa/ubuntu), and 2) update the key with: sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 365C5CA1.

For the sake of cleaning up, I would still like to find out how to delete the old keys and perhaps more importantly which keys to get rid of.

As a last bit, I would like to say that all this is the opposite of intuitive – definitely an area for improvement.

January 30, 2009

Desktop system monitor

Filed under: iotal, linux — siking @ 11:50 pm
Tags:

So far I have been using the canned GNOME system monitor, but I decided that I want a little more eye-candy, some more information, basically just more. Googling around a bit, I first looked at Screenlets. After spending a day with it I decided against it, because my desktop ended up way too cluttered once I got everything that I wanted on there – I am keeping it around, however, for another project that I have in mind.

Eventually I found Conky. The nicest thing – in my mind – about it is that it is old-school: the whole thing is configured from a .*rc file, and that uses bash-like syntax.

I am not much of an artist; here is a screenshot of my Conky.
Conky screenshot

I am more of a coder; here is my entire .conkyrc.

alignment bottom_left
border_margin 0
border_width 0
color1 dark slate grey
color2 steel blue
default_color slate grey
double_buffer yes
draw_borders no
draw_graph_borders no
draw_outline no
draw_shades no
font -*-helvetica-medium-r-normal-*-11-*-*-*-*-*-*-*
gap_x 20
gap_y 30
minimum_size 300
own_window yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
own_window_transparent yes
own_window_type normal
pad_percents 2
short_units yes
total_run_times 0
use_xft no

TEXT
${font -*-helvetica-bold-r-normal-*-14-*-*-*-*-*-*-*}${color1}
${alignc}${pre_exec id -un}@${nodename} ${machine}
${if_existing /etc/issue}${alignc}${pre_exec sed {'s/ [@\][[:alpha:]]//g; /^[[:blank:]]*$/ d'} /etc/issue}${endif}
${alignc}${sysname} ${kernel}
${alignc}${uptime} uptime
${color}${font}${hr 2}
${color}CPU ${cpu cpu0}% ${freq}MHz ${ibm_temps 0}°C
${color}FAN ${ibm_fan}RPM
${color}MEM ${memperc}% ${color2}${membar}
${color}SWAP ${swapperc}% ${color2}${swapbar}
${color}sda2 ${fs_free_perc /}% ${color2}${fs_bar /}
${color}sda3 ${fs_free_perc /home}% ${color2}${fs_bar /home}
${color}diskIO ${diskio sda}
${color}${diskiograph sda 30 0000ff ff0000}
${hr 2}
${if_gw}${if_up eth1}
${alignc}WiFi: ${addr eth1}
${alignc}${wireless_essid eth1} ${wireless_link_qual_perc eth1}%
UP ${upspeed eth1}kB/s${alignr}DOWN ${downspeed eth1}kB/s
${upspeedgraph eth1 30,150 ffff00 00ff00}${downspeedgraph eth1 30,150 ffff00 00ff00}
${totalup eth1}${alignr}${totaldown eth1}
${else}
${alignc}Ether: ${addr eth0}
UP ${upspeed eth0}kB/s${alignr}DOWN ${downspeed eth0}kB/s
${upspeedgraph eth0 30,150 ffff00 00ff00}${downspeedgraph eth0 30,150 ffff00 00ff00}
${totalup eth0}${alignr}${totaldown eth0}
${endif}
${alignc}GW: ${gw_ip}
${else}No network
${endif}

Note the ATI symbol is from my desktop wallpaper (the X300 black). If you do not care about how things work as long as they do, then you can stop reading now.

Conky basic tutorial

Following is a discussion of how I built up my Conky config file; I am hoping it will serve as a basic tutorial for anyone who is just starting out.

First thing, I surfed the Internet to see what others have done, and started planning out what I would like to have. Then I got down into the guts of the thing. My Conky basically has three blocks: system stats, hardware stats, and network stats.

The config file has two sections: a configuration section which describes the behaviour of Conky, and a variables section which describes the output – what you will see on the screen – of Conky. The configuration section is allowed to have comments anywhere and only lines that do not start with the # character will actually be used. The variables section starts with the configuration command “TEXT“, and is read literally. This means that you cannot have any comments in there, as they will be treated as text to be displayed.

As a first step I dumped everything from the Conky man page into a new config file (yes, this is really old school :grin: ) 'man -P cat conky > .conkyrc'. Open that up in an editor (vi of course!), delete everything above the line “CONFIGURATION SETTINGS”, and everything starting from line “EXAMPLES” down. Comment out (append the # character in front of) everything else. You now have a blank configuration file that contains all the instructions.

System stats block

This block is displayed with the following variables (code?):

${font -*-helvetica-bold-r-normal-*-14-*-*-*-*-*-*-*}${color1}
${alignc}${pre_exec id -un}@${nodename} ${machine}
${if_existing /etc/issue}${alignc}${pre_exec sed {'s/ [@\][[:alpha:]]//g; /^[[:blank:]]*$/ d'} /etc/issue}${endif}
${alignc}${sysname} ${kernel}
${alignc}${uptime} uptime
${color}${font}${hr 2}

Although messing around with fonts is actually the last thing I did, I will discuss it first. The configuration command font -*-helvetica-medium-r-normal-*-11-*-*-*-*-*-*-* sets the default font. For the system stats block I wanted to use a bigger font, so on the first line of the variables section I just raised the point size and bolded the font. Every line after this will use this new font, until you get to a blank ${font} variable (on the last line of this block), which resets it back to the default. One more thing worth mentioning, is that when I ran conky from the command line, it complained that it could not load the default font. However, it did display the way that I wanted so I just ignored this error.

I also changed the colour of this block with ${color1}; this is actually a variable which is defined in the configuration section with color1 dark slate grey. The colour works similarly to the font, in that it will be in effect until a blank ${color} resets it back to default. The default is defined in the configuration section with default_color slate grey. All these predefined colour names come from your system, and they can be found in /etc/X11/rgb.txt.

Every line in this block starts with the variable ${alignc} which centres all text following it up to the end of that line only.

One the first line that actually displays something, I wanted the login name @ machine name and the machine architecture. Conky provides variables for the machine name and the machine architecture, but surprisingly not the login name. You can get the login name from the system with id -un. Conky has several different ways of running system commands. The most popular is ${exec command} which will be ran periodically, and ${pre_exec command} which will be ran only once. Since the user name does not change, running it only once is good enough.

On the next line I wanted to have the name of the distribution that I am running. Again Conky does not provide a canned way of doing this, and in fact there is no standard way of doing this in the Linux world! I would expect my solution to work on only about 1/3 of all the distros out there. The idea is that there is a file (/etc/issue) that sometimes holds the name of the distro, along with some additional characters – see 'man issue' for more information about this file. I strip of the extra information and any blank lines with the sed command, and again this needs to be executed only once ${pre_exec ...}. The whole thing is wrapped in an if statement, that tests for the existence of this file. If you need to adjust this for your particular distro – good luck. :twisted:

Next two lines show the name of the operating system, the kernel version, and the uptime. All these Conky provides canned variables for. The whole thing is closed with a horizontal line of 2 pixel thickness.

Hardware stats block

${color}CPU ${cpu cpu0}% ${freq}MHz ${ibm_temps 0}°C
${color}FAN ${ibm_fan}RPM
${color}MEM ${memperc}% ${color2}${membar}
${color}SWAP ${swapperc}% ${color2}${swapbar}
${color}sda2 ${fs_free_perc /}% ${color2}${fs_bar /}
${color}sda3 ${fs_free_perc /home}% ${color2}${fs_bar /home}
${color}diskIO ${diskio sda}
${color}${diskiograph sda 30 0000ff ff0000}
${hr 2}

In this block I was changing the colours quite a lot, and so I reset every single line with ${color} whether it needed it or not just to keep things legible, and changed the colour on the line as needed. Again, ${color2} is a variable that is defined in the configuration block with color2 steel blue.

The two variables ${ibm_temps 0} (temperature of the CPU) and ${ibm_fan} (speed of the fan) are architecture dependant, but Conky provides plenty of other canned variables to get this information from other architectures. You will have to consult the manpage.

The degree Celsius took only a little while. There are a lot of suggestions on the Internet, that involve all sorts of hacks, some of which work and some of which don’t and all of which are unnecessary. I just picked a plain font that already contains this symbol. Done!

The rest of the information, hopefully, is self-explanatory, except perhaps for the last graph. The ${diskiograph (device) (height),(width) (gradient colour 1) (gradient colour 2) (scale)} has a lot of options. The device is the Linux naming convention of disks (hda, hdb, sda, sdb, whatever). The height and width are both in pixels. I use only the height, and by having no width, the graph will take up the maximum available width – more on this below. The first gradient colour is what the graph will show on the right side, the second colour is what will be on the left side, and the graph will step between the two in the middle. Unfortunately, I could not get the second colour to “take” – see the screenshot above – no idea if this is a bug or what. Last is the scale of the graph; from the available documentation I could not figure out what exactly this does, so I left it blank and let Conky pick something for me.

Network stats block

This block has the most complicated logic. There are actually two enclosed if statements. The outermost is:

${if_gw}
... network stuff ...
${alignc}GW: ${gw_ip}
${else}No network
${endif}

The only way in Conky to find out if the network is actually connected to anything, is by detecting if there is a gateway, using ${if_gw}. For the moment I will skip the middle “network stuff”. At the end Conky prints, centred, the gateway IP address. If there is no gateway ${else}, then you will get the plain text “No network” at the bottom of Conky. And lastly ${endif} ends the if statement.

Now for the network stuff. As a first attempt I had something like:

${if_up eth0}
... wired network stuff ...
${endif}
${if_up eth1}
... wireless network stuff ...
${endif}

The way that the GNOME network manager works, is that in order to turn on wireless (eth1 in my case), it must turn on all networking first including the ethernet card (eth0 in my case). Using the above, when wireless was on, I would see both the wired and the wireless stuff. So I had to change the logic to:

${if_up eth1}
${alignc}WiFi: ${addr eth1}
${alignc}${wireless_essid eth1} ${wireless_link_qual_perc eth1}%
UP ${upspeed eth1}kB/s${alignr}DOWN ${downspeed eth1}kB/s
${upspeedgraph eth1 30,150 ffff00 00ff00}${downspeedgraph eth1 30,150 ffff00 00ff00}
${totalup eth1}${alignr}${totaldown eth1}
${else}
${alignc}Ether: ${addr eth0}
UP ${upspeed eth0}kB/s${alignr}DOWN ${downspeed eth0}kB/s
${upspeedgraph eth0 30,150 ffff00 00ff00}${downspeedgraph eth0 30,150 ffff00 00ff00}
${totalup eth0}${alignr}${totaldown eth0}
${endif}

Basically, I switched the two around, and combined them into just one if statement: if wireless is on ${if_up eth1}, display wireless stuff, ${else} assume wired is on; end the whole thing with ${endif}. If wired is not on, there will be no gateway, which is already handled by the previously discussed if statement.

The information displayed is almost the same in both the wired and wireless case. First centred line is the device’s IP address. For wireless I have one extra line showing the wireless SSID and the percentage of the quality of the signal, again all centred. Next I show the up speed on the left side of the window, and the down speed on the right side ${alignr} of the window. Next line shows two graphs, back to back: history of the transmission speed, upload first and download second. I force the graphs to be 30 pixels high and 150 wide each. The combined width is, therefore, 300 pixels. This is the widest item in my entire Conky display, and everything else is formated according to this … except when there is no network at all. In the case there is no network, I force the width with the configuration statement minimum_size 300. Lastly, the graphs go from green 00ff00 on the right to yellow ffff00 on the left. Again this variable has an optional scale, just like ${diskiograph ...} above, which I chose not to use for the same reasons as above. Lastly I show the total upload bytes on the left and total download bytes on the right under the graphs.

One thing that may not be clear, is that in both cases there is also the same number of blank lines to maintain the same formatting. In the case of wireless, you will get a blank line right after the ${if_up eth1}, which if you look at my code way above is on the same line as the ${if_gw}. If the wired network is on, the ${if_up eth1} will NOT produce a blank line, but the ${else} will. In both cases, each of the two ${endif} will also produce a blank line. In order to see these in your own code, put any (unique) text on any line that does not have text, and test it that way.

Starting Conky automatically

Get into your session manager (or wherever you manage automatically started programs in your distro), and start Conky with 'conky --daemonize'. This will force it to run in the background. Oddly enough, if I used the background yes configuration command, this messed up my Nautilus.

All the above stuff took me approximately one day to figure out. The following took me four! First suggestion that I can give you, is to take the documentation with a serious grain of salt. From my experimentation, the various configuration commands do not do what they say they should do.

In the Conky FAQ, there is something about turning on the double buffering in your Xorg. For me, this makes no difference whatsoever.

All the important stuff is among the double_buffer and the four own_window* configuration commands. I tried all sots of combinations, until I ended up with:

double_buffer yes
own_window yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
own_window_transparent yes
own_window_type normal

However, every once in a while, with no warning or an explanation, Conky stops working! In those cases, I usually change the window type to anything else, restart Conky. Change it back restart Xorg. Repeat as necessary; after a few times, it starts behaving again. :shock:

The rest of the configuration commands are just for dressing and are completely optional.

January 27, 2009

Trimming some fat off Mint

Filed under: iotal, linux — siking @ 7:49 am
Tags:

The other day I went poking around in my Sessions Preferences (System > Preferences > Sessions). This is a tool that controls all the running background apps per user basis; versus Service Settings, which controls background processes for the entire machine. What are all those things and how did they get there? Some of them were placed there during initial installation, some showed up after installing certain apps, and some the user (possibly unknowingly) adds himself.

Sessions Preferences

The app has three tabs:

  • Startup Programs lists various programs that you can dis/enable next time you login
  • Current Session lists the currently running programs
  • Session Options has two controls

Unfortunately, I found that disabling certain items in the Startup Programs tab does not necessarily prevent them from showing up in the Current Session tab after a reboot. I am not sure if this is a bug, but it is at the very lest un-intuitive. Here is how I cleaned up my system:

1. Make sure that Startup Programs list what you want / need / consider important. Check everything off to start. Restart your X session – Ctrl-Alt-Backspace will do, as the normal logout may not be working at this point.

2. In Current Sessions kill everything that does not appear in Startup Programs. You will have to 1) select the app in question, 2) click Remove, and lastly 3) click Apply. It is actually sufficient to only Apply the changes after you remove the last one.

At this point I was left with the following:

  • compiz – (hopefully) self-explanatory. If you happen to kill it, it is not obvious how to get it back. I had to run ‘compiz‘ from the command line, and Reload Window Manager using the Fussion-icon utility – this utility is a must and should be installed by default.
  • nautilus – this apparently needs to be running to make a whole bunch of stuff work (desktop wallpaper for example). If you do kill it, you need to run ‘nautilus‘ from the command line and it will be able to figure out the rest on its own.
  • gnome-panel is where you keep everything that you want to launch. If you kill it, just restart it from command line.
  • gnome-session-properties which is the window you’re looking at. Note the trashcan icon next to it – this means that it will not be restarted next time.

3. At this point go into the Session Options, and click Remember Currently Running Applications. To prevent further pollution, make sure to check off Automatically remember running applications when logging out.

4. Lastly go back to Startup Programs, and turn on everything that you know you need. Restart your X session.

If you completely reboot after this, things may take a little longer to come back than usual. This is normal only the first time.

December 26, 2008

Installing dictionaries in OpenOffice.org

Filed under: ooo — siking @ 5:10 pm
Tags:

When installing new dictionaries in OOo, here a couple of hints:

  1. You probably want everyone on your computer to be able to use the dictionary. Run OOo with Administrator setup: sudo openoffice. Then go through the wizard under File > Wizards > Install new dictionaries…
  2. If the DicOOo wizard is too small, you need to turn off special effects like Compiz. See this post if you want an explanation.

See updated information here.

October 10, 2008

Linux Mint on Thinkpad T43, part 2/2

Filed under: iotal, linux — siking @ 12:00 pm
Tags:

Linux Mint logoI have been with Linux Mint (and GNOME) for little over 3 months now, several software upgrades, and I think even 2 kernel upgrades. This distro is rok solid and I would recommend it to anyone without hesitation!

In this second post I wanted to go a little more into the distro itself. There are already numerous reviews online, so the below will be just some of my own rants and things that I would improve; and being unemployed right now, maybe I will.

Software: What I liked and what I didn’t

Right after install, before any user changes, I tried some additional things, like mounting external drives, playing various multimedia formats, and playing around with the various tools. Everything worked right out of the box with very little problems.

Wireless

Wireless support, as in Ubuntu, is handled by the Network Manager from GNOME. Being new to GNOME I initially had some issues figuring this thing out. The tool gives absolutely no feedback on what it is doing – the flyover text is usually wrong. Sorry guys, but this one needs work. I know that wireless is difficult at best of times, but I need to know if you’re connecting, trying, sleeping, whatever. And especially if you’re not working, why not. A swirly thing flying around in a circle is not feedback! Tell me what you don’t like, and maybe I can try and fix it. Eventually, after some trial-and-error I did figure out how the tool operates, and especially how it gives you feedback, but my initial impression was that it was plain stuck.

One additional improvement that I would like to see for NM, would be a second mode of operation – call it “home user mode”. Assume that there is one account that has Administrator privileges, and several other accounts that do not – the “Desktop user”. In this home mode, the administrator would set up the preferred network(s) with appropriate security and access keys, which would then all be copied (perhaps after being prompted to confirm the action) into all existing and future user accounts. That way the casual users are not bothered by that pesky WEP vs. WPA, 64-bit vs. 124-bit keys, keyring, and all that other junk.

Package Management

Mint is derived from Ubuntu, which is derived from Debian, hence the native software packages are .deb. There are several graphical front ends, the default being Synaptic. There is also a mintInstall tool, which is suppose to make installation of most popular packages easier. Personally I feel pretty comfortable with Synaptic and so I do not make much use of mintInstall. There is also mintUpdate which automatically checks for updates to all installed packages. The only changes that I made to mintUpdate is to check every 5 days instead of the default every 5 minutes :shock: , and to not bother me with level 3 updates – but neither of these is necessary, just my preference.

One thing that is sorta annoying though: any user that is created as a “Desktop user” does not need to have mintUpdate running, because they can’t do anything with it even if they wanted to – it requires sudo access, which they do not have. For all current and future Desktop users mintUpdate should be disabled by default.

Software

Languages, in the Ubuntu repositories, are a friggin’ mess – at least from my point of view. Could someone explain to me the following? I am bilingual, and so I installed support for Czech to get the dictionaries. Now in Thunderbird when I compose a message, I have the options: “cs_CZ”, “Czech (CZ)”, “cs-CZ” in certain parts, and “Cechia (CZ)”. How about this one: I have a slight patriotic streak, and prefer the Canadian variant of English over the US. So I installed language-support-en. Now I have like ten different English languages, each one at least twice, but not one single version of Canadian English. I had to install that manually, separately for Thunderbird and separately for OpenOffice.org.

After install, I had some problems with Flash plugin. Apparently Mint 5 comes with version 10.0.218; I could swear that mine came with 9.something.outdated. The only reason why I know this is that I had to upgrade it, because several websites, that are absolutely essential to my daughter’s existence :roll: , did not work. Well, at some point during the upgrade I screwed something up. Although the Flash plugin did work, Synaptic (or any of the other package managers) were completely unaware that had one. Eventually I did fix it, but it did take some investigative work.

Update 08/12/25: Mint5 comes with both Macromedia Flash player 9.0.21.78 and Adobe Flash player 10.0.b218. Things might have gotten confused the first time around.

I tried to get BOINC going; this is probably one of the most worth-while volunteer-driven projects on the Internet today. I had some problems getting the graphical screensaver to work as I wanted, so I decided to dig a little deeper into it. I even went so far as to create a .mint file for it. It turns out, that this is currently not available under Linux. :sad:

Desktop

Brightness control is all wacky, on my machine. There is a range of 7 steps that you can have brightness set to. You would expect that pressing the up or down key once, would raise or lower the brightness one step. However, this works only in the up direction. Going down jumps one step below the previous bottom-most level. For example, let’s say that I take my brightness down to level 4 (3 down key presses), and then I go back all the way up (3 up key presses). When I press the down key next time, I will be taken straight down to level 3 – one below the last bottom-most level!

Keyboard Shortcuts I cannot get to do anything; open it up from System > Preferences > Keyboard Shortcuts. Click Help gives me “There was an error displaying help: Help document user-guide/user-guide.xml not found.” No idea where to get the user guide from. Change or disable any Shortcut has no effect – only the old combination still works. Still searching for a clue here – anyone?

Update 08/12/25: I got these to work now. I suspect I had my keyboard model initially configured wrong in the layout; I now use “IBM ThinkPad 560Z/600/600E/A22E” model.

Update 08/12/26: To get help, install gnome-user-guide.

mintMenu – my kids love it (that is not a put down, they actually do), I myself prefer the default GNOME menu. One change that I would make: any user that is a “Desktop user” (meaning that he has no sudo access) does not need to even see the System submenu (as everything there requires sudo access). These accounts should have this menu turned off by default.

Miscellaneous

From the don’t-eat-yellow-snow department: I tried some of the things I found in an article 10 ways to make Linux boot faster. After turning on the CONCURRENCY (#10: Use a hack with Debian), I lost all wireless. All the other ideas were less useless. Be careful of these crackpots!

There are several apps, where the screen oddly flashes at a very annoying frequency – Google Earth, SuperTux, and probably others. Apparently the problem is somewhere between ATI drivers, openGL, and Xorg – basically extremely complicated to fix. The workaround is that you need to (temporarily) disable Compiz with: metacity --replace. Unfortunately putting this in front of the command that launches the app, such as metacity --replace && googleearth does not work; it’s going to have to be done with some sort of (nohup metacity --replace &) && googleearth or sumtin’or’ther. I’m still working on this one.

Update 08/11/09: Found a workaround here. Thanx Tom!

September 19, 2008

Time warpin’ with Sun xVM VirtualBox

Filed under: virtualization — siking @ 3:42 pm
Tags:

Got a new job, got a new machine, got a new toy! :wink: I am currently working on testing something that requires me messing around with system time; specifically what will happen during the time changes due to summer daylight saving time. Since I have a history of messing around with things I should not be messing with and irrevocably screwing up machines, I thought it would be best to do my messing in a virtual machine. It’s the first time I really had a chance to play around with one of these.

Sun VirtualBox, while a VM is running, holds on to everything. If you change the system time, normally within a minute the time will return back to what it should be. Not only that, I actually needed to change the BIOS time as well as the system time. Although the VirtualBox has a pretty GUI, it is rather limited when it comes to the advanced functions. The BIOS time can only be modified from the command line.

VBoxManage modifyvm <uuid|name> -biossystemtimeoffset <msec>

The above one-liner is the entire documentation of this particular function! You have to do this while the VM is not running; in my case that means shutdown my system, shutdown the VM, modify the time, bring up the VM, bring up my system – all in all, about 20 minutes each time I do this. I immediately put in a request for more RAM. However, figuring out the milliseconds that you want to offset the time is a bit of a pain. :arrow: At least it will take negative values if you need to go backwards.

I immediately came up with a few shortcuts. In case you’re wondering, this is all bash.

 vboxHtime () {

	# Advance VM BIOS time X hours

	msecs=$(( ${1:-0} * 60 * 60 * 1000 ))

	echo Advancing time ${msecs}ms

	VBoxManage modifyvm Vista -biossystemtimeoffset ${msecs};

 }

 vboxDtime () {

	# Advance VM BIOS time X days

	msecs=$(( ${1:-0} * 60 * 60 * 1000 * 24 ))

	echo Advancing time ${msecs}ms

	VBoxManage modifyvm Vista -biossystemtimeoffset ${msecs};

 }

 vboxWtime () {

	# Advance VM BIOS time X weeks

	msecs=$(( ${1:-0} * 60 * 60 * 1000 * 24 * 7 ))

	echo Advancing time ${msecs}ms

	VBoxManage modifyvm Vista -biossystemtimeoffset ${msecs};

 }

:neutral: So far, nothing spectacular. If you need to reset the time back to normal, just run any of these with no arguments; this is taken care of by the ${1:-0} bit. But I quickly found out that all these are not additive.

 vboxWDtime () {

	# Advance VM BIOS time x weeks plus y days

	msecs=$(( $(( ${1:-0} * 60 * 60 * 1000 * 24 * 7 )) + $(( ${2:-0} * 60 * 60 * 1000 * 24 )) ))

	echo Advancing time ${msecs}ms

	VBoxManage modifyvm Vista -biossystemtimeoffset ${msecs};

 }

Still a pain in the ass to figure out how many milliseconds are between now and any given point in time.

A big Thank You goes out to ripat for inspiring the following.

 vboxdate () {

	# Adjust VM BIOS time to a given date

	secs=$(date --date "$*" +%s)    # convert supplied date to secs, since 1970-01-01

	let secs-=$(date +%s)           # subtract the date NOW

	msecs=$(( $secs * 1000 ))       # convert to millis

	echo Adjusting time ${msecs}ms

	VBoxManage modifyvm Vista -biossystemtimeoffset ${msecs};

 }

June 18, 2007

Windows 2000 SP5 and Linux Ghost

Filed under: linux, windows — siking @ 12:29 pm
Tags:

How do you backup stuff? Do you even bother? I took some time today to go through a proof of concept exercise for myself, just to see if I could do it; actually, it was a couple of different exercises strung together in a row.

Slipstreaming Windows

I recently updated etanol from WinXPx64 to Win2k. I used an SP1 CD to perform the install, and I had previously downloaded SP4 which had to be installed afterwards, and after that Microsoft also released an Update Rollup, and then about 50 additional fixes. After that, IE needs to be upgraded to version 6, and WMP is now up to version 9, and… To make a long story short, to install the basic system with all updates takes a very long time. In order to make this easier, you can slipstream all this stuff into the install CD.

I created a Windows 2000 SP5 install CD using the hfslip utility; vg’f yvprafr serr, yrzzr xabj vs lbh jnag n pbcl! The utility even allows you to update IE, OE, WMP, .NET, Java and some other stuff all to latest versions! If nothing else, the page is an interesting read on the incompetence of Microsoft. The process of creating the CD and then installing it, is much faster than installing everything separately. Tried the resulting install CD on my test machine, and it seemed to have gone fine. The really kool thing is: the entire utility is a 220k batch script!

Backups

I knew about this *NIX utility from before, but only after reading Hack #48 in Knoppix Hacks did I find out actually how easy this thing is!

To backup the entire drive, you just run sudo dd if=/dev/hda of=/media/sda2/hda.ing &, where /dev/hda is the entire disk you want to backup and /media/sda2 is a mounted location where the backup image hda.img will be created. You can watch the progress with watch ls -l /media/sda2/hda.img as it will take some time. Since everything in *NIX is a file, you can backup only one partition by telling dd if=/dev/hda1 or whichever. Have a read through the man page to see what all it can do.

To whack the entire disk, just to prove a point, I used the shred utility, described next door in Hack #49.

To restore the backup you just switch the targets of the if= and of= that you passed to dd.

As with everything else in *NIX world, dd can be piped to / from a remote machine across a network. And for those that are a little squeamish about the command line, there is even a menu-driven front end.

Man, screw that other thing!

Next Page »

Blog at WordPress.com.