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

DELETED /usr/local #1191

Open
vermaden opened this issue Nov 28, 2024 · 12 comments
Open

DELETED /usr/local #1191

vermaden opened this issue Nov 28, 2024 · 12 comments
Assignees
Labels

Comments

@vermaden
Copy link

With this in /usr/local/etc/poudriere.conf config:

BASEFS=/poudriere
ZROOTFS=/usr/local/poudriere
POUDRIERE_DATA=/usr/local/poudriere/data

After creating first Jail - like that command below:

# poudriere jail -c -j 14-1-R-amd64 -v 14.1-RELEASE

Entire /usr/local will be deleted.

Why?

@vermaden vermaden added the bug label Nov 28, 2024
@vermaden
Copy link
Author

While this in /usr/local/etc/poudriere.conf config does NOT destroy entire /usr/local dir.

BASEFS=/usr/local/poudriere
ZROOTFS=/poudriere
POUDRIERE_DATA=/usr/local/poudriere/data

@vermaden
Copy link
Author

So the 'problem' seems to be ZROOTFS from my understanding ...

@bileslav
Copy link

Oh, hi, that's the thing I emailed you about some time ago. I hope no one got hurt too badly because of this. Backups, backups, backups...

@vermaden
Copy link
Author

vermaden commented Nov 30, 2024

@bileslav

Yes - I remember - I will add a warning to the article with link to this issue.

What is even more interesting ... there is NOTHING there at ZROOTFS place ...

root@poudriere-14-2:~ # find /poudriere/
/poudriere/
/poudriere/jails
root@poudriere-14-2:~ # 

@vermaden
Copy link
Author

Interesting ... I have just set ZROOTFS to /dev/null and everything still works ...

root@poudriere-14-2:~ # grep ^ZROOTFS /usr/local/etc/poudriere.conf
ZROOTFS=/dev/null

@MirLach
Copy link

MirLach commented Dec 1, 2024

What version of Poudriere?
Do you have ZPOOL set?

I am using this for a long time

ZPOOL=tank1
ZROOTFS=/vol1/poudriere
BASEFS=/vol1/poudriere
POUDRIERE_DATA=${BASEFS}/data

@vermaden
Copy link
Author

vermaden commented Dec 1, 2024

Great. But why it deletes /usr/local dir?

I already found a solution that works with ZROOTFS set to /dev/null value.

Fix the problem - do not seek the solution in workarounds.

It has to be bulletproof - not kill each user that did not lost tons of data by trying ...

@MirLach
Copy link

MirLach commented Dec 1, 2024

I haven't looked at the sources, but isn't it possible that it must not be a directory / filesystem that is already occupied by other data, because Poudriere is trying to create other sub-filesystems in it?
I agree that it should have some sort of security check so that the user doesn't lose data.

If I understand it right, the BASEFS is the target mount point, ZROOTFS is the filesystem under the ZPOOL.

In your case from the first post, is it true that the filesystem /usr/local/poudriere is set to mount under /poudriere?
Do you have ZPOOL set right?

@bdrewery bdrewery self-assigned this Dec 9, 2024
@bdrewery
Copy link
Member

bdrewery commented Dec 9, 2024

Whatever the reason for this, it is definitely NOT OKAY. We need a validation to prevent this. I'll look into it if no one else gets to it.

@devnull-hub-lab
Copy link

devnull-hub-lab commented Dec 23, 2024

As I understood ZROOTFS is the dataset, not directory.
When you set ZROOTFS=/usr/local/poudriere, you are instructing poudriere to use "ZPOOL/ZROOTFS", in other words
zroot/usr/local/poudriere

As zroot/usr is already mounted on /usr, poudriere will create ZROOTFS datasets hierarchically, so:
zroot/usr - already mounted on /usr (default)
zroot/usr/local/ - poudriere will mount on /usr/local (this point, /usr/local seems "erased")
zroot/usr/local/poudriere - poudriere will mount on /usr/local/poudriere

So, ZFS creates the new dataset and mounts it to a directory already in use (/usr/local/).
Therefore, your /usr/local/ will remain "erased" due to the creation of a new dataset mounted on it.

But note that probably your /usr/local/ was not really deleted.
If you "zfs unmount" your datasets, your /usr/local/ probably still exists.
But as long as the zroot/usr/local/ dataset is mounted, it will appear empty to you.

Its a ZFS thing and configuration, nothing wrong to poudriere as I can see.
If there is validation on the part of poudriere, it could be something like "does the location where the dataset is being mounted already have files and directories inside it? If so, abort the creation of dataset".

So I use in my configurations:
ZPOOL=zroot
ZROOTFS=/poudriere (its a dataset)
BASEFS=/usr/local/poudriere (its a directory)

In my settings above:
zroot is already mounted on "none" (default)
And poudriere will create the datasets (ZPOOL/ZROOTFS):
zroot/poudriere (mounted on "none" - due to hierarchy)
zroot/poudriere/jails (mounted on "none" - due to hierarchy)

And poudriere jails and ports datasets will be created and mounted on BASEFS:
zroot/poudriere/jails/poudriere_jail mounted on /usr/local/poudriere/jails/poudriere_jail
zroot/poudriere/ports/HEAD mounted on /usr/local/poudriere/ports/HEAD

@vermaden
Copy link
Author

There is some logic in it ... and there is not.

With ZROOTFS=/usr/local/poudriere it can create (and destroy in the process) these:

  • zroot/usr
  • zroot/usr/local
  • zroot/usr/local/poudriere

... but if I set it up as ZROOTFS=/dev/null then why it does not create these?

  • zroot/dev
  • zroot/dev/null

@devnull-hub-lab
Copy link

I did tests you mentioned, and worked perfectly here. I tested on FreeBSD 14.2 fresh install.

With ZROOTFS=/dev/null, poudriere created these: zroot/dev and zroot/dev/null

Screen Shot 2024-12-26 at 13 54 24

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

No branches or pull requests

5 participants