Category Archives: Fedora

VMware View Client with PCoIP on Fedora 17/18/19

Updated for VMware View Client 2.1.0 on Fedora 19

This is a quick and most probably dirty installation of VMware View Client with PCoIP support on Fedora system. As VMware has recently released package that is publicly available for Ubuntu systems it is now relatively easy to get it working.

# wget http://launchpadlibrarian.net/148281994/vmware-view-client_2.1.0-0ubuntu0.12.10_i386.deb
  • Extract the package. I’ve used “/opt/vmware/view-client” which would allow me to keep my system clean. If you are going to extract the contents elsewhere, you should change -C “/opt” and –xform=’s|usr|vmware/view-client|g’ accordingly.
# ar p vmware-view-client_2.1.0-0ubuntu0.12.10_i386.deb data.tar.gz | tar zx  --xform='s|usr|vmware/view-client|g' -C /opt
  • Modify the vmware-view binary to run with the new location (In my case: /opt/vmware/view-client/bin/vmware-view). Add the following lines at the beginning of the file:
#!/bin/sh

VIEW_CLIENT_FOLDER=$(dirname `readlink -f $0` | sed 's|/bin$||')
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$VIEW_CLIENT_FOLDER/lib
export PATH=$PATH:$VIEW_CLIENT_FOLDER/bin

You can add LD_LIBRARY_PATH and PATH modifications system wide, but I’ve chosen not to do so, again to keep my system clean.

  • At the end you should find two deprecated libraries that are missing in the Fedora install repositories and put them inside /opt/vmware/view-client/lib (again to keep the system clean)
libcrypto.so.0.9.8
libssl.so.0.9.8

I’ve used the AdobeReader_enu install package which can be found in Adobe repository (I need that package anyway, so I’ve just installed it)

# cat /etc/yum.repos.d/adobe-linux-i386.repo
[adobe-linux-i386]
name=Adobe Systems Incorporated
baseurl=http://linuxdownload.adobe.com/linux/i386/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-adobe-linux

 

# yum install AdobeReader_enu
# cp /opt/Adobe/Reader9/Reader/intellinux/lib/libcrypto.so.0.9.8 /opt/vmware/view-client/lib
# cp /opt/Adobe/Reader9/Reader/intellinux/lib/libssl.so.0.9.8 /opt/vmware/view-client/lib
  • Install zenity package, required for proper view-client execution

# yum install zenity

You should be able now to run /opt/vmware/view-client/bin/vmware-view and end up with something like this:


Congrats – you now should be able to connect to your PCoIP enabled client desktop machine. Do not forget that you still need to install rdesktop package if you are going to use RDP connection.

  • TODO: figure out how to import custom root certificates that verify the connection the view connection broker server. For now I’ve just disabled that verification under File->Preferences

Tagged , , , ,

Thinkpad X220 and Ultrabase 3 Docking Station

As I promised, there will be more posts related to the Fedora 16 configuration on a Thinkpad X220. This one will be about the seamless docking/undocking of the notebook from the dock.

It seems that this is largely still a grey area and is something that rarely seems to work as expected, so I had to hack it away, because this one was one of the biggest problems that I face every day because I take the notebook every day at work and dock it so I’m able to use is as a regular desktop PC and  in the afternoon I take it with me at home (one never knows for sure where he’ll end up the next day – at work or at a customer’s site 🙂

What I was aiming was achieving effortless X setup and display switching under the following conditions:

1. When booting the notebook – should work as expected – show KDM on external display when docked and on local LVDS display when not

2. Proper switching when docking / undocking the notebook and there is active user X session

3. Proper switching when docking / undocking the notebook when KDM is active

4. Proper switching when the notebook is docked / undocked during it was suspended

To achieve this I’ve ended up with a simple bash script that verifies the current configuration (docked / undocked) and switches the display accordingly. What was left was to put it in the all appropriate places, so that it gets executed on all of the above listed conditions. So first about the script – it still a work in progress, but is mostly working properly. I’ll update it here when it becomes more polished. Bare in mind that this was written with KDM in mind, although it shouldn’t be so difficult to be adapted for GDM or other login manager.

The Script (thinkpad-dock.sh)


#!/bin/sh
# wait for the dock state to change
sleep 0.5

export IFS=$"\n"

DOCKED=$(cat /sys/devices/platform/dock.0/docked)

# invoke from XSetup with NO_KDM_REBOOT otherwise you'll end up in a KDM reboot loop
NO_KDM_REBOOT=0
for p in $*; do
case "$p" in
"NO_KDM_REBOOT")
NO_KDM_REBOOT=1
;;
"SWITCH_TO_LOCAL")
DOCKED=0
;;
esac
done

