boot failure when model-config sets snap-proxy

Bug #1940445 reported by Nicolas Bock
22
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Canonical Juju
Fix Released
High
Ian Booth

Bug Description

When I set a snap proxy and then add a machine, i.e.

juju model-config snap-http-proxy="http://10.0.0.1:8000"
juju add-machine

The juju created user-data will configure snap in the bootcmd section. This fails since at the time bootcmd is run the snapd service is not running.

$ juju ssh 0 -- sudo head -n30 /var/lib/cloud/instances/nan7an/user-data.txt.i
Content-Type: multipart/mixed; boundary="===============8907033412026628814=="
MIME-Version: 1.0
Number-Attachments: 1

--===============8907033412026628814==
MIME-Version: 1.0
Content-Type: text/cloud-config
Content-Disposition: attachment; filename="part-001"

#cloud-config
apt_mirror: ""
bootcmd:
- |-
printf '%s
' 'Acquire::http::Proxy "http://10.0.0.2:8000";
Acquire::http::Proxy::"127.0.0.1" "DIRECT";
Acquire::https::Proxy::"127.0.0.1" "DIRECT";
Acquire::ftp::Proxy::"127.0.0.1" "DIRECT";
Acquire::http::Proxy::"localhost" "DIRECT";
Acquire::https::Proxy::"localhost" "DIRECT";
Acquire::ftp::Proxy::"localhost" "DIRECT";
Acquire::http::Proxy::"::1" "DIRECT";
Acquire::https::Proxy::"::1" "DIRECT";
Acquire::ftp::Proxy::"::1" "DIRECT";' > /etc/apt/apt.conf.d/95-juju-proxy-settings
- snap set system proxy.http="http://10.0.0.1:8000"
- snap set system proxy.https="https://10.0.0.1:8000"
output:
all: '| tee -a /var/log/cloud-init-output.log'
package_update: true
package_upgrade: true
packages:

$ juju ssh 0 -- sudo grep snapd /var/log/cloud-init-output.log
error: cannot communicate with server: Put http://localhost/v2/snaps/system/conf: dial unix /run/snapd.socket: connect: no such file or directory
error: cannot communicate with server: Put http://localhost/v2/snaps/system/conf: dial unix /run/snapd.socket: connect: no such file or directory

Revision history for this message
Ian Booth (wallyworld) wrote :

I was unable to reproduce this at all, but have done a small patch to defer the snap set commands to cloud init runcmds rather than bootcmds.

https://github.com/juju/juju/pull/13261

Changed in juju:
milestone: none → 2.9.12
assignee: nobody → Ian Booth (wallyworld)
importance: Undecided → High
status: New → In Progress
Revision history for this message
Nicolas Bock (nicolasbock) wrote :

Reproduces with juju-2.9.11 and AWS as cloud provider with default series focal.

I will test your patch now.

Revision history for this message
Nicolas Bock (nicolasbock) wrote :

I can confirm that with your change the issue is not reproducible anymore Ian.

Revision history for this message
Ian Booth (wallyworld) wrote :

Great, thanks for testing

Changed in juju:
status: In Progress → Fix Committed
status: Fix Committed → In Progress
Ian Booth (wallyworld)
Changed in juju:
status: In Progress → Fix Committed
Changed in juju:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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