From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: passt.top; dkim=pass (2048-bit key; secure) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.a=rsa-sha256 header.s=202508 header.b=IBZ8VExt; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 7B2A35A026F for ; Wed, 24 Sep 2025 03:58:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202508; t=1758679128; bh=AMtXyWSpxd3vhwQGZrHvzpsB6zztNr6GQ4XYfUyrd9k=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=IBZ8VExtQ/LwFTZKn/ifszY2n+MnEMnsbKbog4UVWtANmN7IQ0npQ+ej3Z2f5geEu H4DSo6tjt21qjwAP0bPtQDTD+9wS0ObQRJdaciXDphB73rVt1AlNktmjiIBtEF4deZ BoIhnU7riY6o3WWX/+e1Z4/r9Z6jIYY1hkHCIHd4SAW3zvIexGXEWknKKdy8y8ySUh e3KL2urPJDkjMDKtMHX70t7KOqc5Ce1FVCdza20Sh+pYf1BWbRdXMoMxn39wSYpLyT PtQfNvtygweLx5X0jABRFhy26py/IgM/szJ87XZRL7q5Uhjkd4WI1roDL+lWTvIqvH HjpvK8rWif0uQ== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4cWg4S2gZtz4wBj; Wed, 24 Sep 2025 11:58:48 +1000 (AEST) Date: Wed, 24 Sep 2025 11:58:43 +1000 From: David Gibson To: Stefano Brivio Subject: Re: [PATCH] test: Update README.md Message-ID: References: <20250919014329.6007-1-yuhuang@redhat.com> <20250919115822.4e3aab21@elisabeth> <20250922220338.49013fce@elisabeth> <20250923123213.61ddd9d5@elisabeth> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="PtM7WMUwYFviPHui" Content-Disposition: inline In-Reply-To: <20250923123213.61ddd9d5@elisabeth> Message-ID-Hash: H2FJHT3RANXAKN75BEDIDBVI2YFN73QQ X-Message-ID-Hash: H2FJHT3RANXAKN75BEDIDBVI2YFN73QQ X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Yumei Huang , passt-dev@passt.top X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --PtM7WMUwYFviPHui Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Sep 23, 2025 at 12:32:13PM +0200, Stefano Brivio wrote: > On Tue, 23 Sep 2025 14:36:41 +0800 > Yumei Huang wrote: >=20 > > On Tue, Sep 23, 2025 at 4:03=E2=80=AFAM Stefano Brivio wrote: > > > > > > On Mon, 22 Sep 2025 11:03:23 +0800 > > > Yumei Huang wrote: > > > =20 > > > > On Fri, Sep 19, 2025 at 5:58=E2=80=AFPM Stefano Brivio wrote: =20 > > > > > > > > > > On Fri, 19 Sep 2025 09:43:29 +0800 > > > > > Yumei Huang wrote: > > > > > =20 > > > > > > Signed-off-by: Yumei Huang > > > > > > --- > > > > > > test/README.md | 31 +++++++++++++++++++++++++++++-- > > > > > > 1 file changed, 29 insertions(+), 2 deletions(-) > > > > > > > > > > > > diff --git a/test/README.md b/test/README.md > > > > > > index 91ca603..e3e9d37 100644 > > > > > > --- a/test/README.md > > > > > > +++ b/test/README.md > > > > > > @@ -32,7 +32,7 @@ Example for Debian, and possibly most Debian-= based distributions: > > > > > > git go iperf3 isc-dhcp-common jq libgpgme-dev libseccomp-d= ev linux-cpupower > > > > > > lm-sensors lz4 netavark netcat-openbsd psmisc qemu-efi-aar= ch64 > > > > > > qemu-system-arm qemu-system-misc qemu-system-ppc qemu-syst= em-x86 > > > > > > - qemu-system-x86 sipcalc socat strace tmux uidmap valgrind > > > > > > + sipcalc socat strace tmux uidmap valgrind > > > > > > > > > > > > NOTE: the tests need a qemu version >=3D 7.2, or one that cont= ains commit > > > > > > 13c6be96618c ("net: stream: add unix socket"): this change int= roduces support > > > > > > @@ -81,7 +81,12 @@ The following additional packages are common= ly needed: > > > > > > > > > > > > ## Regular test > > > > > > > > > > > > -Just issue: > > > > > > +Before running the tests, you need to prepare the required ass= ets: > > > > > > + > > > > > > + cd test > > > > > > + make assets > > > > > > + > > > > > > +Then issue: > > > > > > > > > > > > ./run > > > > > > > > > > > > @@ -91,6 +96,28 @@ variable settings: DEBUG=3D1 enables debuggi= ng messages, TRACE=3D1 enables tracing > > > > > > > > > > > > PCAP=3D1 TRACE=3D1 ./run > > > > > > > > > > > > +**Note:** > > > > > > + > > > > > > +* It's recommended to run the commands as a non-root user. > > > > > > + Due to [Bug 967509](https://bugzilla.redhat.com/show_bug.cgi= ?id=3D967509), > > > > > > + if you switch users with `su` or `sudo`, the directory `/run= /user/ID` may > > > > > > + not be created. In that case, `XDG_RUNTIME_DIR` will incorre= ctly point to > > > > > > + `/run/user/0` instead of `/run/user/ID`, which can cause err= or. =20 > > > > > > > > > > Thanks for the research, I wasn't aware of that, and recently spe= nt > > > > > quite some time figuring that out (for other reasons): > > > > > > > > > > https://issues.redhat.com/browse/RHEL-70222 > > > > > > > > > > in that case, XDG_RUNTIME_DIR was simply not set. Things were wor= king > > > > > with 'machinectl shell' instead. > > > > > > > > > > At the same time: running this whole stuff as root sounds rather = crazy, > > > > > unless it's a throw-away VMs with absolutely nothing important on= it. > > > > > > > > > > That is, regardless of the issue with XDG_RUNTIME_DIR. I would ma= ybe > > > > > make the wording stronger, something like: > > > > > > > > > > * Don't run the tests as root, it's not needed! > > > > > * If you really need to, note that ... > > > > > =20 > > > > > > + **Workaround:** Log out and log back in as the intended user= to ensure the > > > > > > + correct runtime directory is set up. =20 > > > > > > > > > > We could also suggest 'machinectl shell' if it's really needed for > > > > > whatever reason. =20 > > > > > > > > I'm not sure how 'machinectl shell' works here. The error happens w= hen > > > > running 'make assets', > > > > which calls 'prepare-distro-img.sh' script, which calls 'virsh edit= '. =20 > > > > > > Ah, I didn't know! So this is actually similar to > > > https://issues.redhat.com/browse/RHEL-70222. > > > =20 > > > > If we run 'make assets' with root, the error is like this: > > > > > > > > ./prepare-distro-img.sh prepared-debian-8.11.0-openstack-amd64.qcow2 > > > > libguestfs: error: could not create appliance through libvirt. > > > > Original error from libvirt: Cannot access storage file > > > > '/home/test/passt/test/prepared-debian-8.11.0-openstack-amd64.qcow2' > > > > (as uid:107, gid:107): Permission denied [code=3D38 int1=3D13] > > > > > > > > If we switch to a non-root user via 'su', the error is like this: > > > > > > > > ./prepare-distro-img.sh prepared-debian-8.11.0-openstack-amd64.qcow2 > > > > libvirt: XML-RPC error : Cannot create user runtime directory > > > > '/run/user/0/libvirt': Permission denied > > > > libguestfs: error: could not connect to libvirt (URI =3D > > > > qemu:///session): Cannot create user runtime directory > > > > '/run/user/0/libvirt': Permission denied [code=3D38 int1=3D13] > > > > make: *** [Makefile:115: prepared-debian-8.11.0-openstack-amd64.qco= w2] Error 1 > > > > > > > > Do you mean to run 'make assets' with 'machinectl shell'? What's the > > > > exact cmd here? I tried this, seems not work. > > > > > > > > # machinectl shell --uid=3D$(id -u pat) .host > > > > /home/test/passt/test/make assets > > > > Connected to the local host. Press ^] three times within 1s to = exit session. > > > > > > > > Connection to the local host terminated. =20 > > > > > > No, I mean using 'machinectl shell' instead of 'su' (it's intended as= a > > > replacement), that is: > > > > > > $ machinectl shell > > > # make assets > > > > > > ...because that one will set XDG_RUNTIME_DIR. =20 > >=20 > > Yes, 'machinectl shell' will solve the issue when switching to a > > non-root user via su. But it doesn't solve the issue when running > > 'make assets' as root. They are actually different issues as above. >=20 > Can one need specify a XDG_RUNTIME_DIR that actually exists, maybe? > Does that work? >=20 > > Maybe we can just put it like: > >=20 > > Running the commands as root is just not allowed. If you login > > the system with root, don't use su to switch users due to [Bug > > 967509](https://bugzilla.redhat.com/show_bug.cgi?id=3D967509). Log out > > and log back in as the intended user, or use 'machinectl shell > > --uid=3D$user'. > >=20 > > What do you think? >=20 > Well, it's free software, so "not allowed" doesn't really mean much. >=20 > I would simply warn users that it's a bad idea and it's not needed, > something like my previous proposal: >=20 > * Don't run the tests as root, it's not needed! > * If you really need to, note that ... >=20 > and then just list the workaround that actually works. >=20 > I think the most typical need for running things as root is that you > don't actually have other users (it happens with some VM images or > in embedded systems), so 'machinectl shell --uid=3D$user' won't really > help there. >=20 > Maybe just mention setting XDG_RUNTIME_DIR to whatever is appropriate > (does /tmp work?)? I wonder if we're overcomplicating things. The README doesn't need to address every possible option, just the common / expected ones. So I think it's sufficient to say "don't test as root, the whole point of passt is not to run as root". If you insist on testing as root you can figure out the details yourself. --=20 David Gibson (he or they) | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you, not the other way | around. http://www.ozlabs.org/~dgibson --PtM7WMUwYFviPHui Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmjTUFIACgkQzQJF27ox 2Gceng/7BhUrSOUxioYyfAnIjU8o+d9AURvxs5gY98Ax8hMvXw3Jt4qE/tfJUC9x 1/M5v2hZZ6xqidWh7WJVAVQ1TOElcm7ul41n/3Ex0BR0SNZLZcgx64LuFN1w/XY/ fd39NzKLWWnLTGwYUJad0M2R8yh8Bh9Taa3WyfNi8Lq3Z7pnNLmIt9IDW1aCjqsW aFSqzZPZsV90+2SL4hMq/1uYjuC5lYXOKkD93Dei9ND88y0IG7zrWjfIafRYSbl0 oRxGRf+bkXctJoOOlDZnyKIHTGPmkZNXnPOjLRKqA4IsEir7o6nFiYLAPix4XxvE M4UV7jW5uP00aH5EQyVmmduyrH1BbiGwv4G1zmdKAgdTjL9LPGzVFLsTlRC9qswh qHn33AW0sv0HqWJoc46ArAZdUbnmIet4aVgZDBT41h5cThdXIbKnOnwFAjYAySYm /24QF7nV2N2rjUGYPrk+j03OA5ZfAmvvt90U370V9YuFkUeufB1PMRJpMuMLb8dr I/sPf76k+TD/EoP7kGH05cGzU2gx0HK2GhnV+wTtf0CtpdakW1EZB829lj0d6mY8 yaJCq7AAK32T4BBtkjz85ah7wB7ylg36gltpQ9lkr5QcmqYngxRxJWV5gW3y4WPS iZHV387oZ7eibKkX0bCrljjE23YqNAnWXEwKgS7KZV/jCkBfTZ4= =sblE -----END PGP SIGNATURE----- --PtM7WMUwYFviPHui--