So I again spent some time on this and the solution to get it working is to 
modify snapd service file - not directly, but by using an override file - and 
pointing to the /etc/environment file that defines the environment variables 
for the proxy.
(Still not sure why it behaved before differently with SNAPD_DEBUG_HTTP=7 set - 
anyway ...)

# don't modify /lib/systemd/system/snapd.service - just have a look at it:
ubuntu@zlin42:~$ cat /lib/systemd/system/snapd.service
[Unit]
Description=Snappy daemon
Requires=snapd.socket

[Service]
ExecStart=/usr/lib/snapd/snapd
EnvironmentFile=-/etc/environment
Restart=always

[Install]
WantedBy=multi-user.target
ubuntu@zlin42:~$

# no override file by default
ubuntu@zlin42:~$ ls -la /etc/systemd/system/snapd.service.d/override.conf
ls: cannot access '/etc/systemd/system/snapd.service.d/override.conf': No such 
file or directory
ubuntu@zlin42:~$

# this will create an appropriate override file and will not touch 
snapd.service directly
ubuntu@zlin42:~$ sudo systemctl edit snapd
# point it to use /etc/environment as EnvironmentFile (clear it before)
ubuntu@zlin42:~$ cat /etc/systemd/system/snapd.service.d/override.conf 
[Service]
EnvironmentFile=
EnvironmentFile=/etc/environment
ubuntu@zlin42:~$

# that's the override file now:
ubuntu@zlin42:~$ ls -la /etc/systemd/system/snapd.service.d/override.conf 
-rw-r--r-- 1 root root 43 Apr 28 06:49 
/etc/systemd/system/snapd.service.d/override.conf
ubuntu@zlin42:~$

# an that's the content of the environment file (I only added the last two 
proxy lines):
ubuntu@zlin42:~$ cat /etc/environment 
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
http_proxy="mysquid.internal-domain.com:3128"
https_proxy="mysquid.internal-domain.com:3128"
ubuntu@zlin42:~$

# restart of service is required to read the new config
ubuntu@zlin42:~$ sudo systemctl restart snapd.service

# now snap works and I don't see any timeouts anymore ...
ubuntu@zlin42:~$ sudo snap install hello-world
hello-world 6.3 from 'canonical' installed

ubuntu@zlin42:~$ snap list 
Name         Version  Rev   Developer  Notes
core         16-2     1582  canonical  -
hello-world  6.3      27    canonical  -
ubuntu@zlin42:~$

Obviously snap/snapd does not always need the proxy, a "snap find ."
works without having a proxy in place in my case...

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1609754

Title:
  Cannot install/use 'hello-world' example

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/snapd/+bug/1609754/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to