Bug 228351 - cannot unhide log or tty with devfs.rules
Summary: cannot unhide log or tty with devfs.rules
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: conf (show other bugs)
Version: CURRENT
Hardware: amd64 Any
: --- Affects Only Me
Assignee: freebsd-jail (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-05-18 18:36 UTC by Jason Mader
Modified: 2023-01-19 15:37 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jason Mader 2018-05-18 18:36:11 UTC
This doesn't unhide the log symlink or tty, at least when used in a jail.

/etc/devfs.rules:

[devfsrules_minimal=5]
add include $devfsrules_hide_all
add path log unhide
add path tty unhide

/etc/jail.conf:

jail {
    path = /var/jail;
    devfs_ruleset = "5";
    mount.devfs;
    ...
}

Excepting to appear in /var/jail/dev:

lrwxr-xr-x  1 root  wheel    12 May 18 14:14 /dev/log -> /var/run/log
crw--w----  1 root  tty    0x5d May 18 14:34 /dev/tty
Comment 1 Jason Mader 2021-10-10 17:25:55 UTC
In FreeBSD 13.0, it is still the case that "add path log unhide" doesn't create a /dev/log in the jail.

jail.conf:

  devfs_ruleset=2;
  mount.devfs;

rc.conf:

syslogd_flags="-ss -l /jail/var/run/log"
Comment 2 Zhenlei Huang freebsd_committer 2022-03-14 07:05:32 UTC
(In reply to Jason Mader from comment #0)
The `/dev/log` is just a symbolic link to `/var/run/log` created by /etc/rc.d/syslogd . It is not created by devfs(5).

For jails, the symbolic link is not created due to PR https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=179828 .

Do you have any cases requiring `/dev/log` then ?

See also: https://cgit.freebsd.org/src/commit?id=3a361e0c330fe9d5ab506cc02ee3bcc3d2d474ce
Comment 3 Jason Mader 2022-03-14 13:56:52 UTC
(In reply to Zhenlei Huang from comment #2)
I probably don't. I guess it was just unexpected since, /etc/defaults/devfs.rules has:

[devfsrules_unhide_basic=2]
add path log unhide
Comment 4 Zhenlei Huang freebsd_committer 2022-03-15 09:09:54 UTC
(In reply to Zhenlei Huang from comment #2)
> For jails, the symbolic link is not created due to PR https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=179828 .

Sorry it is misleading. The unhide for log is introduce by https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=160711 , but after https://cgit.freebsd.org/src/commit/etc/rc.d/jail?id=84b354cb9ab61224713c159b1484e8f070fd37be the logic of creating /dev/log is removed, as consequence there's no /dev/log anymore for created jails.

The symptoms is devfs can not unhide log but that is not true. You can repeat on FreeBSD 13.0 as following:

# mkdir -p /tmp/dev
# mount -t devfs devfs /tmp/dev
# ln -sf /var/run/log /tmp/dev/log
# devfs -m /tmp/dev rule -s 4 applyset
# ls -ll /tmp/dev

(In reply to Jason Mader from comment #3)
> I probably don't. I guess it was just unexpected since, /etc/defaults/devfs.rules has:
The /dev/log is transitional symlink for old binaries, it is about ten years since it was there. We can bravely remove it as it seems nobody complains about it, at least for jail users.
Comment 5 Zhenlei Huang freebsd_committer 2022-04-11 02:45:09 UTC
Proposed change to prevent the ambiguity for end users https://reviews.freebsd.org/D34563
Comment 6 commit-hook freebsd_committer 2022-05-24 13:58:17 UTC
A commit in branch main references this bug:

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

commit 2670ea8a075ea29a0eee9d227c4cdf585a7b3b55
Author:     Zhenlei Huang <zlei.huang@gmail.com>
AuthorDate: 2022-05-24 13:54:38 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2022-05-24 13:54:38 +0000

    devfs.rules: Do not expose "log" in the default devfs rules.

    /etc/rc.d/jail no longer creates /dev/log as a symbolic link since
    commit 84b354cb9ab61224713c159b1484e8f070fd37be.

    PR:             228351
    Reviewed by:    jamie, mark
    MFC after:      2 weeks
    Differential Revision:  https://reviews.freebsd.org/D34563

 sbin/devfs/devfs.rules | 1 -
 1 file changed, 1 deletion(-)
Comment 7 commit-hook freebsd_committer 2022-06-07 00:30:46 UTC
A commit in branch stable/13 references this bug:

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

commit 02fe4484379c1e67c22ad6abbeea10c8a20d10eb
Author:     Zhenlei Huang <zlei.huang@gmail.com>
AuthorDate: 2022-05-24 13:54:38 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2022-06-07 00:29:58 +0000

    devfs.rules: Do not expose "log" in the default devfs rules.

    /etc/rc.d/jail no longer creates /dev/log as a symbolic link since
    commit 84b354cb9ab61224713c159b1484e8f070fd37be.

    PR:             228351
    Reviewed by:    jamie, markj

    (cherry picked from commit 2670ea8a075ea29a0eee9d227c4cdf585a7b3b55)

 sbin/devfs/devfs.rules | 1 -
 1 file changed, 1 deletion(-)
Comment 8 commit-hook freebsd_committer 2023-01-19 15:07:28 UTC
A commit in branch stable/12 references this bug:

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

commit 4d8dd8c29480c4cb8985d65e10689ab83dae4512
Author:     Zhenlei Huang <zlei.huang@gmail.com>
AuthorDate: 2022-05-24 13:54:38 +0000
Commit:     Zhenlei Huang <zlei@FreeBSD.org>
CommitDate: 2023-01-19 15:01:00 +0000

    devfs.rules: Do not expose "log" in the default devfs rules

    /etc/rc.d/jail no longer creates /dev/log as a symbolic link since
    commit 84b354cb9ab61224713c159b1484e8f070fd37be.

    PR:             228351
    Reviewed by:    jamie, markj
    Differential Revision:  https://reviews.freebsd.org/D34563

    (cherry picked from commit 2670ea8a075ea29a0eee9d227c4cdf585a7b3b55)
    (cherry picked from commit 02fe4484379c1e67c22ad6abbeea10c8a20d10eb)

 sbin/devfs/devfs.rules | 1 -
 1 file changed, 1 deletion(-)
Comment 9 Zhenlei Huang freebsd_committer 2023-01-19 15:37:44 UTC
@Jason Mader 
Thanks for your report.

As `/etc/rc.d/jail` no longer creates `/dev/log` as a symbolic link, the "log" in devfs.rules will confuse users, remove it from default devfs.rules.

Also note `etc/rc.d/syslogd` still try to create `/dev/log` but that is only done in host ( not in jails ), see https://cgit.freebsd.org/src/commit?id=3a361e0c330fe9d5ab506cc02ee3bcc3d2d474ce