Configuring snapd on ubuntu core for a web proxy

Michael Hudson-Doyle michael.hudson at canonical.com
Thu Jan 12 19:28:48 UTC 2017


On 13 January 2017 at 08:14, Max Brustkern <max.brustkern at canonical.com>
wrote:

> So I created a system directory with the contents of /lib/systemd/system.
> I edited that file to contain the environment variables:
> nuclearbob at localhost:~$ cat /lib/systemd/system/snapd.service
> [Unit]
> Description=Snappy daemon
> Requires=snapd.socket
>
> [Service]
> ExecStart=/usr/lib/snapd/snapd
> EnvironmentFile=/etc/environment
> Restart=always
> http_proxy=http://squid.internal:3128
> https_proxy=https://squid.internal:3128
>

That's not the right syntax, it should be

Environment=http_proxy=http://squid.internal:3128 https_proxy=https://squid.
internal:3128

See man systemd.exec for more details on this.

Cheers,
mwh


> [Install]
> WantedBy=multi-user.target
>
> I then did:
> nuclearbob at localhost:~$ sudo systemctl daemon-reload
> nuclearbob at localhost:~$ sudo service snapd restart
>
> I still don't seem to see snapd picking up on the proxy. I tried:
> sudo systemctl edit snapd
> I pasted in the file contents to there, but after that I get:
> nuclearbob at localhost:~$ sudo service snapd restart
> Failed to restart snapd.service: Unit snapd.service is not loaded
> properly: Invalid argument.
> See system logs and 'systemctl status snapd.service' for details.
> nuclearbob at localhost:~$ systemctl status snapd.service
> ● snapd.service - Snappy daemon
>    Loaded: error (Reason: Invalid argument)
>   Drop-In: /etc/systemd/system/snapd.service.d
>            └─override.conf
>    Active: active (running) since Thu 2017-01-12 19:11:46 UTC; 2min 26s ago
>  Main PID: 1339 (snapd)
>    CGroup: /system.slice/snapd.service
>            └─1339 /usr/lib/snapd/snapd
>
> Any additional tips to get snapd running on ubuntu core in the lab?
>
> On Wed, Jan 11, 2017 at 11:49 PM, Stuart Bishop <
> stuart.bishop at canonical.com> wrote:
>
>>
>>
>> On 12 January 2017 at 01:44, Max Brustkern <max.brustkern at canonical.com>
>> wrote:
>>
>>> I'm trying to run ubuntu core 16 in a kvm instance in an internal lab
>>> that requires a web proxy. This bug:
>>> https://bugs.launchpad.net/ubuntu/+source/snapd/+bug/1579652
>>> seems to cover how to do this on classic ubuntu, but the files that hold
>>> the environment variables used by snapd on an ubuntu core system are all on
>>> read-only filesystems. How do I set HTTPS_PROXY in a persistent way for
>>> snapd on that system?
>>>
>>
>> https://bugs.launchpad.net/snappy/+bug/1533899 is similar, but about
>> adding support for proxies to snapd (rather than have it use the system
>> environment variables, which is one implementation option but not always
>> what you want since that affects everything on the system). But that
>> doesn't help with your read-only filesystem sorry :-(
>>
>> (Hmm... disgusting hack idea.... since you can't create
>> /etc/systemd/system/snapd.service.d/ on your read-only filesystem, try
>> mounting that directory from somewhere. Extra points for using systemd to
>> mount the systemd service file overrides and setting up dependencies so it
>> does everything in the right order :-) )
>>
>>
>> --
>> Stuart Bishop <stuart.bishop at canonical.com>
>>
>> --
>> Snapcraft mailing list
>> Snapcraft at lists.snapcraft.io
>> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailm
>> an/listinfo/snapcraft
>>
>>
>
> --
> Snapcraft mailing list
> Snapcraft at lists.snapcraft.io
> Modify settings or unsubscribe at: https://lists.ubuntu.com/
> mailman/listinfo/snapcraft
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/snapcraft/attachments/20170113/42646903/attachment.html>


More information about the Snapcraft mailing list