Ubuntu Unity

A couple of months ago I ran the usual

sudo apt update && sudo apt upgrade

on my Ubuntu box and when I logged back in, there was no graphical user interface. Nothing. Not even a Ctrl-Alt-T into a terminal.

An internet search suggested it was a Compiz issue but nothing seemed to work. Until now! I thank Jonayad Rahman on the Ask Ubuntu forums for this fix:

Press Ctrl-Alt-F2 to call up a command-line. Log in with your usual credentials. You can then fix the compiz problem by removing the local config files:

sudo rm -fr ~/.cache/compizconfig-1
sudo rm -fr ~/.compiz

Then try this if your session still does not load:

sudo rm -fr ~/.Xauthority
sudo rm -fr ~/.config/autostart

Reinstall compiz:

sudo apt-get install --reinstall ubuntu-desktop unity compizconfig-settings-manager upstart

Reboot the machine and you should be able to log into Unity. Finally clear and restart the Unity Desktop by opening a terminal and typing:

sudo dconf reset -f /org/compiz/
setsid unity

So I have Unity back. More or less. I don’t seem to be able to right-click on the desktop and get a menu, and my wallpaper choices don’t seem to get saved, but it’s good to have some windows visible.

One thing I’ve discovered in the meantime is that I actually prefer the Gnome desktop!

Advertisements
Tagged , , ,

AWS & satellite data: a primer

Massive thanks to Annekatrien for her original post on this topic which should be available using this link: http://www.digital-geography.com/accessing-landsat-and-sentinel-2-on-amazon-web-services/

This is mainly a post to remind me of the steps I undertook (following the blog post above) to access Sentinel 2 data on AWS (developed and managed by Sinergise).

I use an Ubuntu 16.04 Mate VM with shared folders to the host machine as my processing/dev box. I use the Anaconda Python 3.5 distribution and the following has been tested and works on that system.

Python setup

I installed the AWS commandline packages using the conda-forge repository
conda install -c conda-forge awscli=1.10.44

and tested the installation using
aws help

which returned the man pages.

AWS Setup

I am currently on the free tier (https://aws.amazon.com/free/) which is fine for what is listed in this post.

Sign in and go to the Amazon Console.

Go to the Services tab at the top of the console then select:
Security&Identity > IAM > Users > Create a new user

Ensure that the check box to generate a new key is ticked, add your user name and click Create. Download your user credentials BEFORE clicking Close.

To access the data on Amazon S3, change the permissions using the Console by clicking on
Services > Security&Identity > IAM > Users

again and then clicking on the name of your new user. This will open a summary page where you can manage a user. Click on
Permissions > Attach policy

and choose AmazonEC2FullAccess and AmazonS3FullAccess (and any others you want) before clicking Attach. The IAM user should now be set up.

AWSCLI Config

In the bash terminal, type:
aws configure

and type in your access key ID and secret access key from the file downloaded earlier, when prompted. For region use the appropriate value from the table below based on the data you want access to. For output format, use json.

Landsat Sentinel-2
us-west-2 eu-central-1

Accessing data

To list the data available for Landsat use the following Terminal commands:
aws s3 ls landsat-pds

and for Sentinel use
aws s3 ls sentinel-s2-l1c

As Annakatrien says in her blog post, ‘to go deeper into the storage, and see separate images, you have to know what you’re looking for’.

In general you will use the following structure for landsat:
aws s3 ls landsat-pds/L8/<path>/<row>/<image name>/

and this for Sentinel-2:
aws s3 ls sentinel-s2-l1c/tiles/<UTM zone number>/<grid number>/<subgrid number>/<year>/<month>/<day>/

To download an image use one of the following commands:
aws s3 cp s3://landsat-pds/L8/201/024/LC82015242016111LGN00/ ~/Downloads/ --recursive
aws s3 cp s3://sentinel-s2-l1c/tiles/30/U/YC/2016/4/13/0/ ~/Downloads/ --recursive

More effort is then required to sort the downloads (if more than one image at a time) into a file structure on the local computer, as all images are download to the same directory.

Processing set up

This post is here as a reminder of what I did to setup my coding environment. If it is of any use or interest to anyone else then that’s great 🙂

First up I set up a VirtualBox VM on my desktop (from Entroware!). It is running an Ubuntu Mate 16.04 guest, but I guess that is inconsequential, as it could be running any version. It has the VirtualBox Additions installed, NAT and Bridge Adaptor networking are enabled, and a shared folder on the host has been setup.

On the guest, the shared folder is mounted using the command:

sudo mount -t vboxsf -o uid=1000 sharedVMfolder path/to/mountpoint

Anaconda Python has been installed on the guest and a new environment called spatialP3 has been created using:

conda create --name spatialP3

This is activated using:

source activate spatialP3

In that environment, a number of spatial libraries have been installed using:

conda install --name spatialP3 packagename

There were a number of version conflicts with some of the default packages, so I searched the Anaconda Cloud to find the most recent packages and installed them from the Anaconda Cloud repository using:

conda install -c conda-forge shapely=1.5.16

and similar.

To launch a Jupyter Notebook server with no local display (i.e. on the guest) use:

jupyter notebook --ip=0.0.0.0 --no-browser

Port forwarding has been set up in Virtualbox using the TCP protocol and with the host port being 8899 and the guest port being 8888 (the default for Jupyter Notebooks).

This means that you can run the notebooks from the host (as long as the VM and Jupyter server are both running) by typing the following into your browser:

localhost:8899

or from any machine on the network by typing in the local IP address of the host machine and the port 8899. If you start them in the correct location i.e. the shared folder that was mounted in the VM, then the notebooks will be accessible irrespective of whether the VM is running, and can be part of a backup strategy for the host machine.

Tagged , ,

Stat

Another nice little bash tool that I’ve recently come across is stat.

More details can be found here: http://www.computerhope.com/unix/stat.htm

but basically it returns the status of a file or filesystem.

Ubuntu Mate Lenovo microphone fix

On a Lenovo G50 I have access to there was no sound being recorded by the internal microphone. This was a problem with Skype and Hangouts. The following fixed the issue:

  • sudo apt-get install pavucontrol
  • Type pavucontrol in the terminal
  • A new window will open. Click on the Input Devices tab at the top of the window
  • With Port set to Internal Microphone:
  • Move the Front Left slider bar to more than 85% and the Front Right slider bar to between 60% and 70%
  • Start your Skype conversation and keep tweeking the sliders in pavucontrol

Based on a post here: http://ubuntuforums.org/showthread.php?t=2270010

Tagged