Break-and-fix Linux troubleshooting labs in disposable local KVM virtual machines.

4 points•pavithrarajan22•about 2 hours ago•1 comment•
Hey everyone,

This is my first post on HN and I've always been someone who went through others' posts. Hopefully, this idea interest you and would really love some feedback!

A while back I came across SadServers through a LinkedIn post. It's been one of the most useful ways I've found to practice real troubleshooting. Thanks fduran for building this.

I wanted to keep practising on my own machine as well, offline and sometimes with no time limit if I am deep into reading some docs, so I built brokenbox. It's a small Python CLI that runs the same kind of scenario in disposable KVM VMs.

How it works:

- Each scenario is a qcow2 copy-on-write overlay on a shared golden image, created through libvirt. cloud-init creates the user and SSH keys.

- the setup and checker scripts are piped to root over SSH stdin, so they're never written to the guest's disk and you can't read the answer from inside the VM.

- After setup, a disk+memory snapshot is taken, so reset is near-instant and is useful if someone does end up messing up the VM while troubleshooting.

There are 15 scenarios so far. Each one is based on a question people keep asking on Stack Exchange, and those questions for inspiration are linked in the scenario. I've personally solved these as well and was a fun learning experience.

If you loved this, I'd love contributions on tasks as well.

It needs Linux with KVM and libvirt. I wrote more about why and how I built it in https://pavithra.dev/blogs/5

1 comment

paperstache42 minutes ago
Great! I can see how useful this would be for local iteration and testing. Always glad to get one more thing off a server into a machine I actually own. Looking forward to more tasks to complete.

Read the full thread on Hacker News →

Related stories