function switch_to_local {
export DISPLAY=$1
export XAUTHORITY=$(find /var/run/kdm -name "A${DISPLAY}-*")

# Turn off all external displays
for output in $(/usr/bin/xrandr --verbose|grep "+"|grep connected| grep -v LVDS|awk '{print $1}'); do
logger -t DOCKING "Switching off $DISPLAY"
/usr/bin/xrandr --output $output --off
done

# Turn on local display
logger -t DOCKING "Switching on LVDS1"
/usr/bin/xrandr --output LVDS1 --auto
}

function switch_to_external {
export DISPLAY=$1
export XAUTHORITY=$(find /var/run/kdm -name "A${DISPLAY}-*")

# The Display port on the docking station is on HDMI2 - lets use it and turn of local display
logger -t UNDOCKING "Switching off LVDS1 and turning on HDMI2"
/usr/bin/xrandr --output HDMI2 --primary --left-of LVDS1
/usr/bin/xrandr --output LVDS1 --off
/usr/bin/xrandr --output HDMI2 --primary --auto
}

case "$DOCKED" in
"0")
#undocked event
CONNECTED_USER=0
# Check for logged users with X sessions
for u in $(w | awk '{print $1" "$2}' | grep ' :[0-9]'); do
CONNECTED_USER=1
switch_to_local $(echo $u | awk '{print $2}')
done
if [ $CONNECTED_USER -eq 0 ] && [ ! $NO_KDM_REBOOT ]; then
# we are at login screen
logger -t KDM_DOCKING "Reloading KDM after X setup"
kill $(cat /var/run/kdm/kdm.pid)
fi
;;
"1")
#docked event
CONNECTED_USER=0
for u in $(w | awk '{print $1" "$2}' | grep ' :[0-9]'); do
CONNECTED_USER=1
switch_to_external $(echo $u | awk '{print $2}')
done
if [ $CONNECTED_USER -eq 0 ] && [ ! $NO_KDM_REBOOT ]; then
logger -t KDM_DOCKING "Reloading KDM after X setup"
kill $(cat /var/run/kdm/kdm.pid)
fi
;;
esac

The Hooks

There are several places where you should put an invoke this script.

1. KDM

Obviously you need it to be run at KDM startup when X is initialized. You need to add this line at the and of /etc/kde/kdm/Xsetup file:

/usr/local/sbin/thinkpad-dock.sh NO_KDM_REBOOT

Where /usr/local/sbin/thinkpad-dock.sh is the location of the above script.

One more thing about the KDM – in order to get proper looking KDM login screen on the external display you’ll need to alter the xorg.conf, otherwise you”ll get a little borked KDM background.

Add this file to /etc/X11/xorg.conf.d/ folder


$ cat /etc/X11/xorg.conf.d/01-external-monitor.conf
Section "Device"
Identifier      "HD3000"
Driver         "intel"
Option          "monitor-LVDS1" "local-display"
Option          "monitor-HDMI2" "external-display"
EndSection

Section "Monitor"
Identifier      "local-display"
Option "Enable" "false"
EndSection

Section "Monitor"
Identifier      "external-display"
Option "PreferredMode" "1680x1050"
Option "Position"       "0 0"
EndSection

Be carefull here as this instructs X to NOT enable by default the local display – it will be “later” activated when KDM is started and thinkpad-dock.sh is invoked.

2. Docking / Undocking events

You’ll need to add this file in /etc/udev/rules.d to catch all dock/undock events through udev:


$ cat 81-thinkpad-dock.rules
KERNEL=="dock.0", ACTION=="change", RUN+="/usr/local/sbin/thinkpad-dock.sh"

3. Suspend / Resume events

Finally you’ll need to ensure and check that the configuration was not changed while the notebook was suspended. To hook the script you’ll need to add this in /etc/pm/sleep.d/

$ cat 00check_dock
#!/bin/bash

case "$1" in
hibernate|suspend)
# If sleeping - pretend undocking
/usr/local/sbin/thinkpad-dock.sh SWITCH_TO_LOCAL
;;
thaw|resume)
# If resuming verify docking station presence
/usr/local/sbin/thinkpad-dock.sh
;;
esac

Only one thing to be noted here – the script needs to be executed only during the resume process, but because of some problems that I had during resuming on local display when system was suspended on the dock I had to add the hook also during suspend state and force the X server to be switched over the local display in case the machine is undocked while suspended.

EDIT:

You’ll also need to disable the KDE display management systems, so it does not ask you every time for display reconfiguration because a new display was detected. The only thing that should be done is to stop the service itself like this:

That’s all – there still some quirks that should be polished and may be the script must be made some more general – like defining some variables at the beginning, but I’ll do that later. In general it just works, is quite simple to implement I think and finally the dock is out of my way 🙂

Tagged , , , ,

Thinkpad x220 – the (almost) perfect setup (Fedora 16)

So here I am – sitting in front of my new laptop – Lenovo Thinkpad X220. The date is November 8, 2011 which happens to be the release date of Fedora 16 codenamed “Jules Verne”. It’s 11:00pm, everybody are already asleep and it’s quite and peaceful in my home (thanks to my son that rarely happens 🙂 – it’s time to start with that perfect setup that I’ve had in my mind for quite some time now. I suppose that this is not going to be a short post – so if you are in same state of mind – thrilled, excited and willing to start that Fedora setup any minute now – this is the time to go grab a cup of coffee, tea or beer maybe 🙂 I’m going to describe all the specific things that I’ve done during the install (leaving the boring stuff behind 🙂

The Hardware (4291-2WG)

  • Intel i5-2540M
  • 1 x 4GB memory
  • 12.5” HD Premium Display (the one with the IPS panel)
  • 320GB 7200 HDD
  • 80GB Intel mSATA SDD
  • Wireless – Intel 6205
  • Video – Intel HD 3000
  • 720p webcam, fingerprint reader, bluethooth
  • 9 cell battery
  • Thinkpad Ultrabase 3 + DVD Burner

Some thoughts about the hardware – first of all I had some doubts about my choice, but after I’ve received the package – they are *all* gone. What where my main concerns:

  • Display size would be too small – that turned out to be fine by me, but still I had to do some tricks to further “improve” it
  • Lack of USB3 ports – not a dealbreaker in the end as you can always stick an additional ExpressCard that sits flush in the laptop (like this one) whenever you get the need of USB 3.0 speeds
  • The IPS panel would suffer from ghosting – there is a huge thread about that, but the issue was actually addressed by Lenovo in the mid of August and after I’ve received mine I’ve even didn’t bother to check whether it has the new or old panel – the screen is (almost) perfect and is miles away from those TN panels. It has some bleeding from the bottom bezel though noticeable at boot time or at the console (when the screen is almost black), but that is not something that you’ll notice during your day to day work.

One more remark about the hardware that I’ve choose – if you don’t have the option to order a customized device (like me) you can get all available options from the so called “tabook” – Personal Systems Reference Lenovo® ThinkPad ® Notebooks. Truly a must read if you are in a position of deciding what Thinkpad to buy.

The Installation

So, enough about the hardware itself – lets get it rolling. You’ll need a boot media first. A couple of options here, but as I wanted to go with the latest and greatest of the available technology I’ve decided to go with UEFI boot on the machine (I really wasn’t able to find any major benefits of using UEFI instead of BIOS BOOT, besides maybe the possibly faster boot times) with got me to the first part of this setup.

1. Preparing bootable media (USB Stick)

I’ve decided to continue using 64bit OS despite the numerous problems that I had with some proprietary  software/packages, so I’ve downloaded the Fedora-16-x86_64-netinst.iso. From the Fedora documentation  – the are not UEFI bootable media by default – you’ll need the installation ISO file readily downloaded somewhere (on the preinstalled Windows 7 perhaps? or boot the Fedora Live CD image), mount it and extract the UEFI bootable image located under /images/efidisk.img on the iso itself.  The Network installation iso contains that file also so you can stick with it. After that you can put it on whatever USB stick you’ve got (the image is around 140MB) using dd:

mount -o loop /<path>/<to>/<file>.iso /mnt/cdrom

dd if=/mnt/cdrom/images/efidisk.img of=/dev/sdc #where /dev/sdc is your USB flash disk (be careful here!)

When this is finished the machine is ready to be rebooted.

REMARK: You’ll need to enter BIOS settings (F1) and select as boot method either only UEFI or at least select UEFI as preferred boot method. After that pressing F12 at boot time will allow you to select the USB stick as temporary boot device.

2. Booting the installation

Nothing special here – I used the Intel SSD of course for the system installation, creating EFI, BOOT and SYSTEM partitions. If everything is correct the Fedora installer will know that it was booted from UEFI and will create GPT table instead of MBR on the SSD, which will automatically be also aligned to the 2048 sector which is exactly at 1MB. To verify that, you can do the following. First select “Review and modify partitioning layout” during the installation setup and then check that the EFI partition is created:

You could also verify the alignment and the partition table format from command line after the disk was formatted:

[root@yggdrasil ~]# parted /dev/sdb
GNU Parted 3.0
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) unit s
(parted) print
Model: ATA INTEL SSDMAEMC08 (scsi)
Disk /dev/sdb: 156301488s
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start     End         Size        File system  Name                  Flags
1      2048s     5974015s    5971968s    fat32        EFI System Partition  boot
2      5974016s  6998015s    1024000s    ext4
3      6998016s  156301311s  149303296s                                     lvm

What packages are you going to install is entirely a matter of personal taste, but for me – the most important was to switch the default Desktop Environment that is going to be installed from GNOME to KDE. Also I’ve removed almost all packages in the Base System -> Hardware Support section that were not needed anyway on my system.

Tagged , , , ,

Fixing Marble KML files

So today I’ve woke up and went for my morning run. I’ve decided to use Marble for tracking on my N900 this time, as eCoach has failed me the couple of times and was not able to produce proper tracks. Everything went smoothly and I’ve got a nice track, which I saved after I’ve finished. Marble supports only KML files, so when I got home, I knew I must convert it to GPX prior to uploading it to mapmytracks.com (one of the best sites I’ve seen for analyzing your tracking data).

The conversion

Using guidelines from the Marble/Tracking page I’ve used the following command:

$ gpsbabel -i kml -f running-2011-10-11_071712.kml -o gpx -f running-2011-10-11_071712.gpx

Please bare in mind that I’m running this on a Fedora 14 install which misses the gpsbabel GUI. I was able to find packages for F15/F16 so if you are using one of those you should have it in the Fedora Repositories.

Having the file converted I’ve tried to upload it to mapmytracks.com, but this is where the things got ugly. The following error was thrown at me:

Warning: Division by zero in /var/www/vhosts/mapmytracks.com/httpdocs/assets/php/modules/classes/gpx.php on line 103
Warning: Division by zero in /var/www/vhosts/mapmytracks.com/httpdocs/assets/php/modules/classes/gpx.php on line 103
Warning: Division by zero in /var/www/vhosts/mapmytracks.com/httpdocs/assets/php/modules/classes/gpx.php on line 103


The Problem

After short investigation I’ve found that my other (eCoach) gpx tracks were having the attribute for each trackpoint () and the converted file was missing them. The google search resulted in nothing of a help that would allow me to inject the timestamps inside this trackpoints, so the logical continuation was to do it myself 🙂

The Fix

For the purpose of this task, a simple perl script was created. You’ll need Date::Parse perl module (perl-TimeDate package on Fedora 14):

#!/usr/bin/perl -w

use Date::Parse;
use POSIX qw/strftime/;

# read the input file
$num_args = $#ARGV + 1;
if ($num_args != 1) {
  print "\nUsage: $0 <input_file.gpx>\n";
  exit;
}

# if you are consolidating points in gpsbabel, change this accordingly
# by default marble writes points every 1 second
my $timeStep = 1;

my $inFile = $ARGV[0];
open FILE, "< $inFile" or die "Can't open $inFile : $!";

# calculate the timezone
my $tz = strftime("%z", localtime(time()));
$tz =~ s/(\d{2})(\d{2})/$1:$2/;
my $unixTime = 0;

while(<FILE>){
  print $_;
  if(/<time>(.*)Z<\/time>/){
    # get the starting time
    $unixTime = str2time($1);
  }
  if(/<ele>/){
    # print ISO8601 formated time
    print "  <time>" . strftime("%Y-%m-%dT%H:%M:%S", localtime($unixTime)) . $tz . "</time>\n";
    $unixTime += $timeStep;
  }
}
close FILE

The only argument that this script takes is the input gpx file, generated with gpsbabel and the output is thrown on stdout. What that script does is it takes the initial time when the gpx file was generated and injects <time></time> values from it, increasing it after every trackpoint with one second. Of course this is not perfect as the timestamps are shifted in time and are not the real values, but at least that allows me to insert the file and analyze it on MapMyTracks. Maybe I’ll post update on that script that will take also as input the KML file, where the time when the files was saved is used, and reverse it back to the first trackpoint. That should give more accurate gpx files.

It seems that I’ll be using this half-baked solution for uploading my tracks, as it works and generates pretty detailed track (one trackpoint per second), unlike eCoach that does this at best every 2 seconds (and does not work on my device :-). Here is the final result on MapMyTracks.

 

EDIT: I’ve found what’s wrong with eCoach and how to fix it

Tagged , , , , , , ,

Add some fun to your KDE desktop

So today I’ve got a little bored of my o-so-serious-monochrome-desktop and decided to change it a little bit. And here I am surfing my best site for desktop “candies” 🙂 – kde-look.org.

The icons

First I’ve found some pretty good-looking and as it seems quite complete set of icons. Of course I’ve installed them directly through systemsettings->Application Appearance->Icons – it is as easy as that. Just search for kfaenza. Here is a sample screenshot from my desktop with the this iconset:

They may resemble some other OS to some extent, but I do not care – they are nice in the end.

The wallpaper

After that I’ve searched for something different and new and found one little nifty plasmoid package that makes wonders 🙂 – The Wallpaper Clock plasmoid. What this plasmoid is supposed to do is to sit in the background as a sort of dynamic wallpaper showing current date and time. It has lots and lots of themes and all of them looking great.

The plasmoit itself depends on plasma-scriptengine-python (as I’m installing this on Fedora 14), and you’ll need to install it if you don’t have it already. Initially I’ve tried installing the package which I’ve downloaded through the plasmoid GUI (“install from local file”), but that failed miserably. So I did it the old way:

$ plasmapkg -r clock # removing the plugin that failed
$ plasmapkg -i clock.plasmoid

EDIT: I’ve done this on another Fedora 14 install and this time I’ve used the “Download new plasma widgets” searched for “wallpaper clock” and directly installed it – it worked like a charm. Still if you have problems, you can try the manual install. You can verify that everything is working as expected by running it manually in separate window:

$ plasmawallpaperviewer --wallpaper clock

/EDIT

And that’s all. After that you can find it sitting under your wallpaper configuration:

As you’ll see adding themes is completely integrated into the plasmoid configuration itself (under “Get New Wallpapers”) and  are very fresh and fun. Please note that some of the themes are only for registered users.

Tagged , , , ,

Webex on 64bit Fedora 13

Have you ever tried to join webex session through 64bit firefox? Well – in case you’ve tried may be you’ve got something along the lines:

OpenJDK Runtime Environment (IcedTea6 1.8.1) (fedora-42.b18.fc13-x86_64)
OpenJDK 64-Bit Server VM (build 14.0-b16, mixed mode)
applet start
applet start
######### leaveUrl=https://vmwareeducation.webex.com/cmp0306lb/webcomponents/docshow/docshow.do?siteurl=vmwareeducation&jvm=1.6.0_18&isJavaClient=true
applet return
java.lang.NullPointerException
at sun.applet.PluginAppletViewer.handleMessage(PluginAppletViewer.java:649)
at sun.applet.PluginStreamHandler.handleMessage(PluginStreamHandler.java:270)
at sun.applet.PluginMessageHandlerWorker.run(PluginMessageHandlerWorker.java:82)
java.lang.RuntimeException: Failed to handle message: width 1 height 1 for instance 1
at sun.applet.PluginAppletViewer.handleMessage(PluginAppletViewer.java:660)
at sun.applet.PluginStreamHandler.handleMessage(PluginStreamHandler.java:270)
at sun.applet.PluginMessageHandlerWorker.run(PluginMessageHandlerWorker.java:82)
Caused by: java.lang.NullPointerException
at sun.applet.PluginAppletViewer.handleMessage(PluginAppletViewer.java:649)
... 2 more
Java downloader 2.5
Os Name: Linux
Netscape user.dir : /home/tushe
Netscape installation path11: /home/tushe
Download finish^M
/bin/chmod 755 /home/tushe/.mozilla/plugins/npatgpc.so
LoadPlugin: failed to initialize shared library /home/tushe/.mozilla/plugins/npatgpc.so [/home/tushe/.mozilla/plugins/npatgpc.so: wrong ELF class: ELFCLASS32]

OpenJDK Runtime Environment (IcedTea6 1.8.1) (fedora-42.b18.fc13-x86_64)OpenJDK 64-Bit Server VM (build 14.0-b16, mixed mode)applet startapplet start######### leaveUrl=https://vmwareeducation.webex.com/cmp0306lb/webcomponents/docshow/docshow.do?siteurl=vmwareeducation&jvm=1.6.0_18&isJavaClient=trueapplet returnjava.lang.NullPointerException        at sun.applet.PluginAppletViewer.handleMessage(PluginAppletViewer.java:649)        at sun.applet.PluginStreamHandler.handleMessage(PluginStreamHandler.java:270)        at sun.applet.PluginMessageHandlerWorker.run(PluginMessageHandlerWorker.java:82)java.lang.RuntimeException: Failed to handle message: width 1 height 1 for instance 1        at sun.applet.PluginAppletViewer.handleMessage(PluginAppletViewer.java:660)        at sun.applet.PluginStreamHandler.handleMessage(PluginStreamHandler.java:270)        at sun.applet.PluginMessageHandlerWorker.run(PluginMessageHandlerWorker.java:82)Caused by: java.lang.NullPointerException        at sun.applet.PluginAppletViewer.handleMessage(PluginAppletViewer.java:649)        ... 2 moreJava downloader 2.5Os Name: LinuxNetscape user.dir : /home/tusheNetscape installation path11: /home/tusheget:https://vmwareeducation.webex.com/client/T27LB/linux/nbr/npatgpc.xxxDownload finish^M
/bin/chmod 755 /home/tushe/.mozilla/plugins/npatgpc.soLoadPlugin: failed to initialize shared library /home/tushe/.mozilla/plugins/npatgpc.so [/home/tushe/.mozilla/plugins/npatgpc.so: wrong ELF class: ELFCLASS32]

inside your .xsession-errrors log file.

That is because webex tries to download and install their plugin and start it in the firefox session, but as it is only 32bit and it cannot be wrapped by the nspluginwrapper – it fails.

I’ve tried to manually install it and wrap it, but the java applet apparently does not have checks whether the plugin is already installed and tries the same procedure again and again.

So at the end I’ve managed to fix this with these tree simple commands:

# setarch i686 yum install firefox (this install firefox as i686 binary and pulls all its 32bit dependencies)

# yum reinstall firefox (this reinstalls the original 64bit firefox)

# setarch i686 firefox (this instructs firefox script to load the 32bit libraries)

And there you go – the webex plugin load like a charm!

Tagged , , ,

Receiving static routes through DHCP in Fedora 12

So, today I had this very simple problem – to add static route to a certain network on my laptop 🙂 It really is as simple as:

ip route add network/mask via gateway

But as I’m quite lazy, to add this every time I need access to that network (the laptop is using NetworkManager + DHCP), I’ve decided to push this config through the DHCP server.

Here started the funny part – it seems that at this point this is not so trivial and you need to make modifications to BOTH the server and the client.

The Server

Let’s start with the server as this was the easy part. The only thing that is needed there is to add an DHCP option 121. In my case, as I’m using dnsmasq, this was the relevant option that should be added in /etc/dnsmasq.conf:

dhcp-option=121,10.10.0.0/24,172.16.1.100

This option defines all classless static routes that will be advertised by the DHCP server. If you need more than one route, the above can be changed like this:

dhcp-option=121,10.10.0.0/24,172.16.1.100,192.168.1.0/24,172.16.1.200

The Client

Now let’s go on the client side. There seems to be ALLOT of misunderstandings between NetworkManager and dhclient configurations. I took me quite a lot of time to figure it out, where what should be changed in order the NetworkManager to get the proper configuration from dhclient.

The first thing that should be done is to inform dhclient that you need this DHCP option 121 requested from the server. In order this  configuration to be picked up from NetworkManager also, you’ll have to edit (most probably create) /etc/dhclient-eth0.conf, where eth0 is the interface where the static routes should be added:

option classless-routes code 121 = array of unsigned integer 8;
script "/usr/local/sbin/dhclient-script-networkmanager";
also request classless-routes;

Note, that adding this config to /etc/dhclient.conf didn’t work for me. NM picked the config after the file was moved to /etc/dhclient-eth0.conf.

So now, the server is ready to send static routes, the client is ready and is hopefully at this point receiving these routes. But, but this by itself does not do anything to modify the routing table. You’ll need to add /etc/dhcp/dhcp-exit-hook file for dhclient, that will parse the DHCP option 121. I found how this could be done here on this blog. You can copy the file from there, or below here:

#!/bin/bash
#
# /etc/dhcp/dhclient-exit-hooks
#
# This file is called from /sbin/dhclient-script after a DHCP run.
#
#
# parse_option_121:
# @argv: the array contents of DHCP option 121, separated by spaces.
# @returns: a colon-separated list of arguments to pass to /sbin/ip route
#

function parse_option_121() {
result=""
while [ $# -ne 0 ]; do
mask=$1
shift
# Is the destination a multicast group?

if [ $1 -ge 224 -a $1 -lt 240 ]; then
multicast=1
else
multicast=0
fi

# Parse the arguments into a CIDR net/mask string
if [ $mask -gt 24 ]; then
destination="$1.$2.$3.$4/$mask"
shift; shift; shift; shift
elif [ $mask -gt 16 ]; then
destination="$1.$2.$3.0/$mask"
shift; shift; shift
elif [ $mask -gt 8 ]; then
destination="$1.$2.0.0/$mask"
shift; shift
else
destination="$1.0.0.0/$mask"
shift
fi

# Read the gateway
gateway="$1.$2.$3.$4"
shift; shift; shift; shift
# Multicast routing on Linux
#  - If you set a next-hop address for a multicast group, this breaks with Cisco switches
#  - If you simply leave it link-local and attach it to an interface, it works fine.

if [ $multicast -eq 1 ]; then
temp_result="$destination dev $interface"
else
temp_result="$destination via $gateway dev $interface"
fi

if [ -n "$result" ]; then
result="$result:$temp_result"
else
result="$temp_result"
fi
done
echo "$result"
}

function modify_routes() {
action=$1
route_list="$2"
IFS=:
for route in $route_list; do
unset IFS
/sbin/ip route $action $route
IFS=:
done
unset IFS
}

if [ "$reason" = "BOUND" -o "$reason" = "REBOOT" -o "$reason" = "REBIND" -o "$reason" = "RENEW" ]; then

# Delete old routes, if they exist
if [ -n "$old_classless_routes" ]; then
modify_routes delete "$(parse_option_121 $old_classless_routes)"
fi

# Add new routes, if they exist...
if [ -n "$new_classless_routes" ]; then
modify_routes add "$(parse_option_121 $new_classless_routes)"
fi
fi

Next you’ll need to modify the dhclient dhclient-script, so that the NetworkManager actually executes the hooks defined in /etc/dhcp/dhclient-exit-hooks. The information was found on this blog. I’ve modified the script found on that blog so that it would work on Fedora 12. Put this file in /usr/local/sbin/dhclient-script-networkmanager (If you’ve noticed we’ve already modified the dhclient-eth0.conf file and instructed the dhclient to use this script instead of the default one located in /sbin/dhclient-script):

#!/bin/bash
NM_DHCLIENT_SCRIPT=/usr/libexec/nm-dhcp-client.action


# dhclient-script for Linux. Dan Halbert, March, 1997.
# Updated for Linux 2.[12] by Brian J. Murrell, January 1999.
# Modified for Debian.  Matt Zimmerman and Eloy Paris, December 2003
# Modified to remove useless tests for antiquated kernel versions that
# this doesn't even work with anyway, and introduces a dependency on /usr
# being mounted, which causes cosmetic errors on hosts that NFS mount /usr
# Andrew Pollock, February 2005
# Modified to work on point-to-point links. Andrew Pollock, June 2005
# Modified to support passing the parameters called with to the hooks. Andrew Pollock, November 2005
# The alias handling in here probably still sucks. -mdz


run_hook() {
local script="$1"
local exit_status
shift       # discard the first argument, then the rest are the script's


if [ -f $script ]; then
. $script "$@"
fi


if [ -n "$exit_status" ] && [ "$exit_status" -ne 0 ]; then
logger -p daemon.err "$script returned non-zero exit status $exit_status"
save_exit_status=$exit_status
fi
}


run_hookdir() {
local dir="$1"
local exit_status
shift       # See run_hook


if [ -d "$dir" ]; then
for script in $(ls -1 $dir); do
run_hook $script "$@" || true
exit_status=$?
done
fi


return $exit_status
}


# Must be used on exit.   Invokes the local dhcp client exit hooks, if any.
exit_with_hooks() {
exit_status=$1


# Source the documented exit-hook script, if it exists
if ! run_hook /etc/dhcp/dhclient-exit-hooks "$@"; then
exit_status=$?
fi


# Now run scripts in the Debian-specific directory.
if ! run_hookdir /etc/dhcp/dhclient-exit-hooks.d "$@"; then
exit_status=$?
fi


exit $exit_status
}


# The action starts here
# Invoke the local dhcp client enter hooks, if they exist.
run_hook /etc/dhcp/dhclient-enter-hooks
run_hookdir /etc/dhcp/dhclient-enter-hooks.d


$NM_DHCLIENT_SCRIPT
exit_with_hooks 0
return $exit_status

Finally, if you are running SELinux like me, you’ll need to change the security context of the file, so that the dhclient could execute it:

chcon -t dhcpc_exec_t /usr/local/sbin/dhclient-script-networkmanager

And thats all – you done and good go to 🙂

Tagged , , , ,

VMware Workstation 6.5.3 on Fedora 11/Fedora 12

Most probably if you were trying to install the latest (6.5.3) version of VMware workstation on Fedora 11 you’ve got troubles – like me. I finally (by chance) found a workaround, not a solution, to the problem.

As the installer fails during the modules compilation/installation, the only thing that you need to do is:

  • remove the gcc package – that way effectively disabling the installer from trying to install/compile modules 🙂

Edir (Thanks to Gerard Braad – see comments bellow): alternatively you can only move the gcc binary, so that the installer would not find it:

mv $(which gcc) $(which gcc).disabled

  • install VMware-Workstation package – bare in mind that you’ll need at least 1.2GB of free space on your root volume, during that operation
  • reinstall back gcc ( and kernel-devel if you don’t have it) or (see above) move back the gcc binary

mv $(which gcc.disabled) $(echo $(which gcc.disabled) | sed ‘s/\.disabled$//’)

  • run VMware Workstation and let it compile/install the new modules

That’s all

Tagged , ,

File indexing on Fedora 11 for KDE4.3

Today I’ve got really frustrated that I cannot search through my documents quickly and made a quick research to see why Strigi (which is an file indexing service) cannot be integrated with Nepomuk under my KDE 4.3 installation. I won’t go in details why it was not working but if you would like to make that integration you can read first that blog post which I found very useful:

Nepomuk + Strigi –> Resolving the mystery

With two words – there is a missing part which is responsible for the nepomuk->strigi integration and this is the soprano backend. Reading the instructions in the above blogpost I’ve just recompiled the rpm for the current 4.3 version of KDE.

So what you need to do is grab and install this package

#yum localinstall –nogpgcheck soprano-backend-sesame2-2.3.0-3.fc11.i386.rpm

#yum install strigi

nepomik-strigi

After this – its up to you – Either reboot or relogin to your KDE session and you should see something like this:

So – fire up dolphin and start your search now! 🙂

Tagged , , , ,