Skip to content

Unmanaged datasets destroyed at boot time #196

@azazar

Description

@azazar

Describe the bug

When custom datasets are present in the system, they are not recognised by zsys and sceduled for destuction. That's probably a new incarnation of a bug #103 reported earlier.

Before actually deleting filesystem there were two failed attempts:

...
Mar 12 14:19:45 hp zed: eid=132 class=history_event pool_guid=0x974173CCDE607995
Mar 12 14:19:48 hp zed: eid=133 class=history_event pool_guid=0x974173CCDE607995
Mar 12 14:19:50 hp zed: eid=134 class=history_event pool_guid=0x974173CCDE607995
Mar 12 14:20:18 hp systemd[1]: zsysd.service: Succeeded.
Mar 12 14:21:01 hp systemd[1]: Starting Clean up old snapshots to free space...
Mar 12 14:21:01 hp systemd[1]: Starting ZSYS daemon service...
Mar 12 14:21:02 hp systemd[1]: Started ZSYS daemon service.
Mar 12 14:21:03 hp zsysd[14234]: level=warning msg="[[f0d315a4:620bdb6a]] Couldn't destroy user dataset rpool/USERDATA/m_enc (due to rpool/USERDATA/m_enc): couldn't destroy \"rpool/USERDATA/m_enc\" and its children: cannot destroy dataset \"rpool/USERDATA/m_enc\": dataset is busy"
Mar 12 14:21:03 hp zsysctl[14228]: #033[33mWARNING#033[0m Couldn't destroy user dataset rpool/USERDATA/m_enc (due to rpool/USERDATA/m_enc): couldn't destroy "rpool/USERDATA/m_enc" and its children: cannot destroy dataset "rpool/USERDATA/m_enc": dataset is busy
Mar 12 14:21:05 hp systemd[1]: zsys-gc.service: Succeeded.
Mar 12 14:21:05 hp systemd[1]: Finished Clean up old snapshots to free space.
Mar 12 14:22:05 hp systemd[1]: zsysd.service: Succeeded.
...
Mar 12 21:28:30 hp systemd[1]: Starting Clean up old snapshots to free space...
Mar 12 21:28:31 hp zed: eid=3635 class=history_event pool_guid=0x974173CCDE607995
Mar 12 21:28:35 hp systemd-resolved[1254]: Server returned error NXDOMAIN, mitigating potential DNS violation DVE-2018-0001, retrying tr
ansaction with reduced feature level UDP.
Mar 12 21:28:35 hp zed: eid=3636 class=history_event pool_guid=0x974173CCDE607995
Mar 12 21:28:38 hp zed: eid=3637 class=history_event pool_guid=0x974173CCDE607995
Mar 12 21:28:38 hp zsysd[476502]: level=warning msg="[[489b0020:c2f4566c]] Couldn't destroy user dataset rpool/USERDATA/m_enc (due to rpool/USERDATA/m_enc): couldn't destroy \"rpool/USERDATA/m_enc\" and its children: cannot destroy dataset \"rpool/USERDATA/m_enc\": dataset is busy"
Mar 12 21:28:38 hp zsysctl[485834]: #033[33mWARNING#033[0m Couldn't destroy user dataset rpool/USERDATA/m_enc (due to rpool/USERDATA/m_enc): couldn't destroy "rpool/USERDATA/m_enc" and its children: cannot destroy dataset "rpool/USERDATA/m_enc": dataset is busy
Mar 12 21:28:41 hp zed: eid=3638 class=history_event pool_guid=0x974173CCDE607995
Mar 12 21:28:43 hp zed: eid=3639 class=history_event pool_guid=0x974173CCDE607995
Mar 12 21:28:45 hp systemd[1]: zsys-gc.service: Succeeded.
Mar 12 21:28:45 hp systemd[1]: Finished Clean up old snapshots to free space.
Mar 12 21:28:46 hp zed: eid=3640 class=history_event pool_guid=0x974173CCDE607995

From zpool history -il rpool output:

2021-03-13.10:38:39 [txg:73086] destroy rpool/USERDATA/root_3vm1uh@autozsys_rb901c (481)  [on hp]
2021-03-13.10:38:44 ioctl destroy_snaps
    input:
        snaps:
            rpool/USERDATA/root_3vm1uh@autozsys_rb901c
 [user 0 (root) on hp:linux]
