Preferred method for configuring proxy settings for snapd

I have seen various methods of setting the proxy information, such as settings in file under ‘/etc/systemd/system/snapd.service.d/’ -or- using ‘snap set core proxy.http=…’, or even setting /etc/environment.

SO, at this point, what is the preferred method? If none are preferred, what methods exist today for setting the proxy info? Are there pros/cons to each method?


Setting via /etc/environment is supported because that’s where some GUI things set it (in 16.04, System settings → Network → Network proxy).

On core, snapd itself can set the proxy in /etc/environment, which makes sense as on core snapd manages the device. This is done via snap set system proxy.http= etc (core is a synonym for system here, kept for backwards compatibility).

If you have root on the device you could also edit /etc/environment yourself, or add it to snapd’s environment if you want snapd to have a proxy that is different from the rest of the system’s.

On classic (that is, when not on a core device), snapd won’t write /etc/environment, but still supports setting its own proxy via snap set. A proxy set via snap set overrides that obtained from the environment.

Outside of their effect on the rest of the system, the approaches are (or should be! bugs might exist) equivalent, and down to sysadmin preference.