Skip to content

Instantly share code, notes, and snippets.



Last active Oct 11, 2018
What would you like to do?
Setting up User Mode Linux on Fedora 20

user mode linux: build and run

Generate default .config.

$ make defconfig ARCH=um SUBARCH=x86_64

Build the linux ELF binary.

$ make -j8 linux ARCH=um SUBARCH=x86_64

Create the rootfs. Note the absolute path; supermin 5.1.9 fails with relative paths. --use-installed speeds up the --prepare step but skips files that are inaccessible to non-root users, like files in /usr/sbin.

$ supermin -v --prepare bash coreutils -o $PWD/rootfs.template
$ supermin -v --build --format chroot rootfs.template -o $PWD/rootfs

Create a bootstrapper shell script.

$ cat > rootfs/boot/
mount -t sysfs /sys /sys
mount -t proc /proc /proc
exec /bin/bash
$ chmod +x rootfs/boot/

Start the UML instance with the rootfs mounted read/write. Note again the absolute path.

$ ./linux rootfstype=hostfs rootflags=$PWD/rootfs rw init=/boot/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment