Skip to content

Instantly share code, notes, and snippets.

@kimono-koans
Last active October 3, 2024 15:36
Show Gist options
  • Save kimono-koans/7641ee7bc7ce91f520b324bb08d699c8 to your computer and use it in GitHub Desktop.
Save kimono-koans/7641ee7bc7ce91f520b324bb08d699c8 to your computer and use it in GitHub Desktop.
How I purged zsys and lived to tell the tale
You're going to need to snap your root according to zsys convention (just using a date won't work), like this:
#!/bin/bash
DATE_HASH="$( date | cksum | cut -f1 -d' ' | tr -d '\n' | xargs -0 printf '%x\n' )"
zfs snapshot -r bpool@snap_"$DATE_HASH"_prepApt
zfs snapshot rpool@snap_"$DATE_HASH"_prepApt
zfs snapshot -r rpool/ROOT@snap_"$DATE_HASH"_prepApt
zfs snapshot -r rpool/USERDATA@snap_"$DATE_HASH"_prepApt
And you'll need to execute such a script before 'apt upgrade' from /etc/apt/apt.conf.d:
// Takes a snapshot of the system before package changes.
DPkg::Pre-Invoke {"[ -x /usr/local/sbin/snapPrepApt ] && /usr/local/sbin/snapPrepApt || true";};
And when you update your kernel from /etc/kernel/preinst.d like so:
#!/bin/sh
[ -x /usr/local/sbin/snapPrepApt ] && /usr/local/sbin/snapPrepApt || true
This seems to work with the initramfs/GRUB hooks which remain after you purge zsys.
@46cv8
Copy link

46cv8 commented Oct 3, 2024

I managed to fix my issues with zsys so I'm keeping it for the time being. I posted an answer on a stackexchange thread that helped me resolve the issue. https://askubuntu.com/questions/1388997/zsys-commit-service-fails-with-couldnt-promote-dataset-not-a-cloned-filesy/1528760#1528760

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