[arch-projects] [PATCH] [RFC][mkinitcpio] Cleanly stop udev >= 168 as recommended by upstream.
N0: udev >= 168 is needed. N1: I guess the order is correct (first cleanup then exit). N2: device-mapper/LVM udev rules must be parsed for initramfs creation to add OPTIONS+="db_persist"
From udev NEWS: The running udev daemon can now cleanly shut down with: udevadm control --exit
Udev in initramfs should clean the state of the udev database with: udevadm info --cleanup-db which will remove all state left behind from events/rules in initramfs. If initramfs uses --cleanup-db and device-mapper/LVM, the rules in initramfs need to add OPTIONS+="db_persist" for all dm devices. This will prevent removal of the udev database for these devices. Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> --- init | 13 ++++--------- 1 files changed, 4 insertions(+), 9 deletions(-) diff --git a/init b/init index 7b81a1a..a2c6c8a 100644 --- a/init +++ b/init @@ -118,15 +118,10 @@ elif [ ! -x "/new_root${init}" ]; then launch_interactive_shell --exec fi -#Special handling if udev is running -udevpid=$(/bin/pidof udevd) -if [ -n "${udevpid}" ]; then - # Settle pending uevents, then kill udev - /sbin/udevadm settle - /bin/kill ${udevpid} > /dev/null 2>&1 - while /bin/pidof udevd >/dev/null; do - sleep 0.1 - done +# Stop udevd if is running +if [ "${udevd_running}" -eq 1 ]; then + /sbin/udevadm info --cleanup-db + /sbin/udevadm control --exit fi for d in proc sys dev run; do -- 1.7.5
On 04/30/2011 05:47 PM, Gerardo Exequiel Pozzi wrote:
N0: udev>= 168 is needed. N1: I guess the order is correct (first cleanup then exit). N2: device-mapper/LVM udev rules must be parsed for initramfs creation to add OPTIONS+="db_persist"
From udev NEWS: The running udev daemon can now cleanly shut down with: udevadm control --exit
Udev in initramfs should clean the state of the udev database with: udevadm info --cleanup-db which will remove all state left behind from events/rules in initramfs. If initramfs uses --cleanup-db and device-mapper/LVM, the rules in initramfs need to add OPTIONS+="db_persist" for all dm devices. This will prevent removal of the udev database for these devices. I just tested this setup: /dev/mapper/raiz (ext4) [/] (sda2 -> pv -> vg -> lv) /dev/sda1 (ext4) [/boot]
Without touching any udev rule and booting from it works OK. I don't know the case that db_persist is needed.
Signed-off-by: Gerardo Exequiel Pozzi<vmlinuz386@yahoo.com.ar> --- init | 13 ++++--------- 1 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/init b/init index 7b81a1a..a2c6c8a 100644 --- a/init +++ b/init @@ -118,15 +118,10 @@ elif [ ! -x "/new_root${init}" ]; then launch_interactive_shell --exec fi
-#Special handling if udev is running -udevpid=$(/bin/pidof udevd) -if [ -n "${udevpid}" ]; then - # Settle pending uevents, then kill udev - /sbin/udevadm settle - /bin/kill ${udevpid}> /dev/null 2>&1 - while /bin/pidof udevd>/dev/null; do - sleep 0.1 - done +# Stop udevd if is running +if [ "${udevd_running}" -eq 1 ]; then + /sbin/udevadm info --cleanup-db + /sbin/udevadm control --exit fi
for d in proc sys dev run; do
-- Gerardo Exequiel Pozzi \cos^2\alpha + \sin^2\alpha = 1
Am 30.04.2011 22:47, schrieb Gerardo Exequiel Pozzi:
N0: udev >= 168 is needed.
What for?
N1: I guess the order is correct (first cleanup then exit). N2: device-mapper/LVM udev rules must be parsed for initramfs creation to add OPTIONS+="db_persist"
What does this cleanup do? Do we actually need it? In any case, we might still want to check if udev exited properly before proceeding.
On 05/01/2011 07:59 PM, Thomas Bächler wrote:
N0: udev>= 168 is needed. What for? For this patch. Newer commands introduced in udev 168. N1: I guess the order is correct (first cleanup then exit). N2: device-mapper/LVM udev rules must be parsed for initramfs creation to add OPTIONS+="db_persist" What does this cleanup do? Do we actually need it? Remove files from /run/udev. Is what upstream recommend to do in initramfs stage, before re-run udevd on real root. In any case, we might still want to check if udev exited properly before
Am 30.04.2011 22:47, schrieb Gerardo Exequiel Pozzi: proceeding. From udevadm(8) manpage: control --exit Signal and wait for udevd to exit.
-- Gerardo Exequiel Pozzi \cos^2\alpha + \sin^2\alpha = 1
On Sat, Apr 30, 2011 at 10:47 PM, Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> wrote:
N0: udev >= 168 is needed. N1: I guess the order is correct (first cleanup then exit). N2: device-mapper/LVM udev rules must be parsed for initramfs creation to add OPTIONS+="db_persist"
From udev NEWS: The running udev daemon can now cleanly shut down with: udevadm control --exit
Udev in initramfs should clean the state of the udev database with: udevadm info --cleanup-db which will remove all state left behind from events/rules in initramfs. If initramfs uses --cleanup-db and device-mapper/LVM, the rules in initramfs need to add OPTIONS+="db_persist" for all dm devices. This will prevent removal of the udev database for these devices.
Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> --- init | 13 ++++--------- 1 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/init b/init index 7b81a1a..a2c6c8a 100644 --- a/init +++ b/init @@ -118,15 +118,10 @@ elif [ ! -x "/new_root${init}" ]; then launch_interactive_shell --exec fi
-#Special handling if udev is running -udevpid=$(/bin/pidof udevd) -if [ -n "${udevpid}" ]; then - # Settle pending uevents, then kill udev - /sbin/udevadm settle - /bin/kill ${udevpid} > /dev/null 2>&1 - while /bin/pidof udevd >/dev/null; do - sleep 0.1 - done +# Stop udevd if is running +if [ "${udevd_running}" -eq 1 ]; then Hi Gerardo,
You should use bash style as much as possible.
+ /sbin/udevadm info --cleanup-db + /sbin/udevadm control --exit fi
for d in proc sys dev run; do -- 1.7.5
-- Sébastien Luttringer www.seblu.net
On Mon, May 02, 2011 at 04:11:08AM +0200, Seblu wrote:
On Sat, Apr 30, 2011 at 10:47 PM, Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> wrote:
N0: udev >= 168 is needed. N1: I guess the order is correct (first cleanup then exit). N2: device-mapper/LVM udev rules must be parsed for initramfs creation to add OPTIONS+="db_persist"
From udev NEWS: The running udev daemon can now cleanly shut down with: udevadm control --exit
Udev in initramfs should clean the state of the udev database with: udevadm info --cleanup-db which will remove all state left behind from events/rules in initramfs. If initramfs uses --cleanup-db and device-mapper/LVM, the rules in initramfs need to add OPTIONS+="db_persist" for all dm devices. This will prevent removal of the udev database for these devices.
Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> --- init | 13 ++++--------- 1 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/init b/init index 7b81a1a..a2c6c8a 100644 --- a/init +++ b/init @@ -118,15 +118,10 @@ elif [ ! -x "/new_root${init}" ]; then launch_interactive_shell --exec fi
-#Special handling if udev is running -udevpid=$(/bin/pidof udevd) -if [ -n "${udevpid}" ]; then - # Settle pending uevents, then kill udev - /sbin/udevadm settle - /bin/kill ${udevpid} > /dev/null 2>&1 - while /bin/pidof udevd >/dev/null; do - sleep 0.1 - done +# Stop udevd if is running +if [ "${udevd_running}" -eq 1 ]; then Hi Gerardo,
You should use bash style as much as possible.
But this isn't a bash environment. It's busybox ash. dave
On Mon, May 2, 2011 at 4:21 AM, Dave Reisner <d@falconindy.com> wrote:
On Mon, May 02, 2011 at 04:11:08AM +0200, Seblu wrote:
On Sat, Apr 30, 2011 at 10:47 PM, Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> wrote:
N0: udev >= 168 is needed. N1: I guess the order is correct (first cleanup then exit). N2: device-mapper/LVM udev rules must be parsed for initramfs creation to add OPTIONS+="db_persist"
From udev NEWS: The running udev daemon can now cleanly shut down with: udevadm control --exit
Udev in initramfs should clean the state of the udev database with: udevadm info --cleanup-db which will remove all state left behind from events/rules in initramfs. If initramfs uses --cleanup-db and device-mapper/LVM, the rules in initramfs need to add OPTIONS+="db_persist" for all dm devices. This will prevent removal of the udev database for these devices.
Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> --- init | 13 ++++--------- 1 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/init b/init index 7b81a1a..a2c6c8a 100644 --- a/init +++ b/init @@ -118,15 +118,10 @@ elif [ ! -x "/new_root${init}" ]; then launch_interactive_shell --exec fi
-#Special handling if udev is running -udevpid=$(/bin/pidof udevd) -if [ -n "${udevpid}" ]; then - # Settle pending uevents, then kill udev - /sbin/udevadm settle - /bin/kill ${udevpid} > /dev/null 2>&1 - while /bin/pidof udevd >/dev/null; do - sleep 0.1 - done +# Stop udevd if is running +if [ "${udevd_running}" -eq 1 ]; then Hi Gerardo,
You should use bash style as much as possible.
But this isn't a bash environment. It's busybox ash.
Sorry for the noise. Cheers, -- Sébastien Luttringer www.seblu.net
participants (4)
-
Dave Reisner
-
Gerardo Exequiel Pozzi
-
Seblu
-
Thomas Bächler