Skip to content

Instantly share code, notes, and snippets.

@dm0-
dm0- / 09_coreos.cfg
Created July 18, 2016 21:07
Sample GRUB menu item to boot a CoreOS PXE image (assuming it is stored on the seventh GPT partition)
#!/bin/tail -n+2
menuentry 'CoreOS 1109.1.0' --class coreos --class gnu-linux --class gnu --class os --unrestricted {
insmod part_gpt
insmod fat
set root='hd0,gpt7'
linuxefi /coreos/vmlinuz-4.6.4-coreos kvm_intel.nested=1 coreos.autologin=tty1 coreos.configdrive=1
initrdefi /coreos/coreos-1109.1.0.img
}
@dm0-
dm0- / fedora-nspawn.service
Created July 18, 2016 21:10
Sample alternate Fedora container service (incomplete, X input fails)
[Unit]
Description=Start the local Fedora installation in a container
After=getty@tty2.service getty@tty3.service \
boot.mount mnt-fedora.mount opt.mount
Conflicts=getty@tty2.service getty@tty3.service
Requires=mnt-fedora.mount
Wants=boot.mount opt.mount
[Service]
Delegate=yes
@dm0-
dm0- / noodel.c
Created July 22, 2016 23:56
Run a program without the ability to delete files
/* cc -o noodel -lseccomp noodel.c */
#include <seccomp.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int
main (int argc, char *argv[])
{
scmp_filter_ctx ctx;
@dm0-
dm0- / build.sh
Created October 26, 2016 23:30
Build an Azure agent ACI using CentOS 7 (WIP)
#!/bin/bash -e
# Build a CentOS system with the configuration file from CoreOS.
config_url='https://raw.githubusercontent.com/coreos/coreos-overlay/master/app-emulation/wa-linux-agent/files/waagent.conf'
mirrorlist='http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os'
mirror=$(
IFS=$'\n' urls=($(curl --location --silent "$mirrorlist"))
echo "${urls[$((RANDOM % ${#urls[@]}))]}"
)
@dm0-
dm0- / overlay-modules.md
Created July 18, 2016 21:00
Add out-of-tree kernel modules to CoreOS

If the CoreOS developer image was used to build custom kernel modules for the same kernel version as in a CoreOS image, these modules can be added to the existing set with overlayfs. This example mount unit illustrates this if the modules are available under /mnt. Note that usual overlayfs requirements apply: namely that the working directory must be on the same root as the upper layer, and it needs to support extended attributes.

[Unit]
Description=Add custom kernel modules into the mix

ConditionPathExists=/mnt/%v

@dm0-
dm0- / utcbios.bat
Created July 18, 2016 20:58
Set Windows to expect UTC system time (save file, right-click, run as administrator)
reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation" /v RealTimeIsUniversal /d 1 /t REG_DWORD /f
@dm0-
dm0- / user_data.yml
Created July 18, 2016 21:25
The nightmare config for a CoreOS workstation (messy, unsafe, and wildly incomplete)
#cloud-config
hostname: "set-this"
coreos:
update:
reboot-strategy: "off"
units:
- name: "default.target"
command: "start"
@dm0-
dm0- / README.md
Last active December 7, 2018 14:33
Automated Tectonic installer for local virtual machines

Tectonic virtual install script

This script is a Tectonic installer for local development and testing. It creates a cluster of virtual machines on the same host that runs the script. All files, processes, and any other virtual resources that are created during its execution should be automatically removed on exit.

Dependencies

The first lines in the script list every command dependency, which can be

@dm0-
dm0- / kernel-small.md
Last active July 30, 2019 19:53
Build a modified CoreOS kernel (no initramfs modules; X260 driver notes)

Download and start the CoreOS development image in a container. Make sure to bind writable directories over the kernel's build and install paths.

wget 'http://alpha.release.core-os.net/amd64-usr/current/coreos_developer_container.bin.bz2'
bzcat coreos_developer_container.bin.bz2 > coreos_developer_container.bin
mkdir boot modules src
sudo systemd-nspawn \
    --bind="$PWD/boot:/boot" \
    --bind="$PWD/modules:/lib/modules" \

--bind="$PWD/src:/usr/src" \

CoreOS Workstation Notes

This is a summary of the system setup used for the demonstration on 2016-07-18.

Goals / Requirements

This was put together with the following intent:

  • It must build upon an unmodified CoreOS user space image.