Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 909664 - Remove sys-apps/makedev from profiles/default/linux/packages.build
Summary: Remove sys-apps/makedev from profiles/default/linux/packages.build
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Profiles (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Release Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-07-05 01:25 UTC by Mike Gilbert
Modified: 2023-10-31 20:01 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Gilbert gentoo-dev 2023-07-05 01:25:36 UTC
I would like to remove sys-apps/makedev as a stage1 dependency in profiles/default/linux/packages.build.

Currently, we rely on makedev's pkg_postinst to create several devices nodes in ${ROOT}/dev when USE=build.

This package is quite old and crusty, and is really overkill for the few device nodes we actually need in stage tarballs.

I would propose that we update baselayout to create the following device nodes in ROOT when USE=build:

/dev/console
/dev/null

Assuming devtmpfs is enabled in the kernel, these *should* be the only device nodes necessary on the root filesystem for a successful boot using OpenRC. The devfs init script mounts devtmpfs fairly early in the boot process.

systemd does not actually require these nodes since it mounts devtmpfs even earlier.

I assume that catalyst mounts a more robust /dev before it chroots for stage3, but please correct me if I am mistaken.

Once an appropriate version of baselayout is stable, we can remove sys-apps/makedev from profiles/default/linux/packages.build.

Please provide any thoughts or concerns before I start messing with this. :)
Comment 1 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2023-07-06 06:02:38 UTC
As followup from bug 909661.

switch_root behavior:
util-linux switch_root moves already mounted /proc, /dev, /sys and /run to newroot and makes newroot the new root filesystem and starts init process.

busybox switch_root does *NOT* move the psuedo-filesystems.

If the initramfs does not move them, then there is a risk depending on the newroot's /dev contents:

As of 2023/07/05, I have verified that the minimal contents are /dev/null & /dev/console.

If those are missing, and /dev is not mounted some other way, then sysvinit will NOT start (specifically will appear to hang and not print  "INIT: version 3.07 booting"

This situation is not hypothetical, a number of older infra systems somehow ended up with the underlying rootfs /dev being empty. This worked fine until the busybox module was enabled in dracut, at which point the system behavior changed and the system failed to boot. Dracut could have explicitly.

One concern I have is how to ensure user systems correctly have those two nodes underneath the devtmpfs. Helper script that does a bindmount of the rootfs and checks it is probably the best way.
Comment 2 Mike Gilbert gentoo-dev 2023-07-06 15:49:35 UTC
(In reply to Robin Johnson from comment #1)
> As of 2023/07/05, I have verified that the minimal contents are /dev/null &
> /dev/console.

Thanks for verifying that.

> This situation is not hypothetical, a number of older infra systems somehow
> ended up with the underlying rootfs /dev being empty. This worked fine until
> the busybox module was enabled in dracut, at which point the system behavior
> changed and the system failed to boot. Dracut could have explicitly.

While I understand this bit you in the ass, I'm not too worried about it affecting users en masse.

I think it is fairly atypical for users to make fundamental changes to their boot process (like messing with dracut modules) after initial installation.

> One concern I have is how to ensure user systems correctly have those two
> nodes underneath the devtmpfs. Helper script that does a bindmount of the
> rootfs and checks it is probably the best way.

I don't like the idea of messing with mounts in an ebuild context. I think any script would need to be invoked manually by the user.

If you want to spread the word, maybe write a news item?
Comment 3 Ben Kohler gentoo-dev 2023-07-07 15:43:08 UTC
This change (along with the baselayout change) looks good to me.

FYI if /dev is empty on your rootfs, then someone probably made a mistake during a rootfs migration or backup/restore.  This is a specific misconfiguration, even if it's somewhat common in the wild.  A properly installed gentoo will have a populated /dev on rootfs.
Comment 4 Larry the Git Cow gentoo-dev 2023-07-09 01:17:15 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/baselayout.git/commit/?id=5c926abe03ba6e17ba58faa71a512b3f6db90b19

commit 5c926abe03ba6e17ba58faa71a512b3f6db90b19
Author:     Mike Gilbert <floppym@gentoo.org>
AuthorDate: 2023-07-06 17:25:46 +0000
Commit:     Mike Gilbert <floppym@gentoo.org>
CommitDate: 2023-07-09 01:16:36 +0000

    Makefile: create /dev/console and /dev/null in the layout target
    
    Bug: https://bugs.gentoo.org/909664
    Signed-off-by: Mike Gilbert <floppym@gentoo.org>

 Makefile | 4 ++++
 1 file changed, 4 insertions(+)
Comment 5 Larry the Git Cow gentoo-dev 2023-07-09 01:32:06 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d148943deee0e9d74622cff112e680069b324dc6

commit d148943deee0e9d74622cff112e680069b324dc6
Author:     Mike Gilbert <floppym@gentoo.org>
AuthorDate: 2023-07-09 01:29:52 +0000
Commit:     Mike Gilbert <floppym@gentoo.org>
CommitDate: 2023-07-09 01:29:52 +0000

    sys-apps/baselayout: add 2.14
    
    Bug: https://bugs.gentoo.org/909664
    Signed-off-by: Mike Gilbert <floppym@gentoo.org>

 sys-apps/baselayout/Manifest               |   1 +
 sys-apps/baselayout/baselayout-2.14.ebuild | 367 +++++++++++++++++++++++++++++
 2 files changed, 368 insertions(+)
Comment 6 Mike Gilbert gentoo-dev 2023-10-30 21:10:48 UTC
It looks like baselayout-2.14 is now stable, so I think we can proceed with removing sys-apps/makedev from packages.build.

Any objections?
Comment 7 Larry the Git Cow gentoo-dev 2023-10-31 20:01:53 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=afb52ace885d8e24bfd1408f61c895be908547b3

commit afb52ace885d8e24bfd1408f61c895be908547b3
Author:     Mike Gilbert <floppym@gentoo.org>
AuthorDate: 2023-10-31 20:01:10 +0000
Commit:     Mike Gilbert <floppym@gentoo.org>
CommitDate: 2023-10-31 20:01:10 +0000

    profiles/default/linux: drop sys-apps/makedev from packages.build
    
    Closes: https://bugs.gentoo.org/909664
    Signed-off-by: Mike Gilbert <floppym@gentoo.org>

 profiles/default/linux/packages.build | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)