Caution: You will not be able to click to see large images unless you enable Java on your Browser.

April 19th 2011

Ubuntu 11.04 Natty Beta with Unity Desktop LiveCD

I have been looking at the new version of Ubuntu which is a very major change from previous versions as it follows the desktops developed for Netbooks which are designed to make best use of the screen area, in particular with widescreen type layouts which are only 600 pixels high on a netbook which gives a stupid aspect ration when you have multiple toolbars. Unity uses a very much simplified launcher on the left, removes the lower panel and reduces and shares use of the top panel with the top toolbar (usually drop down menus like File Edit View ... .... .... Help) in the application which is In Focus. The Application Bar/Dock on the left lacks some features but there are other excellent touches such as automatic expansion to full screen when an application is draged to the top or half screen when dragged to a side. Some features have disappeared including the ability to run applets such as Netspeed completely and the system tray part of the top panel is only accessible to a few favoured and whitelisted applications which stopped Truecrypt from being usable as it reduces into an indicator icon in the systray. See below for the solution.

First you need to instal the configuration tool for the Unity Desktop - the equivalent to gconf-editor for the gnome desktop. Not surprisingly it is called dconf-editor and most of it is very similar - there is however a useful addition of a return to defaults button for each setting. It can be installed in a terminal or you can use the Synaptic Package Manager. In this case I used a terminal to get the overall package of tools but first I had to enable the universe repository and the easy way was to run the Ubuntu Softwar Centre and use the drop down edit menu -> Software Sources and tick the Universe box on the Ubuntu Software tab - you should also be able to search and install from the Software Centre but it did not work on Beta 2:

sudo apt-get install dconf-tools

Now run dconf-editor using the terminal

dconf-editor

then navigate to desktop > unity > panel and enter: ['all'] in place of the existing string in Value for the for the Key systray-whitelist by clicking, overwriting with ['all'] and then a return

You now need to logout and log back in. If you are testing with a LiveCD this is more difficult and I got to a logout menu and loged back in as ubuntu with null password by doing in a terminal:

gnome-session-save --logout-dialog

I was also advised when I was using askubuntu.com (A very useful source of help) that the following in a terminal would restart Unity with the same effect:

(unity &)

This did the job but did produce some strange error messages!

Tests with Truecrypt showed the above proceedure worked. You can also add Truecrypt to the whitelist if you do not want any other extra programs to use the systray. I found it worked with the capital T.

LibreOffice

LibreOffice is a fork of OpenOffice resulting from the games being played by Sun and is being increasingly used by all Linux distributions. It looks and feels almost identical and I have upgraded one of my machines to use it as there is a PPA with more up-to-date versions than the equivalent OpenOffice version in Lucid. This is again based on the proceedures on Web UPD8 on how to install LibreOffice from a PPA

LibreOffice has an Ubuntu PPA so it's easy to install and stay up to date with the latest LibreOffice versions. The LibreOffice packages in this official Ubuntu PPA are backported from Natty so they come with all the patches/optimizations applied to LibreOffice for Ubuntu. Important note: You must remove OpenOffice so you cannot have both in the same time!

To remove OpenOffice, add the LibreOffice Ubuntu PPA and install it in Ubuntu 10.04 Lucid Lynx, 10.10 Maverick Meerkat and 11.04 Natty Narwhal, use the following commands in a terminal:

The last two commands integrate Libreoffice with the gnome desktop environment and replace the spellchecker and the language support packages which were removed with OpenOffice (you can replace "-en" with your language in the final command).

The version of OpenOffice is 3.2 and the integration has a few problems so this is possibly a good update to make to Lucid.

Installing Firefox 4 in Ubuntu Lucid Lynx 10.04

Natty uses the latest Firefox 4 and this is now available from Ubuntuzilla Repository which is a third-party repository. There seems to be no PPA but the repository contains the latest released versions of Thunderbird and Firefox and it can be added to the Third Party Software Sources lists used by the Synaptic Package Manager if you want to update an earlier (LTS) version such as Lucid. You should not use Ubuntuzilla with Natty as these versions do not integrate with the Unity Desktop or AppArmor and you should remove the repository before upgrading. The instructions are all clear at Ubuntuzilla and it only involves copy/pasting three commands and running in a terminal to make Firefox 4 available to Instal. In summary for 10.04 and 10.10:

Copy and paste the following command (as one line) into a terminal and run it. This adds the Repository to your sources.list :

You should now check that the new version is available in the Synaptic Package Manager by searching for firefox-mozilla-build and installing it. It will add links which bypass the Firefox 3.x you are using.

It is significantly improved but you may need to reconfigure your toolbars as items such as the + for a new tab may have gone. It is easiest to reset the toolbars to the default then start again when you have seen the changes. I have also moved the tabs back to their usual place. You may find that some of the Extensions need to be updated and some may not yet be compatible.

There are more useful pages at askubuntu.com covering Unity keyboard and mouse shortcuts some of which I have reproduced here with some of my additions - Initially I found it difficult to see why Unity has any advantages without this information and then I realised that most of it is implemented via Compiz and is equally applicable whether you use Unity or not!

Unity Keyboard and Mouse Shortcuts

Ones I find useful are coloured

Ones I found did not work at present are Grayed out

Keyboard

Launcher

Hold Super - Invoke the Launcher.

Hold Super, then 1 or 2 or 3 and so on until 0 - Open or focus an application. The number corresponds to the location of the icon on the launcher from top to bottom.

Adding Shift will open a new instance of the application if it's already open. Super - Shift - Number is one of the only ways to open a fresh instance from the launcher

Holding the key is also useful when you want to get to the Launcher but do not want to invoke the Dash.

Super-T - Open the rubbish bin/trash can.

Alt-F1 - Put keyboard focus on the Launcher, use arrow keys to navigate, Enter launches and application, Right arrow exposes the quicklists if an application has them.

Ctrl-Alt-T - Launch a terminal window.

Super-A - Open Applications place

Super-F - Open Files & Folders place

Dash

Tap Super - Opens the Dash

Alt-F2 - Invoke the Dash in a "special mode" to run a command. Typing in a Folder Name will find that folder in Nautilus, you can also use ~ as a shortcut in the field.

The Dash opens with focus on the search box to find applications and files. Using the arrow keys will navigate the results, use Enter to launch.

Panel

F10 - Open the first menu on the panel, use the arrows keys to "scrub" across the menus. (There is no shortcut for the session menu, so hitting F10 and left arrow is a quick way to get there)

Window Management

Super-W - Spread mode, zoom out on all windows in all workspaces.

Super-D - Minimize all windows; hitting it again restores them.

Window Placement

If you cycle through the same key Unity will cycle through different placement widths, so experiment by hitting the numkey multiple times:

Ctrl-Alt-Numpad 7 - Place window in top left corner of screen.

Ctrl-Alt-Numpad 8 - Place window in top half of screen.

Ctrl-Alt-Numpad 9 - Place window in top right corner of screen.

Ctrl-Alt-Numpad 4 - Place window on the left side of the screen.

Ctrl-Alt-Numpad 5 - Center/Maximize the window in the middle of the screen.

Ctrl-Alt-Numpad 6 - Place window on the right side of the screen.

Ctrl-Alt-Numpad 1 - Place window in the bottom left corner of the screen.

Ctrl-Alt-Numpad 2 - Place window in the bottom half of the screen.

Ctrl-Alt-Numpad 3 - Place window in the bottom right corner of the screen.

Ctrl-Alt-Numpad 0 - Maximize window.

Workspace Management

Super-S - Expo mode (for everything), zooms out on all the workspaces and let's you manage windows.

Shift-Alt-^ - Expo mode for all windows in the current workspace only.

Screenshots

PrtScn - Take a screenshot of the current workspace

Alt-PrtScn - Take a screenshot of the current window

Mouse Tricks

Launcher

Clicking and holding an icon and then dragging it around will allow you to reorder it on the launcher. You can also drag it off to the right of the launcher to move it around. Note that you need to make an explicit movement to the right to move the icon off the launcher before you can move it around.

Dragging and Dropping an icon into the trash can will remove it from the Launcher. The program itself will remain installed and accessible through the dash.

Scrolling the mouse wheel while over the Launcher scrolls the icons if you have too many and need to move around quickly
.

Right Click Applications - gives a menu of Application types

Right Click Files and Folders - gives a menu of Favorites

Window Management

Maximizing - Dragging a window to the top panel will maximize it.

Restore - There are two ways to restore, or unmaximize the topmost maximized window of the current monitor for this workspace (not using the window controls)

Double clicking on the top panel (but not in the application's menu)

Dragging the top panel down.

Middle click on Maximize - Maximize Window Vertically.

Right click on Maximize - Maximize Window Horizontally

Focus the topmost maximized window of the current monitor for this workspace: Left click on the top panel (but not in the application's menu)

Cycle between maximized windows of the current monitor for this workspace: Middle click on the top panel (but not in the application's menu)

Tiling - Dragging a Window to the left/right border will auto tile it to that side of the screen.

Middle click on an application's launcher icon - Open a new instance of the application in a new window. If the application isn't running it will just open it normally.

Middle click on the top panel (but not the menu) - send the current window behind all other windows.

17th April 2011

O2 Pay and Go

I am having to change my O2 tariff because the legacy contract Leasure 600 tariff is no longer offered - it was £100 a year for 600 minutes off peak without data (except for dial-up) with a £75 discount if I did not take a new phone. I need to keep to O2 because it saves me £60 on my broadband from O2 which is excellent. Pay and Go is acceptable for the broadband discount if I top up £10 every three months and I can ask for the number to be transfered to my new SIM when I terminate the Contract and the prediction is 48 hours with only a dead time of 2 hours.

I have so far bought the new Pay and Go SIM - actually free with a £10 Topup in the Shop. One needs to chose an initial tariff but one can swop round using phone calls, Internet, TXT and in a shop. I agonised over tariffs - the Simplicity Tariff on P&G which is pushed is better than the Contract one but still needs a £10.50 deduction from the phone credit monthly to be useful.

The tariff I have chosen is Text and Web which needs no monthly deductions but depends on a Topup of £10 which provides 300 Texts and 500 Mbytes of Data (and Wifi) to be used in the next 30 days in addition to the Topup. Once you have this active it seems that the topup required to keep it going can be anytime during the month ie you do not need to wait till it has expired before topping up. The first month I monitored data use carefully and used 470 Mbytes and 6 TXTs

Boltons are not advertised in the brochures for the Tariff but I found I have the ability to buy a monthly Bolt-on giving 100 minutes of calls to Landlines for £5 on the Web which is very consistent with my previous use. Once started the bolt-on continues until cancelled or you run out of credit. Most other calls are 25p/min. including support calls

Automatic topups can be set up on the web by month or when your credit falls to a given level to ensure your bolt-ons continue.

O2 Pay and Go Settings for Data Access

The following were sent me during a chat session with O2 Support - I have coloured the information I have actually used so far:

You can check your balances by calling 4444. Or text ‘balance’ to 20202. Both are free. Calling 4444 gives a comprehensive menu which allows you to topup, add and remove bolt-ons, change tariffs etc as well as checking your various balances.

Setting up MyO2 allows one to login and check and set up everything in a very convenient manner and also allows one to opt in and access ones 'Rewards' which are 10% of your topups which can be used for topup, new phones or various other things.

Voicemail 901 answers any calls you miss and lets you know when you have new messages. It is ready to go on all new O2 SIMs. If it's switched off, you can turn it on by calling 1750 free of charge from your mobile. To Switch it off - Dial 1760 from your mobile free of charge.

The alternative is O2 Call Alert - call 1710 free of charge from your mobile to toggle it on and off. Please note: you can only have one service or the other.

28th April 2011

Unity Day - Ubuntu 11.04 Natty Installed

One of our MSI Wind U100 netbooks has been used as the guinea pig for this and was updated on the Internet first to 10.10 and then to 11.04. The upgrade to 10.10 froze and had to be restarted but fortunately picked up where it had left off from its cache and completed successfully. The next upgrade to 11.04 natty went without incident.

Natty - choice of Unity Desktop or conventional Gnome Desktop

This can be done at login - once the user has been chosen a series of choices are available in a bottom panel including the desktop - the desktop choice is sticky. As far as I can tell so far the settings are largely independent in both although the Desktop remains the same.

This is set in the Unity Plugin in the Compiz Window manager which is reached from System Settings (now under the 'Logout' button) -> CompizConfig Settings Manager -> Desktop -> Ubunty Unity Plugin -> Experimental -> Launcher Icon Size and set to 32 .

The Launcher can be kept fixed rather than being hidden by CompizConfig Settings Manager -> Desktop -> Ubunty Unity Plugin -> Behavior -> Hide Launcher and set to Never

The combination of smaller icons makes the use of Unity much quicker and easier, much more like the old bottom panel.

Natty Configuration - Restoring the Systray for all applications when running Unity

Many programs that I use require use of Indicators in the Systray (ie on the top panel) which is blocked by default for most programs in Natty. In my case this prevented use of Truecrypt, Kaffeine and Gnome-ppp to name a few.

First you need to instal the configuration tool for the Unity Desktop - the equivalent to gconf-editor for the gnome desktop. Not surprisingly it is called dconf-editor and most of it is very similar - there is however a useful addition of a return to defaults button for each setting. It can be installed in a terminal or you can use the Synaptic Package Manager. In this case I used a terminal to get the overall package of tools but first I had to enable the universe repository and the easy way was to run the Ubuntu Software Centre and use the drop down edit menu -> Software Sources and tick the Universe box on the Ubuntu Software tab - you should also be able to search and install from the Software Centre:

sudo apt-get install dconf-tools

Now run dconf-editor using the terminal

dconf-editor

then navigate to desktop > unity > panel and enter: ['all'] in place of the existing string in Value for the for the Key systray-whitelist by clicking, overwriting with ['all'] and then a return.

Natty/Unity mouse click freezes

I have had a couple of program problems which have frozen the mouse clicks. Alt F4 will close a program and release the mouse. These intermittent freezes could be a problem with my use of mousemu alongside unity which also makes use of the 'Super' key. They seem to have largely gone away with the latest updates.

Natty/Unity Workround for Mouse Displacement and other anomolies using Dreamweaver and other programs running under Wine?

I could not use Dreamweaver which runs under Wine with Unity as the Mouse Pointer wass displaced by what seems to be a toolbar width down. This seems to come and go - cause unknown. I have now found a workround which is to avoid running wine/dreamweaver maximised but to run it in a window which is adjusted to be as big as possible. Dreamweave always seems to be launched maximised but it is simple to use the new mechanism of draging the top panel down to change it to a window then drag it back up where it parks in the correct position. I use the same trick for other programs running under Wine and it seems to cause confusion if you have more than one program running under wine. Even worse running Picasa shows up as another window of Dreamweaver or Paint Shop Pro - definitely some bugs here! It seems to now be recognised at https://bugs.launchpad.net/unity/+bug/755406 and at https://bugs.launchpad.net/ubuntu/+source/unity/+bug/704187/

Natty Customisation - Suitable Themes

I have had to change my themes and also put the control icons back on the left side as I had modified this for Lucid - I am currently using Ambience customised with Tangerine icons and a background picture of the QE2.

Natty Improvements

A major step forwards is that the addition of signal strength to the display when using a mobile broadband stick. The network monitor also now identifies the network name and type you are connected to. There is also improved handling of Mobile Phones connected via Bluetooth if you can fix all the bugs with Bluetooth. These are not dependent on using Unity.

2 - 7 May 2011

I found great difficulty in making a Bluetooth connection to my mobile phone on searching I found there is currently a problem with Bluetooth see https://bugs.launchpad.net/ubuntu/+source/bluez/+bug/762964 and Bluetooth needs to be restarted after a Cold Boot, Restart, Suspend and Hibernate. There are further problems if you want to use Bluetooth to connect to a modem in mobile phone as the devices rqeuired are no longer automatically connected so programs such as gnome-ppp will no longer work.

Short-term Fix to allow testing of Bluetooth - Restart Bluetooth in a terminal.

This is a simple way to allow one to test out and bluetooth but has the disadvantage that a command has to be entered and run in a terninal after every startup, reboot and when leaving suspend and hibernate. It may be an acceptable way to proceed for occasional use if one assumes the bug will be quickly fixed!

Open a terminal by Applications; Search for Terminal and in the terminal enter:

sudo /etc/init.d/bluetooth restart

A Way to automatically start bluetooth

I have tried adding restart bluetooth to /etc/rc.local which is run after all other init scripts. This works most of the time at cold starts and restarts but does not work after a return from suspend - there must be a better or extra place to place it for Natty

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.# Addition to ensure bluetooth is restarted
/etc/init.d/bluetooth restart
exit 0

Ways to restart BlueTooth after a Suspend or Hibernate

I have found out that the scripts which are run on Suspend, Hibernate, Resume and Thaw are in /etc/pm/sleep.d where I created a new fle as root called 99_bluetooth-restart and gave it execute permissions. It can be created by

sudo gedit etc/pm/sleep.d/99_bluetooth-restart

The permissions can be set most easily by starting nautilus (the file navigator) as root and navigating to the file, right clicking -> Properties -> permissions and seting the execution tickbox

gksudo nautilus /etc/pm/sleep.d

The contents have to follow a strict format I copied from other files giving:

The end result of the three modifications mean that Bluetooth is turned on correctly with the rfcomm bindings (Bluetooth Device creation) carried out for 95% of the time and an extra suspend and resume will enable it almost for certain!

There is a new method of making a bluetooth connections to modems in phones which then appear in the Network Manager. The new way is described in https://help.ubuntu.com/community/BluetoothDialup for 10.10 and is a big step forwards although it does not work for 'tricky' phones like those running Windows mobile. The following assumes the Bluetooth problem in Natty has been fixed or you are prepared to do a Bluetooth restart in a terminal as above.

When Bluetooth is enabled on, for example, my MSI Wind U100 a Bluetooth icon appears in the Indicator Applet in the top panel. Right Click -> Preferences to see if you already have any BT connections set up from earlier versions as you need to clear them and set up the device including 'pairing' again to get to the new option to make a Dial Up Networking (DUN) connection to the modem in the phone in a way it will appear in Network Manager - this is alluded to in the reference above. So delete any existing connections to the phone - Set Up the device again using the Set Up New Device button, work through the wizard to pair the phone and at the end it offers a tick box to add a DUN connection - this then takes you to wizard to add the APN etc and eventually the connection ends up in the Network Manager (In System Applet in top panel) but, be warned, you do not seem to be able to edit the settings so if they are wrong you have to start again by deleting the device etc.

Using dialer applications such a gnome-ppp under Natty

The method above will not work with fancy phones such as Windows Mobile Devices because it is unable to detect and obtain details of these phones which do not follow the standards properly. You therefore need to use a connection application such as the excellent gnome-ppp which I have been using for many years.

I have found there is yet another problem with using Bluetooth through Gnome-PPP in that the rfcomm devices are not being created in Natty even when Bluetooth running correctly - it took me a while to remember that this is actually a problem I have met before and involving editing a system file in Lucid. I will reproduce the section from Ubuntu on the Move here for completeness:

Fix for a bug where the bluetooth modem (rfcomm) devices are not automatically created (Karmic - Natty)

There is a bug (see https://bugs.launchpad.net/ubuntu/+source/linux/+bug/416056) starting in Karmic and the rfcomm devices are not automatically started - so one sets up the configuration file rfcomm.conf but the rfcomm program is not run so the rfcomm devices are not created. You can check by looking in /dev to see if /dev/rfcomm0 is present. The obvious thing to do is to modify /etc/init.d/bluetooth to add rfcomm bind all at the end of the startup sequence and rfcomm release all at the start of the stop sequence. So, in a terminal open the file for editing by typing:

gksudo gedit /etc/init.d/bluetooth

and add the lines in red to the file as in the section shown below for Lucid.

case "$1" in
start)
#currently this init script exists only because of what appears to be
#an egg and chicken problem
# bluetoothd normally starts up by udev rules. it needs dbus to function,
# but dbus doesn't start up until after udev finishes triggering
#
if [ ! -f /sbin/udevadm.upgrade ]; then
udevadm trigger --subsystem-match=bluetooth
fi# Additional code to automatically bind the devices set up in rfcomm.conf during startup
rfcomm bind all
;;
stop)# Additional code to automatically release the devices set up in rfcomm.conf when bluetoth stopped
rfcomm release all
pkill -TERM bluetoothd || true
;;
restart|force-reload)
$0 stop
$0 start
;;

Note that you should make any backup of the file /etc/init.d/bluetooth in a different folder as everything in the init.d folder is run at startup and you will end up doing everything twice in an unpredictable order.

The file /etc/init.d/bluetooth is slightly different for Natty although the changes are similar

case "$1" in
start)
#currently this init script exists only because of what appears to be
#an egg and chicken problem
# bluetoothd normally starts up by udev rules. it needs dbus to function,
# but dbus doesn't start up until after udev finishes triggering
#
log_daemon_msg "Starting $DESC"

First you need to instal the configuration tool for the Unity Desktop - the equivalent to gconf-editor for the gnome desktop. Not surprisingly it is called dconf-editor and most of it is very similar - there is however a useful addition of a return to defaults button for each setting. It can be installed in a terminal or you can use the Synaptic Package Manager. In this case I used a terminal to get the overall package of tools but first I had to enable the universe repository and the easy way was to run the Ubuntu Softwar Centre and use the drop down edit menu -> Software Sources and tick the Universe box on the Ubuntu Software tab - you should also be able to search and install from the Software Centre but it did not work on Beta 2:

sudo apt-get install dconf-tools

Now run dconf-editor using the terminal

dconf-editor

then navigate to desktop > unity > panel and enter: ['all'] in place of the existing string in Value for the for the Key systray-whitelist by clicking, overwriting with ['all'] and then a return

You now need to logout and log back in.

Gnome-PPP now connects fine once one has done the Systray, Bluetooth and the rfcomm Bindings fixes but I found it was quickly disconnecting when I was doing updates with an O2 connection.

Some modifications are required in /etc/ppp/options as the default settings cause timeouts with some mobile connectsions.

These settings can not be changed via the Gnome-PPP GUI interface and I change them in the the 'master' pppd (I think that stands for ppp daemon) set up file which is /etc/ppp/options so the changes apply to all users. We can look at the current options which are set by:

sudo egrep -v '#|^ *$' /etc/ppp/options

It is desirable to make a backup before editing the /etc/ppp/options file so to make a copy and open a terminal:

I normally make three changes to the file. The first two are essential for most GPRS connections and disable the sending and checking of the echo response sent to check the connection is alive - the echo is not implemented by most mobile service providers and the default result is that 4 echo response requests are sent at 30 second intervals and after the 4th failure to receive a response the connection is broken. If you are disconnected after 2 minutes that is the cause. The new values of 0 inhibit the sending and checking:

lcp-echo-failure 0
lcp-echo-interval 0

The third change is essential, as far as I know, for the Vodafone PCMCIA Connect Card but does not impact other connections significantly so I do it routinely so I do not forget. It involves disabling negotiation of Van Jacobson style IP header compression by un-commenting

-vj

I have also tried modifying the /ect/ppp/options file to add an extra delay before connection as I was sometimes not getting a correct DNS delivered using gnome-ppp with the Vodafone but it seems to have little benefit but you can try it but only if you have problems as it will slow down making all connections.

connect-delay 5000

Note the information in the /etc/ppp/options file does not recommend that changes are made in this file. The documentation ( man pppd ) says that if there is a file ~/.ppprc which is used for user default options which could be used instead of modifying /etc/ppp/options - I have not tried that method as the simple way works for me and gives me a working system. I have the attitude that "if its not broken don't fix it" and this way works for all users.

Once all these fixes were complete I can use the T610, O2 XDA Exec and Palm to connect to the Internet via bluetooth just as I could on earlier versions of Ubuntu. There are a number of special techniques needed to use the XDA and Palm because they run Windows Mobile 5 which does not follow the 'rules'. This is why the new methods using network manager do not work - Windows Mobile Phone are not detected properly by Ubuntu Natty 11.04 but manual access via Gnome-PPP is fine.

10 May 2011

Wammu under Natty

Nothing special required - I loaded from the Synaptic Package Manager. It requires the Systray fix if you want to use the feature of minimising to the Systray otherwise everyhing worked as expected after a reboot - it complained about perpissions when trying to connect to a phone until the reboot. The T610 was connected via rfcomm0 so the fix for Bluetooth and the rfcomm device creations fix was required. The K3565 dongle connected via /dev/ttyUSB1 just as on my other machines with Lucid. I loged out nd switched to Ubuntu Classic mode to create a desktop launcher. See the Wammu Section in Ubuntu on the Lookout for more about Wammu.

11 May 2011

A Netspeed AppIndicator for Ubuntu 11.04 with Unity

The last outstanding facility I needed for Ubuntu 11.04 Unity was a replacement for the Netspeed Applet which would continuously display upload and download speeds in the 'panel'. Applets no longer work in Unity and the nearest replacements are called Appindicators so I have been looking for a replacement which I eventually found on Webupd8 in the article How To Display Network Upload / Download Speed On The Panel In Ubuntu 11.04 . This solution uses an existing Appindicator called Indicator-Sysmonitor which is very versatile and allows one to display almost anything on the Unity (or GNOME) panel by using a simple command or a bash script. In this case a script has been written by Alex to display any combination of network speeds, memory use and cpu loads using a system application called dstat to provide the information. I have modified the script slightly to display lower data rates for watch for data 'leakage' when operating mobile.

Indicator-Sysmonitor is in a PPA which can be loaded using a terminal by:

The script needs a system program called dstat to be installed - this is a very versatile way to monitor maany system parameters do a man dstat to find out more once it is installed. It can be installed in a terminal by:

sudo apt-get install dstat

My modified version of the script which follows should be stored as sysmon in a folder called scripts in the home folder - if you put it elsewhere the command in Indicator-Sysmonitor will need to be modified.

Open Indicator-Sysmonitor (it should show up as System Monitor Indicator in the menu), then click it on the panel and select "Preferences" and under "Use this command", enter this:

$HOME/scripts/sysmon

Close and re-open sysmon and it should now display upload and download speeds.

I start it automatically by System Settings -> Personal ->Startup Applications -> Add - and fill in the command as indicator-sysmonitor , the name as Netspeed Appindicator and the Description as Displays Download and Upload Speeds

12-16 May 2011

Fix to AppArmor to use a Firefox 4 profile on a separate drive/partition under Ubuntu Natty 11.04

I have always used a separate partition/drive for Data as well as having a separate partition for my home folder. When I upgraded to Ubuntu 11.04 I found none of my profiles would run under Classic Ubuntu or Unity. They still ran perfectly when I used the 'straight' Firefox 4 firefox-mozilla-build from the Ubuntuzilla PPA but that did not integrate with the Unity so that was not a long term solution. The error message on trying to start Firefox was:

Firefox cannot use the profile "??????" because it is in use. To continue, close the running instance of Firefox or choose a different profile.

This message is apparently given if the profile is locked or if the profile can not be found. It is clearly not a stale lock file as it also occured when I created a new profile so it would seem Firefox cannot find or has access blocked to the Profile.

I evetually narrowed the problem down even further and found my existing profiles would run in the default location ~/.mozilla/firefox or in a sub-folder below that location but nowhere else even via a symlink in ~/.mozilla/firefox. I could only create new profiles in the same locations. [ Click to reveal all the stages I then went through before finding the probable solution ]

I have edited profiles.ini to see if it is related to the IsRelative addressing and that is not the cause as one can change a relative to absolute location without problems.

I was baffled so I sought advice on AskUbuntu which is a very useful resource. There were some useful initial suggestions of what to try including the new stand alone Profile Manager and to use a Symlink from the default folder to where I have my profiles.

I tried a symlink from .mozilla/firefox to my normal folders on my DATA drive and again I can not access the profile in the folder to which the link has been set although I can use firefox -P to set up an entry in profile.ini which looks correct.

ln -s /media/DATA/Profiles/ ~/.mozilla/firefox/linktodata

I also tried a symlink to a folder under ~/.mozilla/firefox and that worked perfectly.

This was now looking like a very serious problem as the common use of a profile on a USB stick is ruled out completely if the symlink approach does not work.

My next approach was to try it on clean install which never had firefox-mozilla-build installed - I had to use a LiveCD as I only have one machine currently available to experiment with. Again I could not access the profiles.

The breakthrough came with a suggestion on AskUbuntu that I checked the AppArmor-Profile for Firefox. AppArmor ("Application Armor") is a security module for the Linux kernel designed to proactively protect the operating system and applications from external or internal threats, by enforcing good behavior and preventing application flaws, even unknown ones, from being exploited. AppArmor security policies completely define what system resources individual applications can access, and with what privileges. AppArmor works by implementing security profiles (apparmor-profiles) that restricts the capabilities of protected programs. Ubuntu has included AppArmor since 7.10 but up till now the apparmor-profile for firefox has present but not enabled.

This looked a likely cause of my problems but it took a lot of searching and background work over many days before I came up a very short and easy long term solution. [ Click to reveal all the background, detailed commands and terminal output from configuring AppArmor. ]

sudo ln -s /etc/apparmor.d/usr.bin.firefox /etc/apparmor.d/disable/
sudo apparmor_parser -R /etc/apparmor.d/usr.bin.firefox
This has restored the behavior to what I expected and firefox now works with profiles in any location. The suggestions I got from AskUbuntu especially from lovelinux were of great assistance.

If you want to find out which programs are 'protected' then, in a terminal

The terminal command to switch to Complain (rather than Enforce) mode where errors are only logged to /var/log/messages is:

sudo aa-complain /etc/apparmor.d/usr.bin.firefox

You can watch the /var/log/system file by

tail -F /var/log/messages

