Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Feb 2014 20:22:50 -0600
From:      Bryan Drewery <bdrewery@FreeBSD.org>
To:        Kai Gallasch <k@free.de>, freebsd-pkg@freebsd.org
Subject:   Re: pkg snapshot and pkg rollback functionality
Message-ID:  <530BFE7A.6010302@FreeBSD.org>
In-Reply-To: <95F734F1-21C5-4DAC-ADC2-AF730B115237@free.de>
References:  <95F734F1-21C5-4DAC-ADC2-AF730B115237@free.de>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
On 1/31/2014 4:52 AM, Kai Gallasch wrote:
> Hi.
> 
> I am using pkg in combination with my own poudriere repos to install and maintain a lot of FreeBSD servers and jails.
> 
> When upgrading FreeBSD installations I often run into the following problem:
> 
> After I did a "pkg upgrade" I find out the hard way, that upgraded applications are broken (software bug, config changed, incompatible dependencies, etc.) and I need to go back to the state, before the pkg upgrade.
> I normally get around this bis doing a "zfs snapshot" and a rollback after I broke something with pkg upgrade..
> 
> What is your preferred method of rolling back a troublesome pkg upgrade?
> 
> Wouldn't it be nice to have a "pkg snapshot" and "pkg rollback" functionality in pkg itself?
> 
> The upgrade cycle would then be:
> 
> a) pkg snapshot --create --comment "before upgrade to php 5.3.38"
> b) pkg upgrade
> c) bang!! php trouble..
> d) pkg snapshot --rollback --last
> 
> This could be implemented in a way to lock all packages in the local package cache of the upgraded system, that are connected to a certain existing pkg snapshot.
> 
> -- example --
> 
> # pkg clean
> The following package files will be deleted from the cache directory
> /var/cache/pkg:
> 
> Package:                       Origin:              Reason:
> All/bash-4.2.45.txz            shells/bash          Superseded by bash-4.2.45_1
> All/pkg-1.2.1.txz              ports-mgmt/pkg       Superseded by pkg-1.2.5
> All/openssl-1.0.1_8.txz        security/openssl     Superseded by openssl-1.0.1_9
> All/sqlite3-3.8.0.2.txz        databases/sqlite3    Superseded by sqlite3-3.8.2
> All/p5-Socket6-0.25.txz        net/p5-Socket6       Superseded by p5-Socket6-0.25_1
> 
> The following package files are locked and cannot be deleted from the cache
> directory, because they belong to an existing snapshot. Please delete snapshot first!
> 
> All/python27-2.7.6.txz         lang/python27        needed by snapshot $snapshot_uuid
> All/p5-DateTime-1.04.txz       devel/p5-DateTime    needed by snapshot $snapshot_uuid
> 
> -- example --
> 
> Other functions:
> 
> - pkg snapshot --list
> - pkg snapshot --delete --$snapshot_uuid
> 
> 
> I think such a snapshot/rollback option for pkg would be very beneficial, because it would give you the option to "roll back" your pkg to every former frozen state in an orderly manner. Even after you find out a week later that doing an upgrade was not such a splendig idea.
> 
> What do you think?
> 
> K.
> 
> 
> --
> GPG-Key: A593 E38B E968 4DBE 14D6  2115 7065 4D7C 4FB1 F588
> Key available from hkps://hkps.pool.sks-keyservers.net
> 

I like the concept. You can do this with ZFS plugin currently.

https://github.com/freebsd/pkg-plugins/blob/master/zfssnap/README.md

Also, poudriere 3.1 (not yet released) has a feature that will allow you
to rollback to your previous set. It will keep N builds around for you.
So if an upgrade goes bad you can change your repo to point to one of
the older ones and run pkg upgrade -f to rollback.

I was just thinking the other day of having pkg keep backups of upgraded
packages. That would allow you to downgrade to a previous working set as
well.

-- 
Regards,
Bryan Drewery


[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJTC/56AAoJEDXXcbtuRpfPkNAIANwC7xsOimi8N1lhAc9Jjr0N
s+VDBH6F3Q7SuT1oE13i1x4f0bTDiMUQQ7CHyFYprGDASnvlHA4ZTGe50uHjI/Ky
GdIZ6FIlnEWI5KiiWx81QnWcj9BGAuTvmgbJUxI8k8WlYTPIcdqvSPN3cY7P/s/r
ehD+bgzBfFb0qJUi1VDNDgbuQjm861ID+UwrABcrERGDq9mb2Qx0FNlR1a8+JtHT
IjMhWp/HrBQtJdDYeZEn8sWveysWEKBMsSBfvrSaa2rGVl4FSpCOmXOlEldMh28N
qLQmKdaw25DUxlWQhlgz6UGRSR4qVLQtKim5WILjFEgB8dtR0jwCvbIt6YJAys0=
=MlVh
-----END PGP SIGNATURE-----

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?530BFE7A.6010302>