Bug 205273

Summary: ports-mgmt/poudriere: Failed update deletes jail
Product: Ports & Packages Reporter: leeb
Component: Individual Port(s)Assignee: Bryan Drewery <bdrewery>
Status: Closed FIXED    
Severity: Affects Only Me CC: w.schwarzenfeld
Priority: --- Flags: bugzilla: maintainer-feedback? (bdrewery)
Version: Latest   
Hardware: amd64   
OS: Any   

Description leeb 2015-12-12 18:42:02 UTC
I attempted to update my jail with poudriere 3.1.10 using the following:

poudriere jail -u -j 101amd64 -f none -M /usr/local/SystemBuilder/src/10.1-releng

However the pathname was wrong.

The result was removal of the jail.  It would be much friendlier if the original jail was retained.
10.1-RELEASE-p4 FreeBSD 10.1-RELEASE-p4 #0
Comment 1 Bryan Drewery freebsd_committer freebsd_triage 2015-12-15 17:31:52 UTC
Yes this is wrong. It should just rollback to the good version.
Comment 2 Bryan Drewery freebsd_committer freebsd_triage 2016-01-06 18:01:15 UTC
What method was the jail created with?

The only case I see where an update will delete a jail is when '-m url=' is used. There is no way for -u to work with a URL, so it deletes it first then recreates it from the latest image.

allbsd|gjb|url=*)
        [ -z "${VERSION}" ] && VERSION=$(jget ${JAILNAME} version)
        [ -z "${ARCH}" ] && ARCH=$(jget ${JAILNAME} arch)
        delete_jail
        create_jail
        ;;
Comment 3 leeb 2016-01-06 19:06:30 UTC
The jail would have been created with '-m url='.  My internet is too slow, so I spin my own world.

It seems the url and directory are retained somewhere:

# poudriere jail -l
101amd64 10.1-RELEASE-p24 amd64 url=/usr/local/SystemBuilder/export/Server_Std/release/ftp 2015-12-12 10:30:12 /usr/local/poudriere/jails/101amd64

So could it not rename the jail directory first, attempt the create, then take appropriate action on success/failure?

-----

Looking further I see my use of -M was wrong, my intention was not to null-mount, but to use the produced .txz's, so I suspect my intuition of using:

poudriere jail -u -j 101amd64

probably barfed because the original url no longer existed (I just tried that on another jail and it worked correctly, as you describe, delete, create).

Maybe in this case, poudriere should balk and tell me it was created with url= so cannot be updated to null-mount?
Comment 4 Walter Schwarzenfeld 2018-01-17 07:27:45 UTC
Is this still relevant?
Comment 5 Bryan Drewery freebsd_committer freebsd_triage 2018-01-24 20:39:16 UTC
Yup this was fixed in 3.2.