proxy settings is not applied to services

Bug #1866095 reported by Ondrej Kubik
20
This bug affects 3 people
Affects Status Importance Assigned to Milestone
snapd
Fix Released
High
Zygmunt Krynicki

Bug Description

snap version 2.44~pre1
core 18

Precondition: snap set system proxy.http=blablabla

Expected result:
 proxy setting is available to applications and services
Actual result:
 proxy is only available to applications
 no daemon has proxy settings applied

Closer investigations shows following:
snapd will update /etc/environment with http_proxy value once config is applied
this is then picked by applications, when they are started
But services do not source /etc/environment at all and ignore the configuration.

Quick test shows why, service file is missing line: 'EnvironmentFile=-/etc/environment'

$ systemctl cat snap.hello-world.env-daemon.service
[Unit]
# Auto-generated, DO NOT EDIT
Description=Service for snap application hello-world.env-daemon
Requires=snap-hello\x2dworld-x6.mount
Wants=network.target
After=snap-hello\x2dworld-x6.mount network.target
X-Snappy=yes

[Service]
ExecStart=/usr/bin/snap run hello-world.env-daemon
SyslogIdentifier=hello-world.env-daemon
Restart=no
WorkingDirectory=/var/snap/hello-world/x6
TimeoutStopSec=30
Type=oneshot

[Install]
WantedBy=multi-user.target

Once service file is updated with 'EnvironmentFile=-/etc/environment' all works as expected.
We likely need to update service file template, otherwise there is different behaviour between apps and daemons

Tags: mvo
Ondrej Kubik (ondrak)
tags: added: mvo
Zygmunt Krynicki (zyga)
Changed in snapd:
status: New → Confirmed
Michael Vogt (mvo)
Changed in snapd:
importance: Undecided → High
Zygmunt Krynicki (zyga)
Changed in snapd:
status: Confirmed → In Progress
assignee: nobody → Zygmunt Krynicki (zyga)
milestone: none → 2.44
Revision history for this message
Zygmunt Krynicki (zyga) wrote :
Zygmunt Krynicki (zyga)
Changed in snapd:
status: In Progress → Fix Committed
Revision history for this message
Zygmunt Krynicki (zyga) wrote :

This was released in snapd 2.44. Marking as such.

Changed in snapd:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.