Build own core snap

Hey Guys,

I want to build my own core.snap with some modifications on a RPi3

First of all I have tried to build a clean core from

https://github.com/snapcore/core

I have follow the instructions and build it on a ubuntu core in classic mode.
Then I have build an image with --extra-snaps core.snap, after the build on boot it failures on two services:

Failed to Start LSB: AppArmor Initilization and
Faild to Start Automatically Repair incorrect Owner/Permission on core devices

After then it stucks on

Reached target cloud-init and Started update UTMP run level services

What do I wrong?
or what I have todo?

Greets

any suggestions on this?

or did I need to include this?

into the core.snap?

@tokurz Looks like some of those options are unconventional. For example, are you trying to run an Ubuntu Core device, or a classic Ubuntu device? Why are you trying to load the core snap by hand?

@awe Whoā€™s the best person to help here?

1 Like

Hey @niemeyer @awe
I want to build an ubuntu core device with own core snap for my own education to understand deeper the way of the core.

Greets Tony

Iā€™d recommend to actually not do it in the classic chroot on a core device but instead install qemu-user-static on your host, create a chroot using qemu-debootstrap and run the build in there ā€¦

the snapcore/core-build code is the source for packages in the snappy PPA that the core build uses, you do not need to touch it.

What part of the core snap are you trying to modify?

If you just want to build a Ubuntu Core image manually, you can follow the process here: https://docs.ubuntu.com/core/en/guides/build-device/image-building and use the core snap from the store.

Also, when Iā€™ve needed to test changing things in the core snap, I have built the core snap natively on an Ubuntu 16.04 machine. I tried using a docker container and an lxd container, but ran into issues I donā€™t remember related to executing mounts. Perhaps @ograā€™s advice is better here, I wasnā€™t able to get that setupā€¦

Hey @ogra , I have now successfully build the core snap, but wenn I try to boot it stucks in AppArmor initilization and by Automatically repair user permission service and hangs on UTMP Boot Service.

Any Ideas?

Greets

well, what did you change ?

nothing I build it from scratch in an chroot, also an build on the classic snap on an raspi3 its the same error

did you install livecd-rootfs from the PPA into the build env first ?

yep I installed these, also snapcraft fetch this also, right?

snapcraft fetches the build-packages from whatever is defined in the sources.list of the building host/environment, so it is essential that the build host or container has the right entries for the PPA.

1 Like

Hey, this package is already installed, I have double checked.
The problem might be on other side.

I have now make some changes in the chroot system, i had forget to do ā€œdist-upgradeā€, but now when I run snapcraft, the error comes:

Unable to locate package ubuntu-core

apt sources:

deb http://ppa.launchpad.net/snappy-dev/image/ubuntu xenial main
deb http://ports.ubuntu.com/ubuntu-ports xenial-updates main restricted universe multiverse
deb http://ports.ubuntu.com/ubuntu-ports xenial main restricted universe multiverse
deb-src http://ports.ubuntu.com/ubuntu-ports xenial-updates main restricted universe multiverse
deb http://ports.ubuntu.com/ubuntu-ports xenial-proposed main restricted universe multiverse
deb-src http://ports.ubuntu.com/ubuntu-ports xenial-proposed main restricted universe multiverse
deb http://ports.ubuntu.com/ubuntu-ports xenial-security main restricted universe multiverse
deb-src http://ports.ubuntu.com/ubuntu-ports xenial-security main restricted universe multiverse

any ideas?

http://ppa.launchpad.net/snappy-dev/image/ubuntu/pool/main/u/ubuntu-core-meta/

not really i fear :frowning:

if you did apt update ubuntu-core should be found ā€¦

hey @ogra,

finally i getting working the build of the core snap. Shame on me it was an typo issue in the Makefile lineā€¦

Thx for help :slight_smile:

Hi,

I follow the steps on https://github.com/snapcore/core ,

it report below when used snapcraft to build, any suggestion? thanks!

liao@Android:~/workspace/core$ sudo snapcraft
DEPRECATED: The ā€˜buildā€™ keyword has been replaced by ā€˜override-buildā€™
See http://snapcraft.io/docs/deprecation-notices/dn8 for more information.
DEPRECATED: The ā€˜buildā€™ keyword has been replaced by ā€˜override-buildā€™
See http://snapcraft.io/docs/deprecation-notices/dn8 for more information.
Pulling check
The ppa:snappy-dev/image PPA is missing.
This probably means that the build was triggered incorrectly.
ubuntu-core-config:
Installed: (none)
Candidate: 0.6.40
Version table:
0.6.40 500
500 http://cn.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
500 http://cn.archive.ubuntu.com/ubuntu xenial/main i386 Packages
Failed to run ā€˜override-pullā€™: Exit code was 1.
liao@Android:~/workspace/core$

well, it tells you what is wrong :wink: add the PPA to the build environment (the host or the container you run the build process in) and it will work ā€¦

but, how to add PPA :joy: