How to setup global remotes properly

Hi, while attempting to add a server as a “global” remote by following these directions, I cannot seem to get it to appear in lxc remote list.

In order to get the right information and the server cert I would manually add the server via lxc remote add <name> <server url> and then type in the password then copy it from ~/snap/lxd/common/servercerts to /etc/lxc/servercerts with the same name as defined in the /etc/lxc/config.yml like mentioned in the documentation page.

My question is, is this a good way to do it? Is there a different way I should be doing this?

Did you resolve this via Unable to add global remotes on snap version of lxd · Issue #10934 · lxc/lxd · GitHub?

yeah! That worked perfectly. Thank you!

1 Like

This solution didn’t work for me; I tried adding a global remote as described above and the remote shows up in the list:

$ lxc remote list
|      NAME       |                   URL                    |   PROTOCOL    |  AUTH TYPE  | PUBLIC | STATIC | GLOBAL |
| myremote        | https://myremote:8443                    | lxd           | tls         | NO     | NO     | YES    |

However I am unable to actually use the remote, instead getting this error:

$ lxc list myremote:
Error: not authorized

If I run lxc info myremote:, I see that the environment section is empty (I don’t see the certificate or any of the other data), whereas a normal/working remote has the certificate and other data populated in this section:

  addresses: []
  architectures: []
  certificate: ""
  certificate_fingerprint: ""
  driver: ""
  driver_version: ""
  firewall: ""
  kernel: ""
  kernel_architecture: ""
  kernel_features: {}
  kernel_version: ""
  lxc_features: {}
  os_name: ""
  os_version: ""
  project: ""
  server: ""
  server_clustered: false
  server_event_mode: ""
  server_name: ""
  server_pid: 0
  server_version: ""
  storage: ""
  storage_version: ""
  storage_supported_drivers: []

The certificate file is present in /var/snap/lxd/common/global-conf/servercerts/, has the same permissions/owner as other certificates in that directory, etc, yet it won’t work. I have tried restarting the snap.lxd.daemon service with no change in behavior. This Ubuntu 22.04 server is running LXD 5.0.1. What can I do to get this working? Thanks!