Category: Tech Tips

Restoring a Missing Date and Time Indicator

The little date and time indicator vanished from the top panel of the screen. This is what I did to get it back.

I made sure all elements of it were still installed (in case anything had borked any of the required files).

sudo apt-get install indicator-datetime

I issued the following command to reconfigure the date and time timezone data through dpkg.

sudo dpkg-reconfigure –frontend noninteractive tzdata

Finally I restarted Unity.

sudo killall unity-panel-service

That was it. Short and sweet.

Tags :

Shellshock – What To Do To Make Yourself Safe

Shellshock is a vulnerability in the Bash shell. A shell is the program that provides a command line interface. Bash is the default shell in the Ubuntu universe. The Bash shell is vulnerable to a particular type of attack, described here: GNU Bash Remote Code Execution Vulnerability (CVE-2014-6271).

To determine if your Ubuntu box is vulnerable, Type the following at a command line, and then press enter. It is probably easiest to copy this and paste it into the terminal window, it must be typed exactly as shown and the spaces are important.

env x='() { :;}; echo vulnerable’ bash -c “echo this is a test”

If your system has the vulnerability, the output to the terminal window will be:

vulnerable
this is a test

If your system is secure, the output to the terminal window could show one of two things. One is this longer message:

bash: warning: x: ignoring function definition attempt
bash: error importing function definition for `x’
this is a test

The other, shorter message is simply:

This is a test

If you find you have the vulnerability you can update your system to a patched version of Bash by entering the following at a command line and then pressing enter:

sudo apt-get update && sudo apt-get upgrade

You will be prompted for your password. A lot of screen output will be displayed, and eventually you will be returned to a command prompt. You can then repeat the above test to check that the vulnerability has now been secured.

Following my own updates on my Trusty Tahr 14.04 the version of Bash I was upgraded to is version 4.3.11(1)-release, and this passes the vulnerability test.

Tags : , ,

Fast and Easy Access to Network Shares – Enter the Gigolo

Mounting a Windows or other OS drive across a network can be a challenge in Ubuntu. Samba is great but it certainly takes a bit of getting used to. If you´re in a hurry it can be a bit cumbersome and fiddly to set up. If the need to have the connection to the other OS is a short-lived one, there is even less incentive to go through the whole rigmarole to get the connection set up.

Gigolo is a great utility that has saved me time as well as finger and brain-ache on more than one occasion. It is available in the Software Centre.

To use it is very straightforward. Firing up the software brings up the main window.

Gigolo Main Window
Gigolo Main Window

Click on the Connect icon and complete the details for your connection in the Connect to Server dialog. Pick the appropriate type of connection from the Service type drop-down menu and the fields that are required in order to complete the connection are displayed. These fields differ from connection type to connection type. The ones that appear when you select a Samba share are shown below.

Connect to Server Menu
Connect to Server Menu

Provide the required information as appropriate for your connection, and then click the Connect button. If one is required you will be asked for a password. The Connect to Server dialog closes and you are returned to the main Gigolo window. You should have en entry in the main window representing your connection.

You can double-click it to open a file browser window on your Samba share, or highlight it and click the terminal icon in the toolbar to open a terminal window on your shared resource.

Gigolo With Active Connection
Gigolo With Active Connection

You can also create bookmarks in Gigolo so that you don’t need to re-enter the details of a connection that you wish to re-use, and you can select to have the shared resource automatically connected each time your system is restarted.

Tags : , ,

Setting File Associations at the Command Line

I use Freemind, the FOSS mind-mapping software, as a thought capture and organisation tool. When I upgraded to Trusty Tahr 14.04 I forgot to re-install Freemind. I subsequently tried to open an existing mindmap file (a Freemind file with an extension of .mm) but it opened in gEdit, the default Ubuntu test editor.

Realising I hadn’t put Freemind back onto my desktop since the upgrade, I fired up the Software centre and installed Freemind. I double-clicked the .mm file again but it still opened in gEdit.

OK, looked like I needed to set the default application for the .mm file type. I right-clicked the .mm file and highlighted Open With in the context menu. Darn – Freemind wasn’t listed in the daughter menu.

Next step was to select the Other Application… option from the context menu. This allows you to select the default program from a list of installed applications. But Freemind wasn’t listed there either!

I did a bit of reading and found the mimeopen command, which saved the day.

I opened a terminal window, cd’d to the folder with the .mm file and executed:

mimeopen -d FirstOrderLogic.mm

I was presented with a text mode menu in the terminal:

Please choose a default application for files of type application/x-freemind

1) FreeMind (freemind)
2) LibreOffice Writer (libreoffice-writer)
3) Geany (geany)
4) gedit (gedit)
5) Other…

use application #

That was great – Freemind was listed in the menu. I entered the digit 1 as my response and pressed enter. Freemind was then fired up automatically and the file loaded.

From that point onwards the association between Freemind and .mm files was established, and double-clicking any .mm files invoked Freemind to correctly launch and open the target file.

Even if Freemind hadn’t been listed in the mimeopen menu, I could have used option 5 and then specified the application I wanted to use by name. In my case this would have been:

freemind %f

Where the %f represents a token which is replaced at run time by the name of the file on which you have double-clicked.

Tags : , ,

GTK+ 3 and SQLite Installation Commands

Having recently re-installed my Ubuntu system with Raring Ringtail, I needed to install the development tools I use most frquently. The first time I did this I struggled to get everything installed and working. It was one of those situations where you try so many things you can’t remember exactly which combination of events took place in which order, and you end up staring at your history file trying trying to work out which particular invocations were the ones that worked.

I usually program in C, using the GTK+ 3.0 libraries and SQLite. I also sometimes use the Geany IDE, Nemiver debugger front-end, Glade UI designer and Git. For Git I either use the Git CLI commands or gitg or Smartgit/Hg. These are all easy to locate and install, with Geany, Glade and Nemiver both readily accessible through the Ubuntu Software Centre.

I’ve managed to backtrace through my previous flounderings and have got two single CLI commands that install the GTK and SQLite libraries for me. I’m recording them here so that I know where to find them next time.

To install the GTK libraries enter this in a terminal window:

sudo apt-get install libgtk-3-dev

To install the SQLite libraries enter this in a terminal window:

sudo apt-get install sqlite3 libsqlite3-dev

Tags : , , ,

Open a Terminal Window from Nautilus Menus

Because I like to do a lot of things by the command line, I often need to open a terminal window, which is nice and fast using the keyboard shortcut:

Ctrl+Alt+T

That opens the terminal window with the current working directory set to my Home folder. Usually this is fine, if you’re going to be doing something that doesn’t care what your current folder is, like running top. but if you want to do something quickly at the CLI in the folder that you have just browsed to in Nautilus, you have to manually CD to that folder in the terminal window before you can start to work there.

What would be really nice would be the ability to right-click on a folder (or on the background of the file window) in Nautilus and to be able to select an ‘Open a Terminal Window Here’ option from the context menu.

This shows you how to do just that. First of all, open a terminal window with Ctrl+Alt+T, and type the following:

sudo apt-get install nautilus-open-terminal

Once that has finished installing, close all Nautilus windows and then force a reset of Nautilus:

nautilus -q

Now ehen you right-click on a folder or in the background of the file window, you’ll see a context menu with an entry that says ‘Open in Terminal’. Selecting that option will open a terminal window with the current working directory set to the location you clicked on. Perfect.

Note that the context menus are slightly different depending where in Nautilus you clicked.

Folder Context Menu
Folder Context Menu
File Window Background Menu
File Window Background Menu
Tags : ,

Command Line Networking Tools

I’ve been using a pair of Raspberry Pi credit card sized computers to set up a basic Network Attached Storage device (NAS) and an XBMC media centre. I bought my Pi’s and cases from ModMyPi.

One Pi is running the standard Raspbian Wheezy Debian image with a large externally powered USB drive connected to it. This forms the NAS storage device. It has some Samba SMB shares set up on it. This means the shares are acessible from other computers on the same network. I can therefore back up to the USB drive on the NAS Pi and transfer media files to it.

The other Pi, the XBMC Pi, which is running Xbian, can access the Samba shares as media sources. Xbian is a stripped-down distro that boots straight to XBMC.

There are any number of tutorials on the web on how to do all of this, so I’m not going to rehash what has already been done elsewhere. But, because the XBMC Pi is connected to a wireless dongle (both systems are running headless, and I ssh onto them) I had to track down a few CLI networking commands to help me sort all of this out. I had a feeling that they might prove useful to others.

Of course, everyone knows about ifconfig. This enumerates the network interfaces and prints out a set of useful information about each one.

ifconfig

ifconfig

Another similar command is iwconfig. This concentrates on the wireless network interfaces and provides a different set of information.

iwconfig

iwconfig

To find your IP address quickly use ip addr.

ip addr

ip_addr

Another useful command to have up your sleeve is findsmb. This enumerates Samba shares on your network. The screenshot below was taken from my laptop in a public library, so there is not much information displayed in it. More details of this command can be found at the Samba.org website. It also shows example output.

findsmb

findsmb

Tags : , ,

Skype and a cheap Tesco Webcam

My niece is going to be working over seas for a while. I was asked to set up Skype on her Mum’s Kindle HD, and I put it on my wife’s and my own Android handsets. Being in the mood for global coverage, I also installed and configured it on my wife’s Nexus 7 tablet and her Windows 7 PC.

I then turned to my Ubuntu box (and put the bad thoughts of installing anything to do with Microsoft on my Linux box out of my head). Not having any real need for a webcam apart from this purpose, and a low-specced device being sufficient for my purposes, I bought a Tesco own-brand model. The store was handy and it was cheap. At £7.00 you can’t expect the Earth, and I didn’t hope for any more than a functional, cheap and cheerful camera. Which is lucky, because that’s exactly what it was. We’re talking no frills whatsoever.

To install Skype you must add the following repository, and then install Skype. In a terminal window, do the following:

sudo add-apt-repository “deb http://archive.canonical.com/ $(lsb_release -sc) partner”
sudo apt-get update && sudo apt-get install skype

With Skype installed I was able to enter my credentials and get on-line, but the webcam wasn’t being recognised. I Googled a bit and found some advice on the subject. Again at the command line, I had to perform the following steps to make sure I had the correct Video4Linux drivers installed:

sudo apt-get install libv4l-0

Once the drivers were installed, I installed a little application called Cheese, as a test. Skype doesn’t need Cheese, but I thought if I could get the camera working in another application it would let me know if the issue was related to the webcam or to the settings in Skype. I did this to install Cheese:

sudo apt-get install cheese

Cheese worked with the webcam without issue, so it was something to do with Skype. More Googling turned up more help. There are drivers that need to be pre-loaded before Skype is fired up. Specifically, these Video4Linux drivers need to be loaded: v4l1compat.so.

At the command line I did the following to see where the drivers were located on my hard disk:

locate v4l1compat.so

I made a note of the path that was returned, which in my case was: /usr/lib/i386-linux-gnu/libv4l/v4l1compat.so.

I needed to make a script to load these libraries, and then to load Skype. Back at the command line, I did the following:

sudo gedit /usr/local/bin/skype

and then entered the following two lines into the file:

#!/bin/bash
LD_PRELOAD=/usr/lib/i386-linux-gnu/libv4l/v4l1compat.so /usr/bin/skype

Once that was saved I added the following line to my .bash_aliases file (which is where I keep all my aliases; you could add it to your .bashrc file if you hold your aliases in there):

alias sk=’/usr/local/bin/skype &’

Now I can type sk and hit enter and Skype loads and runs and the camera works just fine.

Tags : , ,

Installing KompoZer in Quantal Quetzal

It was only recently that I upgraded my desktop PC to Quental (12.10). I had upgraded my laptop and that ran well, but my desktop had issues Precise (with 12.04) and so I was wary about taking my desktop up to Quental. My thinking was that I would give Quental time to stabilise and get a few patches out, and then I’d upgrade. That’s what I did and I’m pleased to say my desktop likes Quental (and vice versa) so once again my two machines are running on the latest and greatest Ubuntu, and with no apparent issues.

So that was good, but I was dismayed that a few of my favourite applications were no longer included in the 12.10 distribution. That was no major problem, I just installed them from the Ubuntu Software Centre. But KompoZer, one of my often used applications, had been removed from the Ubuntu Software Centre (although it does seem to be back now). Just in case it vanishes again and you need to install it, you can get the two required packages from the links below. One is for KompoZer itself, the other is described as ‘KompoZer data files’. You need to install the data files first.

Follow the links below and then download the .debs. Double-click the downloaded .debs to install them.

KompoZer Data Files

KompoZer Application

Tags : , , ,

Transparent Terminal Windows

I saw an Ubuntu desktop recently with semi-transparent terminal windows. I’m not a great one for UI tweaks and themes but this looked good to me, and I was intrigued about how it was achieved. My Unity UI is more or less standard. I’ve changed the wallpaper, reduced the size of the icons within the launcher and have Conky running. Apart from that it is basically your standard Unity.

I didn’t want to have to install new themes or UI tweaking applications just to achieve transparent terminal windows which, let’s face it, are nothing more than eye-candy, so it was a pleasant surprise to find out it is controlled by a setting that is built right into the standard terminal window.

Open a terminal window and from the main menu select:
Edit, Profile Preferences, Background Tab and then select the Transparent background option. You can use the slider to set the degree of transparency.

Desktop with transparent terminal windows
Desktop with transparent terminal windows
Tags :