Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 27 Sep 2020 11:29:46 -0700
From:      Yuri <yuri@rawbw.com>
To:        Freebsd hackers list <freebsd-hackers@FreeBSD.org>
Subject:   Is it possible to exit the chroot(2) environment?
Message-ID:  <b6412618-02ec-1dbd-f474-b4412d7b774b@rawbw.com>

next in thread | raw e-mail | index | archive | help
This line 
https://github.com/rpm-software-management/rpm/blob/master/lib/rpmchroot.c#L155 
calls chroot(".") in order to exit from the chroot environment.

It apparently succeeds on Linux (this is rpm), but it fails on FreeBSD 
with "Operation not permitted", while executed under sudo.


The chroot(2) man page doesn't mention anything about exiting the chroot 
environment.


Does chroot(2) behave differently on Linux and FreeBSD, and chroot(".") 
is a valid way to exit on Linux and not on FreeBSD? Or what is going on 
here?


I wish somebody familiar with chroot add this information into the 
chroot(2) man page.


Thank you,

Yuri





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?b6412618-02ec-1dbd-f474-b4412d7b774b>