Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[MDEV] Settings groups of /dev nodes right (not working)
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
xaviermiller
Bodhisattva
Bodhisattva


Joined: 23 Jul 2004
Posts: 8707
Location: ~Brussels - Belgique

PostPosted: Sun Feb 03, 2013 5:37 pm    Post subject: [MDEV] Settings groups of /dev nodes right (not working) Reply with quote

Hello,

I am running mdev-based systems (USE="-udev"), and using mdev.conf and mdev scripts from "mdev like a boss", as cited in the Gentoo Wiki page

But some nodes are not with the right group, especially audio-related device nodes:
Code:
ls -la /dev/snd
total 0
drwxr-xr-x  2 root root      180  3 fév 18:12 .
drwxr-xr-x 13 root root     5620  3 fév 18:12 ..
crw-rw----  1 root root  116,  5  3 fév 18:12 controlC0
crw-rw----  1 root audio 226, 64  3 fév  2013 controlD64
crw-rw----  1 root root  116,  4  3 fév 18:12 hwC0D0
crw-rw----  1 root root  116,  3  3 fév 18:12 pcmC0D0c
crw-rw----  1 root root  116,  2  3 fév 18:12 pcmC0D0p
crw-rw----  1 root root  116,  1  3 fév 18:12 seq
crw-rw----  1 root root  116, 33  3 fév 18:12 timer


I would like all those /dev/snd devices be assigned to root:audio in place of root:root.

Some of those devices are loaded with modprobe, some other detected by mdev.
How can I tell the system to use the right group?

Thanks in advance!
_________________
Kind regards,
Xavier Miller


Last edited by xaviermiller on Tue Feb 12, 2013 9:22 am; edited 2 times in total
Back to top
View user's profile Send private message
xaviermiller
Bodhisattva
Bodhisattva


Joined: 23 Jul 2004
Posts: 8707
Location: ~Brussels - Belgique

PostPosted: Fri Feb 08, 2013 8:17 pm    Post subject: Reply with quote

Hello,

I have found the problem : the script and configuration files from "mdev like a boss" are not as good as busybox.
So, please don't use those from "mdev like a boss" and keep the "vanilla" ones.

In that case, you need to coldplug the modules, and I do it in my "pre-init" script:
/sbin/linuxrc:
#!/bin/busybox ash
mount -t proc proc /proc
mount -t sysfs sysfs /sys

# Load kernel modules, run twice.
/usr/bin/find /sys -name 'modalias' -type f -exec /bin/cat '{}' + | /usr/bin/sort -u | /usr/bin/xargs /sbin/modprobe -b -a 2>/dev/null
/usr/bin/find /sys -name 'modalias' -type f -exec /bin/cat '{}' + | /usr/bin/sort -u | /usr/bin/xargs /sbin/modprobe -b -a 2>/dev/null


exec /sbin/init


The coldplug part is not mentionned in the Gentoo Wiki page, this could be nice if it was added.
_________________
Kind regards,
Xavier Miller
Back to top
View user's profile Send private message
xaviermiller
Bodhisattva
Bodhisattva


Joined: 23 Jul 2004
Posts: 8707
Location: ~Brussels - Belgique

PostPosted: Tue Feb 12, 2013 9:25 am    Post subject: Reply with quote

Hello,

Busybox's mdev cannot be use in a hot-plugged environment: the nodes are not created with the right groups, even if the entry is present in mdev.conf.

I tried with USB audio devices, and this is a nightmare. I had to launch "mdev -s" after a module is automatically loaded, in order to reset the rights. So hotplug don't work (and yes, /sbin/mdev is registered as the hotplug manager).
And no colplug.

So, don't use mdev as a (e)udev alternative for a dynamic desktop system.
_________________
Kind regards,
Xavier Miller
Back to top
View user's profile Send private message
cach0rr0
Bodhisattva
Bodhisattva


Joined: 13 Nov 2008
Posts: 4123
Location: Houston, Republic of Texas

PostPosted: Mon Feb 18, 2013 11:53 pm    Post subject: Reply with quote

interesting that i stumbled onto this

I've been using mdev for the last ~9 months on one system, my old laptop
it creates device nodes with the appropriate permissions, precisely as we'd expect it to. I followed the mdev wiki for this way back when, and it worked (I've never heard of this "mdev like a boss" thing)

Fast forward to this past weekend, I get a new laptop (T420!), and begin running into this issue.

Only difference I can see, new laptop is busybox 1.21.0, old one is an older busybox (i dont recall what version provides the binary I have in my initramfs)

