Udev-ldap workaround
From ArchWiki
Here is a workaround for udev and ldap. This solves the issue of udev hanging on boot forever.
This patch will rewrite the nsswitch.conf file on boot prior to udev loading. It will also replace it once the / filesystem is remounted rw. Make sure you copy nsswitch.ldap to nsswitch.conf as recommended per the documentation.
NOTE: It will work with any nsswitch.conf that has group: files ldap.
The patch is below for rc.sysinit
How to Apply
System Information:
- Arch Linux 0.8 Don't Panic
- udev 114-1
[cdowns@ArchVM08 rc.sysinit]$ sudo patch -p0 /etc/rc.sysinit < rc.sysinit.diff Password: patching file /etc/rc.sysinit [cdowns@ArchVM08 rc.sysinit]$
--- rc.sysinit 2007-09-14 17:01:37.000000000 -0500 +++ rc.sysinit_mod 2007-09-14 17:00:37.000000000 -0500 @@ -16,6 +16,33 @@ # start up our mini logger until syslog takes over /sbin/minilogd +# check nsswitch.conf for group: files ldap on boot. +# if found rewrite nsswitch.conf. +# NOTE: this is using nsswitch.ldap copied to -> nsswitch.conf +# cdowns\@openmethods.com +function udev_ldap_hack() { + status "Starting LDAP Udev Check" mount -o remount,rw / + if [ -e /tmp/nsswitch.udev ] ; then + rm /tmp/nsswitch.udev + fi + if [ -f /etc/nsswitch.conf ] ; then + sed -e 's/group:\s*files ldap/group:\t\tfiles/' /etc/nsswitch.conf >> /tmp/nsswitch.udev + status "Ending LDAP Check" mount -o remount,ro / + sleep 2 + fi +} + +function udev_ldap_restore() { + status "Restoring LDAP config" + if [ -e /tmp/nsswitch.udev ] ; then + rm /tmp/nsswitch.udev + fi + if [ -f /etc/nsswitch.conf ] ; then + sed -e 's/group:\s*files/group:\t\tfiles ldap/' /etc/nsswitch.conf >> /tmp/nsswitch.udev + sleep 2 + fi +} + # mount /proc mount -n -t proc none /proc @@ -33,6 +60,9 @@ /sbin/modprobe usbcore >/dev/null 2>&1 grep -qw usbfs /proc/filesystems && mount -n -t usbfs none /proc/bus/usb +## run the udev_ldap_hack +udev_ldap_hack + if [ -x /etc/start_udev -a -d /sys/block ]; then # We have a start_udev script and /sys appears to be mounted, use UDev status "Starting UDev Daemon" /etc/start_udev init @@ -268,6 +298,11 @@ mount -t usbfs none /proc/bus/usb fi fi + + +# set ldap nsswitch.conf back to normal. +udev_ldap_restore + # now mount all the local filesystems /bin/mount -a -t $NETFS stat_done @@ -341,7 +376,7 @@ /usr/bin/kbd_mode -u /usr/bin/dumpkeys | /bin/loadkeys --unicode # the $CONSOLE check helps us avoid this when running scripts from cron - echo 'if [ "$CONSOLE" = "" -a "$TERM" = "linux" -a isatty ]; then echo -ne "\e%G"; fi' >>/etc/profile.d/locale.sh + echo 'if [ "$CONSOLE" = "" -a "$TERM" = "linux" -a -t 1 ]; then echo -ne "\e%G"; fi' >>/etc/profile.d/locale.sh stat_done fi @@ -355,7 +390,7 @@ fi done # the $CONSOLE check helps us avoid this when running scripts from cron - echo 'if [ "$CONSOLE" = "" -a "$TERM" = "linux" -a isatty ]; then echo -ne "\e(K"; fi' >>/etc/profile.d/locale.sh + echo 'if [ "$CONSOLE" = "" -a "$TERM" = "linux" -a -t 1 ]; then echo -ne "\e(K"; fi' >>/etc/profile.d/locale.sh stat_done fi # Adding persistent network/cdrom generated rules