Tuesday, 9 November 2010

The Battle Continues!

After thinking that I had finally resolved my problems with mounting a Windows NAS to my Ubuntu box, I've noticed that my system takes upwards of two minutes to shutdown. It wasn't a huge problem as, whatever was hanging at shutdown eventually timed-out and the box closed down successfully.

However, things like this irritate me and I just had to find out what was causing the problem. Running the usual logs (/var/log/dmesg & /var/log/messages) suggested that the problem was some sort of segfault with Python: that didn't make much sense to me as I hadn't done anything to cause Python to hang.

So, working on the assumption that the last thing I did caused the problem, my attention returned to my ongoing battle with my network attached storage device. A simple test to see if this was the problem revealed that, for some as yet undetermined reason, the NAS wasn't being unmounted properly at shutdown causing some kind of network interface error.

I used the CLI to unmount the NAS

sudo umount /media/device_name

Where device_name is the name of the NAS (in my case, mybook). Thereafter, shutting Ubuntu down took seconds rather than minutes indicating that I had found the problem.

After struggling for a week to get Ubuntu to mount the network share, I didn't really want to undo everything, but I did want to stop the automatic mount at bootup. This is easy: just comment out the device line in the fstab file.

sudo gedit /etc/fstab

Add a # (hash) to the relevant device and grub will ignore the line at boot. My file looks like this:

# /etc/fstab: static file system information.
#
# Use 'blkid -o value -s UUID' to print the universally unique identifier
# for a device; this may be used with UUID= as a more robust way to name
# devices that works even if disks are added and removed. See fstab(5).
#
#
proc /proc proc defaults 0 0
# / was on /dev/sda1 during installation
UUID=d5837259-b437-46a8-a10c-3d962bf58e41 / ext4 errors=remount-ro 0 1
# swap was on /dev/sda5 during installation
UUID=1b210c31-3575-4179-8fbd-c72984f8c8bb none swap sw 0 0
/dev/scd0 /media/cdrom0 udf,iso9660 user,noauto,exec,utf8 0 0
/dev/fd0 /media/floppy0 auto rw,user,noauto,exec,utf8 0 0
#//MYBOOKWORLD/id19748494 /media/mybook cifs credentials=/home/jogga/.smbcredentials 0 0


I can still reach the device using Nautilus and the ip address but I can't use the device name (Netbios name) or the ip address to mount the device.

Monday, 8 November 2010

Revisiting Rhythm

Following my post about repairing my Rhythmbox library, a friend of mine over at Delliberate suggested that a better way of achieving my goal was to mount my network drive as a permanent Windows share on my Ubuntu box.

I've struggled with this for over a week, trying to get Ubuntu and Samba to play nice with Netbios names (clearly, using the IP address to establish the mount defeats the object!) but eventually had to acknowledge that the problem was better than I! Nautilus connects to my network drive using the ip address without any difficulty, all that is required is to type the ip address of the drive followed by the share name into the location dialog box in Nautilus using:

smb://###.###.###.###/share_name

Where ###.###.###.### is the ip address for the drive and share_name is the name of the directory (or folder) that you want to reach. Instructions for creating a permanent mount point can be found at the Ubuntu Wiki (here) and, if you can't get Ubuntu to resolve Netbios names, you can substitute the ip address for the server name.

However, today I found a workaround that, whilst it doesn't completely solve the problem of Netbios resolution, does provide a partial solution. You can add the Netbios name to the /etc/hosts file and Nautilus will use this to resolve the ip address to the device name. Open the /etc/hosts/ file:

sudo gedit /etc/hosts

and input your password when prompted. Add the ip address and the Netbios name as follows:

###.###.###.### Netbios_Name

My file output looks like this:

127.0.0.1 localhost
127.0.1.1 jogga-desktop
192.168.1.10 MYBOOKWORLD
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts


Line 3 is the one of interest! If I've understood how this works properly, Nautilus uses the etc/samba/smb.conf file to resolve Netbios names (in a specific order): the smb.conf file specifically lists the host as a reference source. Now I can use the Netbios name rather than the ip address which is more intuitive when searching and browsing in Nautilus. In my case, I type:

smb://MYBOOKWORLD/Share_Name

