On 5/7/24 15:50, Rob Landley wrote:
> And THAT was based on the old environment setup I used to do in Firmware Linux
> to give User Mode Linux a mostly writeable chroot despite starting with
> https://user-mode-linux.sourceforge.net/hostfs.html but that was back before 
> git
> was invented so I just have a bunch of tarball snapshots over the years (at
> https://landley.net/aboriginal/downloads/old/) rather than

A) Sorry, forgot to explain,

B) That's not even the old one I'm talking about,
https://landley.net/aboriginal/old/download/snapshots probably is.

User Mode Linux is a port of Linux to userspace, I.E. making the "vmlinux" ELF
file built at the top of the tree an actual runnable Linux program, which boots
its own little VM and runs processes inside it. This predated QEMU or KVM by a
decade, and was one of the first ways to run a virtual Linux system without
requiring root access on the host. Firmware Linux was built around it,
Aboriginal Linux was the relaunch targeting QEMU instead (and doing cross
compiling, because UML only ever properly supported x86 for some reason).

UML had the "hostfs" filesystem, which acted like a network filesystem making a
directory from the host appear in a directory of the virtual system. (Again,
decades before virtfs and friends, although NFS and Samba were around.)

The problem was, a hostfs file belonging to root (UID 0) wasn't writeable to
root within the VM. The mount point was SORT of writeable, but it was getting
translated on the host to reads/writes/renames/deletes as the host user running
UML, and then the translated syscall would fail and failures that shouldn't
happen were getting returned on the client. And this included fixups you needed
to do like replacing /etc/mtab with a symlink to /proc/mounts (because mount
points became a per-process attribute in Linux 2.5, so a single global mount
table as a filesystem maintained by the userspace mount tool didn't cut it 
anymore).

So I made a script that created a new directory in the host user's fully
writeable space and populated it with symlinks to host resources before
chrooting into it (all within UML), so I had access to the host stuff I needed
but could also replace it all as needed. And that's what I did my emulated Linux
>From Scratch build in, back around 2004.

Anyway, "here's a thing that needs to be spliced into the $PATH, you may want to
use symlinks" sometimes goes "whoosh" over my head as "hard for people who
haven't done it before" because to ME it's a 20 year old trick. Sorry 'bout 
that...

Rob
_______________________________________________
Toybox mailing list
Toybox@lists.landley.net
http://lists.landley.net/listinfo.cgi/toybox-landley.net

Reply via email to