I’m happy to announce a new ZFS boot environment manager written completely from scratch in C - zectl.

In 2018 I wrote zedenv, a ZFS Boot Environment manager, I’ve taken what I learned from zedenv and added improvements in workflow, performance and reliability.

For a summary on what a boot environment manager is, and how it can be used see my previous post.

Why the Rewrite

I had been having misgivings about writing my original implementation in Python. At the time of writing there was no libzfs library interface for python and I wrote my own “wrapper library” - pyzfscmds - that simply called out to the zfs binary. While the wrapper has worked, it meant a lot of extra work was done parsing string output from zfs subcommands. Directly using the libzfs library allows for more robust code, significantly better performance, and error handling. I was considering porting the python tool to use py-libzfs, or writing it in C when the tool bectl came out for FreeBSD. Seeing bectl ’s impressive implementation I was inspired to do the rewrite in C.

Plugins

Part of the reasoning behind writing the original tool in Python was to facilitate a plugin interface. Having a way to extend the codebase was key so that I, and potentially others, could write plugins for additional bootloaders without requiring them to be part of the core tool. I wanted to carry over the plugin functionality to the C tool, I felt this would be possible using dynamically linked libraries, and have implemented a similar plugin interface using dlopen . As of now a plugin exists for the systemd-boot bootloader, and one is in the works for GRUB.

Contributing

zectl is Open source (MIT-licensed) and looking for contributions.

If you’d like to help out with the project, please reach out to us on GitHub, via email, or on #zectl:matrix.org.

Thanks to