Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Gentoo with static /dev
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo Chat
View previous topic :: View next topic  
Author Message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54096
Location: 56N 3W

PostPosted: Thu May 16, 2013 8:16 pm    Post subject: Gentoo with static /dev Reply with quote

Team,

It can be done and having done it, I quite like a static /dev again. I may keep my Olde Fashioned Gentoo.
Dropping udev drops the boot time from 11 to 7 seconds too.

I did start out to document Olde Fashioned Gentoo, if there is any interest, I'll put some more work into the Guide-xml document and post it.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 6095
Location: Dallas area

PostPosted: Thu May 16, 2013 8:27 pm    Post subject: Reply with quote

Bravo.

It isn't that hard, it's the way things were done for years.
(Yes, it requires one to understand and know ones hardware, but it's not that difficult)
_________________
PRIME x570-pro, 3700x, 6.1 zen kernel
gcc 13, profile 17.0 (custom bare multilib), openrc, wayland
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6920

PostPosted: Fri May 17, 2013 3:19 am    Post subject: Reply with quote

This gave me an idea — all udev does for 99% of people is dynamically set permissions on files devtmpfs creates. Well we already have two de-facto standard ways to set permissions in openrc: tmpfiles.d and checkpath. With one of those and inotifywait it'd be trivial to replace all of udev's functionality with a dozen-line shell script. I might give it a shot tomorrow.
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Fri May 17, 2013 5:26 pm    Post subject: Reply with quote

Ant P. wrote:
This gave me an idea — all udev does for 99% of people is dynamically set permissions on files devtmpfs creates. Well we already have two de-facto standard ways to set permissions in openrc: tmpfiles.d and checkpath. With one of those and inotifywait it'd be trivial to replace all of udev's functionality with a dozen-line shell script. I might give it a shot tomorrow.

Ant P. ... I'm not sure inotifywait would be needed, the kernel will call whatever is in /proc/sys/kernel/hotplug on an event ... eg, for mdev: echo /sbin/mdev > /proc/sys/kernel/hotplug

best ... khay
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6920

PostPosted: Fri May 17, 2013 8:45 pm    Post subject: Reply with quote

Now that I've thought about it that would probably be a better idea for something this simple. I was going with the approach of having one process in the background like udevd, but that seems like a waste of resources considering it'll be mostly idle.
Back to top
View user's profile Send private message
Naib
Watchman
Watchman


Joined: 21 May 2004
Posts: 6051
Location: Removed by Neddy

PostPosted: Fri May 17, 2013 11:54 pm    Post subject: Reply with quote

What actually explicitly depends on udev should be limited, its more of a "convenience thing"
although i still like /dev only being populated with the devices it has rather than every combination from hda to hdz (yes this can be changed but when I started with linux and saw a cluttered /etc and /dev it was a bit derp)
_________________
Quote:
Removed by Chiitoo
Back to top
View user's profile Send private message
salahx
Guru
Guru


Joined: 12 Mar 2005
Posts: 530

PostPosted: Sat May 18, 2013 5:05 am    Post subject: Reply with quote

udev does a lot of things, not just fix permissions. Udev loads firmware (although newer kernels can do this themselves), and handles any device configuration that needs to be done (like this wireless adapter). libudev also provides facilities for retrieving device information, and listening for post-configuration hotplug events (if an application were to listen directly the kernel, it might access the device before its ready).

I ran a quick check to see how many packages *may* require udev (warning: Lots of false positives)
Code:
find /usr/portage -name \*.ebuild -exec grep virtual/udev {} + |  cut -d/ -f-5 | sort -u > udev.txt; wc -l udev.txt
. Only 108 packages, and (almost?) all of them are related to desktop utilites and hotplug devices. Desktop users still will want udev, but you can manage your own static dev (just install sys-fs/static-dev). Things like udisks (which, among other things, automounts media) will not work without udev - all disks will have to manually mounted run by hand.
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7470

PostPosted: Sat May 18, 2013 6:48 am    Post subject: Re: Gentoo with static /dev Reply with quote

NeddySeagoon wrote:
if there is any interest

Of course i am, and even if i would not, your guides are always fine, to a level pointing users to them is enough to answer.

Edit: adding this remind me this : https://forums.gentoo.org/viewtopic-t-938680-highlight-.html
Back to top
View user's profile Send private message
asturm
Developer
Developer


Joined: 05 Apr 2007
Posts: 8933

PostPosted: Sat May 18, 2013 9:40 am    Post subject: Re: Gentoo with static /dev Reply with quote

NeddySeagoon wrote:
I did start out to document Olde Fashioned Gentoo, if there is any interest, I'll put some more work into the Guide-xml document and post it.

It would be much appreciated :)
Back to top
View user's profile Send private message
gerard27
Advocate
Advocate


Joined: 04 Jan 2004
Posts: 2377
Location: Netherlands

PostPosted: Sat May 18, 2013 12:45 pm    Post subject: Reply with quote

I'm game too.
Thanks in advance Neddy.
Gerard.
_________________
To install Gentoo I use sysrescuecd.Based on Gentoo,has firefox to browse Gentoo docs and mc to browse (and edit) files.
The same disk can be used for 32 and 64 bit installs.
You can follow the Handbook verbatim.
http://www.sysresccd.org/Download
Back to top
View user's profile Send private message
peje
Tux's lil' helper
Tux's lil' helper


Joined: 11 Jan 2003
Posts: 100

PostPosted: Sat May 18, 2013 3:50 pm    Post subject: Reply with quote

Hi, just switched 2 htpc's over to mdev and I'm really happy, they run smoother, and booting faster than with udev. I hope gentoo would do more in this direction - I would love to run also my desktop and laptop udevfree...
thanks, cu Peje
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54096
Location: 56N 3W

PostPosted: Sat May 18, 2013 7:52 pm    Post subject: Reply with quote

Team,

Heres your starter for 10.
Its a bit of a 'guddle' just now but its mostly complete.

I've got as far as having xfce4 running with firefox, balsa and hexchat.

Configuring Xorg isn't there yet but readers that can remember <Xorg-1.8 can do that.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
steveL
Watchman
Watchman


Joined: 13 Sep 2006
Posts: 5153
Location: The Peanut Gallery

PostPosted: Sun May 19, 2013 2:14 am    Post subject: Reply with quote

Ant P. wrote:
Now that I've thought about it that would probably be a better idea for something this simple. I was going with the approach of having one process in the background like udevd, but that seems like a waste of resources considering it'll be mostly idle.

IDK I think a process like udevd is fine, but the kernel should notify via netlink socket, again exactly like udevd.

Then you end up with er udevd, so you might as well just use eudev, and help out with its development, including testing and bug-triaging.

It would be great if we could get XML out of the system-space though.
salahx wrote:
Things like udisks (which, among other things, automounts media) will not work without udev - all disks will have to manually mounted run by hand.

Note you can also use uam, which is written and maintained by a Gentoo dev, in combination with pmount{,-gui}. See Dominique's wonderful guide to getting rid of *kit which works for most modern X environments, apart from Gnome-3.

Also you can still use {e,}udev without an initramfs. I'm running KDE with both these mods, and it works beautifully. Combined with getting rid of semantic-craptop, it works as smoothly as 3.5 used to.
Back to top
View user's profile Send private message
chris.c.hogan
Apprentice
Apprentice


Joined: 02 Oct 2005
Posts: 189

PostPosted: Thu May 30, 2013 6:50 pm    Post subject: Reply with quote

Please let me know if this should go in its own thread. This thread seems relevant...

I maintain an older server, used for file sharing, authentication, local DNS, DHCP, and routing. It is a remote system, about 4000 miles away from me, that does not have a local administrator to fix things. The base system is on a single hard drive with an extended partition scheme that separates /. /boot, /usr, /var, /opt, and /tmp. /home and /srv live on 4 120GB hard drives set up in RAID5. The system wasn't really designed for remote operation, I just pulled it out of storage when I needed a server at the location. However, it is currently fulfilling the local needs and I think I can talk one of the local users though hardware replacement if needed. I just wish someone local knew Linux.

The system has been through various dev managers over the years, starting with static, moving through devfs, and currently udev. With newer versions of udev depending on /usr and now with a new scheme for naming network devices, I masked versions of udev after sys-fs/udev-180. In running updates though, I see sys-fs/static-dev is being pulled in. I has me thinking I need to review device management on this system.

In thinking about the needs of this system, I don't really see a need for dynamically managing the device nodes. In the past, I've attached a USB drive for backing up the system. But otherwise, it never has hot-plug events. The hardware is static, so why shouldn't the /dev nodes be static? However, I found a few problems with sys-fs/static-dev. The first was bug 469620. devtmpfs is enabled in the current kernel. I had to edit out the detection from the ebuild to get sys-fs/static-dev installed. I'll remember to remove that option when I update the kernel. A warning in the ebuild would have been better than an error. The next problem I noticed is that the device nodes created seem based on a 2.4 kernel. /dev/sd* is missing completely. I also made a backup of the old (from 2004) static devices that were still living under the currently mounted /dev. so that I could compare them to what sys-fs/static-dev installed. I noticed a number of differences in security settings, mostly dealing with group write access.

With this system being remote, it must be able to reboot and get the external network up. I had an issue a few years ago where the kernel decided to randomly switch the hard drive controllers around. I was able to fix it by telling the system to boot from /dev/sdc1. However, I was onsite for that problem. I wouldn't be able to fix a repeat.

While researching my options, I came across Installing Olde Fashioned Gentoo and this post. The article is about installing from scratch. However, it has some good pointers for converting from udev to static, including references to the problems I had installing sys-fs/static-dev.

I like the idea of mounting the drives using labels. It is something I thought about after the drive controllers renamed themselves. However, NeddySeagoon notes that the kernel cannot mount root by UUID without an initramfs. I'd rather not convert the system over to needing an initramfs, so this would only partially solve the problem. It is something I'll continue to think about.

In considering device management, I also looked into just using devtmpfs. From what I understand, it creates a /dev based on the hardware present at boot. However, I would have to write a policy script to set ownership and permissions as devtmpfs sets everything root ownership and no group permissions. I'm also not sure if it creates everything needed. If I had local access to the machine, I could test this. However, the machine is remote which limits what I can do.

I found mdev which talks about using mdev to replace udev. It is something that I will read a bit more about. Again, I'm worried about it finding all the devices and correctly naming them. I'm also still leaning toward a static dev as all the hardware is currently static.

For now, I've installed sys-fs/static-dev to satisfy sys-kernel/gentoo-sources dependency on virtual/dev-manager. I've also left sys-fs/udev-171-r8 installed and running. I think I'll remove the nodes that sys-fs/static-dev created and just copy the nodes in /dev to the hard drive. I'm thinking that will give me a stable /dev once I disable udev. At some point I will need to get rid of udev as I'm sure something will break it eventually.

I didn't really plan on writing a message this long... I was just looking to see what others had tried and for general advice on the topic. Maybe even a "Don't do that, it will break your system", or other gotchas, reply. :)
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54096
Location: 56N 3W

PostPosted: Thu May 30, 2013 7:19 pm    Post subject: Reply with quote

chris.c.hogan,

You need a way to regain access if whatever you do doesn't work first time.
You should practice that with a remote helper before you embark on this.

My static /dev system isn't working properly yet and the guide is not complete either.

The biggest problem with needing remote access is the need for ptys.
At the moment, I can open two xterms before I run out of ptys.
That needs to be fixed before you can ssh in.

In replace modification to static /dev should be possible but you have to get it right first time or pick up the pieces.
You can't cross a chasm in two smaller jumps :)
Have a plan to pick up the pieces.

You might consider steveLs init scripts patches to start udev after localmount, so a separate /usr is not an issue.
They are posted here.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 6095
Location: Dallas area

PostPosted: Thu May 30, 2013 10:02 pm    Post subject: Reply with quote

NeddySeagoon wrote:
The biggest problem with needing remote access is the need for ptys.
At the moment, I can open two xterms before I run out of ptys.


What's the problem?

Looking at an old 2.4 backup there should be
Code:
crw-rw-rw- root/tty      2,176 1998-11-14 18:17 dev/ptya0
crw-rw-rw- root/tty      2,177 1998-11-14 18:17 dev/ptya1
crw-rw-rw- root/tty      2,178 1998-11-14 18:17 dev/ptya2
crw-rw-rw- root/tty      2,179 1998-11-14 18:17 dev/ptya3
crw-rw-rw- root/tty      2,180 1998-11-14 18:17 dev/ptya4


etc

Asking for clarification as I don't see a problem.
_________________
PRIME x570-pro, 3700x, 6.1 zen kernel
gcc 13, profile 17.0 (custom bare multilib), openrc, wayland
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54096
Location: 56N 3W

PostPosted: Thu May 30, 2013 10:40 pm    Post subject: Reply with quote

Anon-E-moose,

Some things work with the old BSD pty static nodes, as long as you build kernel support.
Some things appear to only support Unix 98 ptys, which need something to make the /dev/pts/X nodes and set permissions.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo Chat 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