[SOLVED] virtualization/chroot of other OSs/GNU/Linuxes
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Lately I setup several other GNU/Linux partitions and chroot into them from Slackware, just to know about those, as I administer some others for users (on other PCs) and in future might work as a computer programmer and/or system administrator and use some others. I also have NetBSD & FreeBSD & DragonFlyBSD UNIXes on partitions and setup reading (not writing, unstable) those (except doesn't work with DragonFlyBSD FFS/UFS) so I don't always have to reboot if I want to save files from one. If something goes wrong with Slackware and I can't fix it right away, sometimes I boot FreeBSD (same /home on ZFS). SlackBuilds.org (SBo) has a SlackBuild for debootstrap which people use to install Debian in a chroot. I used to use Debian in late 1990s and early '0s so would rather try Devuan... their installer didn't work for me, eventually always showing disorganized mess of lines on an AMD Radeon RX 6900 XT regardless of monitor (I think everything newer than FreeBSD has problems with the exception of OpenBSD).
Ones I tried so far are KDE Neon GNU/Linux & GNU/Linux Mint (what a mess! I administer the former for users and used to administer the latter) and in the past some similar miscellaneous ones, and Gentoo GNU/Linux, all which chroot fine even to use network and update those OS... however after successfully installing Fedora and openSUSE (what a mess!) and running bash on them, then rebooting into Slackware (and similarly mounting /dev, /proc, /sys in a way which works for all others) the following happens.
Code:
root@cosmos:~# chroot /fedora
chroot: failed to run command ‘/bin/bash’: Permission denied
root@cosmos:~# chroot /suse
chroot: failed to run command ‘/bin/bash’: Permission denied
Perhaps the question is more suited to their forums, but what could be the cause of this? I wonder if it has to do with whether they use SELinux or this depends on 'running some service (systemd)', etc.
If this works with debootstrap I'd just like to see it eventually work with all major GNU/Linux. Chroot is good for command-line stuff but can be hard to configure X to work right, for which people suggested using virtual machines (VMs) which I'd like to learn how to use these partitions for those in (A)QEMU. In the past I used Xen (it'd be nice to do similar with *BSD and be able to switch there from Slackware) but it was difficult to keep updated and I don't know you could run X sessions in that unless they were separate (unlike Qubes which uses Xen to run programs from each OS in one X session but is extremely security-focused (for activists, etc.) to a point it can be impractical for average people who don't need that to an extreme level, like doesn't let you use network in 'DOM0').
Distribution: slackware, slackware from scratch, LFS, slackware [arm], linux Mint...
Posts: 1,564
Rep:
I can help you with I do with SFS:
Code:
# mkidir /mnt/sfs
# mount -t auto /dev/sda2 /mnt/sfs
# export SFS=/mnt/sfs
# echo $SFS
# cd /mnt
copy the 2 following scripts under /mnt
Code:
#!/bin/bash
mount -v --bind /dev "$SFS"/dev
mount -vt devpts devpts "$SFS"/dev/pts -o gid=5,mode=620
mount -vt proc proc "$SFS"/proc
mount -vt sysfs sysfs "$SFS"/sys
mount -vt tmpfs tmpfs "$SFS"/run
if [ -h "$SFS"/dev/shm ]; then
mkdir -pv "$SFS"/"$(readlink "$SFS"/dev/shm)"
fi
I prefer to mount as I've learned with Slackware, which is usually with '-o bind', not '-vt', which I don't recall what that does differently, but I read some OS need a 'remount' line as shown in what I use below... I'd just forgotten to try the remount line with openSUSE, Fedora but now did and they now chroot fine.
Code:
mount -o bind /dev /neon/dev
mount -o bind /proc /neon/proc
mount -o bind /sys /neon/sys
mount -o remount,dev,exec /neon
mount -o bind /dev /mint/dev
mount -o bind /proc /mint/proc
mount -o bind /sys /mint/sys
mount -o remount,dev,exec /mint
mount -o bind /dev /fedora/dev
mount -o bind /proc /fedora/proc
mount -o bind /sys /fedora/sys
mount -o remount,dev,exec /fedora
mount -o bind /dev /suse/dev
mount -o bind /proc /suse/proc
mount -o bind /sys /suse/sys
mount -o remount,dev,exec /suse
mount -o bind /dev /gentoo/dev
mount -o bind /proc /gentoo/proc
mount -o bind /sys /gentoo/sys
mount -o remount,dev,exec /gentoo
I'm not marking this solved without some more discussion of how to run X (or Wayland) in some of these, preferably with chroot, optionally with Xen, and least preferably (but acceptable) with virtual machines (VM) using these installations on their partitions... I want it done one of these ways to make copying easier when I'm not using them. VM is least preferable because you have to press buttons to get the mouse back out.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.