8000 Friendlier package scripts and improved instructions for reinit · Issue #70 · zabbly/incus · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Friendlier package scripts and improved instructions for reinit #70
Open
@scaleoutsean

Description

@scaleoutsean

It's hard to "reinit" Incus. I think there are usability (or other) bugs.

The docs could say how to do it, so it becomes a difficult exercise for the user... From the docs:

The provided YAML configuration overwrites existing entities. This means that if you are re-configuring an existing entity, you must provide the full configuration for the entity and not just the different keys.

That's great (heads up!), but it's not clear what to do about these problems. I don't know if this is the absolute minimum of steps required, but what works for me for default storage pool conflicts is: remove volumes, remove images, remove device from default profile, delete default storage pool. Then the standard init works, or I can use the preseed example given and add the root device back and launch/create.

you must provide the full configuration for the entity and not just the different keys.

That probably won't work if default storage pool is still in place.

One could go with this brute force approach (example for LVM, use equivalent for other storage).

sudo apt purge incus-base -y 
POOL='default'
sudo vgremove ${POOL}
# 
sudo apt install incus-base -y
DEV='/dev/sdb'
incus admin init --auto --network-address=0.0.0.0 --network-port=8443 --storage-create-device=${DEV} --storage-pool=default --storage-backend lvm --storage-pool default

But that probably isn't how it should ideally work. IMO it should be one or both of these:

  • incus admin init (--force?) is able to re-init default storage pool when there are no volumes or images in default pool.
  • Incus offers to clean storage configuration and app data on apt purge incus (console prompt can default to N) to make it easy to achieve re-init this based on usual Linux conventions (which is that the user is asked if they want to purge app data; currently not the case)

About this second point - apt purge incus doesn't purge Incus data in /var/lib/incus/. While this may be unexpected, it is correct.

The problem IMO is that purge doesn't undo what install does.

  • Install: apt-get install incus - installs incus and incus-base
  • Purge (expected): apt-get purge incus - uninstalls and purges Incus packages, config files and/or data (or the document mention that this does not happen)
  • Purge (actual): just uninstalls that single package, leaving configuration and data behind

Only incus-base removes the data. What purge incus does is remove just that package. And apt then makes things worse.

$ sudo apt-get purge incus
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  genisoimage incus-base incus-client libnet1 sshfs xdelta3
Use 'sudo apt autoremove' to remove them.

Well, that (apt) advice will leave junk data in place because Incus leaves some packages behind and their data is tied to incus-base. sudo apt-get purge incus-base would be the right thing to do rather than apt autoremove, since Incus doesn't.

The last problem is even if you do apt-get purge incus-base, LVM configuration lives on.

$ sudo apt-get install incus-base incus -y 
Reading package lists... Done
...

$ sudo lvdisplay 
  --- Logical volume ---
  LV Name                IncusThinPool
  VG Name                default
...

$ incus admin init --auto --network-address=0.0.0.0 --network-port=8443 --storage-create-device=/dev/sdb --storage-pool=default --storage-backend lvm --storage-pool default
Error: Failed to create storage pool "default": Volume group already exists, cannot use new physical device at "/dev/sdb"

I'm not a fan "mission creep" and getting Incus involved in deleting VGs (or other storage constructs), but it created it and it's named IncusThinPool so it could offer to destroy it on purge (or incus-base could) as well.
I don't have a strong opinion on that. My preference:

  • Document remove and purge (explain that apt remove incus doesn't remove incus-base, and that removing the latter doesn't purge storage configuration)
  • Output that to console on apt-get purge incus (i.e. "You may need to manually purge other Incus packages and delete your storage pool configuration")
  • I wouldn't mind if purge incus-base offered to remove storage configuration

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

      0