Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH 1/2] init-install: fix grub-install command
@ 2017-11-21 21:47 California Sullivan
  2017-11-21 21:47 ` [PATCH 2/2] install*.sh: add short sleep after parted commands California Sullivan
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: California Sullivan @ 2017-11-21 21:47 UTC (permalink / raw)
  To: openembedded-core

The grub_version variable was calling 'grub-install -v' (verbose) instead
of 'grub-install -V' (version) causing unexpected failures.

Fixes bug [YOCTO #12111].

Signed-off-by: California Sullivan <california.l.sullivan@intel.com>
---
 meta/recipes-core/initrdscripts/files/init-install.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/recipes-core/initrdscripts/files/init-install.sh b/meta/recipes-core/initrdscripts/files/init-install.sh
index 572613e..1cac806 100644
--- a/meta/recipes-core/initrdscripts/files/init-install.sh
+++ b/meta/recipes-core/initrdscripts/files/init-install.sh
@@ -132,7 +132,7 @@ fi
 
 disk_size=$(parted ${device} unit mb print | grep '^Disk .*: .*MB' | cut -d" " -f 3 | sed -e "s/MB//")
 
-grub_version=$(grub-install -v|sed 's/.* \([0-9]\).*/\1/')
+grub_version=$(grub-install -V|sed 's/.* \([0-9]\).*/\1/')
 
 if [ $grub_version -eq 0 ] ; then
     bios_boot_size=0
-- 
2.9.5



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

* [PATCH 2/2] install*.sh: add short sleep after parted commands
  2017-11-21 21:47 [PATCH 1/2] init-install: fix grub-install command California Sullivan
@ 2017-11-21 21:47 ` California Sullivan
  2017-11-21 22:27   ` Saul Wold
  2017-11-21 23:02 ` [PATCH v2 " California Sullivan
  2017-12-07 18:19 ` [PATCH 1/2] init-install: fix grub-install command Cal Sullivan
  2 siblings, 1 reply; 6+ messages in thread
From: California Sullivan @ 2017-11-21 21:47 UTC (permalink / raw)
  To: openembedded-core

I wasn't able to install to my Optane SSD due to the following error:

Formatting /dev/nvme0n1p1 to vfat...
mkfs.fat 4.1 (2017-01-24)
mkfs.vfat: unable to open /dev/nvme0n1p1: No such file or directory
Target install-efi failed

A couple lines later I see:

[    10.265401]  nvme0n1: p1 p2 p3

Then looking at the device itself after booting from a USB stick:

root@intel-corei7-64: ~# ls /dev/nvme0n1*
/dev/nvme0n1 /dev/nvme0n1p1 /dev/nvme0n1p2 /dev/nvme0n1p3

So it looks like the parted commands return before the device node is
actually created.

Work around this issue by adding a short sleep before doing the mkfs
commands.

Signed-off-by: California Sullivan <california.l.sullivan@intel.com>
---
 meta/recipes-core/initrdscripts/files/init-install-efi.sh | 2 ++
 meta/recipes-core/initrdscripts/files/init-install.sh     | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/meta/recipes-core/initrdscripts/files/init-install-efi.sh b/meta/recipes-core/initrdscripts/files/init-install-efi.sh
index 5ad3a60..118bf08 100644
--- a/meta/recipes-core/initrdscripts/files/init-install-efi.sh
+++ b/meta/recipes-core/initrdscripts/files/init-install-efi.sh
@@ -186,6 +186,8 @@ parted ${device} mkpart swap linux-swap $swap_start 100%
 
 parted ${device} print
 
+sleep 1
+
 echo "Formatting $bootfs to vfat..."
 mkfs.vfat $bootfs
 
diff --git a/meta/recipes-core/initrdscripts/files/init-install.sh b/meta/recipes-core/initrdscripts/files/init-install.sh
index 1cac806..606317d 100644
--- a/meta/recipes-core/initrdscripts/files/init-install.sh
+++ b/meta/recipes-core/initrdscripts/files/init-install.sh
@@ -211,6 +211,8 @@ parted ${device} mkpart $pname linux-swap $swap_start 100%
 
 parted ${device} print
 
+sleep 1
+
 echo "Formatting $bootfs to ext3..."
 mkfs.ext3 $bootfs
 
-- 
2.9.5



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

* Re: [PATCH 2/2] install*.sh: add short sleep after parted commands
  2017-11-21 21:47 ` [PATCH 2/2] install*.sh: add short sleep after parted commands California Sullivan
@ 2017-11-21 22:27   ` Saul Wold
  0 siblings, 0 replies; 6+ messages in thread
From: Saul Wold @ 2017-11-21 22:27 UTC (permalink / raw)
  To: California Sullivan, openembedded-core

On Tue, 2017-11-21 at 13:47 -0800, California Sullivan wrote:
> I wasn't able to install to my Optane SSD due to the following error:
> 
> Formatting /dev/nvme0n1p1 to vfat...
> mkfs.fat 4.1 (2017-01-24)
> mkfs.vfat: unable to open /dev/nvme0n1p1: No such file or directory
> Target install-efi failed
> 
> A couple lines later I see:
> 
> [    10.265401]  nvme0n1: p1 p2 p3
> 
> Then looking at the device itself after booting from a USB stick:
> 
> root@intel-corei7-64: ~# ls /dev/nvme0n1*
> /dev/nvme0n1 /dev/nvme0n1p1 /dev/nvme0n1p2 /dev/nvme0n1p3
> 
> So it looks like the parted commands return before the device node is
> actually created.
> 
> Work around this issue by adding a short sleep before doing the mkfs
> commands.
> 
Not advisable to just add the sleep, maybe a check before to see if the
device exists and then sleep (or usleep, if we have it) and do this in
a while loop with a counter to actually timeout after some number of
sleeps.

Yes more work, but more appropriate if the settle time is not actually
needed or a longer settle time is required.

Thanks
Sau!

> Signed-off-by: California Sullivan <california.l.sullivan@intel.com>
> ---
>  meta/recipes-core/initrdscripts/files/init-install-efi.sh | 2 ++
>  meta/recipes-core/initrdscripts/files/init-install.sh     | 2 ++
>  2 files changed, 4 insertions(+)
> 
> diff --git a/meta/recipes-core/initrdscripts/files/init-install-
> efi.sh b/meta/recipes-core/initrdscripts/files/init-install-efi.sh
> index 5ad3a60..118bf08 100644
> --- a/meta/recipes-core/initrdscripts/files/init-install-efi.sh
> +++ b/meta/recipes-core/initrdscripts/files/init-install-efi.sh
> @@ -186,6 +186,8 @@ parted ${device} mkpart swap linux-swap
> $swap_start 100%
>  
>  parted ${device} print
>  
> +sleep 1
> +
>  echo "Formatting $bootfs to vfat..."
>  mkfs.vfat $bootfs
>  
> diff --git a/meta/recipes-core/initrdscripts/files/init-install.sh
> b/meta/recipes-core/initrdscripts/files/init-install.sh
> index 1cac806..606317d 100644
> --- a/meta/recipes-core/initrdscripts/files/init-install.sh
> +++ b/meta/recipes-core/initrdscripts/files/init-install.sh
> @@ -211,6 +211,8 @@ parted ${device} mkpart $pname linux-swap
> $swap_start 100%
>  
>  parted ${device} print
>  
> +sleep 1
> +
>  echo "Formatting $bootfs to ext3..."
>  mkfs.ext3 $bootfs
>  
> -- 
> 2.9.5
> 


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

* [PATCH v2 2/2] install*.sh: add short sleep after parted commands
  2017-11-21 21:47 [PATCH 1/2] init-install: fix grub-install command California Sullivan
  2017-11-21 21:47 ` [PATCH 2/2] install*.sh: add short sleep after parted commands California Sullivan
@ 2017-11-21 23:02 ` California Sullivan
  2017-11-21 23:04   ` Wold, Saul
  2017-12-07 18:19 ` [PATCH 1/2] init-install: fix grub-install command Cal Sullivan
  2 siblings, 1 reply; 6+ messages in thread
From: California Sullivan @ 2017-11-21 23:02 UTC (permalink / raw)
  To: openembedded-core; +Cc: saul.wold

I wasn't able to install to my Optane SSD due to the following error:

Formatting /dev/nvme0n1p1 to vfat...
mkfs.fat 4.1 (2017-01-24)
mkfs.vfat: unable to open /dev/nvme0n1p1: No such file or directory
Target install-efi failed

A couple lines later I see:

[    10.265401]  nvme0n1: p1 p2 p3

Then looking at the device itself after booting from a USB stick:

root@intel-corei7-64: ~# ls /dev/nvme0n1*
/dev/nvme0n1 /dev/nvme0n1p1 /dev/nvme0n1p2 /dev/nvme0n1p3

So it looks like the parted commands return before the device node is
actually created.

Work around this issue by waiting for device nodes for a short duration.

Signed-off-by: California Sullivan <california.l.sullivan@intel.com>
---
v2: sleep conditionally for up to three seconds instead of one second
unconditionally. This makes it so if the device nodes are available
immediately, people don't have to wait, but a system has up to three
seconds to create them before failing. 

 meta/recipes-core/initrdscripts/files/init-install-efi.sh | 7 +++++++
 meta/recipes-core/initrdscripts/files/init-install.sh     | 7 +++++++
 2 files changed, 14 insertions(+)

diff --git a/meta/recipes-core/initrdscripts/files/init-install-efi.sh b/meta/recipes-core/initrdscripts/files/init-install-efi.sh
index 5ad3a60..706418f 100644
--- a/meta/recipes-core/initrdscripts/files/init-install-efi.sh
+++ b/meta/recipes-core/initrdscripts/files/init-install-efi.sh
@@ -186,6 +186,13 @@ parted ${device} mkpart swap linux-swap $swap_start 100%
 
 parted ${device} print
 
+echo "Waiting for device nodes..."
+C=0
+while [ $C -ne 3 ] && [ ! -e $bootfs  -o ! -e $rootfs -o ! -e $swap ]; do
+    C=$(( C + 1 ))
+    sleep 1
+done
+
 echo "Formatting $bootfs to vfat..."
 mkfs.vfat $bootfs
 
diff --git a/meta/recipes-core/initrdscripts/files/init-install.sh b/meta/recipes-core/initrdscripts/files/init-install.sh
index 1cac806..dade059 100644
--- a/meta/recipes-core/initrdscripts/files/init-install.sh
+++ b/meta/recipes-core/initrdscripts/files/init-install.sh
@@ -211,6 +211,13 @@ parted ${device} mkpart $pname linux-swap $swap_start 100%
 
 parted ${device} print
 
+echo "Waiting for device nodes..."
+C=0
+while [ $C -ne 3 ] && [ ! -e $bootfs  -o ! -e $rootfs -o ! -e $swap ]; do
+    C=$(( C + 1 ))
+    sleep 1
+done
+
 echo "Formatting $bootfs to ext3..."
 mkfs.ext3 $bootfs
 
-- 
2.9.5



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

* Re: [PATCH v2 2/2] install*.sh: add short sleep after parted commands
  2017-11-21 23:02 ` [PATCH v2 " California Sullivan
@ 2017-11-21 23:04   ` Wold, Saul
  0 siblings, 0 replies; 6+ messages in thread
From: Wold, Saul @ 2017-11-21 23:04 UTC (permalink / raw)
  To: Sullivan, California L, openembedded-core@lists.openembedded.org


Much better!

Sau!

On Tue, 2017-11-21 at 15:02 -0800, California Sullivan wrote:
> I wasn't able to install to my Optane SSD due to the following error:
> 
> Formatting /dev/nvme0n1p1 to vfat...
> mkfs.fat 4.1 (2017-01-24)
> mkfs.vfat: unable to open /dev/nvme0n1p1: No such file or directory
> Target install-efi failed
> 
> A couple lines later I see:
> 
> [    10.265401]  nvme0n1: p1 p2 p3
> 
> Then looking at the device itself after booting from a USB stick:
> 
> root@intel-corei7-64: ~# ls /dev/nvme0n1*
> /dev/nvme0n1 /dev/nvme0n1p1 /dev/nvme0n1p2 /dev/nvme0n1p3
> 
> So it looks like the parted commands return before the device node is
> actually created.
> 
> Work around this issue by waiting for device nodes for a short
> duration.
> 
> Signed-off-by: California Sullivan <california.l.sullivan@intel.com>
> ---
> v2: sleep conditionally for up to three seconds instead of one second
> unconditionally. This makes it so if the device nodes are available
> immediately, people don't have to wait, but a system has up to three
> seconds to create them before failing. 
> 
>  meta/recipes-core/initrdscripts/files/init-install-efi.sh | 7
> +++++++
>  meta/recipes-core/initrdscripts/files/init-install.sh     | 7
> +++++++
>  2 files changed, 14 insertions(+)
> 
> diff --git a/meta/recipes-core/initrdscripts/files/init-install-
> efi.sh b/meta/recipes-core/initrdscripts/files/init-install-efi.sh
> index 5ad3a60..706418f 100644
> --- a/meta/recipes-core/initrdscripts/files/init-install-efi.sh
> +++ b/meta/recipes-core/initrdscripts/files/init-install-efi.sh
> @@ -186,6 +186,13 @@ parted ${device} mkpart swap linux-swap
> $swap_start 100%
>  
>  parted ${device} print
>  
> +echo "Waiting for device nodes..."
> +C=0
> +while [ $C -ne 3 ] && [ ! -e $bootfs  -o ! -e $rootfs -o ! -e $swap
> ]; do
> +    C=$(( C + 1 ))
> +    sleep 1
> +done
> +
>  echo "Formatting $bootfs to vfat..."
>  mkfs.vfat $bootfs
>  
> diff --git a/meta/recipes-core/initrdscripts/files/init-install.sh
> b/meta/recipes-core/initrdscripts/files/init-install.sh
> index 1cac806..dade059 100644
> --- a/meta/recipes-core/initrdscripts/files/init-install.sh
> +++ b/meta/recipes-core/initrdscripts/files/init-install.sh
> @@ -211,6 +211,13 @@ parted ${device} mkpart $pname linux-swap
> $swap_start 100%
>  
>  parted ${device} print
>  
> +echo "Waiting for device nodes..."
> +C=0
> +while [ $C -ne 3 ] && [ ! -e $bootfs  -o ! -e $rootfs -o ! -e $swap
> ]; do
> +    C=$(( C + 1 ))
> +    sleep 1
> +done
> +
>  echo "Formatting $bootfs to ext3..."
>  mkfs.ext3 $bootfs
>  

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

* Re: [PATCH 1/2] init-install: fix grub-install command
  2017-11-21 21:47 [PATCH 1/2] init-install: fix grub-install command California Sullivan
  2017-11-21 21:47 ` [PATCH 2/2] install*.sh: add short sleep after parted commands California Sullivan
  2017-11-21 23:02 ` [PATCH v2 " California Sullivan
@ 2017-12-07 18:19 ` Cal Sullivan
  2 siblings, 0 replies; 6+ messages in thread
From: Cal Sullivan @ 2017-12-07 18:19 UTC (permalink / raw)
  To: openembedded-core

Hi Armin,

This is also suitable for Rocko. Please add it to your backport queue 
when you can.

Its in master here: 
http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=0b8460e2ce9f9a4ea8de8497fbb65b91cb69b8e0

Thanks,
Cal

On 11/21/2017 01:47 PM, California Sullivan wrote:
> The grub_version variable was calling 'grub-install -v' (verbose) instead
> of 'grub-install -V' (version) causing unexpected failures.
>
> Fixes bug [YOCTO #12111].
>
> Signed-off-by: California Sullivan <california.l.sullivan@intel.com>
> ---
>   meta/recipes-core/initrdscripts/files/init-install.sh | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/meta/recipes-core/initrdscripts/files/init-install.sh b/meta/recipes-core/initrdscripts/files/init-install.sh
> index 572613e..1cac806 100644
> --- a/meta/recipes-core/initrdscripts/files/init-install.sh
> +++ b/meta/recipes-core/initrdscripts/files/init-install.sh
> @@ -132,7 +132,7 @@ fi
>   
>   disk_size=$(parted ${device} unit mb print | grep '^Disk .*: .*MB' | cut -d" " -f 3 | sed -e "s/MB//")
>   
> -grub_version=$(grub-install -v|sed 's/.* \([0-9]\).*/\1/')
> +grub_version=$(grub-install -V|sed 's/.* \([0-9]\).*/\1/')
>   
>   if [ $grub_version -eq 0 ] ; then
>       bios_boot_size=0



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

end of thread, other threads:[~2017-12-07 18:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-21 21:47 [PATCH 1/2] init-install: fix grub-install command California Sullivan
2017-11-21 21:47 ` [PATCH 2/2] install*.sh: add short sleep after parted commands California Sullivan
2017-11-21 22:27   ` Saul Wold
2017-11-21 23:02 ` [PATCH v2 " California Sullivan
2017-11-21 23:04   ` Wold, Saul
2017-12-07 18:19 ` [PATCH 1/2] init-install: fix grub-install command Cal Sullivan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox