linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Migrating from static /dev to udev
@ 2009-09-25 22:38 Brendan Moran
  2009-09-25 23:06 ` Stephan Raue
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Brendan Moran @ 2009-09-25 22:38 UTC (permalink / raw)
  To: linux-hotplug

Hi,
I'm trying to migrate an armeb embedded Linux build from a static /dev 
to udev.  I now have the system coming up with udev enabled, but the 
first thing that udev does is disable my console connection.  Before the 
console starts endlessly spewing "file not found" messages, udev prints 
a line like this

    tty ttyAMA0: uevent: unsupported action-string; this will be ignored
    in a futur

for nearly every device that was in the previous static /dev.

I understand that I can add static rules to udev to fix this, but I also 
want to migrate naming conventions to standard names--ttyAMA0 should be 
ttyS0, etc.  I can keep legacy names around with symlinks if necessary.

So I'm not quite sure how to get started.  I have disabled udev's 
startup for the moment, so I can get into /sys.  Is there a guide 
somewhere on how to migrate from a static /dev to udev?

Thanks,
Brendan


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Migrating from static /dev to udev
  2009-09-25 22:38 Migrating from static /dev to udev Brendan Moran
@ 2009-09-25 23:06 ` Stephan Raue
  2009-09-26  9:22 ` Alan Jenkins
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Stephan Raue @ 2009-09-25 23:06 UTC (permalink / raw)
  To: linux-hotplug

Hi,

when you only need a automatically managed /dev (and not need udev) you 
can try the first snapshots of the new 2.6.32 kernel with enabled 
devtmpfs. i have tryed this yesterday (linux-2.6.31 +patch 
http://www.kernel.org/pub/linux/kernel/v2.6/next/patch-v2.6.31-next-20090925.bz2) 
and its works very good for me. you can mount /dev with "mount -t 
devtmpfs none /dev" and you have a complete /dev managed by kernel (when 
you need udev and it works, udev is very fast with this).

Stephan

Am 26.09.2009 00:38, schrieb Brendan Moran:
> Hi,
> I'm trying to migrate an armeb embedded Linux build from a static /dev 
> to udev.  I now have the system coming up with udev enabled, but the 
> first thing that udev does is disable my console connection.  Before 
> the console starts endlessly spewing "file not found" messages, udev 
> prints a line like this
>
>    tty ttyAMA0: uevent: unsupported action-string; this will be ignored
>    in a futur
>
> for nearly every device that was in the previous static /dev.
>
> I understand that I can add static rules to udev to fix this, but I 
> also want to migrate naming conventions to standard names--ttyAMA0 
> should be ttyS0, etc.  I can keep legacy names around with symlinks if 
> necessary.
>
> So I'm not quite sure how to get started.  I have disabled udev's 
> startup for the moment, so I can get into /sys.  Is there a guide 
> somewhere on how to migrate from a static /dev to udev?
>
> Thanks,
> Brendan
>
> -- 
> To unsubscribe from this list: send the line "unsubscribe 
> linux-hotplug" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>


-- 
               ### OpenELEC.tv ###
The free and open Mediacenter Distribution 4 you
              http://www.openelec.tv


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Migrating from static /dev to udev
  2009-09-25 22:38 Migrating from static /dev to udev Brendan Moran
  2009-09-25 23:06 ` Stephan Raue
@ 2009-09-26  9:22 ` Alan Jenkins
  2009-09-26 15:41 ` Greg KH
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Alan Jenkins @ 2009-09-26  9:22 UTC (permalink / raw)
  To: linux-hotplug

Hi

On 9/25/09, Brendan Moran <bremoran@broadcom.com> wrote:
> Hi,
> I'm trying to migrate an armeb embedded Linux build from a static /dev
> to udev.  I now have the system coming up with udev enabled, but the
> first thing that udev does is disable my console connection.  Before the
> console starts endlessly spewing "file not found" messages,

Ow.  Often that means you've either deleted or removed access
permissions to /dev/null.  Maybe the same has happened to /dev/tty or
something as well.  It suggests that your rules are failing to assign
permissions to these devices, so udev is giving them default
permissions which are too restrictive.

> udev prints
> a line like this
>
>     tty ttyAMA0: uevent: unsupported action-string; this will be ignored
>     in a futur
>
> for nearly every device that was in the previous static /dev.

Aha.  That's a kernel message, not a udev one.  It suggests you're doing this:

udevadm trigger --action=uevent

when you should be doing this:

udevadm trigger --action­d

("udevadm trigger" should also work since --action­d is the default).

> I understand that I can add static rules to udev to fix this, but I also
> want to migrate naming conventions to standard names--ttyAMA0 should be
> ttyS0, etc.  I can keep legacy names around with symlinks if necessary.

I suspect this is not relevant to your problems.  Udev doesn't delete
the previous contents of /dev.  There should only be problems if the
names conflict, so that udev overwrites one of your existing nodes
with something you're not expecting.

(Btw, in case you're not already doing this, the README recommends you
mount /dev as a tmpfs and initialize it by copying all your static
devices from /lib/udev/devices).

> So I'm not quite sure how to get started.  I have disabled udev's
> startup for the moment, so I can get into /sys.  Is there a guide
> somewhere on how to migrate from a static /dev to udev?
>
> Thanks,
> Brendan

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Migrating from static /dev to udev
  2009-09-25 22:38 Migrating from static /dev to udev Brendan Moran
  2009-09-25 23:06 ` Stephan Raue
  2009-09-26  9:22 ` Alan Jenkins
@ 2009-09-26 15:41 ` Greg KH
  2009-09-28 16:09 ` Brendan Moran
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Greg KH @ 2009-09-26 15:41 UTC (permalink / raw)
  To: linux-hotplug

On Sat, Sep 26, 2009 at 01:06:27AM +0200, Stephan Raue wrote:
> Hi,
>
> when you only need a automatically managed /dev (and not need udev) you can 
> try the first snapshots of the new 2.6.32 kernel with enabled devtmpfs. i 
> have tryed this yesterday (linux-2.6.31 +patch 
> http://www.kernel.org/pub/linux/kernel/v2.6/next/patch-v2.6.31-next-20090925.bz2) 
> and its works very good for me. you can mount /dev with "mount -t devtmpfs 
> none /dev" and you have a complete /dev managed by kernel (when you need 
> udev and it works, udev is very fast with this).

Or you can have the kernel mount it for you if you want to based on the
config option, making your userspace even simpler.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Migrating from static /dev to udev
  2009-09-25 22:38 Migrating from static /dev to udev Brendan Moran
                   ` (2 preceding siblings ...)
  2009-09-26 15:41 ` Greg KH
@ 2009-09-28 16:09 ` Brendan Moran
  2009-09-28 21:02 ` Alan Jenkins
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Brendan Moran @ 2009-09-28 16:09 UTC (permalink / raw)
  To: linux-hotplug

[-- Attachment #1: Type: text/plain, Size: 2881 bytes --]

Hi Alan,
I'm using virtually the same startup script as is used in Ubuntu 
(attached).  It only uses $udevadm trigger, with no arguments.  I didn't 
expect that permissions would be an issue, as this system is running in 
single user mode.

Mounting /dev as a tmpfs makes perfect sense to me, however I'll have to 
do some hacking before I can modify that.  I have a list of all the 
devices to be created and placed in /dev already.  Currently, it's 
expanded at compile time, but I should be able to change the target from 
/dev to /lib/udev/devices.

One additional thing that I need to do while migrating away from a 
static /dev is to convert our current naming scheme for devices to one 
which is consistent with the naming that udev uses by default.

Thanks again,
Brendan

Alan Jenkins wrote:
> Hi
>
> On 9/25/09, Brendan Moran <bremoran@broadcom.com> wrote:
>   
>> Hi,
>> I'm trying to migrate an armeb embedded Linux build from a static /dev
>> to udev.  I now have the system coming up with udev enabled, but the
>> first thing that udev does is disable my console connection.  Before the
>> console starts endlessly spewing "file not found" messages,
>>     
>
> Ow.  Often that means you've either deleted or removed access
> permissions to /dev/null.  Maybe the same has happened to /dev/tty or
> something as well.  It suggests that your rules are failing to assign
> permissions to these devices, so udev is giving them default
> permissions which are too restrictive.
>
>   
>> udev prints
>> a line like this
>>
>>     tty ttyAMA0: uevent: unsupported action-string; this will be ignored
>>     in a futur
>>
>> for nearly every device that was in the previous static /dev.
>>     
>
> Aha.  That's a kernel message, not a udev one.  It suggests you're doing this:
>
> udevadm trigger --action=uevent
>
> when you should be doing this:
>
> udevadm trigger --action=add
>
> ("udevadm trigger" should also work since --action=add is the default).
>
>   
>> I understand that I can add static rules to udev to fix this, but I also
>> want to migrate naming conventions to standard names--ttyAMA0 should be
>> ttyS0, etc.  I can keep legacy names around with symlinks if necessary.
>>     
>
> I suspect this is not relevant to your problems.  Udev doesn't delete
> the previous contents of /dev.  There should only be problems if the
> names conflict, so that udev overwrites one of your existing nodes
> with something you're not expecting.
>
> (Btw, in case you're not already doing this, the README recommends you
> mount /dev as a tmpfs and initialize it by copying all your static
> devices from /lib/udev/devices).
>
>   
>> So I'm not quite sure how to get started.  I have disabled udev's
>> startup for the moment, so I can get into /sys.  Is there a guide
>> somewhere on how to migrate from a static /dev to udev?
>>
>> Thanks,
>> Brendan
>>     
>
>   

[-- Attachment #2: udev --]
[-- Type: text/plain, Size: 4522 bytes --]

#!/bin/sh -e
### BEGIN INIT INFO
# Provides:          udev
# Required-Start:    mountkernfs
# Required-Stop:
# Should-Start:
# Default-Start:     S
# Default-Stop:
# Short-Description: Start the udev daemon.
# Description:       Mounts the /dev virtual filesystem, starts the udev
#                    daemon and populates /dev.
### END INIT INFO

# Check the package is still installed
[ -x /sbin/udevd ] || exit 0

# Get LSB functions
. /lib/lsb/init-functions
if [ -e /etc/default/rcS]; then
. /etc/default/rcS
fi


case "$1" in
    start)
	DEVMOUNT=`mount | grep "on /dev " | cut -d " " -f 1`
	# We need the uevent support introduced in 2.6.15, bail out if we
	# don't have it and fall back to a static /dev
	if [ ! -f /sys/class/mem/null/uevent ]; then
	    if [ -n $DEVMOUNT ]; then
		# uh-oh, initramfs made some kind of /dev, get rid of it
		umount -l /dev
	    fi
	    exit 1
	fi
	
	if [ -z $DEVMOUNT ]; then
	    # initramfs didn't mount /dev, so we'll need to do that
	    mount -n -t tmpfs -o mode=0755 udev /dev
	fi

	# Copy over default device tree
	if [ -d /lib/udev/devices ]; then
		DEVICELIST=`ls /lib/udev/devices`
		if [ -n $DEVICELIST ]; then
			cp -a -f /lib/udev/devices/* /dev
		fi
	fi	

	# It's all over netlink now
	if [ -e /proc/sys/kernel/hotplug ]; then
	    echo "" > /proc/sys/kernel/hotplug
	fi
	
	# Start udevd
	log_begin_msg "Starting kernel event manager..."
	#if start-stop-daemon --start --quiet --exec /sbin/udevd -- --daemon; then
	/sbin/udevd --daemon & 
	UDEVPID=$! ; echo $UDEVPID > /var/run/udevd.pid
	if [ $UDEVPID -gt 0 ]; then
	    log_end_msg 0
	else
	    log_end_msg $?
	fi

	# This next bit can take a while
	if type usplash_write >/dev/null 2>&1; then
	    usplash_write "TIMEOUT 360" ||:
	    trap "usplash_write 'TIMEOUT 15' ||:" 0
	fi

	# Log things that trigger does
	/sbin/udevadm monitor -e >/dev/.udev.log &
	UDEV_MONITOR_PID=$!

	# Fix permissions and missing symlinks/programs for devices made in
	# initramfs, and catch up on everything we missed
	log_begin_msg "Loading hardware drivers..."
	/sbin/udevadm trigger
	if /sbin/udevadm settle; then
	    log_end_msg 0
	else
	    log_end_msg $?
	fi

	# Kill the udev monitor again
	kill $UDEV_MONITOR_PID
	;;
    stop)
	log_begin_msg "Stopping kernel event manager..."
	#if start-stop-daemon --stop --quiet --oknodo --exec /sbin/udevd --retry 5; then
	if [ -e /var/run/udevd.pid ]; then 
		UDEVPID=`cat /var/run/udevd.pid`
	else 
		UDEVPID=`ps | grep udevd | cut -d " " -f 3`
		if [ -z "$UDEVPID" ]; then
			echo "udev not running"		
			exit 0;
		fi
	fi
	if kill $UDEVPID ; then
	    log_end_msg 0
	else
	    log_end_msg $?
	fi
	umount -l /dev
	;;
    restart)
	if [ ! -f /sys/kernel/uevent_seqnum ]; then
	    echo "Kernel uevent sequence number not available, cowardly not restarting udev" 1>&2
	    exit 0
	fi

	seqnum_before=$(cat /sys/kernel/uevent_seqnum)

 	log_begin_msg "Stopping kernel event manager..."
	#if start-stop-daemon --stop --quiet --oknodo --exec /sbin/udevd --retry 5; then
	if [ -e /var/run/udevd.pid ]; then 
		UDEVPID=`cat /var/run/udevd.pid`
	else 
		UDEVPID=`ps | grep udevd | cut -d " " -f 3`
		if [ -z "$UDEVPID" ]; then
			echo "udev not running"		
			exit 0;
		fi
	fi
		
	
	if kill $UDEVPID ; then
	    log_end_msg 0
	else
	    log_end_msg $?
	fi

	log_begin_msg "Starting kernel event manager..."
	#if start-stop-daemon --start --quiet --exec /sbin/udevd -- --daemon; then
	/sbin/udevd --daemon & 
	UDEVPID=$! ; echo $UDEVPID > /var/run/udevd.pid
	if [ $UDEVPID -gt 0 ]; then	
	    log_end_msg 0
	else
	    log_end_msg $?
	fi

	seqnum_after=$(cat /sys/kernel/uevent_seqnum)

	if [ $seqnum_before -ne $seqnum_after ]; then
	    echo "Kernel uevent sequence number changed, some events may have been missed :o(" 1>&2
	fi
	;;
    refresh-devices)
	cp -au /lib/udev/devices/* /dev

	log_begin_msg "Loading additional hardware drivers..."
	/sbin/udevadm trigger
	if /sbin/udevadm settle; then
	    log_end_msg 0
	else
	    log_end_msg $?
	fi
	;;
    reload|force-reload)
	log_begin_msg "Reloading kernel event manager..."
	#if start-stop-daemon --stop --signal 1 --exec /sbin/udevd; then
	if [ -e /var/run/udevd.pid ]; then 
		UDEVPID=`cat /var/run/udevd.pid`
	else 
		UDEVPID=`ps | grep udevd | cut -d " " -f 3`
		if [ -z "$UDEVPID" ]; then
			echo "udev not running"		
			exit 0;
		fi
	fi
	if kill -1 $UDEVPID ; then
	    log_end_msg 0
	else
	    log_end_msg $?
	fi
	;;
*)
	echo "Usage: /etc/init.d/udev {start|stop|restart|refresh-devices|reload|force-reload}"
	exit 1
	;;
esac

exit 0

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Migrating from static /dev to udev
  2009-09-25 22:38 Migrating from static /dev to udev Brendan Moran
                   ` (3 preceding siblings ...)
  2009-09-28 16:09 ` Brendan Moran
@ 2009-09-28 21:02 ` Alan Jenkins
  2009-09-29 17:41 ` Brendan Moran
  2009-09-30  3:19 ` Bryan Kadzban
  6 siblings, 0 replies; 8+ messages in thread
From: Alan Jenkins @ 2009-09-28 21:02 UTC (permalink / raw)
  To: linux-hotplug

On 9/28/09, Brendan Moran <bremoran@broadcom.com> wrote:
> Hi Alan,
> I'm using virtually the same startup script as is used in Ubuntu
> (attached).  It only uses $udevadm trigger, with no arguments.

Well, I'm sure you can narrow it down.  You can always single-step the
init script on a running system to see what's happening.

> I didn't
> expect that permissions would be an issue, as this system is running in
> single user mode.
>
> Mounting /dev as a tmpfs makes perfect sense to me, however I'll have to
> do some hacking before I can modify that.

?
        if [ -z $DEVMOUNT ]; then
            # initramfs didn't mount /dev, so we'll need to do that
            mount -n -t tmpfs -o mode\a55 udev /dev
        fi

This will definitely cause some problems if you hadn't noticed it and
left /lib/udev/devices empty.  Udev relies on /dev/null being present
at startup.

I think this is your main problem!  Perhaps it is somehow responsible
for the later 'unknown: "uevent"' problem.

>  I have a list of all the
> devices to be created and placed in /dev already.  Currently, it's
> expanded at compile time, but I should be able to change the target from
> /dev to /lib/udev/devices.
>
> One additional thing that I need to do while migrating away from a
> static /dev is to convert our current naming scheme for devices to one
> which is consistent with the naming that udev uses by default.
>
> Thanks again,
> Brendan

Good luck

> Alan Jenkins wrote:
>> Hi
>>
>> On 9/25/09, Brendan Moran <bremoran@broadcom.com> wrote:
>>
>>> Hi,

--
A: Because it messes up the order in which people normally read text.
> Q: Why is top-posting such a bad thing?
>> A: Top-posting.
>>> Q: What is the most annoying thing in e-mail?

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Migrating from static /dev to udev
  2009-09-25 22:38 Migrating from static /dev to udev Brendan Moran
                   ` (4 preceding siblings ...)
  2009-09-28 21:02 ` Alan Jenkins
@ 2009-09-29 17:41 ` Brendan Moran
  2009-09-30  3:19 ` Bryan Kadzban
  6 siblings, 0 replies; 8+ messages in thread
From: Brendan Moran @ 2009-09-29 17:41 UTC (permalink / raw)
  To: linux-hotplug



Alan Jenkins wrote:
> On 9/28/09, Brendan Moran <bremoran@broadcom.com> wrote:
>   
>> Hi Alan,
>> I'm using virtually the same startup script as is used in Ubuntu
>> (attached).  It only uses $udevadm trigger, with no arguments.
>>     
>
> Well, I'm sure you can narrow it down.  You can always single-step the
> init script on a running system to see what's happening.
>   
It turns out it was pretty obvious:
> -n Starting kernel event manager...
> .
> -n Loading hardware drivers...
> [101] udev_monitor_enable_receiving: bind failed: No such file or 
> directory
> error initializing netlink socket
> [101] main: error initializing netlink socket
> udevadm[102]: bind failed: No such file or directory
>
> error: unable to subscribe to udev events
Checking the source, it appears that having 
udev_monitor_enable_receiving fail means that  
udev_monitor_new_from_netlink() is already failing.  I imagine that I'm 
missing a kernel config option, but I'm not sure what it is.


>> I didn't
>> expect that permissions would be an issue, as this system is running in
>> single user mode.
>>
>> Mounting /dev as a tmpfs makes perfect sense to me, however I'll have to
>> do some hacking before I can modify that.
>>     
>
> ?
>         if [ -z $DEVMOUNT ]; then
>             # initramfs didn't mount /dev, so we'll need to do that
>             mount -n -t tmpfs -o mode\a55 udev /dev
>         fi
>
> This will definitely cause some problems if you hadn't noticed it and
> left /lib/udev/devices empty.  Udev relies on /dev/null being present
> at startup.
>
> I think this is your main problem!  Perhaps it is somehow responsible
> for the later 'unknown: "uevent"' problem.  
I've fixed the empty device list problem, so the failed bind is the 
biggest problem now.

Thanks again,
Brendan
>>  I have a list of all the
>> devices to be created and placed in /dev already.  Currently, it's
>> expanded at compile time, but I should be able to change the target from
>> /dev to /lib/udev/devices.
>>
>> One additional thing that I need to do while migrating away from a
>> static /dev is to convert our current naming scheme for devices to one
>> which is consistent with the naming that udev uses by default.
>>
>> Thanks again,
>> Brendan
>>     
>
> Good luck
>
>   
>> Alan Jenkins wrote:
>>     
>>> Hi
>>>
>>> On 9/25/09, Brendan Moran <bremoran@broadcom.com> wrote:
>>>
>>>       
>>>> Hi,
>>>>         
>
> --
> A: Because it messes up the order in which people normally read text.
>   
>> Q: Why is top-posting such a bad thing?
>>     
>>> A: Top-posting.
>>>       
>>>> Q: What is the most annoying thing in e-mail?
>>>>         
>
>   


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Migrating from static /dev to udev
  2009-09-25 22:38 Migrating from static /dev to udev Brendan Moran
                   ` (5 preceding siblings ...)
  2009-09-29 17:41 ` Brendan Moran
@ 2009-09-30  3:19 ` Bryan Kadzban
  6 siblings, 0 replies; 8+ messages in thread
From: Bryan Kadzban @ 2009-09-30  3:19 UTC (permalink / raw)
  To: linux-hotplug

[-- Attachment #1: Type: text/plain, Size: 770 bytes --]

Brendan Moran wrote:
> It turns out it was pretty obvious:
>
>> -n Starting kernel event manager...
>> .
>> -n Loading hardware drivers...
>> [101] udev_monitor_enable_receiving: bind failed: No such file or
>> directory
>> error initializing netlink socket
>> [101] main: error initializing netlink socket
>> udevadm[102]: bind failed: No such file or directory
>>
>> error: unable to subscribe to udev events
>
> Checking the source, it appears that having
> udev_monitor_enable_receiving fail means that 
> udev_monitor_new_from_netlink() is already failing.  I imagine that I'm
> missing a kernel config option, but I'm not sure what it is.

Have you taken a look at the udev README?  (That's twice lately that
I've said that...  hmm...)  :-)


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-09-30  3:19 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-25 22:38 Migrating from static /dev to udev Brendan Moran
2009-09-25 23:06 ` Stephan Raue
2009-09-26  9:22 ` Alan Jenkins
2009-09-26 15:41 ` Greg KH
2009-09-28 16:09 ` Brendan Moran
2009-09-28 21:02 ` Alan Jenkins
2009-09-29 17:41 ` Brendan Moran
2009-09-30  3:19 ` Bryan Kadzban

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).