Bug 295782 - ps within a jail: /boot/kernel/kernel: No such file or directory
Summary: ps within a jail: /boot/kernel/kernel: No such file or directory
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 16.0-CURRENT
Hardware: Any Any
: --- Affects Some People
Assignee: Dag-Erling Smørgrav
URL:
Keywords: rc
Depends on:
Blocks:
 
Reported: 2026-06-02 01:13 UTC by Felix Hanley
Modified: 2026-06-10 05:49 UTC (History)
1 user (show)

See Also:
des: mfc-stable15+
des: mfc-stable14+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Felix Hanley 2026-06-02 01:13:01 UTC
On a pkgbase system from "pkg+https://pkg.FreeBSD.org/${ABI}/base_weekly", running ps within a jail returns:

# ps ax
ps: /boot/kernel/kernel: No such file or directory
# sha256sum /bin/ps
d3af17846d3c10eda524f3195c2d21481e43794df7ffa664ba3c11bc71e443f6  /bin/ps

Some previous discussion which seems related here: https://forums.freebsd.org/threads/why-does-a-jailed-ps-1-suddenly-require-a-kernel-to-be-present-and-then-complain-when-it-is.102485/

Let me know if you need more details.
Comment 1 Felix Hanley 2026-06-02 09:41:56 UTC
I have created a pkgbase system on 15.0-RELEASE-p9 and it still happens so perhaps it has nothing to do with STABLE and the packages??

# freebsd-version -kr
15.0-RELEASE-p9
15.0-RELEASE-p9

# jexec test
root@test:/ # ps ax
ps: /boot/kernel/kernel: No such file or directory

The jail has the following packages:

# pkg -r /jails/test/ info -q
FreeBSD-at-15.0
FreeBSD-audit-lib-15.0
FreeBSD-blocklist-15.0p3
FreeBSD-bsdconfig-15.0p9
FreeBSD-bzip2-15.0
FreeBSD-bzip2-lib-15.0
FreeBSD-caroot-15.0
FreeBSD-certctl-15.0
FreeBSD-clibs-15.0
FreeBSD-cron-15.0
FreeBSD-ctf-lib-15.0
FreeBSD-devd-15.0
FreeBSD-dhclient-15.0p8
FreeBSD-fetch-15.0
FreeBSD-kernel-man-15.0
FreeBSD-libarchive-15.0
FreeBSD-libbsdstat-15.0
FreeBSD-libcasper-15.0p9
FreeBSD-libldns-15.0
FreeBSD-libmagic-15.0
FreeBSD-libucl-15.0
FreeBSD-locales-15.0
FreeBSD-mandoc-15.0
FreeBSD-ncurses-15.0
FreeBSD-ncurses-lib-15.0
FreeBSD-newsyslog-15.0
FreeBSD-openssl-15.0p2
FreeBSD-openssl-lib-15.0p2
FreeBSD-periodic-15.0
FreeBSD-pkg-bootstrap-15.0
FreeBSD-rc-15.0
FreeBSD-resolvconf-15.0
FreeBSD-runtime-15.0p9
FreeBSD-set-minimal-jail-15.0
FreeBSD-syslogd-15.0p9
FreeBSD-tcpd-15.0
FreeBSD-ufs-lib-15.0
FreeBSD-utilities-15.0p9
FreeBSD-vi-15.0
FreeBSD-xz-lib-15.0
FreeBSD-zfs-lib-15.0
FreeBSD-zlib-15.0
FreeBSD-zoneinfo-15.0p7
Comment 2 Felix Hanley 2026-06-02 09:43:06 UTC
(In reply to Felix Hanley from comment #1)
I mean, perhaps not related to 15.1-STABLE and instead the installed packages.
Comment 3 Felix Hanley 2026-06-02 09:44:05 UTC
Jail packages were populated like this:

# pkg -r /jails/test install FreeBSD-set-minimal-jail FreeBSD-bsdconfig
Comment 4 Felix Hanley 2026-06-04 10:07:04 UTC
Actually, it may not be a bug, sorry.

When I add:

mount.devfs;
devfs_ruleset = 5;

then ps works in the jail.
Comment 5 Dag-Erling Smørgrav freebsd_committer freebsd_triage 2026-06-04 16:50:59 UTC
Reopening, I will use this as a pretext to have /etc/rc refuse to run without /dev/null as ps is not the only thing that will fail in that scenario.
Comment 6 Dag-Erling Smørgrav freebsd_committer freebsd_triage 2026-06-04 16:55:35 UTC
https://reviews.freebsd.org/D57447
Comment 7 commit-hook freebsd_committer freebsd_triage 2026-06-05 15:54:24 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=b5a96894f67a92f78f0641763eff1e0a46f2e036

commit b5a96894f67a92f78f0641763eff1e0a46f2e036
Author:     Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2026-06-05 15:53:29 +0000
Commit:     Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2026-06-05 15:53:29 +0000

    rc: Bail if /dev/null is not a device

    On startup, check that /dev/null exists and is a character device.
    Otherwise, one of two things will happen: either /dev is a writable
    directory and we will immediately create /dev/null as a regular file
    and dump garbage into it, or it does not and we will spit out a stream
    of error messages about failing to create /dev/null.

    PR:             295782
    MFC after:      1 week
    Reviewed by:    jhb, emaste
    Differential Revision:  https://reviews.freebsd.org/D57447

 libexec/rc/rc       |  5 +++++
 share/man/man8/rc.8 | 12 +++++++++++-
 2 files changed, 16 insertions(+), 1 deletion(-)
Comment 8 commit-hook freebsd_committer freebsd_triage 2026-06-08 23:01:52 UTC
A commit in branch stable/15 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=5c12023beb94609fb65845b76f21748a9f49bdca

commit 5c12023beb94609fb65845b76f21748a9f49bdca
Author:     Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2026-06-05 15:53:29 +0000
Commit:     Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2026-06-08 23:00:43 +0000

    rc: Bail if /dev/null is not a device

    On startup, check that /dev/null exists and is a character device.
    Otherwise, one of two things will happen: either /dev is a writable
    directory and we will immediately create /dev/null as a regular file
    and dump garbage into it, or it does not and we will spit out a stream
    of error messages about failing to create /dev/null.

    PR:             295782
    MFC after:      1 week
    Reviewed by:    jhb, emaste
    Differential Revision:  https://reviews.freebsd.org/D57447

    (cherry picked from commit b5a96894f67a92f78f0641763eff1e0a46f2e036)

 libexec/rc/rc       |  5 +++++
 share/man/man8/rc.8 | 12 +++++++++++-
 2 files changed, 16 insertions(+), 1 deletion(-)
Comment 9 commit-hook freebsd_committer freebsd_triage 2026-06-08 23:01:55 UTC
A commit in branch stable/14 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=d09b42a876bbd3a03edd8443976d0ad55a864e2e

commit d09b42a876bbd3a03edd8443976d0ad55a864e2e
Author:     Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2026-06-05 15:53:29 +0000
Commit:     Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2026-06-08 23:00:54 +0000

    rc: Bail if /dev/null is not a device

    On startup, check that /dev/null exists and is a character device.
    Otherwise, one of two things will happen: either /dev is a writable
    directory and we will immediately create /dev/null as a regular file
    and dump garbage into it, or it does not and we will spit out a stream
    of error messages about failing to create /dev/null.

    PR:             295782
    MFC after:      1 week
    Reviewed by:    jhb, emaste
    Differential Revision:  https://reviews.freebsd.org/D57447

    (cherry picked from commit b5a96894f67a92f78f0641763eff1e0a46f2e036)

 libexec/rc/rc       |  5 +++++
 share/man/man8/rc.8 | 13 +++++++++++--
 2 files changed, 16 insertions(+), 2 deletions(-)