Re: chroot x11 via Xephyr

2021-05-04 Thread Stuart Henderson
On 2021-05-03, u/Rogu3_AI  wrote:
> Hi, I have successfully populated a chroot with 69 filesets. You can
> refer to https://www.reddit.com/r/openbsd/comments/n2k475/chroot_help/
> to know what I'm talking about. My question is after successfully
> entering my chroot environment how can I forward x11 apps to to the
> hosts Xephyr window. I have successfully opened up a Xephyr window on
> the host 'Xephyr -ac :1 &'. Whenever I run 'DISPLAY=:1 xlock' inside the
> chroot it fails to open the display > ' Error: Can't open display: :1'.
> Kindly please correct if I'm wrong or refer to a source of information
> please.

What are you hoping to gain from doing this?

chroot can be useful if it restricts what the application running inside it
has access to, but outside of some special cases (ports development/builds
occasionally being one) populating it with enough files to run "full fat"
software negates most of the benefits..




Re: chroot x11 via Xephyr

2021-05-04 Thread Karsten Pedersen
>
> I tried this " doas mv /tmp/.X11-unx/x1 /chroot/test/tmp/.X11-unix/ "
> The stdout was " Operation not Permitted".
>

Can I just confirm that the path was correct? It looks like you
have a typo ".X11-unx".

Also, does the destination directory also exist? "/chroot/test/tmp/.X11-unix/".
Depending on your chroot creation scripts, you might not have this yet.

Now, what I can't quite recall (and unable to test on my current
setup) is if it works moving across a different partition (such as
/tmp, /usr, /, ...)



Re: chroot x11 via Xephyr

2021-05-03 Thread Ian Darwin
On Mon, May 03, 2021 at 08:51:51PM +, Karsten Pedersen wrote:
> It is worth noting that you can move (not copy) UNIX sockets (again,
> so long as they are on the same filesystem).
> 
> So, once Xephyr has started up, you can move the socket from
> "/tmp/.X11-unix/X1" into "$CHROOT/tmp/.X11-unix/X1" and then your
> chroot application can access it.

Assuming root permissions, the above will "succeed" even if $CHROOT
is not on the same filesystem as /tmp. Then fail to connect at runtime.

Using ln (not ln -s) instead of mv will fail faster if the same-filesystem
requirement is not met. 



Re: chroot x11 via Xephyr

2021-05-03 Thread Karsten Pedersen
>
> DISPLAY=:1 is short hand for connecting via the Unix socket
> "/tmp/.X11-unix/X1".
>
> That will only works if both the X server and applications run in
> the same base filesystem.
>
> If you chroot the application and not Xephyr, then the application
> cannot found the unix socket.
>

It is worth noting that you can move (not copy) UNIX sockets (again,
so long as they are on the same filesystem).

So, once Xephyr has started up, you can move the socket from
"/tmp/.X11-unix/X1" into "$CHROOT/tmp/.X11-unix/X1" and then your
chroot application can access it.



Re: chroot x11 via Xephyr

2021-05-03 Thread Hugo Villeneuve
On Mon, May 03, 2021 at 06:00:41AM +0200, u/Rogu3_AI wrote:
> Hi, I have successfully populated a chroot with 69 filesets. You
> can refer to https://www.reddit.com/r/openbsd/comments/n2k475/chroot_help/
> to know what I'm talking about. My question is after successfully
> entering my chroot environment how can I forward x11 apps to to the
> hosts Xephyr window. I have successfully opened up a Xephyr window
> on the host 'Xephyr -ac :1 &'. Whenever I run 'DISPLAY=:1 xlock'
> inside the chroot it fails to open the display > ' Error: Can't
> open display: :1'. Kindly please correct if I'm wrong or refer to
> a source of information please.


DISPLAY=:1 is short hand for connecting via the Unix socket
"/tmp/.X11-unix/X1".

That will only works if both the X server and applications run in
the same base filesystem.

If you chroot the application and not Xephyr, then the application
cannot found the unix socket.


It is possible to make Xephyr (and all the other Xservers) listen
on a TCP socket like in the old days with:

Xephyr :1 -listen tcp -ac &


This will allow you to use "DISPLAY=127.0.0.1:1" for your x
applications. (And no other IP than 127.0.0.1 on OpenBSD.)




chroot x11 via Xephyr

2021-05-03 Thread u/Rogu3_AI
Hi, I have successfully populated a chroot with 69 filesets. You can refer to 
https://www.reddit.com/r/openbsd/comments/n2k475/chroot_help/ to know what I'm 
talking about. My question is after successfully entering my chroot environment 
how can I forward x11 apps to to the hosts Xephyr window. I have successfully 
opened up a Xephyr window on the host 'Xephyr -ac :1 &'. Whenever I run 
'DISPLAY=:1 xlock' inside the chroot it fails to open the display > ' Error: 
Can't open display: :1'. Kindly please correct if I'm wrong or refer to a 
source of information please.