Oct 05 2007

Gnome 2.20 and the new Gnome Library site

Tag: Gnome, Linux, Open Source, UbuntuDan @ 7:32 pm

I’ve just read over the Gnome 2.20 Release Notes and I must say I’m looking forward to using it in Ubuntu 7.10 (Gutsy). There are quite a few small improvements that I’ve been waiting for. For instance:

  • Finally the Evolution mail client has an icon for the Gnome Panel’s Notification Area, I hope it supports minimizing of Evolution too (without leaving behind the task bar button).
  • Evolution now has a built-in backup utility to help export and move settings to another machine.
  • The properties dialog for a mounted disk now shows a disk-usage pie chart - very useful.
  • One neat feature is that if you lock your screen and go away someone can leave you a message to read once you return (no more sticky post-its stuck to your screen).
  • Automatic unlocking of the Gnome Keyring (Password Manager) when you login or unlock your screen.

However, the thing I am most happy to see is the new Gnome Library documentation site. This is a very polished site collecting together Gnome related tutorials, manuals, and API references. I think this is a great step forward for the Gnome project; I have felt in the past the resources were not as well presented or well maintained as they could be, particularly developer docs on subjects such as Gtk and Glib.


Jul 27 2007

Useful Talk on Packaging Java Applications for Ubuntu/Debian

Tag: Java, Linux, Software Engineering, UbuntuDan @ 6:56 pm

Came across an excellent JavaOne conference session on software packaging for Ubuntu/Debian. It has a specific focus on packaging Java software but I found it gave an excellent general insight into the process of getting a piece of software, commercial or free, into the Ubuntu repositories. The main example used was the experience of the Sun engineer Harpreet Singh who was responsible for packaging the Glassfish application server which is now available in the Ubuntu multiverse repository.

Here’s the link, you will need a Sun Online account to access the talk:

JavaOne Technical Sessions - Packaging Java Platform Applications into Ubuntu


Jul 19 2007

Tips for learning to program Unix/Linux shell scripts

Tag: Linux, System Administration, UbuntuDan @ 8:25 am

I’ve been studying shell scripting in more depth recently. Here’s some of the things I found useful on the way.

1) Write your scripts to run on a real POSIX / Bourne Shell compatible sh interpreter first rather than bash or any of the other advanced shells. This improves the portability of your scripts and helps you to clearly learn the differences between the basic shell syntax and the advanced syntax introduced in shells such as bash.

On most Linux systems in recent years /bin/sh is a symlink to bash which has allowed people to ‘leak’ bash syntax in without error. Scripts like this only fail when run on a system that’s using a strict sh like on the FreeBSD or Ubuntu Feisty where /bin/sh is symlinked to ‘dash’ - The Debian Almquist Shell, which is a “lightweight POSIX compliant Bourne shell implementation”. IMO this is a better way to internalize the differences between sh and bash than using tools like ‘checkbashisms’ after you’ve created your script.

Firstly always specify ‘/bin/sh’ in the ’shebang’ line at the top of your scripts:

  1. #!/bin/sh
  2.  
  3. echo "Beginning of my script"

To see what your /bin/sh is linked to try this:

  1. $ ls -l /bin/sh
  2.  
  3. lrwxrwxrwx 1 root root 4 2007-05-03 13:09 /bin/sh -> dash

You’ll see that on my system (Ubuntu Feisty) the output at the end of the ls command is ‘/bin/sh -> dash’ which indicates that /bin/sh is linked (->) to dash. If on your system it links to bash do not try to link sh to anything else! If you do you may not be able to boot your system! Instead install the ‘ash’ or ‘dash’ shells and run you script in those directly like this:

  1. $ dash myscript.sh

2) Bookmark and read these reference manuals:

  • Bourne Shell Manual - Steve Parker’s html version of the original Bourne Shell manual great to check exactly what syntax is available in the real Bourne Shell.
  • Advanced Bash-Scripting Guide - The best tutorial on bash with loads of practical examples. The section on ‘tests’ (conditional logic) is particularly good.
  • Bash Reference Manual - The actual bash manual. It can be a little difficult to find things in this sometimes so it’s worth getting used to its structure

3) Use shell options to help you debug problems. You can do this either by using the ’set’ command (in bash type ‘help set’ to see usage or ‘man sh’ to view the man page) in your script or by passing the option on the command line as you run your script e.g.

  1. $ sh -x bin/myscript

Here are the options I find most useful:

  • -x Prints commands and their arguments as they are executed
  • -u Treat unset variables as an error when substituting
  • -e Exit immediately if a command exits with a non-zero status. Note this should be used with caution as there will be no warning when ths happens, you need to use -x to help discover where the problem is happening

There are loads so it’s worth looking through the list.

4) Use bash to discover syntax errors not highlighted by sh. If you script is failing silently in sh it can sometimes be due to a syntax error. On my system dash isn’t reporting these but I’ve found that explicitly running the script in bash often helps locate the cause of the problem.

5) Consider portability. If you know your script is going to be used across many different systems then it’s worth making sure you are only using commands available in the POSIX standard or on Linux now we can use the ones defined in the Linux Standards Base. See LSB Base - Commands and Utilities for more information.


Feb 22 2007

Debconf 2007 in Edinburgh

Tag: Linux, Open Source, UbuntuDan @ 5:13 pm

This years Debian Conference is going to hosted in Edinburgh, UK from Sunday 17 to Saturday 23 June 2007. I’m definitely going to go along. Here’s the main event info page: DebConf7.


Dec 15 2006

HOWTO: Installing Netbeans 5.5 on Ubuntu

Tag: HOWTO, Java, Linux, Software Engineering, UbuntuDan @ 11:19 pm

Netbeans is not currently available in the Ubuntu/Debian repositories. I believe this is because it uses the Sun CDDL licence which is considered incompatible with the GPL.

However, as an end-user you may wish to use Netbeans despite that. Although it comes with a neat installer wizard I personally prefer to try to get native .deb packages where possible in order to get native package management and menu/launcher icons. I found a debian packaged version by Daniel Baumann. It appears he put it on the Debian new queue but is wasn’t accepted. He’s made the prepacked binaries available here:

http://archive.daniel-baumann.ch/debian/packages/netbeans/5.5-1/

However, I wanted to learn something so I decided to try building a package using the current 5.5 source dist from Netbeans archive and Daniel Baumann’s debian package source. Here are the steps I took.

Building and Packaging Netbeans 5.5 for Ubuntu

1) Grab daniel-baumann’s patch here

netbeans_5.5-1.diff.gz

2) Get the Netbeans 5.5 source from:

http://www.netbeans.info/downloads/all.php?b_id=2180&src=1

I picked up the ’source’ tgz file from the table of links at the bottom of the page.

3) Untar the sources

  1.  
  2. mkdir netbeans
  3. cd netbeans
  4. tar -zxf netbeans-5_5-ide_sources.tar.gz
  5.  

4) Now apply the patch to the sources

  1.  
  2. # first decompress the patch
  3. gunzip netbeans_5.5-1.diff.gz
  4. cd netbeans-src
  5. patch -p1 < ../netbeans_5.5-1.diff
  6.  

The patch simply installs the debian packaging kit into the Netbeans 5.5 src directory. After applying you will find the new files under the newly created debian directory. For more info on what these files do see The Ubuntu Packaging Guide or the Debian New Maintainers Guide.

6) Next build the packages and install

  1.  
  2. debuild -uc -us
  3. sudo debi
  4.  

When debuild completes there will be 2 .deb files left in the directory above:

netbeans-ide_5.5-1_all.deb
netbeans-platform_5.5-1_all.deb

debi installs both files by reading the netbeans_5.5-1_i386.changes file which will have been generated in the directory above.


Dec 15 2006

HOWTO: Packaging Java 6 for Ubuntu

Tag: HOWTO, Java, Linux, Software Engineering, UbuntuDan @ 10:18 pm

Update: As of Fri 19th Jan 07 Java 6 has now been officially included into the Dapper Backports repository. See it’s package page.

Today I found out how to package Java for Ubuntu/Debian. I wanted to see if a .deb package file of Java 6 was available for Ubuntu I found details on creating one in the following forum post: Re: JDK 6 Available…now when is a deb coming?. The instructions there are great except they don’t work perfectly for Dapper so here are the modified steps for Dapper:

1) Patch ‘java-package’

The Debian Java Maintainers have created a tool make-jpkg which is a neat script to take the Sun Java native linux .bin installer and turn it into a .deb package. This script comes in the ‘java-package’ package which is in the multiverse repo in Ubuntu.

Dapper stocks the 0.27 version which does not support conversion of Java 6 yet. However, mlind attached a patch to his forum post (link above) to add support for Java 6 to java-package version 0.28. Luckily it’s not difficult to tweak the patch for 0.27. Here’s the modified version of the patch:

java-package_sun-java6.dapper.patch

Here’s the instructions on how apply the patch and build the updated package:

  1.  
  2. mkdir java-package
  3. cd java-package
  4. sudo apt-get build-dep java-package
  5. apt-get source java-package
  6. cd java-package-0.27
  7. patch -p1 < ../java-package_sun-java6.dapper.patch
  8. debuild -b -us -uc
  9. cd ..
  10. sudo dpkg -i java-package_0.27local0_all.deb

2) Package sun-jdk6

Now that you’ve updated java-package it’s time to package Java 6. First download Java 6 from Sun. You need to download the Linux self extracting file (jdk-6-linux-i586.bin). Here are the instructions on building it (taken from the forum post listed above).

  1.  
  2. mkdir sun-jdk6
  3. cd sun-jdk6
  4. # put jdk-6-linux-i586.bin into this directory
  5. make-jpkg jdk-6-linux-i586.bin
  6. dpkg -i sun-j2sdk1.6_1.6.0_i386.deb
  7. sudo update-alternatives –config java
  8. # select the new Java 6 installation as the provider of java
  9. java -version
  10. # Output of the above command should be
  11. # java version "1.6.0"
  12. # Java(TM) SE Runtime Environment (build 1.6.0-b105)
  13. # Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing)

Nov 06 2006

Ubuntu 6.10 Edgy Eft Released

Tag: Linux, UbuntuDan @ 1:48 pm

The new release of Ubuntu is out. Seems it happened about a week ago so I’m behind the times already.


Oct 30 2006

Making HP LaserJet-1020 work with Ubuntu 6.06

Tag: Linux, System Administration, UbuntuDan @ 8:33 pm

I inherited an HP LaserJet 1020 from the previous owner of my house. I found the drivers for Windows on the net and got it working fine, I really liked it (and so did my wife cause it prints quicker than my HP-PSC-1210). However, in June I migrated to Ubuntu 6.06 as my primary OS and couldn’t get it to work with the 1020.

My first attempt was to try the HPLIP drivers however, I noticed the 1020 listed in their unsupported devices page. On further investigation I found a note about it in their FAQ - apparently they consider the 1020 a “non-standard host based printer” and they don’t plan to support it.

Then I found a page on it on LinuxPrinting.org which pointed me to the foo2zjs project which is a linux printer driver for the ZjStream protocol which is what the 1020 uses apparently. Various posts on the Ubuntu forums also direct to this project for 1020 support. This post seems to be the best of the lot.

The process I followed in the end was to download the most current version of foo2zjs and compile and install it from source. This worked but I’m not 100% happy with this setup as it requires uninstallation of the ubuntu packaged version of foo2zjs which also forces uninstallation of the ubuntu-desktop meta package. I also tried to install it using checkinstall so that I could manage the installation using apt/synaptic but the dpkg installation process kept failing reporting that foo2zjs was

trying to overwrite
`/usr/share/foomatic/db/source/driver/foo2hp.xml’,
which is also in package foomatic-db

Here are the exact steps I took in the end, based on the instructions from various places:

  • Build and install foo2zjs
  1.  
  2. wget -O foo2zjs.tar.gz http://foo2zjs.rkkda.com/foo2zjs.tar.gz
  3. tar zxf foo2zjs.tar.gz
  4. cd foo2zjs
  5. ./getweb 1020
  6. sudo make install cups
  7.  
  • Run gnome-cups-manager (System > Adminstration > Printing) and add a new printer. It had already found my 1020 so I accepted the defaults all the way through the wizard.
  • Unplug (if not already) and then plug in the 1020
  • Print a test page (can be found from the gnome-cups-manager printer properties page).

Oct 16 2006

Enabling CPU Frequency Scaling on Ubuntu

Tag: Linux, System Administration, UbuntuDan @ 9:01 am

Found an interesting blog entry about explicitly controlling CPU frequency on Ubuntu/Linux.

The system will by default automatically scale the CPU speed and does a good job, however some users may like to do this manually themselves.

Enabling CPU Frequency Scaling « Ubuntu Blog


Oct 09 2006

Ubuntu feature on More 4 News

Tag: Linux, Open Source, UbuntuDan @ 8:39 am

Found this via the Ubuntu forums. It’s a More 4 (UK Satellite/Cable TV channel) news feature on Ubuntu and Mark Shuttleworth:
TV interview with Mark ‘Ubuntu’ Shuttleworth


« Previous PageNext Page »