From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Wed, 08 Mar 2023 10:45:44 +0100 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by lore.white.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1pZqMh-00DMSC-7h for lore@lore.pengutronix.de; Wed, 08 Mar 2023 10:45:44 +0100 Received: from localhost ([127.0.0.1] helo=metis.ext.pengutronix.de) by metis.ext.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1pZqMh-0002ez-1D; Wed, 08 Mar 2023 10:45:43 +0100 Received: from ptx.hi.pengutronix.de ([2001:67c:670:100:1d::c0]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pZqMe-0002ei-LP for distrokit@pengutronix.de; Wed, 08 Mar 2023 10:45:40 +0100 Received: from rhi by ptx.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1pZqMe-0005C5-Fn for distrokit@pengutronix.de; Wed, 08 Mar 2023 10:45:40 +0100 Date: Wed, 8 Mar 2023 10:45:40 +0100 From: Roland Hieber To: distrokit@pengutronix.de Message-ID: <20230308094540.pevw33qppwmxl2np@pengutronix.de> References: <20230212221449.1644628-1-rhi@pengutronix.de> <20230212221449.1644628-8-rhi@pengutronix.de> <506f7f01d15bfa3835e351566ba126e7f63b33ed.camel@pengutronix.de> <20230302094152.mp3gf3g2j3v4gtrn@pengutronix.de> <20230302160921.GS11792@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230302160921.GS11792@pengutronix.de> User-Agent: NeoMutt/20180716 Subject: Re: [DistroKit] [PATCH 7/8] rauc: add initial support X-BeenThere: distrokit@pengutronix.de X-Mailman-Version: 2.1.29 Precedence: list List-Id: DistroKit Mailinglist List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "DistroKit" X-SA-Exim-Connect-IP: 127.0.0.1 X-SA-Exim-Mail-From: distrokit-bounces@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false On Thu, Mar 02, 2023 at 05:09:21PM +0100, Michael Olbrich wrote: > Hi, > > On Thu, Mar 02, 2023 at 11:34:53AM +0100, Jan Lübbe wrote: > > On Thu, 2023-03-02 at 10:41 +0100, Roland Hieber wrote: > > > On Mon, Feb 13, 2023 at 08:37:25AM +0100, Jan Lübbe wrote: > > > > On Sun, 2023-02-12 at 23:14 +0100, Roland Hieber wrote: > > > > > +++ b/projectroot/etc/rauc/system.conf > > > > > @@ -0,0 +1,16 @@ > > > > > +[system] > > > > > +compatible=@RAUC_BUNDLE_COMPATIBLE@ > > > > > +bootloader=barebox > > > > > + > > > > > > > > Please disable support for plain bundles. > > > > > > ACK. > > > > > > > Also, add a rauc data directory on the data partition so that we can use > > > > adaptive updates and keep a global slot status file. > > > > > > Okay, this turned out to be a bit more involved, because although there > > > is a data partition, it currently not mounted, because there is no mount > > > unit for it and also no fstab entry, and it also there's no file system > > > on it because systemd-autoformat@mmcblk3.service fails to run because > > > mkfs cannot find the partition because after the previous steps which > > > resize the partition to fill the maximum space on the SD card result in > > > the partition table needing to be re-read by the kernel, which fails > > > because the rootfs from the same block device is already mounted. This turned out to be the wrong interpretation of mine. The autoformat service did not run because the data partition is the last partition in the image, and only contains null bytes, which genimage cleverly strips from the generated hdimage. So when I dd the image to the SD card without changing the partition sizes, the old ext4 superblock which was created on the data partition during previous test runs was not overwritten, so libblkid thinks there is still a file system on the partition, and the ENV{ID_FS_USAGE}!="filesystem" in udev doesn't trigger. I've fixed up the genimage config to zero out the first few kilobytes on the data partitions now and will include that patch in my next series. The part with mkfs not finding the partition was because I had refactored the service unit, and was missing a set of braces around the partx calls, so the second partx call to re-add the partition didn't happen. So the current solution with sfdisk and partx did work in principle. - Roland > > > > > > And that is my current yak shaving status… I think the 'correct' way to > > > do this would be using systemd-repart [1] before the rootfs is mounted > > > (but maybe we need an initrd for that…? not sure…), or simply use the > > > existing 512 MB data partition generated by genimage and let the user > > > resize it manually when needed. > > > > > > [1]: https://www.freedesktop.org/software/systemd/man/systemd-repart.html > > > > On the LXA TAC we currently use systemd-repart for this: > > https://github.com/linux-automation/meta-lxatac/tree/langdale/meta-lxatac-bsp/recipes-core/lxatac-repart > > > > We use it from the running system (not initramfs). > > Userspace can change the partition layout manually. systemd-repart does > this internally via fdisk_reread_changes(). That in turn calls the BLKPG > ioctl. So with the right tool you can resize a partition at runtime even if > it's on the same device as the root partition. > > Michael > > -- > Pengutronix e.K. | | > Steuerwalder Str. 21 | http://www.pengutronix.de/ | > 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | > Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | -- Roland Hieber, Pengutronix e.K. | r.hieber@pengutronix.de | Steuerwalder Str. 21 | https://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |