1

Is there any technique or tool that makes it possible to have everything but home directories moved to /linux-5.10 for example and still have the system behaving like if chrooted into that directory?

ls /
/linux-5.10 /root /home
which ls
/linux-5.10/usr/bin/ls

Have you ever seen anything like that? What should I research to know how to do it or understand why it is not possible?

EDIT: I'm just curious if a different skeleton on the rootfs is at all possible, I mean, would it be just a matter of having my package manager to prefix everything upon installation, adjust the $PATH etc or that's impossible because there are binaries that will go nuts if /proc is mounted somewhere else for example.

  • I am not sure what you need, and even less why you need this. But if your /home is a separate fs mounted on /home [of fs /], then you could maybe : just "mount again" underneath /linux-5.10 : all the others fs you will need there, but not the home fs itself, and then chroot to /linux-5.10 ? – Olivier Dulac Feb 01 '21 at 03:55
  • you should edit a bit your question to make it clearer : you seem to show regular ls with no chrooting going on (as you can see: /linux-5.10 underneath /) but it somehow uses the ls found underneath /linux-5.10/usr/bin ? : because you added that path first in $PATH ?) – Olivier Dulac Feb 01 '21 at 03:56
  • @OlivierDulac Thanks for the comment. Well, need is a strong word, for now I'm just curious if a different skeleton on the rootfs is at all possible, I mean, would it be just a matter of having my package manager to prefix everything upon installation, adjust the $PATH etc or that's impossible because there are binaries that will go nuts if /proc is mounted somewhere else for example. Hope that clears up my question a little bit. – cvsguimaraes Feb 01 '21 at 04:15
  • 1
    @kbtz "just a matter" :D No, you'd likely have to build those packages again with the prefix in mind. – muru Feb 01 '21 at 05:13
  • @muru Thanks for linking that question, with the right terminology in hands I can continue my research. Perhaps the easiest "distro" to tweak these is LFS? Thanks again! – cvsguimaraes Feb 01 '21 at 05:28
  • If we knew why, then we may be able to give better answers. As is the answer is "Yes, but…" – ctrl-alt-delor Feb 01 '21 at 07:30
  • @ctrl-alt-delor GoboLinux is kinda of overkill but in the right direction of what I wanted. Single bin,lib,... directories with FHS compatible links hidden by GoboHide kernel patch will pretty much achieve the cleaner structure that I wanted to use in my dailydriver – cvsguimaraes Feb 01 '21 at 12:23
  • Interesting I just read about gobohide. I am worried about the unintended consequences (e.g. what would be the result from du (or similar tools). However the out put of these tools on the root is not to useful anyway. But maybe there are other unintended consequences.) And what is this I hear that only root user can get the list of hidden directories. – ctrl-alt-delor Feb 01 '21 at 16:52
  • @ctrl-alt-delor yeah I gotta see it to believe it, I'll try to use their patch and see what caveats I find – cvsguimaraes Feb 01 '21 at 18:30

0 Answers0