I also had to change the /etc/fstab file in order to make the permanent mount resolve the MYBOOKWORLD name as per the instructions at the Ubuntu Wiki (linked above).

Of course, if the ip address changes, the workaround stops working! However, it's a simple matter to amend the /etc/hosts file to reflect the new ip address and all bookmarks that use the Netbios name should be restored to rude health!

There are some tangible benefits of mounting a network share at boot, not least, pictures and video render in Nautilus (as opposed to icons), making file identification much easier, so it's been worth the pain.

Sunday, 7 November 2010

Wallpaper Fetish

By now you may have realized that I like playing around with the decorations on my Ubuntu box! However, if you take lots of photographs and want a quick and convenient way of setting one as your wallpaper, download and install nautilus-wallpaper from the repository (or use Synaptic)

sudo apt-get install nautilus-wallpaper

Enter your password at the prompt.

After rebooting your PC, you can right-click any picture in your directory and select the (new) Set as Wallpaper... option.

Monday, 1 November 2010

Redecorating

Changing wallpaper and themes is a great way of revitalizing the Ubuntu experience, but have you ever noticed how a fabulous looking picture can drown out text and icons on your panels and desktop? Sometimes, the effect is so bad as to render even the best pictures unusable as a wallpaper!

However, there is a simple way to adjust some of the colours and settings of these essential elements without having to write clever scripts (or copy them from the Internet ;)): install Gnome Colour Chooser from the Ubuntu Software Centre.
  1. From the Applications menu, select the Ubuntu Software Centre
  2. Type Gnome Colour Chooser into the search box
  3. Install the application
It's that easy!

Once installed, you'll find the application shortcut in the System → Preferences Menu and just click the icon to open the program.



One of the real benefits is being able to change the properties of the font (colour, size, and style), allowing you to use dark backgrounds without loosing sight of your menus, but there is a host of options to play with and you can have hours of fun designing (should that be, redesigning?) your theme.

Enjoy!

Sunday, 31 October 2010

Repairing Rythmbox

One of the problems that I experienced when I moved house recently was that my network drive's IP address changed when I plugged my Ubuntu box into the new router equipment. For most day-to-day access this was no problem, I simply repaired the shortcuts in the Nautilus file explorer and everything worked as it should.

However, Rythmbox, my default music player, could no longer read my music library (stored on my network drive) and it took me a little while to figure out how to point the player to the right place. Actually, it's rather a simple operation in Ubuntu, as most things tend to be!
  1. Navigate to /home/[username]/.local/share/rhythmbox
  2. Using your preferred text editor (mine is SciTE), open the */rhythmdb.xml file
  3. Use the text editor's Find/Replace All function to change the IP address or new location
  4. Save the file and reboot your PC
Reopening Rythmbox should rebuild your database and correct any errors when it reconnects with the library. However, as a precaution, I recommend making a copy of your */rhythmdb.xml file before making the adjustments described, just in case you corrupt the original file.

Saturday, 30 October 2010

More Karmic Candy

NASA Image of the Day and the National Geographic Picture of the Day are two of my favourite websites. As you can imagine, these two organizations produce some stunning photographs and many of them end up as temporary wallpapers on my Ubuntu desktop.

As with everything else in Linux, changing backgrounds is easy and, if you know where to look, customizing the behaviour of your wallpaper is convenient and flexible: simply install wallpaper-tray or drapes from the Synaptic Package Manager and add the applet to one of your desktop panels.



You can change the preferences to automatically change your desktop at regular intervals and dictate how the wallpaper renders simply by right-clicking the applet and selecting the Preferences option.



Enjoy!

Friday, 29 October 2010

Seeing is Believing

My wireless keyboard (a Logitech Dinovo) has no onboard indicator lights for the Caps & Number lock functions. This is no problem in Ubuntu, you can add a keyboard indicator applet to a panel.

If the applet doesn't appear in the Add to Panel menu, you can add it via the Synaptic Package Manager: search for Lock-Keys-Applet and check the installation box.



Simply right click on the panel where you want the applet to install and select the applet from the drop-down menu.



You can hide any of the three indicators (Caps, Num, or Scroll) by right-clicking the icon and selecting Preferences...