/snap/bin is not in path when executing user-data scripts

Bug #1772107 reported by Robert C Jennings
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cloud-init (Ubuntu)
Expired
Undecided
Unassigned

Bug Description

Given user-data:
  #!/bin/bash
  snap install aws-cli --classic
  echo $PATH
  aws help # command shipped in the snap

We see the following failure in /var/log/cloud-init-output.log:

Cloud-init v. 18.2 running 'modules:config' at Fri, 18 May 2018 20:10:57 +0000. Up 15.17 seconds.
aws-cli 1.15.21 from 'aws' installed
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
/var/lib/cloud/instance/scripts/part-001: line 5: aws: command not found
Cloud-init v. 18.2 running 'modules:final' at Fri, 18 May 2018 20:11:05 +0000. Up 23.18 seconds.

Expected results: commands shipped in snaps should work in user-data without hard-coded paths

$ apt-cache policy cloud-init
cloud-init:
  Installed: 18.2-27-g6ef92c98-0ubuntu1~18.04.1
  Candidate: 18.2-27-g6ef92c98-0ubuntu1~18.04.1
  Version table:
 *** 18.2-27-g6ef92c98-0ubuntu1~18.04.1 500
        500 http://us-west-2.ec2.archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages
        100 /var/lib/dpkg/status
     18.2-14-g6d48d265-0ubuntu1 500
        500 http://us-west-2.ec2.archive.ubuntu.com/ubuntu bionic/main amd64 Packages

Revision history for this message
Robert C Jennings (rcj) wrote :

Either a duplicate of, or related to, bug #1771858.

Revision history for this message
Dan Watkins (oddbloke) wrote :
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

mvo said he'd look at the other bug on tuesday.

However, one can self-ship the system-environment-generators/ snippet mentioned in the other bug, in a custom image if one needs to get this out quicker. E.g. in /etc/systemd/system-environment-generators/ it should work. Call it something like 50-custom

Revision history for this message
Scott Moser (smoser) wrote :

I'm marking this incomplete now.
If we sort out what needs to happen, and that bug 1771858 does not fix this issue, please set back to 'Confirmed'.

I'd much rather not deal with knowledge in cloud-init of how to set up snap path. That should all "just work" in the system.
I'd be willing to consider the case where cloud-init installed 'snap' specifically.

Changed in cloud-init (Ubuntu):
status: New → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for cloud-init (Ubuntu) because there has been no activity for 60 days.]

Changed in cloud-init (Ubuntu):
status: Incomplete → Expired
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.