Tag: CLI

Teamviewer 12 and Ubuntu 16.10

I use TeamViewer to hop onto a couple of my friends and family member’s PCs to provide occaisional tech support. I couldn’t get TeamViewer 11 to run no matter what I tried, but the following sequence worked for me with TeamViewer 12.

On my 64bit box I had to tell it to add the files to allow it to run 32bit software.

sudo dpkg –add-architecture i386
sudo apt-get update

Then I created the following script. I named it deps.sh. Put the following text into a file and save it and name it what you want, then set it to be executable (right click and select properties and set the appropriate check box).

#!/bin/bash

sudo apt-get install libdbus-1-3:i386
sudo apt-get install libasound2:i386
sudo apt-get install libexpat1:i386
sudo apt-get install libfontconfig1:i386
sudo apt-get install libfreetype6:i386
sudo apt-get install libjpeg62:i386
sudo apt-get install libpng12-0:i386
sudo apt-get install libsm6:i386
sudo apt-get install libxdamage1:i386
sudo apt-get install libxext6:i386
sudo apt-get install libxfixes3:i386
sudo apt-get install libxinerama1:i386
sudo apt-get install libxrandr2:i386
sudo apt-get install libxrender1:i386
sudo apt-get install libxtst6:i386
sudo apt-get install zlib1g:i386
sudo apt-get install libc6:i386

In the folder where you saved your file, execute it. My file was called deps.sh so the command I used was

sudo ./deps.sh

Expect errors. To rectify the errors run the following command. It’s the -f (force) flag that does the magic in this case.

sudo apt-get -f install

Then in the folder you’ve downloaded the TeamViewer deb into run the following command (substitute the appropriate deb filename if it is different).

sudo dpkg -i teamviewer_12.0.71510_i386.deb

That worked for me, TeamViewer fired up and connected as expected. If you’re having difficulty with TeamViewer and Ubuntu 16.10, hopefully these steps might work for you too.

Tags : , ,

Reigning in the Dash

The Dash in Ubuntu 6.04 had decided to come up in full screen mode every time I opened it. This wasn’t what I wanted. After a period of Googling (during which I was surprised to discover that most questions on the Dash were asking how to make that the default behaviour) I found the command I was looking for:

gsettings set com.canonical.Unity form-factor Desktop

Entering this in a terminal forces the Dash to adopt my preferred fashion, taking up the top left of the screen only.

Dash

Tags : , ,

Google Earth and Ubuntu 16.04

After upgrading to 16.04 (for upgrade, read wipe and re-install) I needed to re-install all my applications. I have a shell script that runs through them and installs them in one quick batch, which is great.

There’s one package that requires manual intervention and I haven’t found a way round that, so I set that to be installed last. When I leave my shell script running and come back to it, it’ll be sat waiting for the few options to be selected in this particular package, and then I’m done. That package is the ttf-mscorefonts-installer package that installs some of the common Microsoft TrueType fonts.

From a backup, I drag back in the appropriate dot folders and files and pull back in my data and that’s it, we’re good to go.

Apart from Google Earth.

Desktop with Google Earth

To install Google Earth in Ubuntu always seems to require a special incantation, and that incantation changes (in my personal experience, your mileage might vary) for each new version of Ubuntu. It’s a pain, because it means it can’t be automated.

Anyway, after the usual period of research and frustration (do people even test the instructions they post online?) I whittled the required steps down to this sequence below.

To be specific, this loaded Google Earth onto Ubuntu 16.04 on an Asus R500V core i7 laptop with an nVidia Geforce 610m graphics card. It has been tested on two other lower-spec dekstop PCs.

You need to download these packages first:

http://ftp.us.debian.org/debian/pool/main/l/lsb/lsb-security_4.1+Debian13+nmu1_amd64.deb
http://ftp.us.debian.org/debian/pool/main/l/lsb/lsb-invalid-mta_4.1+Debian13+nmu1_all.deb
http://ftp.us.debian.org/debian/pool/main/l/lsb/lsb-core_4.1+Debian13+nmu1_amd64.deb

Then open a terminal and cd to the folder containing the downloaded files and install them one after the other.

sudo dpkg -i lsb-security_4.1+Debian13+nmu1_amd64.deb
sudo dpkg -i lsb-invalid-mta_4.1+Debian13+nmu1_all.deb
sudo dpkg -i lsb-core_4.1+Debian13+nmu1_amd64.deb

If you have any dependency issues this should fix them (although on my box it didn’t appear to do anything at all).

sudo apt-get install -f

Reboot, then go to the following page and download the Google Earth .deb. Note that although I have a 64bit machine and 64bit Ubuntu, I had to use the 32bit .deb package.

http://www.google.com/earth/download/ge/agree.html

Install the downloaded file. Substitute the name of the file you’ve downloaded, the 32bit .deb is shown in the example below.

sudo dpkg -i google-earth-stable_current_i386.deb

That should be it. Google Earth should now run. It is still a bit flaky trying to show the embedded Panorama photographs, but that is a feature I never use anyway. If I find a way to make that work I’ll post it here.

Tags : ,

Restarting the Printing Daemon

I’ve got a recurring issue with my laptop, that even a recent re-install didn’t cure. Periodically, but thankfully not too frequently, when I attempt to print from within an application such as LibreOffice, none of my printers are listed. I haven’t got to the bottom of it yet, but I have a recovery step that doesn’t take much to perform, so it hasn’t become too much of a pain yet.

The quick remedy (but alas not the cure) is to execute the following in a terminal window:

sudo /etc/init.d/cups restart

Straight away my printers are back. I’ll dig deeper into it once I get a spare hour or two.

Tags : , , ,

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 : , ,

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 : , ,

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 : , ,