Skip to content

Instantly share code, notes, and snippets.

@zellio
Created October 22, 2015 20:32
Show Gist options
  • Save zellio/8748c560c104196ff59c to your computer and use it in GitHub Desktop.
Save zellio/8748c560c104196ff59c to your computer and use it in GitHub Desktop.
Generate Ubuntu Trusty container that will boot under systemd-nspawn
#!/usr/bin/env bash
function __main
{
local -r path="$(realpath "${1:-.}")"
debootstrap --variant=buildd trusty "$1" http://archive.ubuntu.com/ubuntu/
patch --unified "$path/etc/init/console.conf" <<'EOF'
@@ -3,7 +3,8 @@
# This service maintains a getty on console from the point the system is
# started until it is shut down again.
-start on stopped rc RUNLEVEL=[2345] and container CONTAINER=lxc
+start on stopped rc RUNLEVEL=[2345] and (container CONTAINER=lxc or
+ container CONTAINER=systemd-nspawn)
stop on runlevel [!2345]
EOF
path --unified "$path/etc/shadow" <<'EOF'
@@ -1,4 +1,4 @@
-root::16730:0:99999:7:::
+root:*:16730:0:99999:7:::
daemon:*:16730:0:99999:7:::
bin:*:16730:0:99999:7:::
sys:*:16730:0:99999:7:::
EOF
}
__main "$@"
exit "$!"
@bartoszek
Copy link

Perhaps you have a solution for "how to run the network" in systemd-nspawn in ubuntu/trusty ?

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