canonical / classic-snap

The `classic` snap
16 stars 9 forks source link

It is possible to install the classic snap in a classic system #33

Open anonymouse64 opened 5 years ago

anonymouse64 commented 5 years ago

In a classic system, I can run:

sudo snap install classic --edge --devmode

and it will get the classic snap installed.

However, when I run classic.create, it fails with:

cp: cannot stat '/etc/writable/hostname': No such file or directory

I think it shouldn't be possible to install the classic snap in a classic system.

(originally reported by @elopio on launchpad @ https://bugs.launchpad.net/snapd/+bug/1621666)

anonymouse64 commented 5 years ago

FWIW, if someone wants to fix this all you would need to do is add:

UBUNTU_CORE=$(grep "snap_core=" /proc/cmdline | grep "snap_kernel=")
if [ -z "$UBUNTU_CORE" ]; then
    exit 1
fi

to the install hook

howardcochran commented 3 years ago

This issue was already resolved with this snippit:

if ! grep -q "Ubuntu Core" /etc/os-release; then
    echo "Classic mode only works on Ubuntu Core"
    exit 1
fi

In this commit:

commit 3811d122665ea26147f4fb8721d27863ced26441
Author: Michael Vogt <mvo@ubuntu.com>
Date:   Fri Oct 12 12:15:41 2018

    port classic to UC18

    This makes the classic dimension for UC18 available via the classic
    snap. The approach is slightly different than what was done in UC16,
    i.e. the base tarfile from ubuntu 18.04 is included in the snap
    and that is used to prepare the chroot environment (see also
    https://forum.snapcraft.io/t/7985 for a discussion about this).

    Note that as part of the process the sandboxing of apt has to be
    disabled currently.