Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zsysctl state remove --system <state-id> does not remove associated user states #232

Open
ninjit opened this issue Sep 15, 2022 · 1 comment

Comments

@ninjit
Copy link

ninjit commented Sep 15, 2022

The documentation for zsysctl state remove indicates that adding --system (-s) should remove the system state and any associated user states, however this does not work as expected in my experience

e.g.

Here is my current system state:

$ sudo zsysctl show
[sudo] password for ladmin:
Name:           rpool/ROOT/ubuntu_tao4wl
ZSys:           true
Last Used:      current
History:
  - Name:       rpool/ROOT/ubuntu_tao4wl@autozsys_mxwzgq
    Created on: 2022-07-21 06:05:48
  - Name:       rpool/ROOT/ubuntu_tao4wl@autozsys_8tygxr
    Created on: 2022-07-20 06:39:55
  - Name:       rpool/ROOT/ubuntu_tao4wl@autozsys_1zptjz
    Created on: 2022-07-15 06:02:59
  - Name:       rpool/ROOT/ubuntu_tao4wl@autozsys_gf2qwi
    Created on: 2022-07-14 06:37:47
Users:
  - Name:    jit
    History:
     - rpool/USERDATA/jit_pn27zd@autozsys_mxwzgq (2022-07-21 06:05:49)
     - rpool/USERDATA/jit_pn27zd@autozsys_8tygxr (2022-07-20 06:39:56)
     - rpool/USERDATA/jit_pn27zd@autozsys_1zptjz (2022-07-15 06:02:59)
     - rpool/USERDATA/jit_pn27zd@autozsys_gf2qwi (2022-07-14 06:37:48)
  - Name:    ladmin
    History:
     - rpool/USERDATA/ladmin_dgexb0@autozsys_qw1wbn (2022-09-15 11:28:08)
     - rpool/USERDATA/ladmin_dgexb0@autozsys_mxwzgq (2022-07-21 06:05:49)
     - rpool/USERDATA/ladmin_dgexb0@autozsys_8tygxr (2022-07-20 06:39:56)
     - rpool/USERDATA/ladmin_dgexb0@autozsys_1zptjz (2022-07-15 06:02:59)
     - rpool/USERDATA/ladmin_dgexb0@autozsys_gf2qwi (2022-07-14 06:37:48)
  - Name:    root
    History:
     - rpool/USERDATA/root_dgexb0@autozsys_mxwzgq (2022-07-21 06:05:49)
     - rpool/USERDATA/root_dgexb0@autozsys_8tygxr (2022-07-20 06:39:56)
     - rpool/USERDATA/root_dgexb0@autozsys_1zptjz (2022-07-15 06:03:00)
     - rpool/USERDATA/root_dgexb0@autozsys_gf2qwi (2022-07-14 06:37:48)

I then remove the oldest state gf2qwi with the --system flag

$ sudo zsysctl state remove --system gf2qwi
ZSys is adding automatic system snapshot to GRUB menu

but all the associated user states remain

$ sudo zsysctl show
Name:           rpool/ROOT/ubuntu_tao4wl
ZSys:           true
Last Used:      current
History:
  - Name:       rpool/ROOT/ubuntu_tao4wl@autozsys_mxwzgq
    Created on: 2022-07-21 06:05:48
  - Name:       rpool/ROOT/ubuntu_tao4wl@autozsys_8tygxr
    Created on: 2022-07-20 06:39:55
  - Name:       rpool/ROOT/ubuntu_tao4wl@autozsys_1zptjz
    Created on: 2022-07-15 06:02:59
Users:
  - Name:    jit
    History:
     - rpool/USERDATA/jit_pn27zd@autozsys_mxwzgq (2022-07-21 06:05:49)
     - rpool/USERDATA/jit_pn27zd@autozsys_8tygxr (2022-07-20 06:39:56)
     - rpool/USERDATA/jit_pn27zd@autozsys_1zptjz (2022-07-15 06:02:59)
     - rpool/USERDATA/jit_pn27zd@autozsys_gf2qwi (2022-07-14 06:37:48)
  - Name:    ladmin
    History:
     - rpool/USERDATA/ladmin_dgexb0@autozsys_5565ug (2022-09-15 12:09:08)
     - rpool/USERDATA/ladmin_dgexb0@autozsys_qw1wbn (2022-09-15 11:28:08)
     - rpool/USERDATA/ladmin_dgexb0@autozsys_mxwzgq (2022-07-21 06:05:49)
     - rpool/USERDATA/ladmin_dgexb0@autozsys_8tygxr (2022-07-20 06:39:56)
     - rpool/USERDATA/ladmin_dgexb0@autozsys_1zptjz (2022-07-15 06:02:59)
     - rpool/USERDATA/ladmin_dgexb0@autozsys_gf2qwi (2022-07-14 06:37:48)
  - Name:    root
    History:
     - rpool/USERDATA/root_dgexb0@autozsys_mxwzgq (2022-07-21 06:05:49)
     - rpool/USERDATA/root_dgexb0@autozsys_8tygxr (2022-07-20 06:39:56)
     - rpool/USERDATA/root_dgexb0@autozsys_1zptjz (2022-07-15 06:03:00)
     - rpool/USERDATA/root_dgexb0@autozsys_gf2qwi (2022-07-14 06:37:48)
@didrocks
Copy link
Member

Thanks for filing this bug and help making zsys better.

I think this could be due to the minimal amount of states we keep for safety. I do not have the time to look at the code, but I agree this is an errornous behavior and that the user states should be removed under that circumstances. It seems an easy task for anyone who wants to start contributing to the project and I am happy to give a hand if so :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants