All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] initrd: add recovery feature
@ 2012-11-13 21:12 Radu Moisan
  2012-11-13 23:07 ` Saul Wold
  2012-11-14  1:30 ` Otavio Salvador
  0 siblings, 2 replies; 8+ messages in thread
From: Radu Moisan @ 2012-11-13 21:12 UTC (permalink / raw)
  To: openembedded-core; +Cc: Alexandru Damian

Allows you to use as root a partition instead of the rootfs.img
for recovering an old install, and fails safe when no rootfs is
found, dropping the user to a shell if something goes wrong.

Signed-off-by: Radu Moisan <radu.moisan@intel.com>
Signed-off-by: Alexandru Damian <alexandru.damian@intel.com>
---
 meta/recipes-core/initrdscripts/files/init-live.sh |   44 +++++++++++++++++++-
 1 file changed, 42 insertions(+), 2 deletions(-)

diff --git a/meta/recipes-core/initrdscripts/files/init-live.sh b/meta/recipes-core/initrdscripts/files/init-live.sh
index 5682fd1..81686b9 100644
--- a/meta/recipes-core/initrdscripts/files/init-live.sh
+++ b/meta/recipes-core/initrdscripts/files/init-live.sh
@@ -68,13 +68,49 @@ fatal() {
 
 early_setup
 
+# wait for the udevd to settle
+echo "Waiting for udev to settle..."
+udevadm settle --timeout=3
+
 [ -z "$CONSOLE" ] && CONSOLE="/dev/console"
 
 read_args
 
-echo "Waiting for removable media..."
-while true
+# boot partiton menu, if one or more bootable partitions exist
+BOOTMENU=`ls /media/sd*/sbin/init 2>/dev/null | wc -l`
+if [ $BOOTMENU -gt 0 ]; then
+   choice=0
+   while [ $choice -le 0 ]; do
+       echo "1). boot live ramfs image"
+       count=2
+       for i in `ls /media/sd*/sbin/init 2>/dev/null | cut -d "/" -f 3`; do
+           echo $count"). boot /dev/"$i
+           choicecmd[$count]=$i
+           count=$(( count + 1))
+       done
+       echo
+       echo -n "Your choice: "
+       read choice
+   done
+
+   if [ $choice -gt 1 ]; then
+       #ROOT_MOUNT=/media/${choicecmd[${choice}]}
+       ROOT_MOUNT=none #testing
+       echo "Booting local root ... $ROOT_MOUNT"
+       if [ -d $ROOT_MOUNT ]; then
+           boot_live_root
+       else
+           fatal "Rootfs partition not mounted"
+       fi
+   fi
+fi
+
+echo -n "Waiting for removable media... "
+CNT=0
+while [ $CNT -le 3 ];
 do
+  echo -n "$CNT "
+  CNT=$(( $CNT + 1 ))
   for i in `ls /media 2>/dev/null`; do
       if [ -f /media/$i/$ROOT_IMAGE ] ; then
 		found="yes"
@@ -91,6 +127,10 @@ do
   sleep 1
 done
 
+if [ "$found" != "yes" ]; then
+   fatal "...could not mount removable media, drop to shell"
+fi
+
 case $label in
     boot)
 	mkdir $ROOT_MOUNT
-- 
1.7.9.5




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

* Re: [PATCH v2] initrd: add recovery feature
  2012-11-13 21:12 [PATCH v2] initrd: add recovery feature Radu Moisan
@ 2012-11-13 23:07 ` Saul Wold
  2012-11-14 19:39   ` Radu Moisan
  2012-11-14  1:30 ` Otavio Salvador
  1 sibling, 1 reply; 8+ messages in thread
From: Saul Wold @ 2012-11-13 23:07 UTC (permalink / raw)
  To: Radu Moisan; +Cc: Alexandru Damian, openembedded-core

On 11/13/2012 01:12 PM, Radu Moisan wrote:
> Allows you to use as root a partition instead of the rootfs.img
> for recovering an old install, and fails safe when no rootfs is
> found, dropping the user to a shell if something goes wrong.
>
> Signed-off-by: Radu Moisan <radu.moisan@intel.com>
> Signed-off-by: Alexandru Damian <alexandru.damian@intel.com>
> ---
>   meta/recipes-core/initrdscripts/files/init-live.sh |   44 +++++++++++++++++++-
>   1 file changed, 42 insertions(+), 2 deletions(-)
>
> diff --git a/meta/recipes-core/initrdscripts/files/init-live.sh b/meta/recipes-core/initrdscripts/files/init-live.sh
> index 5682fd1..81686b9 100644
> --- a/meta/recipes-core/initrdscripts/files/init-live.sh
> +++ b/meta/recipes-core/initrdscripts/files/init-live.sh
> @@ -68,13 +68,49 @@ fatal() {
>
>   early_setup
>
> +# wait for the udevd to settle
> +echo "Waiting for udev to settle..."
> +udevadm settle --timeout=3
> +
Why are you still adding in the timeout?  This still could have adverse 
affects on some machines, just let settle do it's job.

Sau!


>   [ -z "$CONSOLE" ] && CONSOLE="/dev/console"
>
>   read_args
>
> -echo "Waiting for removable media..."
> -while true
> +# boot partiton menu, if one or more bootable partitions exist
> +BOOTMENU=`ls /media/sd*/sbin/init 2>/dev/null | wc -l`
> +if [ $BOOTMENU -gt 0 ]; then
> +   choice=0
> +   while [ $choice -le 0 ]; do
> +       echo "1). boot live ramfs image"
> +       count=2
> +       for i in `ls /media/sd*/sbin/init 2>/dev/null | cut -d "/" -f 3`; do
> +           echo $count"). boot /dev/"$i
> +           choicecmd[$count]=$i
> +           count=$(( count + 1))
> +       done
> +       echo
> +       echo -n "Your choice: "
> +       read choice
> +   done
> +
> +   if [ $choice -gt 1 ]; then
> +       #ROOT_MOUNT=/media/${choicecmd[${choice}]}
> +       ROOT_MOUNT=none #testing
> +       echo "Booting local root ... $ROOT_MOUNT"
> +       if [ -d $ROOT_MOUNT ]; then
> +           boot_live_root
> +       else
> +           fatal "Rootfs partition not mounted"
> +       fi
> +   fi
> +fi
> +
> +echo -n "Waiting for removable media... "
> +CNT=0
> +while [ $CNT -le 3 ];
>   do
> +  echo -n "$CNT "
> +  CNT=$(( $CNT + 1 ))
>     for i in `ls /media 2>/dev/null`; do
>         if [ -f /media/$i/$ROOT_IMAGE ] ; then
>   		found="yes"
> @@ -91,6 +127,10 @@ do
>     sleep 1
>   done
>
> +if [ "$found" != "yes" ]; then
> +   fatal "...could not mount removable media, drop to shell"
> +fi
> +
>   case $label in
>       boot)
>   	mkdir $ROOT_MOUNT
>



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

* Re: [PATCH v2] initrd: add recovery feature
  2012-11-13 21:12 [PATCH v2] initrd: add recovery feature Radu Moisan
  2012-11-13 23:07 ` Saul Wold
@ 2012-11-14  1:30 ` Otavio Salvador
  2012-11-14 19:41   ` Radu Moisan
  1 sibling, 1 reply; 8+ messages in thread
From: Otavio Salvador @ 2012-11-14  1:30 UTC (permalink / raw)
  To: Radu Moisan; +Cc: Alexandru Damian, openembedded-core

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

On Tue, Nov 13, 2012 at 7:12 PM, Radu Moisan <radu.moisan@intel.com> wrote:

> Allows you to use as root a partition instead of the rootfs.img
> for recovering an old install, and fails safe when no rootfs is
> found, dropping the user to a shell if something goes wrong.
>
> Signed-off-by: Radu Moisan <radu.moisan@intel.com>
> Signed-off-by: Alexandru Damian <alexandru.damian@intel.com>
> ---
>  meta/recipes-core/initrdscripts/files/init-live.sh |   44
> +++++++++++++++++++-
>  1 file changed, 42 insertions(+), 2 deletions(-)
>
> diff --git a/meta/recipes-core/initrdscripts/files/init-live.sh
> b/meta/recipes-core/initrdscripts/files/init-live.sh
> index 5682fd1..81686b9 100644
> --- a/meta/recipes-core/initrdscripts/files/init-live.sh
> +++ b/meta/recipes-core/initrdscripts/files/init-live.sh
> @@ -68,13 +68,49 @@ fatal() {
>
>  early_setup
>
> +# wait for the udevd to settle
> +echo "Waiting for udev to settle..."
> +udevadm settle --timeout=3
>

I think if we take a timeout it needs to be about 10s or 20s. I have some
slow machines that take way more time then 3s.


>  [ -z "$CONSOLE" ] && CONSOLE="/dev/console"
>
>  read_args
>
> -echo "Waiting for removable media..."
> -while true
> +# boot partiton menu, if one or more bootable partitions exist
> +BOOTMENU=`ls /media/sd*/sbin/init 2>/dev/null | wc -l`
> +if [ $BOOTMENU -gt 0 ]; then
> +   choice=0
> +   while [ $choice -le 0 ]; do
> +       echo "1). boot live ramfs image"
> +       count=2
> +       for i in `ls /media/sd*/sbin/init 2>/dev/null | cut -d "/" -f 3`;
> do
> +           echo $count"). boot /dev/"$i
> +           choicecmd[$count]=$i
> +           count=$(( count + 1))
> +       done
> +       echo
> +       echo -n "Your choice: "
> +       read choice
> +   done
> +
> +   if [ $choice -gt 1 ]; then
> +       #ROOT_MOUNT=/media/${choicecmd[${choice}]}
> +       ROOT_MOUNT=none #testing
> +       echo "Booting local root ... $ROOT_MOUNT"
> +       if [ -d $ROOT_MOUNT ]; then
> +           boot_live_root
> +       else
> +           fatal "Rootfs partition not mounted"
> +       fi
> +   fi
> +fi
> +
> +echo -n "Waiting for removable media... "
> +CNT=0
> +while [ $CNT -le 3 ];
>  do
> +  echo -n "$CNT "
> +  CNT=$(( $CNT + 1 ))
>    for i in `ls /media 2>/dev/null`; do
>        if [ -f /media/$i/$ROOT_IMAGE ] ; then
>                 found="yes"
> @@ -91,6 +127,10 @@ do
>    sleep 1
>  done
>
> +if [ "$found" != "yes" ]; then
> +   fatal "...could not mount removable media, drop to shell"
> +fi
> +
>  case $label in
>      boot)
>         mkdir $ROOT_MOUNT
> --
> 1.7.9.5
>
>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
>



-- 
Otavio Salvador                             O.S. Systems
E-mail: otavio@ossystems.com.br  http://www.ossystems.com.br
Mobile: +55 53 9981-7854              http://projetos.ossystems.com.br

