symlinks to snap commands no longer working

Bug #1642117 reported by Martin Winter
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
snapd
Triaged
Medium
Unassigned

Bug Description

(OS Tested and found on: Ubuntu Server 16.04)

Commands defined in snapcraft.yaml get prefixed with the snap name. For example, with the Quagga Snap, the vtysh command is prefixed with quagga and ends up as quagga.vtysh

To support existing scripts which expect the command to just be "vtysh", I've recommended users to create a symlink from vtysh to quagga.vtysh.

This worked fine up to (incl) snapd version 2.14.2
Up to this version, the resulting quagga.vtysh is a shell script which sets the environment and
starts the app.

After the latest upgrade to snapd version 2.16ubuntu3 this does no longer work.
quagga.vtysh is now itself a symlink to /usr/bin/snap (a binary) and all other apps
are a symlink to this same binary.

Running quagga.vtysh directly still works and is detected as calling the right app, but the symlink no longer works and gets interpreted as calling /usr/bin/snap directly

root@ubuntu1604-pkg:~# which quagga.vtysh
/snap/bin/quagga.vtysh
root@ubuntu1604-pkg:~# ls -al /snap/bin/quagga.vtysh
lrwxrwxrwx 1 root root 13 Nov 15 18:28 /snap/bin/quagga.vtysh -> /usr/bin/snap
root@ubuntu1604-pkg:~# ln -s /snap/bin/quagga.vtysh /usr/local/bin/vtysh
root@ubuntu1604-pkg:~# vtysh
error: Please specify one command of: abort, ack, buy, change, changes, connect, create-user, disable, disconnect, download, enable, find, get, help, install, interfaces, known, list, login, logout, refresh, remove, revert, run, set or try

Revision history for this message
Zygmunt Krynicki (zyga) wrote :

This is caused by "snap run" using symlink logic to know which application to run.

As a workaround you can always "snap run $SNAP_NAME" or "snap run $SNAP_NAME.appname" and put that in a script under any name.

Changed in snappy:
status: New → Confirmed
Revision history for this message
Jamie Strandboge (jdstrand) wrote :

Another workaround for just the shell is a simple alias. Eg, for bash:

alias vtysh=quagga.vtysh

Michael Vogt (mvo)
Changed in snappy:
importance: Undecided → Medium
status: Confirmed → Triaged
Michael Vogt (mvo)
affects: snappy → snapd
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.