Skip to content

Instantly share code, notes, and snippets.

@marineam
Last active May 21, 2018 12:47
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save marineam/9914debc25c8d7dc458f to your computer and use it in GitHub Desktop.
Save marineam/9914debc25c8d7dc458f to your computer and use it in GitHub Desktop.
CoreOS dev container

Pending real documentation.... We do have a development container which includes the same toolchain version that was used to build CoreOS but it works under systemd-nspawn, not docker, and isn't documented. But here is a quick guide that may be a useful starting place.

# on coreos
wget http://alpha.release.core-os.net/amd64-usr/current/coreos_developer_container.bin.bz2
bunzip2 coreos_developer_container.bin.bz2
sudo systemd-nspawn -i coreos_developer_container.bin --share-system
# inside container:
emerge-gitclone
emerge -gKav coreos-sources
cd /usr/src/linux
zcat /proc/config.gz >.config
make modules_prepare

After that you should be able to build both internal and external modules, but there is a major quirk here: /lib/modules is read-only so you cannot install them there, use depmod, or use modprobe. You can still load them with insmod by path but it is up to you to load them in the right order if you are building something complicated with lots of modules like ALSA. The Nvidia case does have an advantage here, being a single module there aren't dependencies to deal with.

@crawford
Copy link

Hmmm, this is why I couldn't get this working:

sudo systemd-nspawn --image coreos_developer_container.bin 
Failed to identify root partition in disk image coreos_developer_container.bin.
Note that the disk image needs to follow http://www.freedesktop.org/wiki/Specifications/DiscoverablePartitionsSpec/ to be supported by systemd-nspawn.
Failed to remove loop 0: Device or resource busy

But if I throw in --share-system:

sudo systemd-nspawn --image coreos_developer_container.bin --share-system
Spawning container coreos_developer_container.bin on coreos_developer_container.bin.
Press ^] three times within 1s to kill container.
crawford-test-1 ~ #

Weirdly, if I omit --share-system:

sudo systemd-nspawn --image coreos_developer_container.bin               
Spawning container coreos_developer_container.bin on coreos_developer_container.bin.
Press ^] three times within 1s to kill container.
coreos_developer_container ~ #

It works! I'll have to dig into this later.

@marineam
Copy link
Author

@crawford sure sounds like a bug in nspawn or udev is being a brat. (or something else unknown, there is a claim that the "Device or resource busy" errors in coreos-install are actually not udev's fault after all, for all I know this may be related)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment