pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Problem using a second pkgsrc unprivileged



On Sun, Oct 25, 2020 at 3:48 PM Sad Clouds <cryintothebluesky%gmail.com@localhost> wrote:
>
> On Sun, 25 Oct 2020 15:01:04 +0100
> Connor McLaughlan <cont6pro3%gmail.com@localhost> wrote:
>
> > On Sun, Oct 25, 2020 at 2:29 PM Sad Clouds
> > <cryintothebluesky%gmail.com@localhost> wrote:
> > >
> > > On Sun, 25 Oct 2020 14:12:06 +0100
> > > Connor McLaughlan <cont6pro3%gmail.com@localhost> wrote:
> > >
> > > > It is the second approach... /usr/pkg1 should be the main
> > > > pkgsrc-tree and providing the daemons.
> > > > /usr/pkg2 and /usr/pkg3 should be able to run in parallel, but
> > > > using the daemons of /usr/pkg1.
> > >
> > > Not sure this is going to work. What possible use-case does this
> > > have? Normally you rebuild all packages with new pkgsrc releases
> > > and they completely replace the old software.
> >
> > One out of several usecases i have is to get some old kde3/qt3 stuff
> > compiled and running.
> > It will run in a clean old pkgsrc-tree, but i am unable to install
> > those old libraries into a current pkgsrc-tree, due to file conflicts.
> >
> > Regards,
> > Connor
>
> You need to emulate zones/containers with chroot.
>
> I put my chroot scripts here:
> https://drive.google.com/drive/folders/1lUKFdbW9APwyy04zoRTUKYcxZj-6rLFw
>
> If you create /opt/netbsd_chroot/scripts and copy them there. You need
> to customize chroot.sh as I usually have src, xsrc, pkgsrc and distfiles
> under /opt.
>
> # ls -1 /opt/netbsd_chroot/scripts/
> chroot.sh
> mk.pkgsrc.conf
> pkgbuild
>
> When I run chroot.sh it automatically sets up all mount points and runs
> chroot:
>
> # /opt/netbsd_chroot/scripts/chroot.sh
> Running chroot setup
> mount_null -o rdonly /bin /opt/netbsd_chroot/bin
> mount -t kernfs kernfs /opt/netbsd_chroot/kern
> mount_null -o rdonly /lib /opt/netbsd_chroot/lib
> mount_null -o rdonly /libdata /opt/netbsd_chroot/libdata
> mount_null -o rdonly /libexec /opt/netbsd_chroot/libexec
> mount_null /opt/distfiles /opt/netbsd_chroot/opt/distfiles
> mount_null -o rdonly /opt/pkgsrc /opt/netbsd_chroot/opt/pkgsrc
> mount_null -o rdonly /opt/src /opt/netbsd_chroot/opt/src
> mount_null -o rdonly /opt/xsrc /opt/netbsd_chroot/opt/xsrc
> mount -t procfs procfs /opt/netbsd_chroot/proc
> mount_null -o rdonly /rescue /opt/netbsd_chroot/rescue
> mount_null -o rdonly /sbin /opt/netbsd_chroot/sbin
> mount_null -o rdonly /stand /opt/netbsd_chroot/stand
> mount_null -o rdonly /usr/X11R7 /opt/netbsd_chroot/usr/X11R7
> mount_null -o rdonly /usr/bin /opt/netbsd_chroot/usr/bin
> mount_null -o rdonly /usr/games /opt/netbsd_chroot/usr/games
> mount_null -o rdonly /usr/include /opt/netbsd_chroot/usr/include
> mount_null -o rdonly /usr/lib /opt/netbsd_chroot/usr/lib
> mount_null -o rdonly /usr/libdata /opt/netbsd_chroot/usr/libdata
> mount_null -o rdonly /usr/libexec /opt/netbsd_chroot/usr/libexec
> mount_null -o rdonly /usr/sbin /opt/netbsd_chroot/usr/sbin
> mount_null -o rdonly /usr/share /opt/netbsd_chroot/usr/share
> mount_null /var/shm /opt/netbsd_chroot/var/shm
> cd /opt/netbsd_chroot && chroot /opt/netbsd_chroot /bin/sh
>
> # pwd
> /
> # exit
> Running chroot cleanup
> umount /opt/netbsd_chroot/bin
> umount /opt/netbsd_chroot/kern
> umount /opt/netbsd_chroot/lib
> umount /opt/netbsd_chroot/libdata
> umount /opt/netbsd_chroot/libexec
> umount /opt/netbsd_chroot/opt/distfiles
> umount /opt/netbsd_chroot/opt/pkgsrc
> umount /opt/netbsd_chroot/opt/src
> umount /opt/netbsd_chroot/opt/xsrc
> umount /opt/netbsd_chroot/proc
> umount /opt/netbsd_chroot/rescue
> umount /opt/netbsd_chroot/sbin
> umount /opt/netbsd_chroot/stand
> umount /opt/netbsd_chroot/usr/X11R7
> umount /opt/netbsd_chroot/usr/bin
> umount /opt/netbsd_chroot/usr/games
> umount /opt/netbsd_chroot/usr/include
> umount /opt/netbsd_chroot/usr/lib
> umount /opt/netbsd_chroot/usr/libdata
> umount /opt/netbsd_chroot/usr/libexec
> umount /opt/netbsd_chroot/usr/sbin
> umount /opt/netbsd_chroot/usr/share
> umount /opt/netbsd_chroot/var/shm
>

Thank you very much for your script.

It already has allowed me to set up another pkgsrc with using
unmodified standard packages in the chroot.

One last step missing is that i can't access the Xserver from within the chroot.
The error is not talking very much beside:
localhost$ xclock
Error: Can't open display: :0.0

What i have done so far is:

- Modify the script to include /dev/pts - was commented out
- Modify the script to mount the outside /tmp in rw-mode
- Allowed connections to X from everywhere with the user who started X: xhost +
- Copied over the .Xauthority file to the chroot user.

What could still be missing? Or how could i better find out what is
denying me access?

Regards,
Connor


Home | Main Index | Thread Index | Old Index