Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[solved] How to check kernel config for installed packages
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
emc
Guru
Guru


Joined: 02 Jul 2004
Posts: 473
Location: Cracow, Poland

PostPosted: Thu May 16, 2013 8:33 am    Post subject: [solved] How to check kernel config for installed packages Reply with quote

Hi,
I have a question, let's say I emerge package which need specific kernel configuration (some CONFIG_* needs to be selected) and later on during kernel upgrade I will unchecked this option.

How to check whole system (all packages) if all kernel configuration is provided, is there any gentool for it?


Last edited by emc on Thu May 16, 2013 3:06 pm; edited 1 time in total
Back to top
View user's profile Send private message
TomWij
Developer
Developer


Joined: 04 Jul 2012
Posts: 1553

PostPosted: Thu May 16, 2013 1:17 pm    Post subject: Reply with quote

Don't think so, guess it should be reasonable to do a `grep -r CONFIG_CHECK /var/db/pkg -l` and then have some algorithm that sources these ebuilds and parses those CONFIG_CHECK variables. Not sure if CONFIG_CHECK is the sole way to check config parameters.
Back to top
View user's profile Send private message
khayyam
Advocate
Advocate


Joined: 07 Jun 2012
Posts: 2965

PostPosted: Thu May 16, 2013 1:23 pm    Post subject: Re: How to check kernel config for installed packages Reply with quote

emc wrote:
I have a question, let's say I emerge package which need specific kernel configuration (some CONFIG_* needs to be selected) and later on during kernel upgrade I will unchecked this option. How to check whole system (all packages) if all kernel configuration is provided, is there any gentool for it?

emc ... there isn't such a tool, it would be extremely difficult to make such a thing. Take for example a package like wpa_supplicant, it can run as a ieee802.1x supplicant, and so only require an ethernet driver, in other usage it might require CFG80211/MAC80211, a wireless driver, RFKILL, and other CONFIG options perhaps specific to that card (LEDS, or USB_SERIAL, for instance). Then there is the question of which driver, and all the dependencies of that driver (eg, for a USB ethernet/wireless card, PCI, etc, etc). How would such a tool figure out which specific usage you had in mind when installing wpa_supplicant (and note, this is just one package of many).

Other packages such as say net-libs/libpcap have a netlink useflag and so would require CONFIG_NETFILTER_NETLINK, but it would require a lot of checks against packages, useflags, etc, to then come to the conclusion that this was in fact needed, and some useflags such as 'hardened' can be used without having grsec or selinux enabled in the kernel, so it makes the whole process of parsing out data from useflags and correlating them with config option next to impossible.

So, such a tool (should someone try to code such a thing) would more likely come up with false positives, suggest the wrong options, etc, etc ... and as the kernel is a moving target the tool would need to be constantly updated and know and understand each kernel revision, in all quite an impossible task, specifically if such a tool was for use with portage (another moving target).

best ... khay
Back to top
View user's profile Send private message
emc
Guru
Guru


Joined: 02 Jul 2004
Posts: 473
Location: Cracow, Poland

PostPosted: Thu May 16, 2013 3:06 pm    Post subject: Reply with quote

I see...
Back to top
View user's profile Send private message
original_PQ
n00b
n00b


Joined: 22 Sep 2002
Posts: 24

PostPosted: Sat Jul 25, 2015 11:56 am    Post subject: Re: How to check kernel config for installed packages Reply with quote

khayyam wrote:
there isn't such a tool, it would be extremely difficult to make such a thing.


Wouldn't an 'emerge -ev world' equivalent, that only runs up to the pkg_pretend() hooks of all ebuilds, do the job? Even if that would be limited to certain EAPIs, it would be better than nothing.

After all, ebuilds *do* check kernel config flags, so the problems you describe do not exist by definition: what I would like is for these ebuilds to just re-run their checks without rebuilding the world in the process.

Of course, we would be running only the checks that actually were written in the ebuilds and it won't cover things the ebuilds are not written to test, but wasn't that the whole point to begin with?

I searched, but I couldn't find anything doing this today, nor any other discussion of the matter.
Back to top
View user's profile Send private message
khayyam
Advocate
Advocate


Joined: 07 Jun 2012
Posts: 2965

PostPosted: Sat Jul 25, 2015 2:26 pm    Post subject: Re: How to check kernel config for installed packages Reply with quote

original_PQ wrote:
khayyam wrote:
there isn't such a tool, it would be extremely difficult to make such a thing.

Wouldn't an 'emerge -ev world' equivalent, that only runs up to the pkg_pretend() hooks of all ebuilds, do the job? Even if that would be limited to certain EAPIs, it would be better than nothing.

original_PQ ... sometimes these checks are run under pkg_setup() ... see net-firewall/sanewall as an example. Anyhow, yes, you could run 'ebuild /path/to/ebuild setup' and parse out CONFIG_* but you would need to provide the logic for the REPO/<category>/<package>/<package>-<version>.ebuild for installed packages. None the less, and this is the crux of the point I'm making above, I'm not sure how close it's getting you to providing the list of CONFIG requirements for packages, yes, you get those CONFIG_CHECK's provided by the ebuild, but these are not that useful (or accurate).

Take the following for example:

Code:
# awk '/CONFIG_/{print}' <(ebuild /var/pkg/gentoo/net-firewall/sanewall/sanewall-1.1.6-r1.ebuild setup)
 *   CONFIG_NF_CONNTRACK_ENABLED:        is not set when it should be.
 *   CONFIG_IP_NF_TARGET_LOG:    is not set when it should be.
 *   CONFIG_IP_NF_TARGET_ULOG:   is not set when it should be.
 *   CONFIG_IP_NF_TARGET_REDIRECT:       is not set when it should be.
# for i in CONFIG_NF_CONNTRACK_ENABLED CONFIG_IP_NF_TARGET_LOG CONFIG_IP_NF_TARGET_ULOG CONFIG_IP_NF_TARGET_REDIRECT ; do zgrep $i /proc/config.gz ; done
# CONFIG_IP_NF_TARGET_ULOG is not set
CONFIG_IP_NF_TARGET_REDIRECT=m
# awk '!/^#/ && /CONFIG_NF_CONNTRACK/' <(zcat /proc/config.gz)
CONFIG_NF_CONNTRACK=y
CONFIG_NF_CONNTRACK_MARK=y
CONFIG_NF_CONNTRACK_EVENTS=y
CONFIG_NF_CONNTRACK_FTP=m
CONFIG_NF_CONNTRACK_IRC=m
CONFIG_NF_CONNTRACK_IPV4=m

Firstly, we can see a disparity in terms of what is being checked in this instance, and secondly, we get a "is not set" when the requirement is enabled as a module.

Added to this (as I outline above) what a package may require may not be checked for (such as netlink) or a package/useflag may be used in ways that the check doesn't consider (as in the case of wpa_supplicant).

original_PQ wrote:
After all, ebuilds *do* check kernel config flags, so the problems you describe do not exist by definition: what I would like is for these ebuilds to just re-run their checks without rebuilding the world in the process.

Yes, they do check ... but it doesn't seem to me to be very useful in terms of configuring the kernel, so "by definition" it's a problem if your trying to provide the required CONFIG_ to match the requirements of the package.

original_PQ wrote:
Of course, we would be running only the checks that actually were written in the ebuilds and it won't cover things the ebuilds are not written to test, but wasn't that the whole point to begin with?

Well, if the whole point of the checks is to point the user to the CONFIG options that need enabled then I don't think its doing a good job in this regard ... but then as I said it's "extremely difficult" to do, and do well.

best ... khay
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum