[LXD 4.7] Autocompletion on ubuntu 20.04


I have a fresh install of ubuntu 20.04 with an install of LXD from snap but which doesn’t provide LXD / LXC autocomplete. Unlike to my previous experience with LXD on fedora using snap and LXD where I found the autocompletion file in /var/lib/snapd/snap/lxd/current/etc/bash_completion.d/ snap.lxd.lxc I don’t found this file on ubuntu. On this ubuntu focal, it’s a taller version of Snappy and some internal changes seems to appear there.

How do I get LXD autocomplete on this ubuntu 20.04?


In Ubuntu it should be here (LXD 4.7),

$ ls -l /etc/bash_completion.d/lxc 
lrwxrwxrwx 1 root root 52 Nov   9  2018 /etc/bash_completion.d/lxc -> /snap/lxd/current/etc/bash_completion.d/snap.lxd.lxc

If you do not have this link, then it could be a packaging issue.

1 Like

Yes. The symlink is missing in my case.
Thank you for this nice answer :wink: :+1:

This bash completion symlink is still missing from snap version 5.3, but can be manually fixed just the same. Still I’d consider it a bug.

Please can you log at Issues · lxc/lxd-pkg-snap · GitHub

Not sure how much we can do about this, it’s a snapd feature.

root@u1:~# snap install lxd
lxd 5.3-91e042b from Canonical✓ installed
root@u1:~# lxc 
alias      console    exec       help       info       list       move       pause      publish    rename     shell      stop       
cluster    copy       export     image      init       manpage    network    profile    query      restart    snapshot   storage    
config     delete     file       import     launch     monitor    operation  project    remote     restore    start      version    
root@u1:~# lxc 

Seems to work fine though.

Here the profile ended up in /usr/share/bash-completion/completions/lxd.lxc