#1100744 debianutils: ischroot returns 0 in unshare mode

Package:
debianutils
Source:
debianutils
Description:
Miscellaneous utilities specific to Debian
Submitter:
wangzhaohui
Date:
2025-03-18 03:45:02 UTC
Severity:
normal
Tags:
#1100744#5
Date:
2025-03-18 03:41:19 UTC
From:
To:
Dear Maintainer,

I would like to report an issue with the ischroot utility from debianutils
where it incorrectly returns 0 when executed
inside an unshared mount namespace, which causes issues with hibernation and
wake-up functionality when generating initrd in an unshare environment.

Steps to Reproduce:
$ sudo unshare --mount bash
$ ischroot; echo $?
Observe that the exit code is 0, which indicates that ischroot incorrectly
detects the environment as a chroot.

Expected Behavior:
ischroot should return a non-zero value unless the process is actually inside a
chroot. Simply creating a new mount namespace using unshare does not constitute
a chroot environment.