I frankly don't see any other differences between the two systems. The init is damn near identical, only difference on the old one I use fbcondecor (new machine I use hardened-sources, old machine gentoo-sources)
Yeah, the kernel thing is somewhat of a significant difference, but I don't know how much it comes into play

Code:

#!/bin/busybox sh

rescue_shell() {
        echo "Something went wrong. Dropping you to a shell."
                busybox --install -s
        exec /bin/sh
}

mount -t proc none /proc
mount -t sysfs none /sys
mount -t devtmpfs devtmpfs /dev

cryptsetup -T5 luksOpen /dev/sda3 root
mount -t ext4 -o ro /dev/mapper/root /mnt/root || rescue_shell
umount /proc
umount /sys
umount /dev

exec switch_root /mnt/root /sbin/init


anyway, posting this as a reminder to check back on this myself.

I've been having to chown device nodes by hand on this new build, to e.g. root:video and root:audio, that's the main annoyance.

If I find out anything I'll post back. Long story short, mdev.conf thus far seems to be completely ignored.

DERP

editing instead of adding a new post, since it's fairly quickly after

so, apparently on this new box, i had 'udev-mount' added to sysinit runlevel. I didnt do this myself, I'm guessing portage did it for me (?)
I had to pull in udev because chromium will fail to build without it. So it just sits here as a build dependency doing nothing

ANYWAY

I can't pinpoint udev-mount as a cause, but i dont think ive changed anything else (and this is my zillionth reboot today working on this)
and
after a reboot things are *better*, but imperfect.
Just to show the sequence of things I'm checking, and how I had to correct it:

Code:

vunnable ~ # ls -alh /dev/dri/
total 0
drwxr-xr-x  2 root root      60 Feb 18 17:55 .
drwxr-xr-x 10 root root    5.8K Feb 18 17:55 ..
crw-rw----  1 root video 226, 0 Feb 18 17:55 card0
vunnable ~ # ls -alh /dev/snd/
total 0
drwxr-xr-x  2 root root      220 Feb 18 17:55 .
drwxr-xr-x 10 root root     5.8K Feb 18 17:55 ..
crw-rw----  1 root root  116,  8 Feb 18 17:55 controlC0
crw-rw----  1 root root  116,  2 Feb 18 17:55 controlC29
crw-rw----  1 root audio 226, 64 Feb 18 17:55 controlD64
crw-rw----  1 root root  116,  7 Feb 18 17:55 pcmC0D0c
crw-rw----  1 root root  116,  6 Feb 18 17:55 pcmC0D0p
crw-rw----  1 root root  116,  5 Feb 18 17:55 pcmC0D3p
crw-rw----  1 root root  116,  4 Feb 18 17:55 pcmC0D7p
crw-rw----  1 root root  116,  3 Feb 18 17:55 pcmC0D8p
crw-rw----  1 root root  116, 33 Feb 18 17:55 timer
vunnable ~ # vi /etc/mdev.conf
vunnable ~ # mdev -s
vunnable ~ # ls -alh /dev/snd/
total 0
drwxr-xr-x  2 root root      220 Feb 18 17:55 .
drwxr-xr-x 10 root root     5.8K Feb 18 17:56 ..
crw-rw----  1 root audio 116,  8 Feb 18 17:55 controlC0
crw-rw----  1 root audio 116,  2 Feb 18 17:55 controlC29
crw-rw----  1 root audio 226, 64 Feb 18 17:55 controlD64
crw-rw----  1 root audio 116,  7 Feb 18 17:55 pcmC0D0c
crw-rw----  1 root audio 116,  6 Feb 18 17:55 pcmC0D0p
crw-rw----  1 root audio 116,  5 Feb 18 17:55 pcmC0D3p
crw-rw----  1 root audio 116,  4 Feb 18 17:55 pcmC0D7p
crw-rw----  1 root audio 116,  3 Feb 18 17:55 pcmC0D8p
crw-rw----  1 root audio 116, 33 Feb 18 17:55 timer


Notice the screwiness with /dev/snd/*

I may just add a call to "mdev -s" to a script in /etc/local.d/

I'm also wondering if my automounting of a devtmpfs (kernel setting) is partially responsible. I may be able to live without it given how I have things set up. Will post back after another reboot, but if udev-mount was in any way related, I'm seriously scratching my head.
_________________
Lost configuring your system?
dump lspci -n here | see Pappy's guide | Link Stash
Back to top
View user's profile Send private message
xaviermiller
Bodhisattva
Bodhisattva


Joined: 23 Jul 2004
Posts: 8707
Location: ~Brussels - Belgique

PostPosted: Tue Feb 19, 2013 7:37 am    Post subject: Reply with quote

Hello,

Running mdev -s after coldpluggging is a solution, but not for real use : I plug and unplug audio devices (sound card, synthesizers), and this is a nightmare.

mdev is not suitable for hot-plugging for now.
_________________
Kind regards,
Xavier Miller
Back to top
View user's profile Send private message
cach0rr0
Bodhisattva
Bodhisattva


Joined: 13 Nov 2008
Posts: 4123
Location: Houston, Republic of Texas

PostPosted: Wed Feb 20, 2013 6:51 am    Post subject: Reply with quote

not a solution for you, a solution for me :)

My issue was module-created device nodes having buggered permissions on boot
dev/{snd,dri,videoX} were all root:root, which was a significant problem.

And it's a new issue, because my system that's had mdev for the better part of a year doesn't have the issue
but
for me hotplug is not part of the picture

either way, for my particular issue this works. I'm still not sure why it only affects my new laptop, and not my old, that's a headscratcher. But the mdev -s after module load does work as a workaround
_________________
Lost configuring your system?
dump lspci -n here | see Pappy's guide | Link Stash
Back to top
View user's profile Send private message
xaviermiller
Bodhisattva
Bodhisattva


Joined: 23 Jul 2004
Posts: 8707
Location: ~Brussels - Belgique

PostPosted: Wed Feb 20, 2013 7:01 am    Post subject: Reply with quote

So, for now
- coldplugging is buggy
- hot-plugging is buggy

And since udev has a good Gentoo developer / kernel developer in the team, I will still stay on udev, even if the process is called "systemd-blah-blah" ;)
_________________
Kind regards,
Xavier Miller
Back to top
View user's profile Send private message
SlashBeast
Retired Dev
Retired Dev


Joined: 23 May 2006
Posts: 2922

PostPosted: Sun Mar 03, 2013 1:39 pm    Post subject: Reply with quote

@XavierMiller your issue with permissions is a bug in latest busybox. Downgrade to older version of busybox or install busybox without mdev and emerge mdev-bb from foo-overlay. I've reported this very bug along with other issues with mdev to busybox mailinglist and as far as I know Denys Vlasenko work on it.

fwiw the gentoo wiki's mdev page is a bit off, you don't really need a linuxrc or any custom init wrapper to use mdev, its pretty much drop-in replacement as dev manager.
Back to top
View user's profile Send private message
xaviermiller
Bodhisattva
Bodhisattva


Joined: 23 Jul 2004
Posts: 8707
Location: ~Brussels - Belgique

PostPosted: Sun Mar 03, 2013 8:21 pm    Post subject: Reply with quote

Hello SlashBeast,

I will wait this issue will be fixed upstream. Meanwhile, I wll use udev ;)
_________________
Kind regards,
Xavier Miller
Back to top
View user's profile Send private message
SlashBeast
Retired Dev
Retired Dev


Joined: 23 May 2006
Posts: 2922

PostPosted: Sun Mar 03, 2013 9:03 pm    Post subject: Reply with quote

This issue aside, new mdev have removed -net/ rules support and there is no alternative at this very moment so don't expeect it anytime soon.
Back to top
View user's profile Send private message
miroR
l33t
l33t


Joined: 05 Mar 2008
Posts: 826

PostPosted: Tue Jun 03, 2014 9:52 pm    Post subject: Reply with quote

XavierMiller wrote:
Hello SlashBeast,

I will wait this issue will be fixed upstream. Meanwhile, I wll use udev ;)

I couldn't give advice to you certainly,, XavierMiller, so pls. do not take this in the wrong way.

This is, namely, not just FYI, but for the information to other users who might wish to install something really simpler, nicer, user-oriented, without all the bloat and control that evades the user...

I would like to point out that, with some help from khayyam and others, I have managed to install and am faultlessly running:

mdev-like-a-boss

Unfortunately, I have problems (or perceived problems), or imperfection in the presentation, but actually more something akin to wondering int the wood, the wood being those Gentoo cogs and wheels that one needs to understand to install mdev-like-a-boss, so...

So there was really a lot of wondering to figure out what I needed to do, and only after having been helped did I manage.

So, be warned that my successful install is somewhat difficult to read:

Uninstalling dbus and *kits (to Unfacilitate Remote Seats)
https://forums.gentoo.org/viewtopic-t-992146.html the beginning

for more strictly mdev the reader could try and pick from here onward:
https://forums.gentoo.org/viewtopic-t-992146.html#7559822

Miroslav Rovis
www.CroatiaFidelis.hr
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware 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