2021-03-13.10:39:00 [txg:73115] destroy rpool/USERDATA/m_enc (1331)  [on hp]
2021-03-13.10:50:39 [txg:73753] open pool version 5000; software version unknown; uts hp 5.8.0-44-generic #50~20.04.1-Ubuntu SMP Wed Feb 10 21:07:30 UTC 2021 x86_64 [on hp]
2021-03-13.10:50:39 [txg:73755] import pool version 5000; software version unknown; uts hp 5.8.0-44-generic #50~20.04.1-Ubuntu SMP Wed Feb 10 21:07:30 UTC 2021 x86_64 [on hp]
2021-03-13.10:50:39 zpool import -N rpool [user 0 (root) on hp:linux]
2021-03-13.10:51:31 [txg:73799] set rpool/ROOT/ubuntu_7k8at6 (90) com.ubuntu.zsys:last-used=1615621890 [on hp]
2021-03-13.10:51:31 [txg:73800] set rpool/USERDATA/o_envgoi (5181) com.ubuntu.zsys:last-used=1615621890 [on hp]
2021-03-13.10:51:31 [txg:73802] set rpool/USERDATA/root_3vm1uh (288) com.ubuntu.zsys:last-used=1615621890 [on hp]
2021-03-13.10:51:31 [txg:73804] set rpool/ROOT/ubuntu_7k8at6 (90) com.ubuntu.zsys:last-booted-kernel=vmlinuz-5.8.0-44-generic [on hp]

Filesystem got deleted silently, without any notice:

Mar 13 10:38:10 hp zed: eid=77 class=history_event pool_guid=0x974173CCDE607995
Mar 13 10:38:13 hp zed: eid=78 class=history_event pool_guid=0x974173CCDE607995
Mar 13 10:38:16 hp zed: eid=79 class=history_event pool_guid=0x974173CCDE607995
Mar 13 10:38:18 hp zed: eid=80 class=history_event pool_guid=0xC787AB1273593DF8
Mar 13 10:38:22 hp zed: eid=81 class=history_event pool_guid=0x974173CCDE607995
Mar 13 10:38:25 hp zed: eid=82 class=history_event pool_guid=0x974173CCDE607995
Mar 13 10:38:29 hp zed: eid=83 class=history_event pool_guid=0x974173CCDE607995
Mar 13 10:38:33 hp zed: eid=84 class=history_event pool_guid=0x974173CCDE607995
Mar 13 10:38:36 hp zed: eid=85 class=history_event pool_guid=0x974173CCDE607995
Mar 13 10:38:39 hp zed: eid=86 class=history_event pool_guid=0x974173CCDE607995
Mar 13 10:38:42 hp zed: eid=87 class=history_event pool_guid=0x974173CCDE607995
Mar 13 10:38:45 hp zed: eid=88 class=history_event pool_guid=0x974173CCDE607995
Mar 13 10:38:47 hp dbus-daemon[2744]: [system] Activating via systemd: service name='org.freedesktop.hostname1' unit='dbus-org.freedesktop.hostname1.service' requested by ':1.109' (uid=1001 pid=22803 comm="exo-desktop-item-edit -t Link -c --xid=0x18d /home" label="unconfined")
Mar 13 10:38:48 hp systemd[1]: Starting Hostname Service...
Mar 13 10:38:48 hp dbus-daemon[2744]: [system] Successfully activated service 'org.freedesktop.hostname1'
Mar 13 10:38:48 hp systemd[1]: Started Hostname Service.
Mar 13 10:38:49 hp zed: eid=89 class=history_event pool_guid=0x974173CCDE607995
Mar 13 10:38:52 hp zed: eid=90 class=history_event pool_guid=0x974173CCDE607995
Mar 13 10:38:55 hp zed: eid=91 class=history_event pool_guid=0x974173CCDE607995
Mar 13 10:38:58 hp zed: eid=92 class=history_event pool_guid=0x974173CCDE607995
Mar 13 10:39:01 hp zed: eid=93 class=history_event pool_guid=0x974173CCDE607995
Mar 13 10:39:01 hp CRON[23349]: (root) CMD (  [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi)
Mar 13 10:39:05 hp zed: eid=94 class=history_event pool_guid=0x974173CCDE607995
Mar 13 10:39:07 hp zed: eid=95 class=history_event pool_guid=0x974173CCDE607995
Mar 13 10:39:10 hp zed: eid=96 class=history_event pool_guid=0x974173CCDE607995
Mar 13 10:39:12 hp systemd[1]: zsys-gc.service: Succeeded.
Mar 13 10:39:12 hp systemd[1]: Finished Clean up old snapshots to free space.

To Reproduce

  1. Create encrypted home filesystem as written here: https://talldanestale.dk/2020/04/06/zfs-and-homedir-encryption/
  2. Populate it with data to trigger gc
  3. Create zsys.conf with nonzero general.minfreepoolspace
  4. Reboot

Installed versions:

  • OS: Ubuntu 20.04.2 LTS
  • Zsysd running version: zsysctl 0.4.8 zsysd 0.4.8

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions