1

I've created an fstab file (to mount /dev/pts and /proc, with the bind option) as part of a jail but when I chroot to the jail neither filesystem is mounted. This makes me wonder when the fstab for a jail is parsed while chroot-ing. Is this done before, during, after or never? I'm starting to think never because once the jail has been entered the filesystems that fstab is trying to mount should be out of reach.

(I encountered this stuff while debugging a production system, which makes me wonder if chroot jail fstabs used to be supported but no longer are.)

1
  • I always mount proc sys (-rbind) and dev (-rbind) manually prior to chrooting. (also --make-rslave for sys and dev) since their is no reason why fstab should be rescaned when chrooting)
    – MC68020
    Commented Jan 30, 2023 at 17:53

1 Answer 1

0

/etc/fstab is parsed by your system manager (systemd in many cases) not the kernel. When you chroot, it's unlikely the jail will have a system manager running inside of any kind.

So the short answer is /etc/fstab is not parsed unless you do something to explicitly parse it.

5
  • /etc/fstab is actually parsed by some service launched by the init system, whatever that init system. ;-)
    – MC68020
    Commented Jan 30, 2023 at 21:57
  • "something to explicitely parse it"… such as mount --all after chrooting.
    – MC68020
    Commented Jan 30, 2023 at 22:02
  • @MC68020, according to the manual, the service responsible for parsing the fstab file is systemd-remount-fs, but I have tested it and it seems that it is not. And yes this not about the question. (Weird, I've posted this comment already, but is not here. It's not even in my inbox)
    – SAMPro
    Commented Sep 23, 2023 at 5:38
  • 1
    @SAMPro : Since you had acknowledged that your comment was not related to the particular context of this question / answer (chrooting), I had flagged it to moderator's attention who incidentally decided to remove it. Since you are honestly willing to share some experience with systemd-rmount-fs, I wholeheartedly suggest you open a new question. Your audience should be much larger and chances for you to get some explanation significantly increased. Good luck to you.
    – MC68020
    Commented Sep 23, 2023 at 9:02
  • @SAMPro there's a difference between what happens inside a chroot environment (including docker containers) and what happens on a live system. Chroot environments don't run through any startup sequence, the documentation you are reading is for a full system which does have a startup. Commented Sep 23, 2023 at 9:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .