wtorek, 30 sierpnia 2011

Linux: Bootable USB stick with FreeDOS for upgrading BIOS

Today I was to upgrade a BIOS on one of the laptops (Dell Latitude E5400) that was running Linux Mint 11 distro. I downloaded a single .exe (in fact E5400A16.EXE - E5400 standing for the model, A16 for the version) file from the manufacturer (Dell) website which was to be used together with the bootable floppy. The main problem with that approach was that I did not have a floppy drive (which is not surprising as most of the current laptops do not have a floppy drive) so I had to find an alternative solution. The best idea for me was to create a bootable USB stick with FreeDOS under Linux, which is not that difficult since there is a great wiki that one can use to do it: http://en.gentoo-wiki.com/wiki/FreeDOS_Flash_Drive. I followed the guidelines with one exception namely that I used gparted for partitioning and formating the USB stick (below one can find the guidelines how to do it on Linux Mint 11 distro):
  1. If not already available install gparted from the repo:
    # sudo apt-get install gparted
  2. Start the gparted:
    # gparted
  3. Choose the device corresponding to you USB stick in the main menu gparted->devices - in my case it was /dev/sdb
  4. Remove any partitions if there are any
  5. Create a new partition table: Device->Create Partition Table
  6. Create a new partition: Partition->New and choose fat16 as the filesystem
  7. Format partition with fat16 filesystem: Partition->Format To
  8. Commit all operations: Edit->Apply all operations
  9. Exit gparted and follow guidelines from the wiki starting with the FreeDOS (next MBR, Last Touch etc.)
I hope that the reader will find these information helpful

poniedziałek, 29 sierpnia 2011

Ubuntu: importing Cisco VPN Client connections to vpnc (network manager)

Today I had to connect to my company's network via VPN and all I had from my windows workstation were the definition of the Cisco VPN Client connections in the .pcf format. Below I describe the steps to import these definitions into the network manager (vpnc).

  1. In the network-manager click on the VPN connections option 
  2. You should see a window with a list of configured VPN connections and there should be a button 'Import' to import an existing definition, e.g. in .pcf format
  3. Choose the .pcf file and the new connection shall be available

Problems



  1. vpnc plugin for network-manager - Please check if you have network-manager-vpnc package installed - which brings the plugin for the vpnc into the network manager. Otherwise you will face strange looking errors during import: Error: unknown PPTP file extension.
  2. Missing description - although I have not encountered this problem I found it in some articles on the internet and decided to mention it here. It concerns network-manager-vpnc versions below 0.7.1 - and it occurs when the .pcf file lacks the Description variable in the [main] section
  3. Routing configuration - please check if the routing is properly configured. In my case I had to define additional routes to company's servers which is not difficult and can be done either via script or via GUI - when you edit your VPN connection it is located in the IPv4 settings and routes (screenshot of the window can be found below)



sobota, 27 sierpnia 2011

Ubuntu: Nokia E52 as 3G modem on Natty 11.04 box

Last week I had some problems with the signal strength of the default 3G modem delivered by the operator (which appeared to be Huawei Technologies Co., Ltd. E220 HSDPA Modem / E270 HSDPA/HSUPA Modem) together with the so called Blueconnect offer (offered by the polish T-Mobile former ERA) while the signal strength on my mobile phone Nokia E52 seemed to be perfect. That is why I decided to try to connect with the Blueconnect using my mobile. The idea was to connect the phone to the laptop using the bluetooth and toward the radio network via 3G/GSM.


First of all I did a reference speed measurement on the using the original Huwaei modem (http://www.speedtest.net/) - the results are presented below:

 
Ok, as soon as I had the results I switch the card to my Nokia E52 mobile and started to configure the bluetooth connection. On Gnome there is a wizard for managing the bluetooth devices – it can be found System->Preferences->Bluetooth or as in my case if you are using gnome-do just type bluetooth in the gnome-do window and just follow the instructions as on the screenshots below (please remember to enable the DUN):











 Last but not least I did the bandwidth check and the results are slightly better than in case of Huawei modem but the most important is that the signal strength is more stable than before. The measurements were done at polish seaside (Gaski - 54.241018,15.892321)

środa, 3 sierpnia 2011

Ubuntu: sysstat chart generator utility

There is a new OSS utility that provides mechanisms for generating gnuplot charts out of the sysstat utilities (currently sar and pidstat are supported): http://code.google.com/p/yapcg/. Feel free to contribute and extend this project.
In the nearest future there shall be user guide added and UML model generated out of the code (currently it is enclosed the html api documentation - separate for each module).

Ubuntu: startup process respawn

Today I had a discussion with one of my colleagues about mechanisms for monitoring the process and respawning it if it dies. We discussed the approach via inittab or home made solution with external process monitor. I decided to check it on my ubuntu 11.04 Natty box and to my surprise there was not /etc/inittab file. After deeper investigation it seems that the upstart init daemon in ubuntu is configured via files located in the /etc/init director. Moreover it seems to offer a great piece of functionality that we needed, e.g. limiting the number of respawns in specific period of time.
The startup of services is controlled via the start command, which actually is a symbolic link to the initctl - please check the man for details.
I decided to check also if the number of respawns functionality really works - for that purpose I prepared a configuration file as below:

root@krystianek:/etc/init.d# cat /etc/init/test_respawn.conf 
description "Test respawn"


start on filesystem or runlevel [2345]
stop on runlevel [!2345]


respawn
respawn limit 10 5
umask 022


pre-start script
end script


exec /etc/init.d/test_respawn.sh
root@krystianek:/etc/init.d# 

Limiting the number of respawns to 10 in timeframe of 5 seconds. Next I prepared the test_respawn.sh script to count the actual number of restarts as below:

root@krystianek:/etc/init.d# cat /etc/init.d/test_respawn.sh 
#!/bin/sh


declare -i VALUE
echo "Testing respawn feature"
TMP_FILE=/tmp/count
if [ -f "$TMP_FILE" ]; then
  VALUE=`cat ${TMP_FILE}`
else
  VALUE=0
fi


VALUE=`expr $VALUE + 1`
echo $VALUE > ${TMP_FILE}
exit 1

The result shall be stored in the /tmp/count file. Now as everything is ready for the test it is time to do it:

root@krystianek:/etc/init.d# file /tmp/count
/tmp/count: ERROR: cannot open `/tmp/count' (No such file or directory)
root@krystianek:/etc/init.d# start test_respawn
test_respawn start/pre-start, process 8293
root@krystianek:/etc/init.d# cat /tmp/count
11

Voila the result is 11 (1 start attempt + 10 respawns).