Skip to contentSkip to conversation

dracut-026: lsinitrd doesn't work with provided image

PATCH In review Wim Muskee 3 participants 7 messages Mar 11, 2013 – Mar 13, 2013 6 messages not in the archive

lore
Share & tools
lore

Wim Muskee

author
#0 lore raw

hi,

In dracut-026:

# dracut /boot/initramfs-dracut-x86_64-3.3.8-gentoo 3.3.8-gentoo
# lsinitrd /boot/initramfs-dracut-x86_64-3.3.8-gentoo

No <initramfs file> specified and the default image '/boot/initramfs-3.2.1-gentoo-r2.img}' cannot be accessed!

Usage: lsinitrd [-s] [<initramfs file> [<filename>]]

Looking at the lsinitrd, the provided image seems to be always overwritten after it has been set from $1.

regards, Wim

A message that is not in the archive (sent off-list or not yet received): CAKzfqkfwg_tW70VJbmgKg-Vs3O2DWLX36o0bMZhYvTL9U9QCRQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#2 lore raw
Quoted 6 lines · Wim Muskee

hi,

In dracut-026:

# dracut /boot/initramfs-dracut-x86_64-3.3.8-gentoo 3.3.8-gentoo
# lsinitrd /boot/initramfs-dracut-x86_64-3.3.8-gentoo
Quoted 8 lines

No <initramfs file> specified and the default image '/boot/initramfs-3.2.1-gentoo-r2.img}' cannot be accessed!

Usage: lsinitrd [-s] [<initramfs file> [<filename>]]

Looking at the lsinitrd, the provided image seems to be always overwritten after it has been set from $1.

The machine-id section should only be run in case without $1 as image name. Is below fix works for you?

lsinitrd.sh +13 -13
index 7a09423..fe723f7 100755
@@ -54,23 +54,23 @@ if [[ "$1" ]]; then
         usage
         exit 1
     fi
