snapd ignores proxy settings set via core snap
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
snapd |
Fix Released
|
Undecided
|
Unassigned | ||
snapd (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
Setting proxy settings via the core snap does not have any effect.
sudo snap set core proxy.http=http://
sudo snap set core proxy.https=http://
Although I wouldn't want my global /etc/environment to be modified by snapd in any case but it is not modified:
cat /etc/environment
PATH="/
TESTVAR="testval"
When I go to my proxy server and check the logs there is nothing in them.
Looking at the implementation, the core snap proxy configuration handler only tries to update the global /etc/environment file - not the default HTTP transport used for snapd cases.
https:/
The default http transport is updated based on environment settings:
https:/
func newDefaultTrans
// based on https:/
return &http.Transport{
Proxy: http.ProxyFromE
https:/
Since those settings are not there, snapd doesn't use the proxy specified.
Instead, snapd needs to (thread-safely) set HTTP_PROXY, HTTPS_PROXY and NO_PROXY values in-memory based on core snap settings instead of trying to modify /etc/environment. For this to take effect connections to the snap store need to use new http.Transport objects every time they need to access it or react to in-memory environment variable changes.
apt policy snapd
snapd:
Installed: 2.34.2+18.04
Candidate: 2.34.2+18.04
Version table:
*** 2.34.2+18.04 500
500 http://
100 /var/lib/
2.32.5+18.04 500
500 http://
Changed in snapd: | |
status: | Incomplete → New |
summary: |
- [2.34.2] snapd ignores proxy settings + [2.34.2] snapd ignores proxy settings set via core snap |
summary: |
- [2.34.2] snapd ignores proxy settings set via core snap + snapd ignores proxy settings set via core snap |
Changed in snapd: | |
status: | Fix Committed → Fix Released |
Changed in snapd (Ubuntu): | |
status: | New → Fix Committed |
Changed in snapd (Ubuntu): | |
status: | Fix Committed → Fix Released |
Thanks for your bugreport.
Can you please try "sudo snap refresh --edge core" and see if that fixes the issue for you? We added support for looking up the http proxy from the core configuration on classic in master.