From nobody Tue Sep 17 12:54:10 2024 X-Original-To: questions@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4X7MDQ1C3hz59Ksx for ; Tue, 17 Sep 2024 12:54:14 +0000 (UTC) (envelope-from cryintothebluesky@gmail.com) Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4X7MDP6dRGz4VNJ for ; Tue, 17 Sep 2024 12:54:13 +0000 (UTC) (envelope-from cryintothebluesky@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-378f600e090so1301706f8f.3 for ; Tue, 17 Sep 2024 05:54:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726577652; x=1727182452; darn=freebsd.org; h=mime-version:references:in-reply-to:message-id:subject:cc:to:from :date:from:to:cc:subject:date:message-id:reply-to; bh=x4/td4S9CeLd3yUmTD5CzODKDTmu6ua/UjuASprmJLU=; b=g7vwKJHlIWvBXnLyrx/boePUwMUJRPdpclzkezlDTG7JasMi7kqwK5kSjjAq7bzF6D 4bOZfnBOXh6l9CkFrdMCAnyUviruzB7VlqMKNkKexlVHdNWMBDGGjdOEnWVGVxn2qtl+ 6fLqKHppOdaBWJys7zj9X3Z/pnktM+G+kEdiBB3iQnn+PghTjHQ6gF7qaURHIkt34LFK 3Bt9OIbERsevXIUmR8fkKyrpIkdRxAD6EBi9JE0RkBXo04Wf+Ud28g1xqpr4IG87Fj/e lDQs5yssht3VfQRhGwOMtCwl6briGHmmB9cUjwmbu/4iDtwtMvEoCeFvfjxmzJn8pw8i SBEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726577652; x=1727182452; h=mime-version:references:in-reply-to:message-id:subject:cc:to:from :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=x4/td4S9CeLd3yUmTD5CzODKDTmu6ua/UjuASprmJLU=; b=S2EcgbsVCTa47WDoM2xt0MBt86SWFcH75TDGoikx6GIKWeJz1XzIVMQBJhCor3OdL1 rpu9Z71zHX5bsgBi3ODiWhttAJOncVnbdq/q3OFsH327tDXNfkA67JTCjimeZF1+ReDX uXGVCJABohMiB04/qgq1kCbUQFUVWBWgGG7zCriuZLJNr/hxuZYx3Mq6G6LazUB20SPY QMuK274mvFgXNSUYkqB+O3T0mDySkR/RccgO1Bu9eX6h4/IF6oMtzm+1kPLZckyTdwEn kCVOedReIe/KtqM/a4/Ejave3he1Q+Iqj3t7R9u5kCl1TeRgO7eITvQXtt1s/ps7c7X8 de4A== X-Gm-Message-State: AOJu0YxwRTxV8QWM9inxSt2zO26+uH3nS/ezDPZFjUFKyKa+0VTHooBD b0oLcigwsk6MNfAEOMblbTA7pcncn0x0SUlKbQjBqx4WYyenZx59rN6OiQ== X-Google-Smtp-Source: AGHT+IGaYMI1k95BWXKkHYI/dAaQ5BnevDJzXIVkpJJkVOcpVtXOwzKFhSU8VSoJeA3r9ctQWG3LDg== X-Received: by 2002:a5d:4dc6:0:b0:374:c581:9f4f with SMTP id ffacd0b85a97d-378c2d58d9cmr10073708f8f.55.1726577652016; Tue, 17 Sep 2024 05:54:12 -0700 (PDT) Received: from z600.home.lan (198.85.199.146.dyn.plus.net. [146.199.85.198]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-378e73f988bsm9427930f8f.55.2024.09.17.05.54.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Sep 2024 05:54:11 -0700 (PDT) Date: Tue, 17 Sep 2024 13:54:10 +0100 From: Sad Clouds To: Frank Leonhardt Cc: questions Subject: Re: Manual upgrade using base.txz Message-Id: <20240917135410.7ef40272bad87497c66dd224@gmail.com> In-Reply-To: <573b9b4c7f56702619bbb77e9a8c0a77@fjl.co.uk> References: <573b9b4c7f56702619bbb77e9a8c0a77@fjl.co.uk> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) List-Id: User questions List-Archive: https://lists.freebsd.org/archives/freebsd-questions List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: freebsd-questions@freebsd.org Sender: owner-freebsd-questions@FreeBSD.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="Multipart=_Tue__17_Sep_2024_13_54_10_+0100_jwkrl12s/bNgphLJ" X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US] X-Rspamd-Queue-Id: 4X7MDP6dRGz4VNJ This is a multi-part message in MIME format. --Multipart=_Tue__17_Sep_2024_13_54_10_+0100_jwkrl12s/bNgphLJ Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Have you seen my recent posts to this list about upgrading base system in this manner? I have always preferred manual upgrades and used it for years with NetBSD. The only issue with FreeBSD I found was the lack of postinstall/postupdate scripts to remove obsolete binaries. So I simply "rm -rf" all upgrade directories and then unpack base.txz. You can boot from CD/DVD, but I prefer a small rescue partition with a stripped down install of FreeBSD to perform upgrades. But in case you missed my previous post, I've attached my notes, but you can script it to your own requirements. --Multipart=_Tue__17_Sep_2024_13_54_10_+0100_jwkrl12s/bNgphLJ Content-Type: text/plain; name="Update.txt" Content-Disposition: attachment; filename="Update.txt" Content-Transfer-Encoding: 7bit -- Boot into root-rescue ------------------------------------------------------- gpart show -l da0 => 40 3907029088 da0 GPT (1.8T) 40 2008 - free - (1.0M) 2048 131072 1 efi (64M) 133120 67108864 2 root (32G) 67241984 8388608 3 root-rescue (4.0G) 75630592 8388608 4 swap (4.0G) 84019200 67108864 5 var (32G) 151128064 3755900928 6 data (1.7T) 3907028992 136 - free - (68K) Boot rescue from loader when bootloader OK on root partition: OK lsdev OK set currdev=disk0p3 OK boot Boot rescue from loader when bootloader damaged on root partition: Press Esc before bootloader is loaded, then boot: 0:ad(0p3)/boot/loader -------------------------------------------------------------------------------- -- Mount root and var then create UFS snapshots -------------------------------- mount /dev/gpt/root /mnt mount /dev/gpt/var /mnt/var # Create snapshots for snapshot in '/mnt/.snap/latest' '/mnt/var/.snap/latest' do mksnap_ffs ${snapshot:?}.tmp && chflags nodump ${snapshot:?}.tmp || break mv ${snapshot:?}.tmp ${snapshot:?} || break ls -lho ${snapshot:?} done # If update goes wrong, restore snapshots with tar for snapshot in '/mnt/.snap/latest' '/mnt/var/.snap/latest' do ufsdir="$(dirname ${snapshot:?})/.." rm -rf ${ufsdir:?}/*; chflags -R 0 ${ufsdir:?}/*; rm -rf ${ufsdir:?}/*; mdconfig -a -u md0 -t vnode -o readonly -f ${snapshot:?} || break mkdir /tmp/mnt_md && mount -r /dev/md0 /tmp/mnt_md || break tar -C /tmp/mnt_md --nodump -cf - ./ | tar -C ${ufsdir:?} --clear-nochange-fflags --exclude="./.snap" -xpSUf - umount /tmp/mnt_md && rmdir /tmp/mnt_md || break mdconfig -d -u md0 || break done # If update goes wrong, restore snapshots with dump: for snapshot in '/mnt/.snap/latest' '/mnt/var/.snap/latest' do ufsdir="$(dirname ${snapshot:?})/.." rm -rf ${ufsdir:?}/*; chflags -R 0 ${ufsdir:?}/*; rm -rf ${ufsdir:?}/*; (cd ${ufsdir:?} && dump -0 -a -h 0 -C 16 -b 64 -f - ${snapshot:?} | restore -xuvf -) rm -f ${snapshot:?}.tmp done # Delete snapshots when no longer needed for snapshot in '/mnt/.snap/latest' '/mnt/var/.snap/latest' do rm -f ${snapshot:?} done -------------------------------------------------------------------------------- -- Perform update -------------------------------------------------------------- # Build or download FreeBSD release archives ls -1 base.txz kernel.txz lib32.txz # Root mount point at which update should happen UPDATE_ROOT="/data/vdom/test/system" # Paths that need to be removed and then updated with new binaries UPDATE_PATHS=" bin boot lib libexec rescue sbin usr/sbin usr/bin usr/include usr/lib usr/lib32 usr/libdata usr/libexec usr/share usr/tests " # Backup boot in case of custom loader.conf settings cp -a ${UPDATE_ROOT:?}/boot ${UPDATE_ROOT:?}/boot.copy # Remove paths with old binaries for i in ${UPDATE_PATHS:?} do chflags -R 0 ${UPDATE_ROOT:?}/${i:?} rm -rf ${UPDATE_ROOT:?}/${i:?} done # Extract new updates from base.txz for i in ${UPDATE_PATHS:?} do tar -C ${UPDATE_ROOT:?} --clear-nochange-fflags -xpf base.txz ./${i:?} done # Extract kernel updates (not required for jails) tar -C ${UPDATE_ROOT:?} --clear-nochange-fflags -xpf kernel.txz # View etc changes prior to update etcupdate diff -D ${UPDATE_ROOT:?} -d ${UPDATE_ROOT:?}/var/db/etcupdate | less # Update etc files # 1) Extract etcupdate current tree from the base archive tar -xpf base.txz ./var/db/etcupdate/current # 2) Create etcupdate.tar.bz2 archive tar -C ./var/db/etcupdate/current -jcf etcupdate.tar.bz2 ./ && rm -rf ./var # 3) Run etcupdate merging new changes in etcupdate.tar.bz2 into /etc etcupdate -D ${UPDATE_ROOT:?} -d ${UPDATE_ROOT:?}/var/db/etcupdate -F -t etcupdate.tar.bz2 -------------------------------------------------------------------------------- --Multipart=_Tue__17_Sep_2024_13_54_10_+0100_jwkrl12s/bNgphLJ--