Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 477856 - sys-apps/openrc: Support >=sys-apps/kmod-14 modules.devname static node creation (tmpfiles)
Summary: sys-apps/openrc: Support >=sys-apps/kmod-14 modules.devname static node creat...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Highest normal (vote)
Assignee: OpenRC Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-23 05:22 UTC by Samuli Suominen (RETIRED)
Modified: 2013-08-23 07:16 UTC (History)
4 users (show)

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


Attachments
udev kmod init script (kmod-static-nodes.init,408 bytes, text/plain)
2013-07-23 09:19 UTC, Alexander Vershilov (RETIRED)
Details

Note You need to log in before you can comment on or make changes to this bug.
Comment 1 Samuli Suominen (RETIRED) gentoo-dev 2013-07-23 05:26:13 UTC
For example, from my system:

$ kmod static-nodes --format=tmpfiles
c /dev/ppp 0600 - - - 108:0
d /dev/snd 0755 - - -
c /dev/snd/timer 0600 - - - 116:33
d /dev/snd 0755 - - -
c /dev/snd/seq 0600 - - - 116:1
ssuominen@null ~ $ kmod static-nodes --format=human
Module: ppp_generic
	Device node: /dev/ppp
		Type: character device
		Major: 108
		Minor: 0
Module: snd_timer
	Device node: /dev/snd/timer
		Type: character device
		Major: 116
		Minor: 33
Module: snd_seq
	Device node: /dev/snd/seq
		Type: character device
		Major: 116
		Minor: 1
ssuominen@null ~ $ kmod static-nodes --format=devname
ppp_generic ppp c108:0
snd_timer snd/timer c116:33
snd_seq snd/seq c116:1

So there is 3 different formats we can parse from OpenRC and kmod also has --output flag to put the output in a file.
Comment 2 Alexander Vershilov (RETIRED) gentoo-dev 2013-07-23 08:08:20 UTC
OpenRC support tmpd files so everything we need is to:

a). verify that rc/sh/tmpfiles.sh supports creation of static nodes. It's there

_c() {
	# Create a character device node if it doesn't exist yet
	local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6
	[ ! -e "$path" ] && dryrun_or_real mknod $path c ${arg%:*} ${arg#*:}
}

b). create init script in udev package that will run 

@KMOD@ static-nodes --format=tmpfiles --output=/run/tmpfiles.d/kmod.conf

before tmpfiles.setup.

c). verify that current 0.11.8 version has rc/sh/tmpfiles.sh and init.d/tmpfiles.setup. If not - then backport patches.


So everything we need exists in OpenRC codebase and we don't need to add anything there. But we need to create new init script in udev package.
Comment 3 Alexander Vershilov (RETIRED) gentoo-dev 2013-07-23 09:19:00 UTC
Created attachment 354000 [details]
udev kmod init script

Please add this init script to udev package. 

And please create such bugs _BEFORE_ an actual bump!
Comment 4 Samuli Suominen (RETIRED) gentoo-dev 2013-07-23 09:45:28 UTC
(In reply to Alexander Vershilov from comment #3)
> Created attachment 354000 [details]
> udev kmod init script
> 
> Please add this init script to udev package. 

Why do you think this belongs to sys-fs/udev when udevd explicitely removed support for this?
Shouldn't such init script be part of kmod so it'll be installed for eg. mdev as well?
Comment 5 Samuli Suominen (RETIRED) gentoo-dev 2013-07-23 09:52:41 UTC
Comment on attachment 354000 [details]
udev kmod init script

Fails as following:

$ kmod --format=tmpfiles --output=/tmp/foo.foo
kmod: unrecognized option '--format=tmpfiles'

And is missing eend $? to match ebegin as well

Plus shouldn't hardcode path to kmod
Comment 6 Alexander Vershilov (RETIRED) gentoo-dev 2013-07-23 09:57:03 UTC
(In reply to Samuli Suominen from comment #4)
> (In reply to Alexander Vershilov from comment #3)
> > Created attachment 354000 [details]
> > udev kmod init script
> > 
> > Please add this init script to udev package. 
> 
> Why do you think this belongs to sys-fs/udev when udevd explicitely removed
> support for this?
> Shouldn't such init script be part of kmod so it'll be installed for eg.
> mdev as well?

Udev removed static node creation and provide a unit file that creates tmpfiles.d. This provides same functionality as:

diff --git a/units/kmod-static-nodes.service.in b/units/kmod-static-nodes.service.in
new file mode 100644
index 0000000..f8a2d47
--- a/dev/null
+++ b/units/kmod-static-nodes.service.in
@@ -0,0 +1,16 @@
+# This file is part of systemd.
+#
+# systemd is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+
+[Unit]
+Description=Create list of required static device nodes for the current kernel
+DefaultDependencies=no
+Before=sysinit.target systemd-tmpfiles-setup-dev.service
+
+[Service]
+Type=oneshot
+ExecStartPre=/usr/bin/mkdir -p /run/tmpfiles.d
+ExecStart=@KMOD@ static-nodes --format=tmpfiles --output=/run/tmpfiles.d/kmod.conf

bt because systemd has logically built-in udev and common codebase, they can move this service between folders and say smth about moving functionality, so they did by moving udev-kmod unit into units folder.

OpenRC doesn't belong on udev only, and this init script is needed for >=udev-206 only, so I see no reason for keeping it somewhere but udev.

Kmod may be an option however, but if kmod+eudev is a possible configuration it will lead to a problem. I'd like to hear another suggestions on this point.

So for keeping related thing together having init script in udev is a logical step.
Comment 7 Alexander Vershilov (RETIRED) gentoo-dev 2013-07-23 09:59:45 UTC
(In reply to Samuli Suominen from comment #5)
> Comment on attachment 354000 [details]
> udev kmod init script
> 
> Fails as following:
> 
> $ kmod --format=tmpfiles --output=/tmp/foo.foo
> kmod: unrecognized option '--format=tmpfiles'
> 
> And is missing eend $? to match ebegin as well
> 
> Plus shouldn't hardcode path to kmod

yes needs to be

  kmod static-nodes --format=tmpfiles --output=/run/tmpfiles.d/kmod.conf
Comment 8 Samuli Suominen (RETIRED) gentoo-dev 2013-07-23 10:58:25 UTC
kmod-14-r1 in portage
Comment 9 Samuli Suominen (RETIRED) gentoo-dev 2013-08-23 07:16:18 UTC
With kmod-15 we'll get proper warning if modules.devname is missing (like it would on CONFIG_MODULES=n kernel)

http://git.kernel.org/cgit/utils/kernel/kmod/kmod.git/commit/?id=ae17710117

"Warning: /lib/modules/$(uname -r)/modules.devname not found - ignoring"