From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <gentoo-dev+bounces-75113-garchives=archives.gentoo.org@lists.gentoo.org> Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 3037359CAF for <garchives@archives.gentoo.org>; Wed, 6 Apr 2016 17:43:51 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 7916C21C050; Wed, 6 Apr 2016 17:43:39 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 6516D21C02E for <gentoo-dev@lists.gentoo.org>; Wed, 6 Apr 2016 17:43:38 +0000 (UTC) Received: from [IPv6:2001:470:8840::2] (unknown [IPv6:2001:470:8840::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: ryao) by smtp.gentoo.org (Postfix) with ESMTPSA id 5E51E340E7D for <gentoo-dev@lists.gentoo.org>; Wed, 6 Apr 2016 17:43:35 +0000 (UTC) Subject: Re: [gentoo-dev] usr merge References: <570312c8.1469ca0a.30985.5db1@mx.google.com> <570523FD.3040703@iee.org> <00dd8d2f-a8a8-4fab-b7a6-c72466d62532@gentoo.org> <5705340B.6090800@gentoo.org> <0e611768-d5fc-4283-853f-929a49c97692@gentoo.org> <57053A65.7010903@gentoo.org> To: gentoo-dev@lists.gentoo.org From: Richard Yao <ryao@gentoo.org> X-Enigmail-Draft-Status: N0020 Message-ID: <57054AB4.1020902@gentoo.org> Date: Wed, 6 Apr 2016 13:43:16 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 Precedence: bulk List-Post: <mailto:gentoo-dev@lists.gentoo.org> List-Help: <mailto:gentoo-dev+help@lists.gentoo.org> List-Unsubscribe: <mailto:gentoo-dev+unsubscribe@lists.gentoo.org> List-Subscribe: <mailto:gentoo-dev+subscribe@lists.gentoo.org> List-Id: Gentoo Linux mail <gentoo-dev.gentoo.org> X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org MIME-Version: 1.0 In-Reply-To: <57053A65.7010903@gentoo.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit X-Archives-Salt: 9a0063ce-9952-4d49-9eb1-84f94644761d X-Archives-Hash: dafa188429363cf608386984c2528a59 On 04/06/2016 12:33 PM, Richard Yao wrote: > On 04/06/2016 12:20 PM, Alexis Ballier wrote: >> On Wednesday, April 6, 2016 6:06:35 PM CEST, Richard Yao wrote: >> >>> That is unless you put per-system state in /usr/local, do symlinks to it >>> in / and mount /usr/local as part of system boot, which is the other way >>> of doing this. I have seen a variant of this done in asuswrt-merlin on >>> routers. >> >> This doesnt seem to have anything to do with what I was describing. >> >> Another option I'm using a lot is nfsroot. This doesn't have the same >> level of flexibility: running multiple hosts with nfsroot and thus >> shared /etc/fstab tends to be annoying. >> >>>> See https://fedoraproject.org/wiki/Features/UsrMove for a more complete >>>> discussion. >>> >>> That does not address the problems of supporting this configuration in a >>> rolling release. >>> >>> Formats in /etc can fall out of sync with software in /usr. If boot >>> options change, the stuff in /etc/init.d is not updated. If you add >>> software, the update to /etc/init.d is omitted. If you have a baselayout >>> change, it is not propagated. >> >> Ever heard of CONFIG_PROTECT ? :) What you describe is already what >> happens and what most people want. > > Leveraging the /usr merge to enable easier updating of multiple systems > means that you are updating a Gentoo system image on a build server, > snapshotting /usr both before/after the update and then distributing the > delta on /usr to other systems without any of the changes that occurred > outside of /usr. A proper update requires finding all of those changes > and then applying them manually. That really is not the same thing that > RHEL and Solaris have, where the necessity of propagating changes > outside of /usr is minimized by having none to propagate. After thinking about it some more, maybe git can be (ab)used to do this by having the image's root be a git repository with /usr in .gitingore. When updates are done, you would run etc-update on the build host by committing the changes to / into git with ./usr in .gitignore. Then you would have the delta from /usr via whatever mechanism that the user wishes to use with a patch on / from the build system that can be merged into each target's / repository. The procedure would require more effort than what Solaris and RHEL do, but if documented, it should fix the partial update problem that occurs when you do a /usr merge in a rolling release and then do what people on Solaris and RHEL do to update systems configured for updates via deltas of /usr. To give an example, lets assume: 1. /path/to/build/image has a git repository with ./usr in .gitignore on the build host while the targets have the same (with paths being / and /usr of course). 2. Things are on ZFS on the build host and the targets. 3. There is a snapshot of the build environment that the targets have. 4. tank/BUILD/gentoo is the / and tank/BUILD/gentoo/usr is the /usr on the build host. 5. The targets have rpool/SYSTEM/USR/gentoo as their /usr and rpool/SYSTEM/USR is set readonly (so /usr is not modified due to inheritance of readonly). The delta generation would be something like this: # Setup build environment sudo -i /path/to/enter-container.sh /path/to/build/image https://gist.github.com/ryao/3c345f206b19c9795109) # Update portage emerge-webrsync / emerge-delta-webrsync / emerge --sync # Preferably one of the first two with PORTAGE_GPG_* configured # Install updates emerge -avDuN @world # Update config files etc-update # Exit build environment exit # Commit changes to / git -C /path/to/build/image commit -a # Snapshot the build environment sudo -i zfs snapshot -r tank/BUILD/gentoo@"$(date +%Y%m%d)" Then a child could be updated by something like: # First /usr zfs send -i tank/BUILD/gentoo@previous tank/BUILD/gentoo/usr@"$(date +%Y%m%d)" | ssh root@$CHILD zfs recv rpool/SYSTEM/USR/gentoo # Then / git -C /path/to/build/image diff HEAD^ | ssh root@$CHILD git -C /other/location apply # If conflicts occurred, fix whatever was broken ssh root@$CHILD # Reboot / restart services reboot This is intended to only be an example, but there are a few problems with this simple example that are worth mentioning: 1. You probably want to have a shell into the system in case the update to / does not go well, which makes the update to / somewhat hackish. 2. The way Solaris does things is to have boot environments where the change is in a different boot environment that only takes effect as part of a reboot. If you are doing a boot environment type thing, you could probably update / for the new reboot, although you would want to implement easy rollback if anything goes wrong. That step on / is somewhat hackish, but it is intended to be an example. Doing something similar to what Solaris did to make management of multiple systems easier is likely doable with some way of handling changes outside of /usr. > I do not understand how CONFIG_PROTECT is relevant here. Whatever > CONFIG_PROTECT did was done on the build system. The systems receiving > the updates via ZFS send/recv or some similar mechanism are not going to > have CONFIG_PROTECT evaluated. Even if it were somehow evaluated, all of > the paths in CONFIG_PROTECT should be outside of /usr anyway.