Using snap Application Aliases

If you run snap and snapd <= 2.25 this is how you can set up aliases for snap applications in your snapcraft.yml:

      command: usr/bin/wrapper-psql
      aliases: [psql]
      plugs: [network]

Build and install your snap package. Then you need to enable all such aliases manually as the user you plan to run your application as. Normally, it is an unprivileged user.

Before you can enable an alias, though, you need to make sure you’re logged in:

$ sudo snap login
Email address: *****
Password of "*****": 
Login successful

Otherwise you won’t be able to create aliases as an unprivileged user (only as root via sudo.)

Enable your alias:

$ snap alias postgresql93.psql psql
 - postgresql93.psql as psql

Verify it was created:

$ snap aliases
Command Alias Notes
postgresql93.psql psql manual

Use the alias:

$ whereis psql
psql: /snap/bin/psql
$ psql --version
psql (PostgreSQL) 9.3.17

Remove your alias:

$ snap unalias psql
 - postgresql93.psql as psql

Aliases are unique:

$ snap alias postgresql94.psql psql
error: cannot perform the following tasks:
- Setup manual alias "psql" => "psql" for snap "postgresql94" (cannot enable alias "psql" for "postgresql94", already enabled for "postgresql93")

They can also be enabled automatically upon installation of a snap package when it is installed from a store.

Note, in snap version => 2.26 this behavior will change.

Read more about aliases and upcoming changes here.

How to release mouse pointer in virt-manager running inside VNC client on Mac OS X

My setup consists of Mac OS X system that runs RealVNC client to connect to Ubuntu Server machine that is a KVM host via VNC.

When working in guest VM graphical console (as opposed to text console which usually requires additional configuration of guest VM) you may end up clicking into the black area.

That would grab your mouse pointer.

Actually, you don’t have to click VM screen area if all you want to do is type in something but if you must use mouse to click something inside the terminal view it’s going to get locked.

To release your mouse pointer normally you’d press Ctrl_L+Alt_L, as it is stated in the window title.

Screen Shot 2013-01-31 at 5.18.48 PM

However, it didn’t work on Mac.

Instead you need to use:


which has the same effect.

PS: interestingly it is one of the top blog posts on this blog. I guess way too many people run into this problem? If you’re one of them let me know in the comments section down below.

Ubuntu security updates break unattended-upgrade

What I mean by the title of this post is that sometimes ubuntu folks push security updates to $release-updates repository. I’m told this is so that they propagate faster across all the mirrors. So, when that happens, to APT they look as coming from $release-updates repository ONLY.

Which means unattended-upgrade is fooled into thinking there are no security updates available and so it never installs them automatically despite all the configuration instructing it to do so.

Good thing my little software updates report script can show these security updates regardless, that’s how I know about this.

The trick to dealing with this quirk is as simple as to have a separate APT sources list file for security repositories. You then need to pass this file as an argument to apt commands with the help of the -o flag.

sudo sh -c 'grep ^deb /etc/apt/sources.list |grep securi >> /etc/apt/'

apt-get -s dist-upgrade -o Dir::Etc::SourceList=/etc/apt/