Comment 6 for bug 1791587

Revision history for this message
Dmitrii Shcherbakov (dmitriis) wrote : Re: [2.34.2] snapd ignores proxy settings set via core snap

Tried 2.35.4+18.04.

lxc launch ubuntu:bionic snaptest

# ... enable bionic proposed

root@snaptest:~# apt policy snapd
snapd:
  Installed: 2.35.4+18.04
  Candidate: 2.35.4+18.04
  Version table:
 *** 2.35.4+18.04 500
        500 http://archive.ubuntu.com/ubuntu bionic-proposed/main amd64 Packages
        100 /var/lib/dpkg/status

root@snaptest:~# ip route del default
root@snaptest:~# ip route
10.10.10.0/24 dev eth0 proto kernel scope link src 10.10.10.14
10.10.10.1 dev eth0 proto dhcp scope link src 10.10.10.14 metric 100

# the squid proxy itself works fine
root@snaptest:~# https_proxy=http://10.10.10.30:3128 curl https://api.snapcraft.io
snapcraft.io store API service - Copyright 2018 Canonical.

root@snaptest:~# snap set core proxy.http=http://10.10.10.30:3128 proxy.https=http://10.10.10.30:3128

root@snaptest:~# snap list
No snaps are installed yet. Try 'snap install hello-world'.

root@snaptest:~# snap get core proxy.https
http://10.10.10.30:3128

root@snaptest:~# snap get core proxy.http
http://10.10.10.30:3128

strace -e connect -f -p `pgrep -f snapd` &

root@snaptest:~# snap install fcbtesting

[pid 1313] connect(4, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("127.0.0.53")}, 16 <unfinished ...>
[pid 1319] connect(5, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("127.0.0.53")}, 16 <unfinished ...>
[pid 1313] <... connect resumed> ) = 0
[pid 1319] <... connect resumed> ) = 0
[pid 1319] connect(4, {sa_family=AF_INET, sin_port=htons(9), sin_addr=inet_addr("91.189.92.41")}, 16) = -1 ENETUNREACH (Network is unreachable)
[pid 1319] connect(4, {sa_family=AF_INET, sin_port=htons(9), sin_addr=inet_addr("91.189.92.40")}, 16) = -1 ENETUNREACH (Network is unreachable)
[pid 1319] connect(4, {sa_family=AF_INET, sin_port=htons(9),

After a discussion on IRC it became apparent that the functionality works on Ubuntu core systems because they have a core snap pre-installed and not on classic systems.