-fi
-
-[[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
-
-if [[ $MACHINE_ID ]] && ( [[ -d /boot/${MACHINE_ID} ]] || [[ -L /boot/${MACHINE_ID} ]] ); then
-    image="/boot/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
 else
-    image="/boot/initramfs-${KERNEL_VERSION}.img}"
-fi
+    [[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
 
-if ! [[ -f "$image" ]]; then
-    {
+    if [[ $MACHINE_ID ]] && ( [[ -d /boot/${MACHINE_ID} ]] || [[ -L /boot/${MACHINE_ID} ]] ); then
+        image="/boot/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
+    else
+        image="/boot/initramfs-${KERNEL_VERSION}.img}"
+    fi
+
+    if ! [[ -f "$image" ]]; then
+        {
         echo "No <initramfs file> specified and the default image '$image' cannot be accessed!"
         echo
-    } >&2
-    usage
-    exit 1
+        } >&2
+        usage
+        exit 1
+    fi
 fi
 
 CAT=zcat

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#4 lore raw
Quoted 50 lines · Dave Young
Quoted 6 lines · Wim Muskee

hi,

In dracut-026:

# dracut /boot/initramfs-dracut-x86_64-3.3.8-gentoo 3.3.8-gentoo
# lsinitrd /boot/initramfs-dracut-x86_64-3.3.8-gentoo
Quoted 8 lines

No <initramfs file> specified and the default image '/boot/initramfs-3.2.1-gentoo-r2.img}' cannot be accessed!

Usage: lsinitrd [-s] [<initramfs file> [<filename>]]

Looking at the lsinitrd, the provided image seems to be always overwritten after it has been set from $1.

The machine-id section should only be run in case without $1 as image name. Is below fix works for you?

lsinitrd.sh +9 -10
index 7a09423..fe723f7 100755
@@ -54,23 +54,23 @@ if [[ "$1" ]]; then
         usage
         exit 1
     fi
-fi
-
-[[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
-
-if [[ $MACHINE_ID ]] && ( [[ -d /boot/${MACHINE_ID} ]] || [[ -L /boot/${MACHINE_ID} ]] ); then
-    image="/boot/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
 else
-    image="/boot/initramfs-${KERNEL_VERSION}.img}"
-fi
+    [[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
 
-if ! [[ -f "$image" ]]; then
-    {
+    if [[ $MACHINE_ID ]] && ( [[ -d /boot/${MACHINE_ID} ]] || [[ -L /boot/${MACHINE_ID} ]] ); then
+        image="/boot/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
+    else
+        image="/boot/initramfs-${KERNEL_VERSION}.img}"
+    fi
+
+    if ! [[ -f "$image" ]]; then
+        {
         echo "No <initramfs file> specified and the default image '$image' cannot be accessed!"
         echo

lsinitrd.sh if [[ "$1" ]]; then · line 76

Quoted 10 lines
lsinitrd.sh +4 -3
-    } >&2
-    usage
-    exit 1
+        } >&2
+        usage
+        exit 1
+    fi
 fi
 
 CAT=zcat

Yes, the patch works for me, thx.

A message that is not in the archive (sent off-list or not yet received): CAKzfqkeUkknOwONqZkuZ8c56+5iNLxigLv+K70sSDXuvPaabZg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#6 lore raw

Am 12.03.2013 15:35, schrieb Wim Muskee:

Quoted 39 lines · Dave Young
Quoted 38 lines · Wim Muskee
Quoted 6 lines

hi,

In dracut-026:

# dracut /boot/initramfs-dracut-x86_64-3.3.8-gentoo 3.3.8-gentoo
# lsinitrd /boot/initramfs-dracut-x86_64-3.3.8-gentoo
Quoted 8 lines

No <initramfs file> specified and the default image '/boot/initramfs-3.2.1-gentoo-r2.img}' cannot be accessed!

Usage: lsinitrd [-s] [<initramfs file> [<filename>]]

Looking at the lsinitrd, the provided image seems to be always overwritten after it has been set from $1.

The machine-id section should only be run in case without $1 as image name. Is below fix works for you?

lsinitrd.sh +1 -8
index 7a09423..fe723f7 100755
@@ -54,23 +54,23 @@ if [[ "$1" ]]; then
         usage
         exit 1
     fi
-fi
-
-[[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
-
-if [[ $MACHINE_ID ]] && ( [[ -d /boot/${MACHINE_ID} ]] || [[ -L /boot/${MACHINE_ID} ]] ); then
-    image="/boot/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
 else
-    image="/boot/initramfs-${KERNEL_VERSION}.img}"
-fi
+    [[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
 
Quoted 6 lines

lsinitrd.sh if [[ "$1" ]]; then · line 63

Quoted 6 lines
lsinitrd.sh +4 -2
-if ! [[ -f "$image" ]]; then
-    {
+    if [[ $MACHINE_ID ]] && ( [[ -d /boot/${MACHINE_ID} ]] || [[ -L /boot/${MACHINE_ID} ]] ); then
+        image="/boot/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
+    else
+        image="/boot/initramfs-${KERNEL_VERSION}.img}"

typo.. trailing "}"

A message that is not in the archive (sent off-list or not yet received): [email protected]

#8 lore raw

PATCH 1/1 Do not override user specified initramfs image name

The code section for setting default initramfs image name is only for the case that user has not specified image name argument.

Moving the code to else section of below:

if [[ "$1" ]]; then
...
else
...
fi

Also remove the typo of trailing '}'

---

lsinitrd.sh +13 -13
index 7a09423..fe723f7 100755
@@ -54,23 +54,23 @@ if [[ "$1" ]]; then
         usage
         exit 1
     fi
-fi
-
-[[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
-
-if [[ $MACHINE_ID ]] && ( [[ -d /boot/${MACHINE_ID} ]] || [[ -L /boot/${MACHINE_ID} ]] ); then
-    image="/boot/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
 else
-    image="/boot/initramfs-${KERNEL_VERSION}.img}"
-fi
+    [[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
 
-if ! [[ -f "$image" ]]; then
-    {
+    if [[ $MACHINE_ID ]] && ( [[ -d /boot/${MACHINE_ID} ]] || [[ -L /boot/${MACHINE_ID} ]] ); then
+        image="/boot/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
+    else
+        image="/boot/initramfs-${KERNEL_VERSION}.img"
+    fi
+
+    if ! [[ -f "$image" ]]; then
+        {
         echo "No <initramfs file> specified and the default image '$image' cannot be accessed!"
         echo
-    } >&2
-    usage
-    exit 1
+        } >&2
+        usage
+        exit 1
+    fi
 fi
 
 CAT=zcat

A message that is not in the archive (sent off-list or not yet received): [email protected]

#10 lore raw

Re: [PATCH] Do not override user specified initramfs image name

Am 13.03.2013 02:48, schrieb Dave Young:

Quoted 50 lines

The code section for setting default initramfs image name is only for the case that user has not specified image name argument.

Moving the code to else section of below:

if [[ "$1" ]]; then
...
else
...
fi

Also remove the typo of trailing '}'

---

lsinitrd.sh +9 -10
index 7a09423..fe723f7 100755
@@ -54,23 +54,23 @@ if [[ "$1" ]]; then
         usage
         exit 1
     fi
-fi
-
-[[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
-
-if [[ $MACHINE_ID ]] && ( [[ -d /boot/${MACHINE_ID} ]] || [[ -L /boot/${MACHINE_ID} ]] ); then
-    image="/boot/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
 else
-    image="/boot/initramfs-${KERNEL_VERSION}.img}"
-fi
+    [[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
 
-if ! [[ -f "$image" ]]; then
-    {
+    if [[ $MACHINE_ID ]] && ( [[ -d /boot/${MACHINE_ID} ]] || [[ -L /boot/${MACHINE_ID} ]] ); then
+        image="/boot/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
+    else
+        image="/boot/initramfs-${KERNEL_VERSION}.img"
+    fi
+
+    if ! [[ -f "$image" ]]; then
+        {
         echo "No <initramfs file> specified and the default image '$image' cannot be accessed!"
         echo

lsinitrd.sh if [[ "$1" ]]; then · line 76

Quoted 10 lines
lsinitrd.sh +4 -3
-    } >&2
-    usage
-    exit 1
+        } >&2
+        usage
+        exit 1
+    fi
 fi
 
 CAT=zcat

see
http://git.kernel.org/cgit/boot/dracut/dracut.git/commit/?id=727e68d0b5cb93eb6c6e00f0541b8519657a2597
and
http://git.kernel.org/cgit/boot/dracut/dracut.git/commit/?id=d928724c3cf464a495c11162042951887b80f5e6

already committed on 2013-03-11

A message that is not in the archive (sent off-list or not yet received): [email protected]

#12 lore raw

Re: [PATCH] Do not override user specified initramfs image name

Quoted 67 lines · Harald Hoyer

Am 13.03.2013 02:48, schrieb Dave Young:

Quoted 50 lines

The code section for setting default initramfs image name is only for the case that user has not specified image name argument.

Moving the code to else section of below:

if [[ "$1" ]]; then
...
else
...
fi

Also remove the typo of trailing '}'

---

lsinitrd.sh +9 -10
index 7a09423..fe723f7 100755
@@ -54,23 +54,23 @@ if [[ "$1" ]]; then
         usage
         exit 1
     fi
-fi
-
-[[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
-
-if [[ $MACHINE_ID ]] && ( [[ -d /boot/${MACHINE_ID} ]] || [[ -L /boot/${MACHINE_ID} ]] ); then
-    image="/boot/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
 else
-    image="/boot/initramfs-${KERNEL_VERSION}.img}"
-fi
+    [[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
 
-if ! [[ -f "$image" ]]; then
-    {
+    if [[ $MACHINE_ID ]] && ( [[ -d /boot/${MACHINE_ID} ]] || [[ -L /boot/${MACHINE_ID} ]] ); then
+        image="/boot/${MACHINE_ID}/${KERNEL_VERSION}/initrd"
+    else
+        image="/boot/initramfs-${KERNEL_VERSION}.img"
+    fi
+
+    if ! [[ -f "$image" ]]; then
+        {
         echo "No <initramfs file> specified and the default image '$image' cannot be accessed!"
         echo

lsinitrd.sh if [[ "$1" ]]; then · line 76

Quoted 10 lines
lsinitrd.sh +4 -3
-    } >&2
-    usage
-    exit 1
+        } >&2
+        usage
+        exit 1
+    fi
 fi
 
 CAT=zcat

see
http://git.kernel.org/cgit/boot/dracut/dracut.git/commit/?id=727e68d0b5cb93eb6c6e00f0541b8519657a2597
and
http://git.kernel.org/cgit/boot/dracut/dracut.git/commit/?id=d928724c3cf464a495c11162042951887b80f5e6

Quoted 3 lines

already committed on 2013-03-11

Good to know, thanks for tell.

Signature · 2 lines
Thanks
Dave