From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 7174822613449965568 X-Received: by 2002:aca:2115:0:b0:35e:224c:5698 with SMTP id 21-20020aca2115000000b0035e224c5698mr4670868oiz.273.1670545364901; Thu, 08 Dec 2022 16:22:44 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a9d:172:0:b0:668:d7a2:6181 with SMTP id 105-20020a9d0172000000b00668d7a26181ls1135765otu.11.-pod-prod-gmail; Thu, 08 Dec 2022 16:22:44 -0800 (PST) X-Google-Smtp-Source: AA0mqf4u0D1EnaaAzsClWySv5Vg/Tjeunor84zpeC7coyVQ3SBUTzmRC5tsHqxWRHk8Ci/xHu26G X-Received: by 2002:a05:6830:157:b0:670:5f0e:8b70 with SMTP id j23-20020a056830015700b006705f0e8b70mr2330663otp.5.1670545364240; Thu, 08 Dec 2022 16:22:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670545364; cv=none; d=google.com; s=arc-20160816; b=t+Hi1BTKogTPDhFYcsAXjoON4Rc8WxKROcbBGLYgVKCPkiJCUp+p4hKncQ6k2Tp92c cbN3xlozQF1W9EtPzVfWhoBiM5xwIqjV7LHDV6zBsNNTEpif8a2oMtr5qcIdP0tfn7r5 rbdJImHt92fgZ9NOFruKQ4UBgB8tc+/mfpdkbLgRB+stlkhcQzgfKY7ozeFgdafO3iUN TTpBwps1VqNWHE0OXtLEahD5b/T46ASMX8yHuqdpfGH7FgzB1o0Bm8wXRs8mjbo7N0nQ t65BK8Gu3hNYRO0IZFNUehsQdbuVLmLAFkBUVQYOczXDoRumnkNlJk9jBXL6EagBA3Om 9/8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=X3XJMIthywlyOOJSBxiN8psuHXBpBwpxe8wPmgYeICM=; b=zdcakVG/SM78PZ2SQwXjndZe7GWIFB5tBQ878DLsmIiT7JVz4puZDFYIl08NbUq3FX Ckj+KkgrkNgERTvmlVfZn2Az26jp7uSDLpjUuz4eqZpt3bXFZmphu7V6ryBNtfSCknbz OFZZdqn8z8jiiAr9BicB0LZ3Tu22Qk2P5o5h5rIUrCLfX7nAMJam5iH4+ehmqF0xjgdk 06devBNYz71gBKr2+P9HojKKAmKabJYEuRigF9quVC3fcCOMtl+nAomFVkPqgGCuuiSa FEotq0WVHwspinYh9YTAm8dZRmZgnPjUYj/7iLj1qDqg58e9kNWxC5byjLb9hLIlJn20 dLRw== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=cpEqjndr; spf=pass (google.com: domain of roberto.foglietta@gmail.com designates 2607:f8b0:4864:20::82f as permitted sender) smtp.mailfrom=roberto.foglietta@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from mail-qt1-x82f.google.com (mail-qt1-x82f.google.com. [2607:f8b0:4864:20::82f]) by gmr-mx.google.com with ESMTPS id q13-20020a056830232d00b0066da9f2faeesi1203otg.0.2022.12.08.16.22.44 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 08 Dec 2022 16:22:44 -0800 (PST) Received-SPF: pass (google.com: domain of roberto.foglietta@gmail.com designates 2607:f8b0:4864:20::82f as permitted sender) client-ip=2607:f8b0:4864:20::82f; Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=cpEqjndr; spf=pass (google.com: domain of roberto.foglietta@gmail.com designates 2607:f8b0:4864:20::82f as permitted sender) smtp.mailfrom=roberto.foglietta@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: by mail-qt1-x82f.google.com with SMTP id j16so2506904qtv.4 for ; Thu, 08 Dec 2022 16:22:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=X3XJMIthywlyOOJSBxiN8psuHXBpBwpxe8wPmgYeICM=; b=cpEqjndrVsjfw/VXPOXEPIFmir6miKbZi/nYBmdbNSDZMi/CENtZJogBT6WPMiOzjj YQKAssFzIhNhKT8lASdf+cLExWCW0sQBlDgjD61G5N1ThAh/FRBG18X+Av2+0Xv7NFVl pisjVeze3wbvHcZ6EMfjBQOLYKkfMSZP3rebAFAzuTrfBSgv8t/aT/DhYV8P2YAtNe6J cQlv0ye78WWlodmZXx0+IS/6aZrZgyyjkK1M3J+l3E4BF9wBetooIQk9YMF3D6v0nR9Y oo352SOZwS2u8abvdGv9qo3yVwzfTHJQR0KdbnD/XneMRLTKo01WrL6gef9qT1AQt0Z4 7ddw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=X3XJMIthywlyOOJSBxiN8psuHXBpBwpxe8wPmgYeICM=; b=cmc86xktnfiHm+ATTgJYRJt/T2U/d4EEwFvaTwWFnxqBLEdFTO2NWA5JGLgUC1yxUH Z87hM53rh2cOphLV8r4R9USk9tHU26MgnWMu8j2QGzx1w8TUJeKplHGQYBs5kZRxxHUQ 6zrcUI97WnIXdmznfvJ2nu9tmmvEeweyKf+so0zOCauVCIu+ojRiZAhsMrstiwOWXpE2 rZ2kbYTWHvvc2ZJ8fmUjJB/dAEGVLHZiLwJT4L7W8XEPSggD1DBwuujzR6ZLfkTzrQEn EUxYb+x5+Qo+1+BCKSuCwtdjRR583fV3jLGnFkGcCpEBEFR56/Y4d/Hpdy2pZvx5o6or giHw== X-Gm-Message-State: ANoB5plW630aAuE+/TwJCoeW+kCBtiAbf7BNlMWsWlDyx6WUyAXhRON6 yPLMBLnV1p6yoq79cu4Tt2wvFOQRDwYMCWkltqNktsU2fWin X-Received: by 2002:ac8:43cb:0:b0:39c:ed86:f4d1 with SMTP id w11-20020ac843cb000000b0039ced86f4d1mr71424485qtn.461.1670545363807; Thu, 08 Dec 2022 16:22:43 -0800 (PST) MIME-Version: 1.0 References: <20221208165542.2451856-1-tobias.schaffner@siemens.com> <20221208183919.1703fb25@md1za8fc.ad001.siemens.net> In-Reply-To: <20221208183919.1703fb25@md1za8fc.ad001.siemens.net> From: "Roberto A. Foglietta" Date: Fri, 9 Dec 2022 01:22:06 +0100 Message-ID: Subject: Re: [PATCH] expand-on-first-boot: wait for udev to create symlink To: Henning Schild Cc: "T. Schaffner" , isar-users@googlegroups.com, felix.moessbauer@siemens.com, jan.kiszka@siemens.com Content-Type: text/plain; charset="UTF-8" X-TUID: 3PpLowDeh+Bn On Thu, 8 Dec 2022 at 18:39, Henning Schild wrote: > > Am Thu, 8 Dec 2022 17:55:42 +0100 > schrieb "T. Schaffner" : > > > From: Tobias Schaffner > > > > systemd-growfs depends on a symlink to the partition of the filesystem > > that should be resized. This symlink is created by udev in > > /dev/block/. > > reading that patch I had a flash-back about two patches I did recently for another project https://github.com/robang74/tinycore-editor/commit/d57271e3229551ddfbd3deba1363d2efe2914908 https://github.com/robang74/tinycore-editor/commit/4ff435bb8a73c7e956ea4f9303a36fe06a136e54 both altered this file https://github.com/robang74/tinycore-editor/blob/main/tinycore/changes/rcS the main problem and the final result was much the same: trigger udev and wait for the dev link. # Start Udev to populate /dev and handle hotplug events /sbin/udevd --daemon 2>&1 >/dev/null /sbin/udevadm trigger --action=add 2>&1 >/dev/null /sbin/udevadm settle --timeout=5 echo -ne "\e[1;37m" for i in $(seq 1 10); do if gettcdev; then break; fi >/dev/null echo -n . sleep 1 done echo -e "\e[0m" /sbin/udevadm control --exit --timeout=5 in my case, the booting device is not meaningful because the rootfs is a file. function gettcdev() { blkid --label $tclabel } So, the search for the USB stick device is done s by label > > > /dev/block/ as +# systemd-growfs depends on it > > +while ! readlink /dev/block/* | grep -q "${LAST_PART_NAME}"; do > > I would make that much stricter to not be tricked by partial matches > > sda4 vs sda42 Irrelevant, if sda42 has been found then sda4 exists as well considering the problem is not yet started. However, for sake of precision and to avoid corner cases in which sda42 is created before sda4 a dollar at the end of regex will solve this issue. +while ! readlink /dev/block/* | grep -qe "${LAST_PART_NAME}$"; do > > readlink -f /dev/block/* | grep -e -q "^${LAST_PART}$" > > > + sleep 0.1 > > I wonder if there is anything we could do here. Maybe "udevadm trigger" > and depend on udev after all. Because the 5 is a nasty guess ... This is the reason because I cited my patches. I hope they will help you. Best regards, R-