public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
* [PATCH 0/2] doc/demo: Fix two issues seen on Fedora 36
@ 2022-09-16 23:55 Stefano Brivio
  2022-09-16 23:55 ` [PATCH 1/2] doc/demo: Drop /sbin from dhclient command, pass script file explicitly Stefano Brivio
  2022-09-16 23:55 ` [PATCH 2/2] doc/demo: Clone and use mbuto in init namespace Stefano Brivio
  0 siblings, 2 replies; 6+ messages in thread
From: Stefano Brivio @ 2022-09-16 23:55 UTC (permalink / raw)
  To: passt-dev

[-- Attachment #1: Type: text/plain, Size: 261 bytes --]

Stefano Brivio (2):
  doc/demo: Drop /sbin from dhclient command, pass script file
    explicitly
  doc/demo: Clone and use mbuto in init namespace

 doc/demo.sh | 30 +++++++++++++++++++++---------
 1 file changed, 21 insertions(+), 9 deletions(-)

-- 
2.35.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] doc/demo: Drop /sbin from dhclient command, pass script file explicitly
  2022-09-16 23:55 [PATCH 0/2] doc/demo: Fix two issues seen on Fedora 36 Stefano Brivio
@ 2022-09-16 23:55 ` Stefano Brivio
  2022-09-17  3:23   ` David Gibson
  2022-09-16 23:55 ` [PATCH 2/2] doc/demo: Clone and use mbuto in init namespace Stefano Brivio
  1 sibling, 1 reply; 6+ messages in thread
From: Stefano Brivio @ 2022-09-16 23:55 UTC (permalink / raw)
  To: passt-dev

[-- Attachment #1: Type: text/plain, Size: 1005 bytes --]

dhclient might be in /usr/sbin on recent versions of Fedora, and
mbuto just adds it to the same location as it was on the host:
just call dhclient instead of /sbin/dhclient.

This also applies for dhclient-script: given that we create the file
on boot, pass its explicit location with -sf.

Signed-off-by: Stefano Brivio <sbrivio(a)redhat.com>
---
 doc/demo.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/doc/demo.sh b/doc/demo.sh
index d39a10e..f704ed4 100755
--- a/doc/demo.sh
+++ b/doc/demo.sh
@@ -63,11 +63,11 @@ EOF
 		echo "$ ip link set dev eth0 up"
 		ip link set dev eth0 up
 		sleep 3
-		echo "$ /sbin/dhclient -4 -1"
-		/sbin/dhclient -4 -1
+		echo "$ dhclient -4 -1 -sf /sbin/dhclient-script"
+		dhclient -4 -1 -sf /sbin/dhclient-script
 		sleep 2
-		echo "$ /sbin/dhclient -6 -1"
-		/sbin/dhclient -6 -1
+		echo "$ dhclient -6 -1 -sf /sbin/dhclient-script"
+		dhclient -6 -1 -sf /sbin/dhclient-script
 		sleep 2
 		echo
 		echo "$ ip address show"
-- 
@@ -63,11 +63,11 @@ EOF
 		echo "$ ip link set dev eth0 up"
 		ip link set dev eth0 up
 		sleep 3
-		echo "$ /sbin/dhclient -4 -1"
-		/sbin/dhclient -4 -1
+		echo "$ dhclient -4 -1 -sf /sbin/dhclient-script"
+		dhclient -4 -1 -sf /sbin/dhclient-script
 		sleep 2
-		echo "$ /sbin/dhclient -6 -1"
-		/sbin/dhclient -6 -1
+		echo "$ dhclient -6 -1 -sf /sbin/dhclient-script"
+		dhclient -6 -1 -sf /sbin/dhclient-script
 		sleep 2
 		echo
 		echo "$ ip address show"
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] doc/demo: Clone and use mbuto in init namespace
  2022-09-16 23:55 [PATCH 0/2] doc/demo: Fix two issues seen on Fedora 36 Stefano Brivio
  2022-09-16 23:55 ` [PATCH 1/2] doc/demo: Drop /sbin from dhclient command, pass script file explicitly Stefano Brivio
@ 2022-09-16 23:55 ` Stefano Brivio
  1 sibling, 0 replies; 6+ messages in thread
From: Stefano Brivio @ 2022-09-16 23:55 UTC (permalink / raw)
  To: passt-dev

[-- Attachment #1: Type: text/plain, Size: 1949 bytes --]

...and not in pasta's namespace: the fakeroot(1) version shipping
with (at least) Fedora 36 assumes "nested" operation as it sees that
the UID is 0, and claims it's not supported.

Signed-off-by: Stefano Brivio <sbrivio(a)redhat.com>
---
 doc/demo.sh | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/doc/demo.sh b/doc/demo.sh
index f704ed4..ed71ffb 100755
--- a/doc/demo.sh
+++ b/doc/demo.sh
@@ -128,6 +128,19 @@ start_pasta_delayed() {
 	exit 0
 }
 
+# start_mbuto_delayed() - Run mbuto once, and if, $DEMO_DIR/mbuto.wait is gone
+start_mbuto_delayed() {
+	trap '' EXIT
+	while [ -d "${DEMO_DIR}/mbuto.wait" ]; do sleep 1; done
+	cmd git -C "${DEMO_DIR}" clone git://mbuto.sh/mbuto
+	echo
+	cmd "${DEMO_DIR}/mbuto/mbuto" \
+		-p "$(realpath "${0}")" -f "${DEMO_DIR}/demo.img"
+
+	mkdir "${DEMO_DIR}/mbuto.done"
+	exit 0
+}
+
 # into_ns() - Entry point and demo script to run inside new namespace
 into_ns() {
 	echo "We're in the new namespace now."
@@ -204,11 +217,8 @@ into_ns() {
 		exit 0
 	fi
 
-	cmd git -C "${DEMO_DIR}" clone git://mbuto.sh/mbuto
-	echo
-	cmd "${DEMO_DIR}/mbuto/mbuto" \
-		-p "$(realpath "${0}")" -f "${DEMO_DIR}/demo.img"
-	echo
+	rmdir "${DEMO_DIR}/mbuto.wait"
+	while [ ! -d "${DEMO_DIR}/mbuto.done" ]; do sleep 1; done
 	echo "The guest image is ready. The next step will start the guest."
 	echo "Use ^C to terminate it."
 	next
@@ -229,6 +239,7 @@ trap cleanup EXIT INT
 
 DEMO_DIR="$(mktemp -d)"
 mkdir "${DEMO_DIR}/pasta.wait"
+mkdir "${DEMO_DIR}/mbuto.wait"
 
 echo "This script sets up a network and user namespace using pasta(1), then"
 echo "starts a virtual machine in it, connected via passt(1), pausing at every"
@@ -242,6 +253,7 @@ echo "of this script from there."
 next
 
 start_pasta_delayed &
+start_mbuto_delayed &
 DEMO_DIR="${DEMO_DIR}" cmd unshare -rUn "${0}" into_ns
 
 exit 0
-- 
@@ -128,6 +128,19 @@ start_pasta_delayed() {
 	exit 0
 }
 
+# start_mbuto_delayed() - Run mbuto once, and if, $DEMO_DIR/mbuto.wait is gone
+start_mbuto_delayed() {
+	trap '' EXIT
+	while [ -d "${DEMO_DIR}/mbuto.wait" ]; do sleep 1; done
+	cmd git -C "${DEMO_DIR}" clone git://mbuto.sh/mbuto
+	echo
+	cmd "${DEMO_DIR}/mbuto/mbuto" \
+		-p "$(realpath "${0}")" -f "${DEMO_DIR}/demo.img"
+
+	mkdir "${DEMO_DIR}/mbuto.done"
+	exit 0
+}
+
 # into_ns() - Entry point and demo script to run inside new namespace
 into_ns() {
 	echo "We're in the new namespace now."
@@ -204,11 +217,8 @@ into_ns() {
 		exit 0
 	fi
 
-	cmd git -C "${DEMO_DIR}" clone git://mbuto.sh/mbuto
-	echo
-	cmd "${DEMO_DIR}/mbuto/mbuto" \
-		-p "$(realpath "${0}")" -f "${DEMO_DIR}/demo.img"
-	echo
+	rmdir "${DEMO_DIR}/mbuto.wait"
+	while [ ! -d "${DEMO_DIR}/mbuto.done" ]; do sleep 1; done
 	echo "The guest image is ready. The next step will start the guest."
 	echo "Use ^C to terminate it."
 	next
@@ -229,6 +239,7 @@ trap cleanup EXIT INT
 
 DEMO_DIR="$(mktemp -d)"
 mkdir "${DEMO_DIR}/pasta.wait"
+mkdir "${DEMO_DIR}/mbuto.wait"
 
 echo "This script sets up a network and user namespace using pasta(1), then"
 echo "starts a virtual machine in it, connected via passt(1), pausing at every"
@@ -242,6 +253,7 @@ echo "of this script from there."
 next
 
 start_pasta_delayed &
+start_mbuto_delayed &
 DEMO_DIR="${DEMO_DIR}" cmd unshare -rUn "${0}" into_ns
 
 exit 0
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] doc/demo: Drop /sbin from dhclient command, pass script file explicitly
  2022-09-16 23:55 ` [PATCH 1/2] doc/demo: Drop /sbin from dhclient command, pass script file explicitly Stefano Brivio
@ 2022-09-17  3:23   ` David Gibson
  2022-09-17  8:44     ` Stefano Brivio
  0 siblings, 1 reply; 6+ messages in thread
From: David Gibson @ 2022-09-17  3:23 UTC (permalink / raw)
  To: passt-dev

[-- Attachment #1: Type: text/plain, Size: 1415 bytes --]

On Sat, Sep 17, 2022 at 01:55:18AM +0200, Stefano Brivio wrote:
> dhclient might be in /usr/sbin on recent versions of Fedora, and
> mbuto just adds it to the same location as it was on the host:
> just call dhclient instead of /sbin/dhclient.
> 
> This also applies for dhclient-script: given that we create the file
> on boot, pass its explicit location with -sf.
> 
> Signed-off-by: Stefano Brivio <sbrivio(a)redhat.com>

Hm, for the tests mbuto image I addressed this with symlinks instead.
Not sure which is more elegant.

> ---
>  doc/demo.sh | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/doc/demo.sh b/doc/demo.sh
> index d39a10e..f704ed4 100755
> --- a/doc/demo.sh
> +++ b/doc/demo.sh
> @@ -63,11 +63,11 @@ EOF
>  		echo "$ ip link set dev eth0 up"
>  		ip link set dev eth0 up
>  		sleep 3
> -		echo "$ /sbin/dhclient -4 -1"
> -		/sbin/dhclient -4 -1
> +		echo "$ dhclient -4 -1 -sf /sbin/dhclient-script"
> +		dhclient -4 -1 -sf /sbin/dhclient-script
>  		sleep 2
> -		echo "$ /sbin/dhclient -6 -1"
> -		/sbin/dhclient -6 -1
> +		echo "$ dhclient -6 -1 -sf /sbin/dhclient-script"
> +		dhclient -6 -1 -sf /sbin/dhclient-script
>  		sleep 2
>  		echo
>  		echo "$ ip address show"

-- 
David Gibson			| 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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] doc/demo: Drop /sbin from dhclient command, pass script file explicitly
  2022-09-17  3:23   ` David Gibson
@ 2022-09-17  8:44     ` Stefano Brivio
  2022-09-17  9:50       ` David Gibson
  0 siblings, 1 reply; 6+ messages in thread
From: Stefano Brivio @ 2022-09-17  8:44 UTC (permalink / raw)
  To: passt-dev

[-- Attachment #1: Type: text/plain, Size: 812 bytes --]

On Sat, 17 Sep 2022 13:23:55 +1000
David Gibson <david(a)gibson.dropbear.id.au> wrote:

> On Sat, Sep 17, 2022 at 01:55:18AM +0200, Stefano Brivio wrote:
> > dhclient might be in /usr/sbin on recent versions of Fedora, and
> > mbuto just adds it to the same location as it was on the host:
> > just call dhclient instead of /sbin/dhclient.
> > 
> > This also applies for dhclient-script: given that we create the file
> > on boot, pass its explicit location with -sf.
> > 
> > Signed-off-by: Stefano Brivio <sbrivio(a)redhat.com>  
> 
> Hm, for the tests mbuto image I addressed this with symlinks instead.
> Not sure which is more elegant.

Yes, I noticed... I think the symlinks are actually more elegant, but
this is meant for interactive usage, and that has some potential to
confuse the user.

-- 
Stefano


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] doc/demo: Drop /sbin from dhclient command, pass script file explicitly
  2022-09-17  8:44     ` Stefano Brivio
@ 2022-09-17  9:50       ` David Gibson
  0 siblings, 0 replies; 6+ messages in thread
From: David Gibson @ 2022-09-17  9:50 UTC (permalink / raw)
  To: passt-dev

[-- Attachment #1: Type: text/plain, Size: 1164 bytes --]

On Sat, Sep 17, 2022 at 10:44:31AM +0200, Stefano Brivio wrote:
> On Sat, 17 Sep 2022 13:23:55 +1000
> David Gibson <david(a)gibson.dropbear.id.au> wrote:
> 
> > On Sat, Sep 17, 2022 at 01:55:18AM +0200, Stefano Brivio wrote:
> > > dhclient might be in /usr/sbin on recent versions of Fedora, and
> > > mbuto just adds it to the same location as it was on the host:
> > > just call dhclient instead of /sbin/dhclient.
> > > 
> > > This also applies for dhclient-script: given that we create the file
> > > on boot, pass its explicit location with -sf.
> > > 
> > > Signed-off-by: Stefano Brivio <sbrivio(a)redhat.com>  
> > 
> > Hm, for the tests mbuto image I addressed this with symlinks instead.
> > Not sure which is more elegant.
> 
> Yes, I noticed... I think the symlinks are actually more elegant, but
> this is meant for interactive usage, and that has some potential to
> confuse the user.

Fair enough.  I don't think I've ever tried to do anything with demo.sh


-- 
David Gibson			| 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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-09-17  9:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-16 23:55 [PATCH 0/2] doc/demo: Fix two issues seen on Fedora 36 Stefano Brivio
2022-09-16 23:55 ` [PATCH 1/2] doc/demo: Drop /sbin from dhclient command, pass script file explicitly Stefano Brivio
2022-09-17  3:23   ` David Gibson
2022-09-17  8:44     ` Stefano Brivio
2022-09-17  9:50       ` David Gibson
2022-09-16 23:55 ` [PATCH 2/2] doc/demo: Clone and use mbuto in init namespace Stefano Brivio

Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).