Gentoo Archives: gentoo-dev

From: Mike Pagano <mpagano@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Idea: User centric kernel configuration
Date: Fri, 12 Mar 2021 18:28:59
Message-Id: adcbcf91-7bb6-f673-5c71-01ce8b33339b@gentoo.org
In Reply to: Re: [gentoo-dev] Idea: User centric kernel configuration by Gerion Entrup
1 On 3/12/21 1:04 PM, Gerion Entrup wrote:
2 > Am Freitag, 12. März 2021, 17:40:02 CET schrieb Mike Pagano:
3 >>
4 >> On 3/12/21 11:34 AM, Gerion Entrup wrote:
5 >>> Am Donnerstag, 11. März 2021, 17:41:45 CET schrieb Peter Stuge:
6 >>>> Hi,
7 >>>>
8 >>>> Gerion Entrup wrote:
9 >>>>> the Linux kernel has _a lot of_ configuration options, way too many to configure them by hand.
10 >>>>
11 >>>> I actually disagree strongly with that; I think it's important to
12 >>>> actively decide what kernels include, and I routinely do, but of
13 >>>> course not everyone will. I've made sure to include a kernel build
14 >>>> when teaching systems administration courses and would again.
15 >>>>
16 >>>> As the kernel becomes more complex the threshold for the first
17 >>>> configuration also rises, but it's still completely possible to learn
18 >>>> what you need in order to successfully configure your own kernel.
19 >>>> I guess it's on the order of a weekend project given some basic
20 >>>> understanding of computer architecture and programming.
21 >>>
22 >>> I think, we mean two different things here. I for myself also configured
23 >>> my own kernel(s) for years. I also actively teach students to do so.
24 >>> However, I have never looked into all 18000 configuration options. I
25 >>> don't understand them all (by far).
26 >>>
27 >>> Actually, most of the times, I do a `make localmodconfig`, click through
28 >>> various subsystems and activate what I think that it is useful or sounds
29 >>> nice. Then, to update a kernel, I use `make oldconfig` and answer the
30 >>> questions as good as I can (taking the default otherwise).
31 >>>
32 >>> If my kernel is not capable to do something (for example run docker
33 >>> containers), I take a look in the Gentoo Wiki and "copy" the options
34 >>> into my own config.
35 >>>
36 >>> But for me, this is not an informed decision. Of course, I learn
37 >>> something in this process, maybe also more than a precompiled kernel
38 >>> user, but I have by far not created a minimal config or even begin
39 >>> to understand all subsystems and different configuration options.
40 >>>
41 >>> I'm sure that this is similar to most Gentoo users.
42 >>>
43 >>> BTW, here is a project to create a minimal config (kind of "ideal"
44 >>> config) based on a "golden run" [1]. However, I have not compared such
45 >>> a config with my own homegrown config.
46 >>>
47 >>>
48 >>>>> This requires a mapping between user oriented "features" and the kernel
49 >>>>> internal configuration options.
50 >>>>
51 >>>> So the challenge here is that the kernel is disjoint from user space,
52 >>>> and while the kernel API remains stable over time consumer requirements
53 >>>> such as "docker" or "cryptsetup" will mean different things for
54 >>>> different versions of particular user space software.
55 >>>>
56 >>>>
57 >>>>> Do you think that it is useful and feasible to combine these two mechanisms?
58 >>>>
59 >>>> AFAIK there's no generic method for formal kernel requirements in user
60 >>>> space packages and there's also no sanctioned method for quering
61 >>>> kernel capabilities. The only thing available is /proc/config if that
62 >>>> was enabled in the kernel build, and there are of course reasons to
63 >>>> leave it out, and it only applies to the particular running kernel,
64 >>>> e.g. useless for cross-compilation. There, it would be possible to
65 >>>> read the kernel configuration file if the kernel source code is
66 >>>> available when the userspace package is being built, but that's not
67 >>>> guaranteed.
68 >>>>
69 >>>> In Gentoo, linux-info.eclass provides linux_config_exists() to do all
70 >>>> of this, but order to become a widespread success there would have to
71 >>>> be one method for upstreams to maintain these requirements as part of
72 >>>> their packages, rather than forcing the burden on package maintainers
73 >>>> to repeat the same detective task in every single distribution.
74 >>>>
75 >>>> I think it would be very useful to create something generic for that,
76 >>>> but that's certainly no small task.
77 >>>>
78 >>>> And realistically I only see it succeeding if Linux Foundation decides
79 >>>> to push it onto the world.
80 >>>
81 >>> Sorry, I may have expressed this not clearly. I guess, we actually have
82 >>> the same opinion here. I don't want to do this mapping automatically. I
83 >>> don't want a "fully automatic" config or touch any (user space) ebuilds.
84 >>>
85 >>> My idea is to patch Kconfig (as part of gentoo-sources) to provide the
86 >>> same "features" (i.e. mappings) that are already present in the Gentoo
87 >>> wiki.
88 >>>
89 >>> For example this could result in this installation description for Docker
90 >>> (within the Wiki):
91 >>> "To enable kernel support for Docker, enable
92 >>> 'Gentoo Linux -> Support for user space programs -> Docker'"
93 >>>
94 >>> This Kconfig flag than depends on all options that are needed for proper
95 >>> Docker support (as already described in the Wiki) like cgroups etc..
96 >>>
97 >>> This would allow users to configure there kernels the same way as before
98 >>> but with some additional convenience shortcuts.
99 >>>
100 >>> Of course, this is a high maintenance burden for the kernel package
101 >>> maintainers. Therefore, this mechanism maybe can be automated:
102 >>> Grep the wiki pages for kernel config snippets and automatically
103 >>> condense that in a Kconfig readable configuration option.
104 >>>
105 >>>
106 >>>>> A possible way could be to automatically extract the kernel config
107 >>>>> flags from the wiki pages and map them to Kconfig options.
108 >>>>
109 >>>> At very best that will only be valid for some particular point in time,
110 >>>> like current CONFIG_CHECK in ebuilds using linux_config_exists() are
111 >>>> only valid for particular package versions. At worst it's plain wrong
112 >>>> because the requirements have to be reverse-engineered downstream.
113 >>>
114 >>> Of course, the already existing kernel config snippets in the Wiki are
115 >>> best effort. My idea is to combine these snippets directly with Kconfig.
116 >>>
117 >>>
118 >>> Best regards,
119 >>> Gerion
120 >>>
121 >>> [1] https://vamos.informatik.uni-erlangen.de/trac/undertaker/wiki/UndertakerTailor
122 >>>
123 >>
124 >>
125 >> Hello,
126 >>
127 >> If I am reading this correctly, you are looking for something like we
128 >> have for systemd and openrc where you select something and we preselect
129 >> a bunch of required/suggested kernel configs options.
130 >>
131 >> I'm happy to add this to gentoo-sources for Docker based on the
132 >> expertise of the gentoo developer individuals in the project.
133 >>
134 >> Probably a bug to track this would be the best way for me to implement.
135 >>
136 >> Or am I totally off base on your request?
137 >
138 > You are right, but Docker is just an example. Ideally, this would exist
139 > for every wiki page that explains which kernel config options need to be
140 > set to make XY possible.
141 >
142 > Gerion
143 >
144
145 Specific Request -> Bug -> Discussion -> Implementation -> Release
146
147 I think we can move past generics and get specific.

Replies

Subject Author
Re: [gentoo-dev] Idea: User centric kernel configuration Gerion Entrup <gerion.entrup@×××××.de>