* test: make passt.mbuto script more robust
@ 2023-12-11 18:50 Jon Maloy
2023-12-11 20:39 ` Stefano Brivio
0 siblings, 1 reply; 4+ messages in thread
From: Jon Maloy @ 2023-12-11 18:50 UTC (permalink / raw)
To: passt-dev, sbrivio, lvivier, dgibson, jmaloy
From: Jon Paul Maloy <jmaloy@redhat.com>
Creation of a symbolic link from /sbin to /usr/sbin fails if /sbin
exists and is non-empty. This is the case on Ubuntu-23.04.
We fix this by removing /sbin before creating the link.
Signed-off-by: Jon Maloy <jmaloy@redhat.com>
---
test/passt.mbuto | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/test/passt.mbuto b/test/passt.mbuto
index 90816d2..12d7f50 100755
--- a/test/passt.mbuto
+++ b/test/passt.mbuto
@@ -26,6 +26,8 @@ DIRS="${DIRS} /tmp /sbin /usr/share /var/log /var/lib /etc/ssh /run/sshd /root/.
COPIES="${COPIES} small.bin,/root/small.bin medium.bin,/root/medium.bin big.bin,/root/big.bin"
FIXUP="${FIXUP}"'
+ rm -rf /sbin
+ ln -s /usr/sbin /sbin
cat > /sbin/dhclient-script << EOF
#!/bin/sh
LOG=/var/log/dhclient-script.log
@@ -47,7 +49,6 @@ set >> \$LOG
exit 0
EOF
chmod 755 /sbin/dhclient-script
- ln -s /sbin /usr/sbin
ln -s /bin /usr/bin
ln -s /run /var/run
:> /etc/fstab
--
@@ -26,6 +26,8 @@ DIRS="${DIRS} /tmp /sbin /usr/share /var/log /var/lib /etc/ssh /run/sshd /root/.
COPIES="${COPIES} small.bin,/root/small.bin medium.bin,/root/medium.bin big.bin,/root/big.bin"
FIXUP="${FIXUP}"'
+ rm -rf /sbin
+ ln -s /usr/sbin /sbin
cat > /sbin/dhclient-script << EOF
#!/bin/sh
LOG=/var/log/dhclient-script.log
@@ -47,7 +49,6 @@ set >> \$LOG
exit 0
EOF
chmod 755 /sbin/dhclient-script
- ln -s /sbin /usr/sbin
ln -s /bin /usr/bin
ln -s /run /var/run
:> /etc/fstab
--
2.39.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: test: make passt.mbuto script more robust
2023-12-11 18:50 test: make passt.mbuto script more robust Jon Maloy
@ 2023-12-11 20:39 ` Stefano Brivio
2023-12-11 23:15 ` Stefano Brivio
0 siblings, 1 reply; 4+ messages in thread
From: Stefano Brivio @ 2023-12-11 20:39 UTC (permalink / raw)
To: Jon Maloy; +Cc: passt-dev, lvivier, dgibson
On Mon, 11 Dec 2023 13:50:14 -0500
Jon Maloy <jmaloy@redhat.com> wrote:
> From: Jon Paul Maloy <jmaloy@redhat.com>
>
> Creation of a symbolic link from /sbin to /usr/sbin fails if /sbin
> exists and is non-empty. This is the case on Ubuntu-23.04.
>
> We fix this by removing /sbin before creating the link.
>
> Signed-off-by: Jon Maloy <jmaloy@redhat.com>
> ---
> test/passt.mbuto | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/test/passt.mbuto b/test/passt.mbuto
> index 90816d2..12d7f50 100755
> --- a/test/passt.mbuto
> +++ b/test/passt.mbuto
> @@ -26,6 +26,8 @@ DIRS="${DIRS} /tmp /sbin /usr/share /var/log /var/lib /etc/ssh /run/sshd /root/.
> COPIES="${COPIES} small.bin,/root/small.bin medium.bin,/root/medium.bin big.bin,/root/big.bin"
>
> FIXUP="${FIXUP}"'
> + rm -rf /sbin
This works on Ubuntu, but to be safer with other distributions:
shouldn't we first move anything we need that happens to be in /sbin to
/usr/sbin?
On (your version of) Ubuntu /sbin is created because of $DIRS above,
but let's say that another version or another distribution has ip(8)
at /sbin/ip, we'll get rid of it.
That is, if you add /usr/sbin explicitly to DIRS above (to make sure it
exists), and then, here, do:
mv /sbin/* /sbin || :
rm -rf /sbin
...does it also work for you?
--
Stefano
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: test: make passt.mbuto script more robust
2023-12-11 20:39 ` Stefano Brivio
@ 2023-12-11 23:15 ` Stefano Brivio
2023-12-12 14:53 ` Jon Maloy
0 siblings, 1 reply; 4+ messages in thread
From: Stefano Brivio @ 2023-12-11 23:15 UTC (permalink / raw)
To: Jon Maloy; +Cc: passt-dev, lvivier, dgibson
On Mon, 11 Dec 2023 21:39:55 +0100
Stefano Brivio <sbrivio@redhat.com> wrote:
> On Mon, 11 Dec 2023 13:50:14 -0500
> Jon Maloy <jmaloy@redhat.com> wrote:
>
> > From: Jon Paul Maloy <jmaloy@redhat.com>
> >
> > Creation of a symbolic link from /sbin to /usr/sbin fails if /sbin
> > exists and is non-empty. This is the case on Ubuntu-23.04.
> >
> > We fix this by removing /sbin before creating the link.
> >
> > Signed-off-by: Jon Maloy <jmaloy@redhat.com>
> > ---
> > test/passt.mbuto | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/test/passt.mbuto b/test/passt.mbuto
> > index 90816d2..12d7f50 100755
> > --- a/test/passt.mbuto
> > +++ b/test/passt.mbuto
> > @@ -26,6 +26,8 @@ DIRS="${DIRS} /tmp /sbin /usr/share /var/log /var/lib /etc/ssh /run/sshd /root/.
> > COPIES="${COPIES} small.bin,/root/small.bin medium.bin,/root/medium.bin big.bin,/root/big.bin"
> >
> > FIXUP="${FIXUP}"'
> > + rm -rf /sbin
>
> This works on Ubuntu, but to be safer with other distributions:
> shouldn't we first move anything we need that happens to be in /sbin to
> /usr/sbin?
>
> On (your version of) Ubuntu /sbin is created because of $DIRS above,
> but let's say that another version or another distribution has ip(8)
> at /sbin/ip, we'll get rid of it.
>
> That is, if you add /usr/sbin explicitly to DIRS above (to make sure it
> exists), and then, here, do:
>
> mv /sbin/* /sbin || :
Gah, sorry, I meant:
mv /sbin/* /usr/sbin/ || :
--
Stefano
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: test: make passt.mbuto script more robust
2023-12-11 23:15 ` Stefano Brivio
@ 2023-12-12 14:53 ` Jon Maloy
0 siblings, 0 replies; 4+ messages in thread
From: Jon Maloy @ 2023-12-12 14:53 UTC (permalink / raw)
To: Stefano Brivio; +Cc: passt-dev, lvivier, dgibson
On 2023-12-11 18:15, Stefano Brivio wrote:
> On Mon, 11 Dec 2023 21:39:55 +0100
> Stefano Brivio <sbrivio@redhat.com> wrote:
>
>> On Mon, 11 Dec 2023 13:50:14 -0500
>> Jon Maloy <jmaloy@redhat.com> wrote:
>>
>>> From: Jon Paul Maloy <jmaloy@redhat.com>
>>>
>>> Creation of a symbolic link from /sbin to /usr/sbin fails if /sbin
>>> exists and is non-empty. This is the case on Ubuntu-23.04.
>>>
>>> We fix this by removing /sbin before creating the link.
>>>
>>> Signed-off-by: Jon Maloy <jmaloy@redhat.com>
>>> ---
>>> test/passt.mbuto | 3 ++-
>>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/test/passt.mbuto b/test/passt.mbuto
>>> index 90816d2..12d7f50 100755
>>> --- a/test/passt.mbuto
>>> +++ b/test/passt.mbuto
>>> @@ -26,6 +26,8 @@ DIRS="${DIRS} /tmp /sbin /usr/share /var/log /var/lib /etc/ssh /run/sshd /root/.
>>> COPIES="${COPIES} small.bin,/root/small.bin medium.bin,/root/medium.bin big.bin,/root/big.bin"
>>>
>>> FIXUP="${FIXUP}"'
>>> + rm -rf /sbin
>> This works on Ubuntu, but to be safer with other distributions:
>> shouldn't we first move anything we need that happens to be in /sbin to
>> /usr/sbin?
>>
>> On (your version of) Ubuntu /sbin is created because of $DIRS above,
>> but let's say that another version or another distribution has ip(8)
>> at /sbin/ip, we'll get rid of it.
>>
>> That is, if you add /usr/sbin explicitly to DIRS above (to make sure it
>> exists), and then, here, do:
>>
>> mv /sbin/* /sbin || :
> Gah, sorry, I meant:
>
> mv /sbin/* /usr/sbin/ || :
>
I susspected so :-)
I will try it tomorrow.
///jon
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-12-12 14:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-11 18:50 test: make passt.mbuto script more robust Jon Maloy
2023-12-11 20:39 ` Stefano Brivio
2023-12-11 23:15 ` Stefano Brivio
2023-12-12 14:53 ` Jon Maloy
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).