The following AppArmor profile is my effort to try to enable access to removable drives and other mounted under /media. It follows an earlier version of the apparmor profile for the changes which I found in a fascinating and flaming thread ( https://bugs.launchpad.net/ubuntu/+source/firefox/+bug/592121 ) where these lines had been criticised for allowing too much latitude! I have tighten up everything much more and it is much better than just disabling the firefox apparmor profile totally.

I have left wider options available in my listing below but commented them out. I have ultimately restricted full access to just folders under a folder called Profiles on any drive mounted in /media which covers extra my extra DATA drive, USB sticks and encrypted volumes. I have retricted other folders to read access only. My only uncertainty is whether this will need to be repeated every time firefox is updated.

The following terminal printout shows a status request (sudo apparmor_status) before re-enabling with the new profile after which it is placed in Complain mode where errors are just logged ( aa-complain /etc/apparmor.d/usr.bin.firefox ), then another status and finally placing a 'tail' on the log file ( tail -F /var/log/messages ) to display any errors whilst I tested firefox

The final step in this long saga was when I discovered that the #include lines in the apparmor profile are not includes which were commented out but the actual include statements. I could therefore use the facility to put any modifications into the file /etc/apparmor.d/local/usr.bin.firefox - this means that changes are not made in a system file which could be changed during an upgrade of firefox.

The bottom line is that any local modifications required to the 'policies' used by apparmor for firefox can just be added to the file /etc/apparmor.d/local/usr.bin.firefox and will remain in force through any system and firefox upgrades . In my case I want to allow access to the folder Profiles on any fixed drive, USB drive or encrypted volume from Truecrypt mounted at /media and read access to the whole of those drives

Edit the file in a terminal by:

sudo gedit /etc/apparmor.d/local/usr.bin.firefox

The resulting file in my case was:

# Site-specific additions and overrides for usr.bin.firefox.
# For more details, please see /etc/apparmor.d/local/README.

# Additions made by Peter Curtis 16 May 2011 to access profiles
# on removable media,additional filesystems and encrypted volumes
# in folder Profiles and to have read access to everything.

/media/** r,
owner /media/*/Profiles/** wmk,

Firefox has so far worked exactly as expected and required under Ubuntu 11.04 since this addition to /etc/apparmor.d/local/usr.bin.firefox whilst enjoying a high degree of protection from AppArmor.

18th May 2011

Taming Unity with Compiz

Unity has very efficient interface in terms of increasing the real estate available for Applications but it lacks far behind in offering even the most basic facilities. For years I have told beginners that if they they were ever uncertain how to do something then right clicking would almost inevitably give them a route to do it - just try that on a Unity launcher Icon. The answer lies in Compiz

Compiz is a compositing window manager for the X Window System that exploits most current 3D graphics hardware to create fast desktop effects for window management. A window manager is software that draws a graphical user interface on a computer display – it positions windows, draws additional elements on windows (such as borders and title bars), and controls how windows interact with each other, and with the rest of the desktop environment. With earlier window managers, each program was responsible for rendering its own window directly to display memory. A compositing window manager, however, combines the buffers of each window into a unified framebuffer representing the entire screen.

Compositing window managers such as Compiz can perform additional processing on the buffered windows, applying 2D and 3D animated effects such as fading, scaling, rotation, duplication, bending and contortion, shuffling, blurring, redirecting applications, and translating windows into one of a number of displays and virtual desktops. Computer graphics technology allows for visual effects to be smoothly rendered in real time such as drop shadows, live previews, and complex animation. Since, technically, the screen is double buffered, it does not flicker during updates. The most commonly-used compositing window managers for Linux are Compiz, KWin, and Mutter. Compiz can replace the default managers (Mutter in GNOME and KWin in KDE) because it conforms to the Inter-Client Communication Conventions Manual standard.

Compiz has split and rejoined in the last 6 years and now has all the developments from Beryl and Compiz Fusion back under the same roof. The best source of information is the Compiz Wiki wiki.compiz.org and the description of window managers above draws heavily on wikipedia.

In Compiz, the effects, are implemented as loadable plugins. Compiz plugins include many advanced effects as well as simple features such as Alt-Tab application-switching with live previews or icons, and a feature similar to Exposé. The projuect has been given a big boost now Canonical Ltd. has hired Sam Spilsbury, lead Compiz developer, to further develop Compiz for Ubuntu.

Unity was initially designed for netbooks and related touch-based devices. It includes a new panel and application launcher that makes it fast and easy to access preferred applications, such as the browser, while removing screen elements that are rarely used in mobile and netbook computing.

Unity has a vertical task management panel on the left-hand side and a menu panel at the top of the screen. Using a sidebar for task management conserves vertical screen space, which is much more valuable on a widescreen netbook. The task panel displays icons for commonly-used applications and programs that are currently running. Clicking on an icon will give the target application focus if it is already running or launch it if it is not already running. If you click the icon of an application that already has focus, Unity will activate an Expose-style view of all the open windows associated with that application.

Unity depends on Compiz to provide much of its functionality which has been lost from the panels to save valuable space. It is Compiz which enables you to move or resize windows, to switch workspaces, to switch windows easily and so on. The lose of the panels and panel space does come at a cost and I find that one is currently far more dependent on the keyboard and keyboard short cuts than in previous Ubunty releases although Unity/Compiz is looking to satisfy touch screens much more.

Many of the actions which have moved from a panel to a keystroke have actually been present for a long time through earlier versions of Compiz. The Super D shortcut to toggle revealing the desktop works almost the same in 10.04 as does Super W to Expose all the active windows and Super s for Workspace Switching.

First we must load the Compiz Configuration Settings Manager so search for compizconfig-settings-manager in the Synaptic Package Manager and install it. In 10.04 it will appear in System - Preferences and in 11.04 in System Settings (bottom of drop down on far right top icon) -> Personal - in both cases as CompizConfig Settings Manager. This will reveal the full power and complexity of Compiz. Most of the functions and effects are via plugins and you will see each has a tick box to enable it. There are a few features which are built in and these are accessed under General -> General Options (which is the only icon lacking a tick box). This contains many of the basic key-bindings which glue the system together including Super D for 'Show Desktop' which it took me ages to find.

Enhancing Show Desktop (Super D)

Having talked about Super D being 'bound' to the 'Show Desktop' action I will use this as the first example of an enhancement to Compiz for Unity. In the old days 'Show Desktop had a button on the left of the bottom panel - now we have to use Super D on the keyboard. However we can also bind to mouse gestures susch as a rapid mouse movement to a corner or side. So now lets replace the button by a rapid mouse movement to the bottom left corner - a reasonably safe place. In standard desktops (non Unity) you need Normal Visual Effects enabled for this to work - this requires a medium power graphics board Right click on the desktop -> Desktop background -> Visual Effects tab.

Open CompizConfiguration Settings Manager -> General -> General Options -> Key Bindings tag and scroll down to Show Desktop where you will find there are two lines one with a keyboard symbol and the other with a screen symbol. The keyboard is set to Super D and the screen is disabled. Click on the disabled and a little window appears showing the 'hotspots' - click on the bottom left which will turn green and thats it. Now when you move the mouse quickly to the bottom left corner everything will disappear! Do it again and after a couple of seconds it will be back. It can be mixed with Super D. This is not something to do on a shared machine - the unexpected and sudden loss of all your windows after a mouse movement causes panic in the average user especially when there is no obvious way back.

Changing the Number of Workspaces

Open CompizConfiguration Settings Manager -> General -> General Options -> Desktop Size and change Horizantal Vertual Size and Vertical Virtual Size (NOT Number of Desktops) to give the number and layout you want.

Enhancing the Window Picker (Super W)

The enhancement that transforms Unity for me is to the Super W action which uses the the Scale Plugin found under Windows in the CompizConfiguration Settings manager (CCSM). Here I have made 2 changes. Firstly under Key Bindings adding a TopRight 'gesture Initiate Window Picker for all Windows and ticked the box for Click desktop to Display Desktop.

We now need to enable two more Plugins. First enable Scale Addons found under Utility -> Appearance tab -> Window Title -> Window Title Display - Highlighted Window only. This displays the window title and workspace it is on when you hover over it in the Window Picker. The text display needs an addition Plugin enabled which is called Text and is found under Image Loading.

The Window Picker (Super W) displays all Windows on all Workspaces and now also works with a mouse gesture to top right and displays the Window Title and Workspace so it can be used instead of the Workspace Selection on the Unity Launcher and also to get to the desktop. you can get back from the desktop by Super D or my gesture to bottom left.

Ring Switcher (Super Tab)

If you switch Windows and use a lot of workspaces then you may want to enable the ring switcher plugin as an addition to the usual Window Switcher which is activated by Alt tab. It looks very pretty but I think it is actually less easy to use unless you have several similar windows and need a bigger image and a clear title to distinguish them. It probably needs the Text Plugin. If using it with many Workspaces then the Super Tab could be bound to All Windows and Workspaces instaed of using Super Alt Tab every time.

This is set in the Unity Plugin in the Compiz Window manager which is reached from System Settings (now under the 'Logout' button) -> CompizConfig Settings Manager -> Desktop -> Ubunty Unity Plugin -> Experimental -> Launcher Icon Size and set to 32 .

The Launcher can be kept fixed rather than being hidden by CompizConfig Settings Manager -> Desktop -> Ubunty Unity Plugin -> Behavior -> Hide Launcher and set to Never

The combination of smaller icons makes the use of Unity much quicker and easier, much more like the old panels.

TIPS

You can get your old fashioned gnome panels back on a temporary basis to enable you to, for example put a launcher on the desktop. Enter in a terminal:

gnome-panel

It will look a mess with the Gnome panels over the top of the Unity top panel but it will work for long enough to make sme desktop icons from the Applications menu. You can exit by Ctrl C in the terminal

Removing surplus entries from the Unity Launcher

I do not have a lot of space even with reduced size icons on my Unity launcher so I removed an number of the applications by just right clicking and unticking Keep in Launcher. This does not work for 'Places' or 'Applications' so I used the following method which I found on Webupd8

Reset Unity Launcher icons completely

If you want to reset the Unity Launcher icons to their initial state, run the following command:

unity --reset-icons

22 May 2011

Quicklists for Unity Launchers

It is possible to add items to the list of actions you have available when you right click on a Unity Launcher Icon. The default quicklist is just Quit, Keep in Launcher and the application or action although Places and LibraOffice Writer have some additional Quicklist items. See the best currently for specifications on the Unity Wiki . There is a simple tool described on Webupd8 and an excellent article at AskUbuntu - A list of custom launcher quicklists for unity . The tool will be very useful but is currently not foolproof so it is best to get an understanding of how to do it my hand before using the tool.

So what sort of quicklist items will save more time in the medium term than they take to create? One obvious for anybody doing system work is the ability to open additional terminals. Another couple are to add opening the file manager in your documents folder/drive and to open the file browser running as root which enable one to do almost anything with system files. The final ones I would pick out are additions to thunderbird to open in the address book or via the profile manager - there are dozens more which people find useful at AskUbuntu - A list of custom launcher quicklists for unity.

Before you start to edit your Unity Launcher Items you need to know about where the 'default' ones are stored and where the ones you have edited need to be stored to over-ride the defaults. Mostly you will find ones in the 'over-riding' folder already but sometimes you need to copy a fresh one in or you may wish to do so if you have messed up one so it does not work. Each of the launcher items is in a sensibly named file with the extension .desktop with the original/default for all users in /usr/share/applications/ and the modified versions which are user specific are in ~/.local/share/applications.

I am going to use a quicklist for 'Home Folder' as an example as it is well documented and the GUI tool does not currently work with it because an additional modification is needed. I am also going to add quicklist items that nobody has documented as far as I know for open nautalus as Root, Computer and Network as well as for my Data Drive

Copy 'Home Folder' launcher file to your home directory if it is not already present:

Log out and log in again to see the changes - you will see nothing until you have logged out and in. [ Click to reveal my latest complete file as of 23 May 2011

Instructions for installing the latest version of Wine 1.3 from the WineHQ PPA:

The WineHQ web site cautions that The 1.3 packages are beta packages. This, they say, means they will periodically suffer from regressions, and as a result an update may break functionality in Wine. If the stable 1.2 Wine version works for you, then you may not want to use these beta packages. Ubuntu Natty also offers 1.3 but these will be better tested but slightly earlier versions. I want to use the latest versions to see if the pproblems of compatibility with Unity get fixed.

12th July 2011

Bug Fix for Invisible Task List text in Lightning 1.02b in Thunderbird 3.1 when using 'Dark' Desktop themes such as Ambience - the default in Natty

The task list is impossible to read when certain themes are used with Lightning 1.02b. This bug https://bugs.launchpad.net/ubuntu/+source/lightning/+bug/703503 is caused by the text colour used for the items in the task list being displayed using the same default as menu items which is a very light colour with dark themes such as Ambience which has been available since Ubuntu 10.04 and is the default in 11.04 Natty. One way to avoid this is to make sure each task has been started when the display changes to green.

The best fix is to edit the file in the extension which determines the text colour. This is a .jar (Java Archive file) in Lightning 1.02b which has to be unpacked, the file changed and the file returned to the archive. The files are in the Thunderbird Profile which in my case has been moved to a separate drive and in a sub folder so it is at /media/DATA/Profiles/vortex-ubuntu/. You will need to change this string to point to your default profile in the terminal command below to something like ~/.thunderbird/xyz.default where xyz is a random 8 character string differing for each user. Note the " "s are important to avoid the {} being incorrectly interpreted. The following command opens the file in the Archive Manager on my machine.

You then need to navigate in the archive and edit the file located at /skin/calendar/calendar-task-tree.css and change the two occurences of MenuText to WindowText . This can be done from within the archive manager and when the edit is finished yiu will be asked if you want to replace the changed file into the archive.

The only problem at the present 12 July 2011 is that many of my favourite extensions have either not been updated or do not work properly with natty, thunderbird 5.0 and lightning 1.04b. At present QuickMoveButton is not updated to thunderbird 5.0 and Sync Kolab needs the Nightly to be installed and that upsets the thunderbird status bar. Otherwise it seems to be a significant step forwards and I will change on all my machines as soon as the extensions are working.

15th July 2011

Allowing Extensions not yet upgraded to Firefox 5 or Thunderbird 5 to be Installed

It is possible to fudge this for some extensions by editing a file in .xpi archive to increase the value of the maximum version of Firefox or Thunderbird that is allowed in the compatibility check. This seems to be successful for Thunderbird 3.1 to 5 in some cases but may have disastrous effects in the case of other version changes. I have done it for:

QuickMoveButton 0.2.3

British English Dictionary 1.19.1

Without any obvious problems so far

The procedure is to:

Backup your profile.

download a fresh copy of the .xpi

open it in the archive manager by right click -> Open with Archive Manager

Double click on install.rdf to open in gedit

Change lines like <em:maxVersion>5.0</em:maxVersion> to contain 5.0 as the new maxVersion

Save and close gedit then accept the offer to update the archive.

Close the Archive (.xpi file)

Within Thunderbird Tools -> Add-ons -> Extension and remove the existing add-ons which is disabled and restart Thunderbird

Install the modified version which should now be accepted and restart Thunderbird

Check everything is OK

NOTE on 30 December 2011 - There is a known bug in the latest version of the Archive Manager for Oneiric which prevents it recognising a .xpi file as an archive. The workround is to rename to a .zip before opening and rename back at the end to a .xpi

17th July 2011

Epson Printers, Scanners and 'All-in-Ones' under Ubuntu Linux

This is an update on my earlier Howto which described the steps necessary to use the Epson Perfection V200 Photo scanner with Ubuntu Hardy Heron which was based on an excellent Howto in Uellue's Blog. I have been using the V200 now for 3 years mostly under Ubuntu Lucid 10.04 and have had an Epson C66 printer for even longer which finally died and led to this update.

Epson SX515W All-in-One Multifunction Printer/Scanner

It is now very difficult to buy stand alone Printers or Scanners - most are 'All-in-One' Multifunction Devices. My old Epson C66 printer has been used via a wifi router as a wireless device so I looked for a printer offering wifi operation supported under linux. The other and main criterion was that I could get cheap ink cartridges. My hasty search led me to Epson once more and the SX515W printer was reduced in price at Argos to £59, offered Wifi and used the T0711 series of cartridges with the black available at 7dayshop.com for £8.99 for 10 and a full set including colour for £5.99 one off. But above all Epson offer good Linux support through their web site for both Printing and Scanning.

Wifi Setup on the SX515W - control panel details will be specific to the SX515W.

The SX515 is one of the modern Epson Printers which already has support built into Ubuntu for normal operation so although I downloaded ESC/P drivers from the Epson site for the first machine I found it was not needed on the others for direct USB cable or Wifi operation. In fact the majority of the work was in setting up the SX515W to connect to my Wifi Network via the small built in screen and keys - 26 long WEP key was a pain! The procedure is Setup -> Network Settings (two right arrows OK) - > Wireless Lan Setup (OK) -> Setup Wizard (OK) and follow instructions - you can Back out any time. The only difficult entry is the WEP or other key as the Menu key is used to select between Capitals, Lower Case and Numbers then the arrow keys and OK for the entries - all 26 in my case. I used an IP provided by DCHP but should have used a static one as next time the Wifi box is reset the IP may change so you need to know the range of IP addresses for your Wifi and choose one just outside or at the top of the DCHP range. The Wifi light should now be on. Once you have finished you can check the settings any time by Settings -> Network Settings (two right arrows OK) -> Confirm Settings (two down arrows OK) and scroll down through ( down arrows) then Back(s) till out of settings.

Epson Printer Drivers - should cover most if not all Epson Printers

The Printer and all other drivers are available on the Avasys - Epson Japanese vendor's site - this is much easier to navigate than it used to be but there are still a few things to note. Firstly there are several drivers for printers available in different sections. I loaded the driver from the link to Epson Inkjet Printer Driver (ESC/P) for Linux rather than follow the All-in-One Link as that was what I had used in the past. That presented a huge list and I picked the SX515W link and downloaded and double clicked to install it. That went fine. Later on I followed the links to All-in-One Printers and the print driver there would not install due to a dependence problem - there were scanner drive options to get round the problem with late copies of Ubuntu but not for the printer (but http://avasys.jp/eng/linux_driver/faq/id000613.php may give a way forwards). When I plugged in the USB connection the printer was installed automatically with just a notification - Linux has come a long way. On the first machine I did the driver install for Wifi using System -> Administration -> Printers and + Add Printer and then set up by hand. The next time I found that just selecting network was sufficient for it to go away and find the printer under 11.04 and I confirmed the same happened under 10.04! Forward then took me to an automatic search for the driver and all left was to edit any descriptions - I changed the port number to just be Wifi in the description. All trivially easy.

I have only tried these procedures on two scanners but other Epson scanners should work in a similar way, there is a list of supported devices on the Epson web site. The drivers provides support for 8 bit and 16 bit colour depth and 300, 2400 and 4800 dpi resolution when used by GIMP through Sane and an ImageScan! for Linux Scanner package from Epson.

Firstly a number of Ubuntu packages need to be added via System -> Administration -> Synaptic package manager and Search for each package and Install it. The packages are:

sane

sane-utils

xsane

All the drivers are available on the Avasys - Epson Japanese vendor's site. Choose your scanner/multifunction scanner/printer and your distribution, fill out the small questionnaire and submit the form. You are directed to a download page.

From now on it will be a little different for a pure scanner or an All-in-One multifunction device

Scanner Only Example V200

To install the three .deb packages either just double click them or use dpkp from the folder containing them - note the iscan-data must be installed first and that you need the package with ltd7 in the name - the version numbers will probably have increased:

The third iscan-plugin package is a scanner specific extension only required for some scanners, most do not need it.

Multifunction Printer/Scanner Example SX515W

This part of the web site also offers print drivers but they need an extra library not in latter versions of Ubuntu as it has been superceded so use the ESC/P printer as described above in preference (although http://avasys.jp/eng/linux_driver/faq/id000613.php may give a way forwards if you want to experiment)

Now you need to download and install the scanner driver files. The procedure is well documented but note the one with iscan-data must be installed first and that you need the iscan package with ltd7 in the name.

You will note that the files in this case are the same as for the V200 and in the case of the SX515W a plug-in is not required.

There is no mechanism to update these files and the only way is to uninstall the old version and install the new from the .deb. After doing that I found the set up above runs both my scanners, depending on which is plugged in/turned on, through 'ImageScan! for Linux' but we are getting ahead of ourselves.

There is a third file available for download to enable one to access the scanner via Wifi. I have not installed it as there seems no point in scanning remotely - I use USB cables to the desktop machine closest to the scanners and plug/turn on the one I want to use. If I need to scan onto a laptop or netbook I can carry it to the scanner.

Common to both

Now plug in and switch on the scanner and use lsusb in a terminal which should show the scanner. The output will look like this for V200:

Now use the utilities from sane-utils in a terminal. First use sane-find-scanner to check whether Sane finds the device. With scanimage -L you can find out if the driver is properly installed. The output looked like this for the V200:

pcurtis@triton-ubuntu:~$ sudo sane-find-scanner

# sane-find-scanner will now attempt to detect your scanner. If the
# result is different from what you expected, first make sure your
# scanner is powered up and properly connected to your computer.

# No SCSI scanners found. If you expected something different, make sure that
# you have loaded a kernel SCSI driver for your SCSI adapter.

found USB scanner (vendor=0x04b8 [EPSON], product=0x012e [EPSON Scanner]) at libusb:004:003
# Your USB scanner was (probably) detected. It may or may not be supported by
# SANE. Try scanimage -L and read the backend's manpage.

# Not checking for parallel port scanners.

# Most Scanners connected to the parallel port or other proprietary ports
# can't be detected by this program.
pcurtis@triton-ubuntu:~$ sudo scanimage -L
device `epkowa:libusb:004:003' is a Epson Perfection V200 flatbed scanner

and for the SX515W

pcurtis@triton-ubuntu:~$ sane-find-scanner

# sane-find-scanner will now attempt to detect your scanner. If the
# result is different from what you expected, first make sure your
# scanner is powered up and properly connected to your computer.

# No SCSI scanners found. If you expected something different, make sure that
# you have loaded a kernel SCSI driver for your SCSI adapter.

found USB scanner (vendor=0x04b8, product=0x0856) at libusb:001:005
# Your USB scanner was (probably) detected. It may or may not be supported by
# SANE. Try scanimage -L and read the backend's manpage.

# Not checking for parallel port scanners.

# Most Scanners connected to the parallel port or other proprietary ports
# can't be detected by this program.

# You may want to run this program as root to find all devices. Once you
# found the scanner devices, be sure to adjust access permissions as
# necessary.
pcurtis@triton-ubuntu:~$ sudo scanimage -L
device `epkowa:usb:001:005' is a Epson Stylus NX510/SX510W/TX550W Series flatbed scanner

Requirement to be member of Scanner Group: Depending on your exact installation only root may have access to the scanner although my original user was already in the scanner group. To allow other users to access the scanner, they must be members of the scanner group which has been renamed to saned in 9.10. You can do this by using System -> Administration -> Users and Groups -> Click to Unlock -> Groups and look for scanner or saned -> Click Properties and tick your username. You then need to reboot after adding the extra member.

After that my scanner works fine and can be accessed via GIMP and can also be accessed directly by xscanimage or xsane. Kalmic and the new driver package between them give you two direct routes to scanning from the Applications -> Graphics menu - Xsane which is a multiwindow application with many options and tweaks to the scan and a simpler package ImageScan! which seems to be part of the Avasys Driver download, to quote Avasys:

Image Scan! for Linux

You will find Image Scan! for Linux has been installed under Applications -> Graphics at the same time as the Epson Scanner Drivers. It makes it easy to obtain high quality images on Linux with an EPSON scanner. It:

provides an easy to use graphical user interface to all the scanner settings and image manipulation options

supports scanning of negatives and slides as well as scanning multiple documents from an automatic document feeder (ADF)

supports scanning via a network connection

can be used as a GIMP plugin so you can edit your scans right away

interfaces seamlessly with "Photo Image Print System for Linux" for high quality printouts

Scanning over the Network with Image Scan! for Linux

To set up your device for scanning via its network interface, follow the steps outlined below:

Download and install the latest version of Image Scan! for Linux from here.

If your device has a supported network interface, the iscan-network-nt plugin will also be available for download. Download and install the version appropriate for your system.

Now configure your device for network access. You need to set or obtain the IP address of the device. Please consult the product manual for details on how to do this.

Configure Image Scan! for Linux to connect to your device by editing /etc/sane.d/epkowa.conf. You need administrative privileges to do so. Read the instructions in the file about network configuration and add an entry for your device as indicated.

Finally, disable the conflicting epson2 SANE backend. You can do so by changing the line consisting of "epson2" to "#epson2" in /etc/sane.d/dll.conf. This will require administrative privileges.

Conclusions on Epson Drivers for Linux

Epson are obviously trying very hard to support all their printers and scanners including the multifuntion printer/scanners which have been a problem in the past. The terms and conditions seem to be consistent with true Open Source Software. One wishes everyone else gave such good support.

4 August 2011

MediaTomb Server and the Humax HRD Fox T2 500 Gb

Introduction

We have bought a fancy High Definition Video Recorder which offers many additional features including the ability to access video, photo and sound files over a network. I am using MediaTomb as a server for this data. The MediaTomb for Ubuntu is set up slightly differently to the standard version and is configured to run as a Daemon which is started during the init.d sequence and runs as user mediatomb. This default gave some problems to me because I have my media files on a removable drive and:

I could not access files on the drive because of permissions when it was a NTFS volume as it was mounted with read permissions only for the current user. I could get round that by formating and mounting as a ext3 drive and setting the permissions to give read access to Others which allowed it to work in Daemon mode.

The daemon was started before the drive was mounted so it could not be found initially and the database was cleared. This needed the daemon startup to be removed from the the init.d sequence and the program started manually from a terminal or launcher. This also meant that the server was running as the same user as the one who had mounted the drives so now all drives and contents are accessible

The Humax is very choosy about the file formats it will play - it will play many formats but the number where the 'controls' to allow stepping forwards and back and pausing are strictly limited and undocumented. The good news is that all my 'captures' from my old Video8 tapes (360 Gbytes) are in one of the few formats that plays. The bad news is that all the files ready for authoring into DVDs are .vob files which will not play but I have a way of transcoding them which does not degrade the video stream which is copied unchanged into a new container with a converted audio stream - the cost is 80 Gbytes extra storage. Standard jpeg files can be put into a slide show which adds another 67 Gbytes. Audio is less important for the Humax at present but tests show that audio .mp3 files are handled perfectly and there is a sophisticated indexing allowing selections to be made.

About MediaTomb and how it is used.

MediaTomb is an open source Universal Plug and Play (UPnP) MediaServer complient with the required sections of the V 1.0 specification. A UPnP server allows one to stream digital media, usually from a local hard disk on the server, through ones home network for listening to/watching on a variety of UPnP compatible devices. Humax is advertised as being DLNA (Digital Living Network Alliance) compliant MediaRenderer (player). In practice these 'standards' are very similar so the Humax HRD Fox T2, being a DLNA complient player, ought to be able to browse, request and play audio, video and photos over a network from a UPnP server such as MediaTomb.

MediaTomb is somewhat differently to most programs - it can either be started either as a daemon running in the background when the machine is booted up or as a program started from a normal launcher or in a terminal. In both cases it is then almost 'invisible' - there is not even an icon in the status panel to show it is running. Whlst running, access is purely through the network and control is through a web interface connected to the IP address and port on which it is serving the media. Selection of the media for the database can therefore be from any machine on the network. In a similar manner 'Players' browse over the network the media which is available in the database and select what to play. In practice MediaTomb can serve far more media formats than the Humax can play. The initial configuration is almost entirely through a single options file after which you point your browser at the relevant Address and Port (usually port 49152) where you can view your local filesystem and chose which files and folder structures from which you will make selected classes of media available using a tree view of the database and the file system. The local database can updated on a regular timed basis or whenever a file or folder is added, removed or changed. The initial or timed scanning takes a significant time.

The Mediatomb Web Interface is accessed through your normal browser. You can provide the address in several ways:

192.168.2.234:49152

http://computername:49152

file:///.mediatomb/mediatomb.html

The first way using a standard IP address and port will change depending on the address allocated to your computer and will change everytime your router is turnered on and off. The second way uses you computer name depends on the software being enabled on your machine to resolve it. The third uses a file which is kept up-to-date by mediatomb itself so is ideal for the machine running Mediatomb.

You have two views options for the left panel - filesystem and database. You choose the folders to include in the database in filesystem view using the icons at the top of the right panel which produces a form to fill in - choose the Inotify Basic Recursive options. Then check what you have in Database view - it may take a while to complete the scan and fill it all in. I have my photo and video files on one USB drive and the audios on another.

Preventing Ubuntu 11.04 version of MediaTomb being run automatically as a daemon.

The version supplied with Ubuntu has been set to run as a Daemon and is started during the boot process automatically once it has been installed and run the first time. This may not be what you want so the first stage is to prevent the Daemon being started. The script which starts the mediatomb Daemon during the boot process is in /etc/init.d . A quick and dirty way to stop it being run is to change it from being executable by changing the permissions:

sudo chmod 0644 /etc/init.d/mediatomb

MediaTomb Configuration files

The MediaTomb runs in slightly different ways and has the configuration files in a different place depending on whether it is run as a Daemon during system bootup or has been run by a user.

It is now time to make some changes in the configuration file which is ~/.mediatomb/config.xml when run by a user.

gedit ~/.mediatomb/config.xml

All the important changes are at the top of the file and are in red below:

The first change is to enable the user interface via the web - it was not enabled on my version by default.

The second change is optional and just changes the name of the server which is seen from the clients.

The third line is an addition and fixes the port used to be 49152 rather than the first available starting at 49152 - this also prevent multiple copies on increasing ports. This will need to be different if you have servers on several machines

The choice of database is set to sqlite3 by default - this is the best option but note you need to have sqlite3 installed so check using the Synaptic Package Manager and install the sqlite3 package if required.

Using media on a USB drive in MediaTomb.

USB drives are normally mounted late in the booting process and after the user has logged in. They are mounted by the file manager - Nautilus in Ubuntu and Thunar in Xubuntu and the permissions only allow access by the user who was first logged in. This gives two problems when a Daemon is started during boot process - firstly the drive is not mounted by the time Mediatomb has been started and the database is first accessed and is then cleared. Secondly Mediatomb is run in the mediatomb group and drives mounted this way do not have the permissions for the mediatomb daemon to access them.

This worked well for me on Ubuntu 10.04 and 11.04 and I could get an early mount with the correct permissions for MediaTomb to run at startup in daemon mode however there are some serious disadvantages. One Must have the USB drive plugged in or the boot-up needs intervention to continue when the drive is not found and even if you then plug it in it will not mount through nautilus (only checked in U10.04) although it is still possible to mount it through the mount command in a terminal. I also discovered to my surprise that fstab does not like mount point folder names which have spaces even if you quote them in fstab (again only checked in U10.04). I have used 'defaults' and auto detection for the drive so my filesystem table (/etc/fstab) now looks like:

Starting Mediatomb with a delay after login is complete

The solution I have adopted is to start Mediatomb by using a script which I add to the users Startup Applications using System Applications -> Startup Applications -> Add and filling in the boxes.

The reason to use a script rather than just entering the program name is so I can add a long delay before the program is started to ensure the drive is mounted. I keep all my scripts in ~/bin and have added that folder to the PATH Environment Variable so it can be called just by name but if you do not want to modify ~/.bashrc by adding the liine PATH=$PATH:~/bin to the end you can specify the full path in the Startup Application details.

My additions to the end of ~/.bashrc so I can run scripts in ~/bin are:

The script itself is very simple and the following can be copied into ~/bin/delayed_mediatomb using gedit.

gedit /bin/delayed_mediatomb

And paste in the following

#!/bin/bash
# Script to copy start mediatomb as a daemon after a 40 second delay.
# Lives in ~/bin/delayed_mediatomb where it must be given execute permissions
# and ~/bin should have been be added to to #PATH in ~/.bashrc
# by adding the line
# PATH=$PATH:~/bin
#
sleep 40
mediatomb -d

The file needs to be made executable

chmod 777 /bin/delayed_mediatomb

Now when I start the machine mediatomb is started and all my settings are preserved as the USB drives which contain the media files are alredy mounted.

More about Media Streams/Files

Media files are very large so that it is impossible or impractical to transfer them in their entirety between machines before playing them. The information is therefore requested as required and streamed from the server to the player. Depending on the server/player and type of file/stream it may, in order of complexity, be possible to pause, step forwards and backwards or fast forwards and back. Again, as a generalisation, it is easier to control a local file than one provided from a server. Most video media contains a number of streams, the audio, the video and sometimes other streams with, for example, subtitles or alternative audio streams. Almost all media is heavily compressed and there are many alternative formats for the audio and video streams in the same way that pictures may be in jpeg, png gif, etc formats. Within, say a video format, there are a huge number of options - some obvious like the size 720x578 or 1920x1080, the frame rate and whether the stream is interlaced. Others are more complex such as average, maximum and minimum bandwidths when variable bandwidth encoding is used and some which a normal person has great difficulty in understanding at all. If you want to get an idea of the complexity of the modern standards have a look at http://en.wikipedia.org/wiki/H264 for the latest video format H264. Again there are different audio formats and parameters for the streams, Dolby, Stereo, MP3, OGG etc with variable and fixed bandwidths. The audio and the video streams are not, of course, independent and need to be played in synchronisation so they are in a container - what you normally see is just a container such as AVI, MPG, TS, VOB. Startup Applications

Converting between Audio and Video Formats

There are many options for file convertors, some are gui based and are often part of a video player such as VLC but the best way is often to call the underlying conversion programs which usually means use of a terminal. perhaps the best of all is ffmpeg which many other programs use. This is what I have been using to convert VOB (.vob) files (containers) to MPG files (containers with extension .mpg) and whlst changing the format of the audio stream but leaving the video untouched as any changes seemed to lead to a stuttering video playback.

ffmpeg -i "/media/WD400EXT3/VOB Files for Authoring/The Thorn Birds Volume 4.vob" -f mpeg -vcodec copy -acodec mp2 -ab 384k -ar 48000 "/media/WD400EXT3/VHS Copies for Humax/The Thorn Birds Volume 4.mpg"
This is actually a very simple example! The input parameters for the file are automatically detected from the input file specified by -i filename and normally the container or output format is specified by the extension of the output file, in this case .mpg. In this case the output'container' is also forced by the -f mpeg parameter. The video codec is set by -vcodec copy to a straight copy and the audio codec by -acodec mp2 The audio sample rate is set by -ar 48000 and the badwidth by ab 384k .

The transcoding can be seen to start when mediatomb is run in a terminal and a mpeg or vob file accessed but fails shortly into ffmpeg

djmount - a UPnP Client for Linux which mounts as a FUSE File system

I have had difficulty in identifying a client for UPnP for Linux. The best seems to be a very old utility called djmount which mounts as a Linux filesystem (using FUSE (File System in User Space)) the media content of compatible UPnP AV devices. The Audio and Video content on the network is automatically discovered, and can be browsed as a standard directory tree.It is available through the Ubuntu Software Center or Synaptic and needs the FUSE utilities to be installed. Mine seemed to be installed by default on 10.04 and 11.04 but check. You need to run in a terminal and to specify a mount point which needs to be set up with permissions to access for all users. I created a new folder /media/UPNP_APV and set up the permissions. This is best done in a terminal.

sudo mkdir /media/UPNP_APV
sudo chmod 777 /media/UPNP_APV

I could then mount the UPnP server by

djmount /media/UPNP_APV

The server should now be visible in /media/UPNP_AVP and as we are in a terminal it is worth checking:

We can see the server called Triton is mounted and the standard folders from MediaTomb are below it and have sensible permissions.

It should be possible to add the program to the autostart list but it might need a delay as for mediatomb

9 August 2011

Xubuntu 11.04 on the Toshiba Portege 3440 laptop

I still have a 1998 Toshiba Portege 3440 laptop, a very fine machine in its day which we obtained from Christine in NZ when it became time expired with Windows. It started life with Windows 98SE nad then gained its maximum memory (192Mbytes) and a 30 Gbyte hard drive when it was converted to Windows XP Pro. I used it for several years and in 2006 it was dual booted with Ubuntu Dapper Drake 6.06 and was finally relegated to playing media into our hifi. It has now run out of updates for 6.06 and the automatic upgrade did not work so I looked for a version of Ubuntu which I could load into 192 Mbytes off an alternate CD even if it was incapable of running a LiveCD. Xubuntu seemed the logical choice. So I downloaded an iso of the alternate CD.

The Portege 3440 does not have a built in CD drive but I have the additional bus extender with a CD, extra USB 1.1 port, VGA output and parallel port so I set off with the alternate CD. It died part way through just after it had detected all the devices and complained it could no longer find the CD. After a bit of head scratching I decided to add an USB CD/DVD drive through a powered USB 2 PCMCIA card and although it could not boot from it I found that when I got to the point where it lost the bus extender CD drive I could move the CD across to the USB drive it had just detected and carry on - a big sigh of relief as by then I had no way back.

It is a bit slow with Xubuntu but quite usuable for what I want despite only being a 400 Mhz machine with 192 Mbytes of memory. Whilst I was 'exploring' I had one panic as the upper and lower toolbars completely disappeared and did not return on a reboot. I tried a new user then loaded gnome panel whilst I was looking for a solution which made it very like the standard See Tip below on running gnome-panel for a session. If you want to run it for longer then you can add it to the startup programs. Ubuntu and I eventually found that if I deleted ~/.xfce4 completely it was forced to reconfigure Xubuntu from scratch and everything returned. I rather like Xubuntu - it is a much better interface than Unity and offers a slightly bigger screen area.

I uninstalled gnome-panel and also removed all its dependencies - there is an apt-get incantation which I must look for which came up as an option when I uninstalled gnome-panel. I have loaded gedit and nautilus as all my terminal strings on the web site depend on them. I also stopped as many of the start up programs as I dared to cut down memory use. I have installed rhythmbox 12.1 as a player which brought in quite a lot of dependencies and also the standard gstreamer plugins so I can play mp3s. I have not documented everything as much as I should have so I need some backfilling before I ever repeat it.

The Portege does not have an Ethernet port, Wifi and only a single USB1.1 conection so I have a powered PCMCIA card providing two USB 2 ports and a Firewire port. This allows me to connect a 120 Gbyte WD Passport portable drive and a USB Wifi dongle which is an Edimax EW7711UAn high gain 802.11n 150 Mhz adaptor with a little built-in antenna which can be adjusted - £10.99 from 7dayshop.com.

One thing I have done to help with the lack of memory is to try to reduce the use of the swap file as I can hear there are a lot of disk transfers. There is a parameter called swapiness which is normally reduced on netbooks using solid state memory which wears out faster than a hard drive! See Performance tuning with ''swappiness'' Swappiness controls the tendency of the kernel to move processes out of physical memory and on to the swap disk. As disks are much slower than RAM, this can lead to slower response times for system and applications if processes are too aggressively moved out of memory and wear on solid state disks.

swappiness can have a value of between 0 and 100

swappiness=0 tells the kernel to avoid swapping processes out of physical memory for as long as possible

swappiness=100 tells the kernel to aggressively swap processes out of physical memory and move them to the swap cache

Xubuntu uses a default setting of swappiness=60

Reducing the default value of swappiness will actually improve overall performance for a typical Ubuntu desktop installation. There is a consensus that a value of swappiness=10 is recommended for a desktop and 60 for a server.

To check the swappiness value

cat /proc/sys/vm/swappiness
For a temporary change (lost on reboot) with a swappiness value of 10:

sudo sysctl vm.swappiness=10

To make a change permanent you must edit a configuration file:

sudo gedit /etc/sysctl.conf

Search for vm.swappiness and change its value as desired. If vm.swappiness does not exist, add it to the end of the file like so:

vm.swappiness=10

Save the file and reboot.

At present the system grinds to a halt with 30 second breaks in the music if I run Firefox and Rhythbox together - I will try various values 25 seems about right.

Tricks when running programs from the command line eg gnome-panel

If you just open a shell and run a command, then the program or process is "owned" by that shell. When you kill a parent process ( the shell), all of its children are killed too.

What you need to do is type:

gnome-panel &
disown %gnome-panel

The & starts the panel as a background process (letting you still type at the terminal), and the disown command separates (disowns) the panel process from the terminal, so that when you close the terminal, you don't lose the panel. This is also useful when you run gedit or nautilus. Beware - if you exit the terminal before disowning or closing a copy of gedit you may get no warning about unsaved content when you close the terminal.

nautilus &
disown %nautilus

Firefox and Thunderbird Extension Updates to Version 6

Firefox and Thunderbird have gone onto a regular version update calendar which means that every extension has to be updated every few months. If the extension is not updated to include the new version in the range of versions under which it will run it will be disabled. It seems that the changes this time are minor and may not effect most extensions. There are two ways round this problem:

Edit a file in the .xpi archive before you load it. I covered that in my Diary part 19 but the folowing is much simpler.

Add a new extension which enables you to run the extensions. This is intended for testing and reporting but gives a short term solution until the extensions are updated. To quote: "After installing the Add-on Compatibility Reporter, your incompatible extensions will become enabled for you to test whether they still work with the version of Firefox or Thunderbird that you're using. If you notice that one of your add-ons doesn't seem to be working the same way it did in previous versions of the application, just open the Add-ons Manager and click Compatibility next to that add-on to send a report to Mozilla." This is a slightly risky solution so make sure you back up your profile first. If it all goes pear shaped you can start Firefox/Thunderbird in Safe Mode to disable everything again by using a terminal command:

firefox -safe-mode
thunderbird -safe-mode

Search for "Add-on Compatibility Reporter" and install as usual from Tools -> Add-ons -> Drop down list to left of the search box after you have downloaded it. It is the same for Firefox and Thunderbird.

Clearing the Rhythmbox Library

I have been moving my music library from one drive to another and onto the djmount and I have noticed that there isn't any clear way to change library locations once you have set them - you still have all the old locations in your music library as well as the new ones.

Deleting the file ~/.local/share/rhythmbox/rhythmdb.xml should just remove the music database and when you reopen Rhythbox it should rescan the new location.

rm ~/.local/share/rhythmbox/rhythmdb.xml

The remainder of the configuration can be cleared by removing these folders - they will be replaced next time Rythmbox is started:

Clearing the Gmusicbrowser Library

I have had the same trouble with Gmusicbrowser as Rhythmbox when moving my music library from one drive to another and onto the djmount and I have noticed that there isn't any clear way to change library locations once you have set them - you still have all the old locations in your music library as well as the new ones.

The Music database and other settings are held in ~/.config/gmusicbrowser. If you delete this folder all the settings should be restored to that of a fresh install when you restart. The database file is called gmbrc and it may be possible to just edit (delete all the lines in the section called [songs] and retain your settings. But the simple way is to completely halt gmusicbrowser and:

rm ~/.config/gmusicbrowser

Secure access to a Remote File System using SSH and SSHFS (Advanced)

SSHFS (SSH File System) uses SSH to mounting a remote filesystem on a local machine. SSHFS uses FUSE (Filesystem in Userspace) which is included in Ubuntu and authenticates connections so only those who are authorised can mount them. SSH connections are encrypted, no one can see your files as they are transferred over the network and once mounted the FUSE filesystem is owned by the user that created it and other users on the local machine can not access them.

Firstly we must install sshfs using the Synaptic Package Manager by System -> Administration -> Synaptic Pacakage Manager -> Search for sshfs, Rigtht Click and Mark for Installation -> Apply.

Secondly add yourself to the fuse group by System -> Administration -> Users and Groups -> select user -> Properties -> User Privileges, then tick the following option:

Allow use of fuse filesystems ...

Once you have added yourself to the fuse group, you need to either log out and log back in again or reboot for the change to take effect.

There is a risk that your ssh session will automatically log out if it is idle. To keep the connection active add the following parameter to ~/.ssh/config or to /etc/ssh/ssh_config on the client.

ServerAliveInterval 15

This will send a "keep alive" signal to the server every 15 seconds.

Using sshfs in a Terminal

A local mount point must exist and have permissions set for you to use it before you connect. If you have it in your home directory you can use the file manager to create the new directory which will have the correct permissions.

Assuming that you have ssh installed and the server running on the remote machine you now just need to run the sshfs command to mount the remote directory. In a terminal type:

The idmap=user option ensures that files owned by the remote user are owned by the local user. If you don't use idmap=user, files in the mounted directory might appear to be owned by a different user.

You can not unmount a FUSE file system mounted this way in a terminal using eject or unmount from a right click or nautilus; To unmount you again have to use the terminal and do:

fusermount -u ~/localfolder

Using ‘Connect to Server’ in the Nautilus file browser with the SSH option

An Alternative way to mount a secure remote file system is to open the Nautilus file browser then File -> Connect to Server and select SSH from the drop down menu. Fill in the server name and other parameters as required. This way will give you a mount on the desktop and you can unmount by a right click -> Unmount Volume. You still need SSH on both machines and the fix to the Hostname resolution problem using winbind covered above. I am not sure if you also need the keep alive signals as I already had the fix in place.

If this fails with a timeout error try deleting or renaming ~/.ssh/known_hosts - you will get a message saying that it is a new host you are connecting to and everything will then work. It seems to be caused by the IP address changing for the remote hostname and you not getting the warning message.

Using Places menu

This is very similar to the above but is accessed by Places -> Connect to Server and filling in as above. Nautilus is then opened. It seems less reliable than accessing the connection Window from in Nautilus under one of my machine with Hardy Heron whilst it works fine under Jaunty.

Conclusion

I discovered this way of working much later than Networking using samba. It has many advantages once the basics have been set up as it is a much more secure solution especially over Wifi as snooping is impossible with an encrypted connection. However you still need to have a strong password to prevent a remote login. I plan to bring it up in this document once I have more experience.

Using Public Key Authentication with ssh and sshfs to avoid password requests

It is often inconvenient to have to provide a password when one logs into a remote machine using ssh and impossible if you are automatically mounting a file system at login. The way round this is to use public/private key authentication instead. The key is encrypted and passed between the machines but there is obviously a slight security implication as anyone who gains access to one machine has access to the other. There is a good introducttion to ssh at http://kimmo.suominen.com/docs/ssh/ which covers this.

The following proceedure allows one to set up access via a public/private key pair between two machines running OpenSSH. You should first check that you can log in to the remote machine and are authenticated on it. When running ssh-keygen you will be prompted for a file name and a passphrase. Simply hit the return key to accept the default file name, and enter no passphrase at this time - you can and should enter one a latter stage to improve security. scp is a command for a secure copy using ssh which is part of the ssh package. The command examples below need to be edited to use your own machines and usernames. It assumes you are logged in as username1 on host1 and want remote access to username2 on host2. Run the following commands in a terminal.

You should find that you no longer have to provide a password when using ssh sshfs scp etc. If it ever stops working try ssh in terminal as it is possible the ip addresses have changed and you need to reset things by deleting ~/.ssh/known_hosts and doing a new ssh login. This gets tedious after a few IP address changes (due to DCHP) and I am mindfull to try the following change to configure the secure shell (ssh) on the local machine not to check the IP. You find the ssh configuration file in /etc/ssh/ssh_config and the section to change is:

####### CheckHostIP
#
# If this flag is set to "yes", ssh will additionally check the
# host ip address in the known_hosts file. This allows ssh to
# detect if a host key changed due to DNS spoofing. If the option is
# set to "no", the check will not be executed.
#
CheckHostIP no

Scripts to Mount and Unmount the Media on Matrix using sshfs

I have written two scripts to mount and unmount the media. The mounting script has delays to ensure that the Wifi is up when it is added to the startup program list activated at login. Both scripts check whether the file system was already mounted and has been successfully unmounted and put up alert boxes.

#!/bin/bash
# Script to mount server on matrix ~/mediamount using sshfs.
# Assumes that password is not needed.
# Assumes that local mount point has been set up and has correct permissions
# Lives in ~/bin/sshfs_mediamount where it must be given execute permissions
# and ~/bin should have been be added to to #PATH in ~/.bashrc
# by adding the line
# PATH=$PATH:~/bin
#
# Check if Media Folder already has contents
if [ "$(ls -A ~/mediamount)" ]; then
zenity --info --text "Media Folder was already available for Media Players to use"
else
# Allow time for Wifi to come up when script automatically run at login
sleep 20;
sshfs -o idmap=user pcurtis@matrix:/media/DE_MEDIA ~/mediamount;
# Check mediamount folder now has contents
if [ "$(ls -A ~/mediamount)" ]; then
zenity --info --text "Media Folder has been successfully Mounted for Media Players to use"
else
zenity --warning --text "Media Folder mounting failed - is Matrix turned on? If not turn on and try again using the Desktop Icon";
fi
fi

#!/bin/bash
# Script to unmount ~/mediamount
# Lives in ~/bin/unmount_localmedia where it must be given execute permissions
# and ~/bin should have been be added to to #PATH in ~/.bashrc
# by adding the line
# PATH=$PATH:~/bin
fusermount -u ~/mediamount
# Confirm folder is now empty
if [ "$(ls -A ~/mediamount)" ]; then
zenity --warning --text "Media Folder Un-mounting failed - is it in use?"
else
zenity --info --text "Media Folder has been successfully Un-mounted"
fi

Drivers for 3Com PCMCIA Wifi Card for Portege

The Wifi card no longer worked with any version of Ubuntu 11.04 until I installed the extra drivers for nonfree firmware linux-firmware-nonfree - This is mostly firmware for TV cards but also it seems the Wifi firmware for some Wifi cards including my 3Com.

Xubuntu

I have done a complete fresh install of Xubuntu 11.04 on my old Dell Dimension XPS 700R including reformating to ext4. I have added gedit and nautilus and may use it to try out options such as dockbarx to give an alternative to Ubuntu Unity. I also tried Lubuntu 11.04 from a LiveCD but am less impressed.

13 September 2011

Popups updates to epopup.js

Some brief notes for me! I have had a general tidy up of epopup.js to make sure it works with more of the current browsers especially Chrome.

I have had to move some of the variable declarations so they are 'global' and I have changed the checking for specific browsers to be 'global' rather than in popup5().

Chrome needs to have a fix involving blurring and focusing the window. Some redundant window.focus lines had to be taken out.

I have also taken out the check for browsers latter than version 3 as a surrogate for javascript 1.2 as some new browsers are lower versions and other will soon be in double digits whilst all take 1.2. Check now uses existance of the window.resizeTo method to check for JavaScript 1.2 or higher and a similar check has been included before calling the method in popup5(). See http://www.quirksmode.org/js/support.html

Also Firefox now allows the window to be brought into focus after resizing so firefox fudge removed (which closed and reopened the window) giving a much better experience.

Opera has a preference setting which, currently by default, prevents any popups being brought back into focus and this needs to be changed if you plan to spend much time on my pages. You reach it by clicking the Opera Button the Settings -> Preferences -> Advanced -> Content -> JavaScript Options and tick Allow raising of Windows.

Also checked in Microshaft IE8 (OK). Windows version of Safari (OK), Midori and Epiphany

Have added location=no to window.open preferences.

Check on screen.height to set initial value of broadband flag

17th September 2011

Popups again

The basic code above for the five parameter popup popitup5() formed the basis of all the popups on my web sites for a couple of years with the only significant development being in the way It was used. The code was put in an include file (.js) at the top of every page which had images. The HTML has the following line in the head statement

Note that I specified a relatively old version of JavaScript so almost every browser will work but one which is new enough to provide a couple of features I use for resizing a window, I now include extra .

The file also gained a script added to write a standard browser check into the web page and a script to make it easier to create the calling routines by writing them using only three parameters when I was using my standard size images.

The next major change came when we switched to digital cameras in 2004. The pictures now had the same aspect ratio as the video camera and also digital processing of the images became the norm. I developed code which allows the user to specify from two possible sizes of popup depending on bandwidth of his internet connection and screen size. The size can be toggles by a function call either from a link or by double clicking on any of the images and uses a cookie to maintain the choice throughout the browser session . The write up of our Australian trip in 2004 was the first example. Having all the code and 'scripts' to write the calling routines into the HTML pages in an 'include file'makes it very easy to make changes if required - for example the Firefox browser needs a title parameter as well as an alt parameter to allow text to be displayed when one hovers over an image and that change could be made for most of my pages by only a minor modification in the .js file. The downside of using 'java scripts' to write the complex calling routines into the HTML pages is that visitors who turn JavaScript off will not even see the small pictures (icons) on the pages so an addition warning if this is put in the HTML Body at the top of the page.

<noscript>
<p<font size="+1" color="#FF0000"><b>Caution:</b> You will not be able to see any images unless you enable Java on your Browser. </font></p>
</noscript>
Popup windows are extensively used on the site for the images on our travel pages. The popups for pictures are an essential part of the travelogues and a lot of thought has gone into their design. The objective is to enable the reader to be able to read the text with small 'icons' illustrating the places which are either at the left or right end of the paragraphs or in blocks of 3 or 4 pictures between paragraphs depending on the density of the illustrations. The optimum size seems to be about 160x120 pixels.

It is worth reviewing the requirements for the pop-up function namely it should:

Open an initial window of a size which can be specified to match the image in a consistent position on the screen - top left seems optimum.

Once the window is open it should be possible to drag it to a different position so the text on the page can be read.

It should be possible to get the window back in focus (in the foreground on top of other windows) by clicking on the 'icon' a second time and it should be still be in the same place.

When another 'icon' is clicked the image should be replaced in the window which should be resized if necessary but still be in the same position and in the foreground (in focus).

The popup window(s) should be closed when the page is closed explicitly or by following a link (it is expected that includes the browser itself being closed or that browsers which retain their status when being reopened will do so for all tabs and windows in a consistent manner )

It should be posible to specify the title which is displayed in the title bar of the popup window and when one hovers over the image on the parent page and the image in the popup window.

It should be possible to specify the colour of the border (background) round the image in the popup window.

The above covers the basic access to popups which is used on a number of my web pages, especially the technical pages where the popups are of screen shots which are of very different sizes and sometimes just have a link rather than an icon to click. I have been surprised to find how few, if any, popup windows one finds on commercial web sites achieve all the important first five requirements

The travel pages are rather more specific in there use of popup images - here I have standardised on a 4:3 image ratio which matches my digital camera and video camera grabs and I can then offer two image sizes depending on the screen size and bandwidth one has available. Every picture exists as a set of three .jpg images 160x120 400x300 and 600x450 or the vertical equivalent in a fixed format (imagexxxi.jpg, imagexxxw.jpg and imagexxxb.jpg). The image size is currently chosen depending on the height of the users screen but this may be changed to a combination now tablets are increasingly common. Links are provided to switch sizes at the start of the introduction page for each journey and the size can also be toggled by double clicking although the change seems to be delayed to the next popup as the browsers seem to see the first click of the double click to display and then the double click to toggle.

Each travel page which has popups has code/scripts to:

Link to a standard file containing the popup code common to every page (epopup.js).

Code to call a function in the common code which closes all popup windows when the page is left - this is very important ( tidy() ) .

A check that JavaScript is enabled which alerts the user if it disabled.

Call a browser check function in the common code to alert users to any particular problems they will experience. ie a version of JavaScript does not support all the facilities required (now very unlikely) or other browser and version specific problems. This may be used in the future to also check that cookies are enabled. The warning is provided 'inline' on the page ( browser_check() ).

The individual code for calling the popups - this is quite long and repetitive because of checks for clicks and doubleclicks and the need multiple text strings for title and alt etc so this is written 'on the fly' by a script code block calling functions for the standard horizontal and vertical size photograph based popups ( hpop() and vpop() ) which then call popup5(). The disadvantage is that even the 'icons' are not displayed if JavaScript is turned off but few sites work under those circumstances.

Popup Behavior in different common Browsers

The Popups for pictures on www.pcurtis.com and www.uniquelynz.com work well with most recent versions of the mainstream browsers, Mozilla Firefox, Microsoft Internet Explorer, Google Chrome, Safari and Opera. That is all the desktop browsers with more than 2% market share (September 2011). http://en.wikipedia.org/wiki/Usage_share_of_web_browsers . There are however various factors which can still cause problems.

Popups are abused by many advertisers and most browsers offer preference settings, extensions or other ways ways to limit the abuse of popups. The same goes for various security suites. In general the default settings should not inhibit popups which follow all the rules properly although you may find that you are asked if will permit use of popups on my sites and it is safe and desirable to say yes.

I have been looking at some some of the less common 'lightweight' browsers under Linux on my legacy machines and find some open a popup window in a tab instead of a correctly sized window. This is much more difficult to use and has the associated problem that the reuse of a window incorrectly displayed as a tab may not work correctly and they may not be closed when the page is left. This also makes them difficult to use with many other sites such as banking sites or anywhere that help information is displayed in a popup window. Midori and Epiphany are examples of browsers which do not handle popups in the way one would expect. Both are based on WebKit code.

Chrome uses Webkit code but handles popups fine although it has a number of idiosyncrasies including failing to bring a popup back into focus (ie displayed in front of the main page) - this meant I have included a dedicated 'fudge' in the popup code for Chrome as it now has over 20% of the browser 'market'. Thanks to Tony forputting me on to this problem and providing the solution below.

// Add test for Chrome at top with other variables
var is_chrome=navigator.userAgent.toLowerCase().indexOf('chrome') > -1;

// Add before final newwindow.focus();
if (is_chrome) {newwindow.parent.blur();}

Your browser is identified as having userAgent "
" - you can see this is quite complex and one has to be careful in selecting a suitable string to test.

Firefox 4 also initially tended to lose focus but updated version 4s and versions 5 and higher now handle focus correctly so an earlier 'fudge' I had to implement of closing and reopening has been removed as it had other undesirable side effects - it is best to updated if you have any ananomolies.

Opera has a couple of minor anomolies - the popup windows are displayed the correct size and are also attached to there own tab which is opened and closed in tandem with the windows - this is a good compromise between tabs and windows. However Opera has a preference setting which, currently by default, prevents any popups being brought back into focus and this needs to be changed if you plan to spend much time on my pages. You reach it by clicking the Opera Button then Settings -> Preferences -> Advanced -> Content -> JavaScript Options and tick Allow raising of Windows. You can in any case bring the popup window into focus from its tab or the operating system toolbar although this can be tedious if you have a system with a 'dock' such as Ubuntu Unity. I have also noticed that closing Opera does not always close down the tabs with associated popups - see http://www.quirksmode.org/dom/events/index.html for support of events including onUnload for possible cause of Opera shortfall. Even this would not be a problem - it could even be called a feature if the picture was reloaded - unfortunately the parent page is loaded and it all looks very confusing.

Some examples and a test area of the popups

Firstly I will display the major attributes of navigator object for your browser so you know what you are testing:

The next paragraph starts with my 'standard' browser checks to confirm that JavaScript is enabled and Cookies are enabled - you should only see anything if you turn them off during your tests. Following that is the explanatory text which is copied into every introductory page followed by a few randomly selected pictures from our travels so you can try everything out.

Caution: You will not be able to click to see large images unless you enable Java on your Browser.

All the pictures on the pages provide details of where they were taken if you hover the cursor over them and they can all be clicked to open a larger version in a popup window. The popup windows are reused and then closed up when you leave the page so you do not need to close them. Our digital pictures (from 2004) are in two resolutions and the initial size depends on your screen size. You can chose the small size if you have a slow internet connection or want to restrict data flow on a mobile connection. Click here for high detail popup images and click here for lower resolution images. You can also toggle the resolution by double-clicking an image but it may take an extra click to display the picture in the new size on some browsers. With some systems you may be asked to if you wish to allow popup windows as a protection against adverts.
More

The Popups for pictures on www.pcurtis.com and www.uniquelynz.com work well with reasonably recent versions of most of the mainstream browsers, Mozilla Firefox, Microsoft Internet Explorer, Google Chrome, Apple Safari and Opera. That is all the browsers with more than 2% market share. There are however various factors such as security suites which can cause problems. The page More about Popups covers ways of getting the best from my pages on most systems as well as providing some additional background.

Another factor to be considered is that many of the pages have a lot of detail. The first time you visit them they can be slow to load unless you have broadband, even with the small pictures. You should have text in seconds but the last pictures may take a while to fill in and it is best to wait before clicking on the popups - you may have to refresh some browsers to get the last icons filled in if you interrupt them too early.

Finally the actual JavaScript Code I am using in epopup.js to produce the above

Contents of my current include file epopup.js as of 16th September 2011

// Browser check function to write warnings into the web page when placed within a <script type="text/javascript"> tag

function browser_caution() {
var browser = navigator.appName;
var version = navigator.appVersion;
// Check JavaScript supports resizing of windows - version 1.2 or higher
if (!window.resizeTo) { document.write('<font size="+1" color="#FF0000"><b>Caution:<\/b> You are running a browser identifying itself as ' + browser + ' version ' + version + ' which does not seem to support the JavaScript which would provide the Popup images when you click on the thumbnails on this page.</font><p>') }
}

/* Call function as getCookie("cookiename") It returns the value of a cookie
if set or null. Beware of potential ambiguities in names of cookies -
getCookie is simple and will match the end of a string so xyname
will also be matched by yname and ame. */