[-- Attachment #2: Type: text/html, Size: 4367 bytes --]

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

* Re: [PATCH v2] initrd: add recovery feature
  2012-11-13 23:07 ` Saul Wold
@ 2012-11-14 19:39   ` Radu Moisan
  2012-11-15 10:19     ` Burton, Ross
  0 siblings, 1 reply; 8+ messages in thread
From: Radu Moisan @ 2012-11-14 19:39 UTC (permalink / raw)
  To: Saul Wold; +Cc: Alexandru Damian, openembedded-core

On 11/14/2012 01:07 AM, Saul Wold wrote:
> On 11/13/2012 01:12 PM, Radu Moisan wrote:
>> Allows you to use as root a partition instead of the rootfs.img
>> for recovering an old install, and fails safe when no rootfs is
>> found, dropping the user to a shell if something goes wrong.
>>
>> Signed-off-by: Radu Moisan <radu.moisan@intel.com>
>> Signed-off-by: Alexandru Damian <alexandru.damian@intel.com>
>> ---
>>   meta/recipes-core/initrdscripts/files/init-live.sh |   44 
>> +++++++++++++++++++-
>>   1 file changed, 42 insertions(+), 2 deletions(-)
>>
>> diff --git a/meta/recipes-core/initrdscripts/files/init-live.sh 
>> b/meta/recipes-core/initrdscripts/files/init-live.sh
>> index 5682fd1..81686b9 100644
>> --- a/meta/recipes-core/initrdscripts/files/init-live.sh
>> +++ b/meta/recipes-core/initrdscripts/files/init-live.sh
>> @@ -68,13 +68,49 @@ fatal() {
>>
>>   early_setup
>>
>> +# wait for the udevd to settle
>> +echo "Waiting for udev to settle..."
>> +udevadm settle --timeout=3
>> +
> Why are you still adding in the timeout?  This still could have 
> adverse affects on some machines, just let settle do it's job.
>
> Sau!
>
Well, I didn't see any side effects. If there are side effects I'll 
remove the timeout but please point out to me some of those. Anyway, I 
thought about this more like a safety net because I've noticed "settle" 
has some history with hanging the system boot more that it should in 
some circumstances.

Radu



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

* Re: [PATCH v2] initrd: add recovery feature
  2012-11-14  1:30 ` Otavio Salvador
@ 2012-11-14 19:41   ` Radu Moisan
  0 siblings, 0 replies; 8+ messages in thread
From: Radu Moisan @ 2012-11-14 19:41 UTC (permalink / raw)
  To: Otavio Salvador; +Cc: Alexandru Damian, openembedded-core

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

On 11/14/2012 03:30 AM, Otavio Salvador wrote:
>
>
> On Tue, Nov 13, 2012 at 7:12 PM, Radu Moisan <radu.moisan@intel.com 
> <mailto:radu.moisan@intel.com>> wrote:
>
>     Allows you to use as root a partition instead of the rootfs.img
>     for recovering an old install, and fails safe when no rootfs is
>     found, dropping the user to a shell if something goes wrong.
>
>     Signed-off-by: Radu Moisan <radu.moisan@intel.com
>     <mailto:radu.moisan@intel.com>>
>     Signed-off-by: Alexandru Damian <alexandru.damian@intel.com
>     <mailto:alexandru.damian@intel.com>>
>     ---
>      meta/recipes-core/initrdscripts/files/init-live.sh |   44
>     +++++++++++++++++++-
>      1 file changed, 42 insertions(+), 2 deletions(-)
>
>     diff --git a/meta/recipes-core/initrdscripts/files/init-live.sh
>     b/meta/recipes-core/initrdscripts/files/init-live.sh
>     index 5682fd1..81686b9 100644
>     --- a/meta/recipes-core/initrdscripts/files/init-live.sh
>     +++ b/meta/recipes-core/initrdscripts/files/init-live.sh
>     @@ -68,13 +68,49 @@ fatal() {
>
>      early_setup
>
>     +# wait for the udevd to settle
>     +echo "Waiting for udev to settle..."
>     +udevadm settle --timeout=3
>
>
> I think if we take a timeout it needs to be about 10s or 20s. I have 
> some slow machines that take way more time then 3s.
This is more reasonable then just removing the timeout.

Radu

[-- Attachment #2: Type: text/html, Size: 2664 bytes --]

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

* Re: [PATCH v2] initrd: add recovery feature
  2012-11-14 19:39   ` Radu Moisan
@ 2012-11-15 10:19     ` Burton, Ross
  2012-11-15 14:42       ` Otavio Salvador
  0 siblings, 1 reply; 8+ messages in thread
From: Burton, Ross @ 2012-11-15 10:19 UTC (permalink / raw)
  To: Radu Moisan; +Cc: openembedded-core, Alexandru Damian

On 14 November 2012 19:39, Radu Moisan <radu.moisan@intel.com> wrote:
> Well, I didn't see any side effects. If there are side effects I'll remove
> the timeout but please point out to me some of those. Anyway, I thought
> about this more like a safety net because I've noticed "settle" has some
> history with hanging the system boot more that it should in some
> circumstances.

Your average Intel, qemu, or fast ARM test hardware can easily settle
in under three seconds.  The problem is when you have either slow
hardware, or hardware with lots of storage devices to enumerate.

Ross



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

* Re: [PATCH v2] initrd: add recovery feature
  2012-11-15 10:19     ` Burton, Ross
@ 2012-11-15 14:42       ` Otavio Salvador
  2012-11-15 16:57         ` Radu Moisan
  0 siblings, 1 reply; 8+ messages in thread
From: Otavio Salvador @ 2012-11-15 14:42 UTC (permalink / raw)
  To: Burton, Ross; +Cc: Alexandru Damian, openembedded-core

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

On Thu, Nov 15, 2012 at 8:19 AM, Burton, Ross <ross.burton@intel.com> wrote:

> On 14 November 2012 19:39, Radu Moisan <radu.moisan@intel.com> wrote:
> > Well, I didn't see any side effects. If there are side effects I'll
> remove
> > the timeout but please point out to me some of those. Anyway, I thought
> > about this more like a safety net because I've noticed "settle" has some
> > history with hanging the system boot more that it should in some
> > circumstances.
>
> Your average Intel, qemu, or fast ARM test hardware can easily settle
> in under three seconds.  The problem is when you have either slow
> hardware, or hardware with lots of storage devices to enumerate.
>

Radu, please drop it or set it for 20s or so. I am against the timeout as a
whole as in case this causes a boot fail it will be quite difficult to
average user to come up to realize the cause of the problem so my opinion
would be to drop it completely.

-- 
Otavio Salvador                             O.S. Systems
E-mail: otavio@ossystems.com.br  http://www.ossystems.com.br
Mobile: +55 53 9981-7854              http://projetos.ossystems.com.br

[-- Attachment #2: Type: text/html, Size: 1749 bytes --]

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

* Re: [PATCH v2] initrd: add recovery feature
  2012-11-15 14:42       ` Otavio Salvador
@ 2012-11-15 16:57         ` Radu Moisan
  0 siblings, 0 replies; 8+ messages in thread
From: Radu Moisan @ 2012-11-15 16:57 UTC (permalink / raw)
  To: Otavio Salvador; +Cc: Alexandru Damian, openembedded-core

On 11/15/2012 04:42 PM, Otavio Salvador wrote:
>
> Radu, please drop it or set it for 20s or so. I am against the timeout 
> as a whole as in case this causes a boot fail it will be quite 
> difficult to average user to come up to realize the cause of the 
> problem so my opinion would be to drop it completely.
Ok guys, it fine with me to drop it then.

Radu



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

end of thread, other threads:[~2012-11-15 17:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-13 21:12 [PATCH v2] initrd: add recovery feature Radu Moisan
2012-11-13 23:07 ` Saul Wold
2012-11-14 19:39   ` Radu Moisan
2012-11-15 10:19     ` Burton, Ross
2012-11-15 14:42       ` Otavio Salvador
2012-11-15 16:57         ` Radu Moisan
2012-11-14  1:30 ` Otavio Salvador
2012-11-14 19:41   ` Radu Moisan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.