First time snapcraft user having issues

Robert Park robert.park at canonical.com
Wed Sep 14 19:06:50 UTC 2016


Fun times, gentlemen:

HOST="/var/lib/snapd/hostfs"

# Break out of snap chroot
if [ -x "$HOST/usr/bin/sudo" ]; then
    app="$(mktemp $HOST/tmp/bileto-app-XXX.sh)"
    $HOST/usr/bin/sudo cp --verbose --force $0 $app
    inchroot="$(echo $app | sed "s#$HOST##")"
    $HOST/usr/bin/sudo $HOST/usr/sbin/chroot $HOST sh $inchroot "$@"
    retval="$?"
    rm --force $app
    exit $retval
fi

On Wed, Sep 14, 2016 at 10:36 AM, Kyle Fazzari
<kyle.fazzari at canonical.com> wrote:
> On 09/14/2016 10:18 AM, Kyle Fazzari wrote:
>>
>> On 09/14/2016 10:11 AM, Robert Park wrote:
>>> On Wed, Sep 14, 2016 at 7:53 AM, Kyle Fazzari
>>> <kyle.fazzari at canonical.com> wrote:
>>>> On 09/13/2016 08:08 PM, Robert Park wrote:
>>>>> So I want to snap up a script that needs root and does administrative
>>>>> stuff on the host system. I realize this goes against snaps' goals of
>>>>> being all secure and confined, is there any way I can list a plug in
>>>>> my 'plugs:' that would give me root on the users computer, perhaps
>>>>> giving the user a giant warning that they're installing something that
>>>>> can break their system? Basically I don't want any confinement in my
>>>>> snap at all.
>>>> Yeah, installing with --devmode disables confinement (but enables
>>>> warnings). Make sure the "confinement" property in the snapcraft.yaml is
>>>> set to devmode as well, which will make it impossible to install without
>>>> --devmode.
>>> Even with "confinement: devmode" and "sudo snap install
>>> --force-dangerous --devmode *.snap" I still can't run commands from
>>> the host system:
>>>
>>> /snap/bileto/x1/bin/bileto: 77: /snap/bileto/x1/bin/bileto: curl: not found
>>> + add-apt-repository ppa:ci-train-ppa-service/
>>> /snap/bileto/x1/bin/bileto: 82: /snap/bileto/x1/bin/bileto:
>>> add-apt-repository: not found
>> Yeah your PATH probably doesn't include those. The execution environment
>> for a snap (even a devmode snap) is the core snap, which doesn't include
>> e.g. curl. The classic system on which you're presumably running is
>> mounted into var/lib/snapd/hostfs, I _think_ (zygmunt can answer with
>> more certainty).
>
> (Oops, I missed a leading slash on the /var)
>
> --
> Kyle Fazzari (kyrofa)
> Software Engineer
> Canonical Ltd.
> kyle at canonical.com
>
>



-- 
robru




More information about the Snapcraft mailing list