* [PATCH] init-live: default to initrd shell if image isn't found
@ 2012-12-17 11:29 Alex DAMIAN
2012-12-17 12:04 ` Burton, Ross
` (3 more replies)
0 siblings, 4 replies; 13+ messages in thread
From: Alex DAMIAN @ 2012-12-17 11:29 UTC (permalink / raw)
To: openembedded-core, ross.burton, damien.lespiau, dvhart,
radu.moisan, otavio
Cc: Alexandru DAMIAN
From: Alexandru DAMIAN <alexandru.damian@intel.com>
If the init live fails to find and mount a root-fs image,
we should dump to a shell so that the developer can figure
what's wrong.
Prior art in Ubuntu. Also, leaving a system stale isn't good form.
Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
---
meta/recipes-core/initrdscripts/files/init-live.sh | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/meta/recipes-core/initrdscripts/files/init-live.sh b/meta/recipes-core/initrdscripts/files/init-live.sh
index c591f0d..2d6d6f6 100644
--- a/meta/recipes-core/initrdscripts/files/init-live.sh
+++ b/meta/recipes-core/initrdscripts/files/init-live.sh
@@ -75,6 +75,7 @@ early_setup
read_args
echo "Waiting for removable media..."
+C=0
while true
do
for i in `ls /media 2>/dev/null`; do
@@ -90,6 +91,11 @@ do
if [ "$found" = "yes" ]; then
break;
fi
+ # don't wait for more than 3 seconds
+ C=$(( C + 1 ))
+ if [ $C -gt 3 ]; then
+ fatal "Cannot find root image on media"
+ fi
sleep 1
done
--
1.7.10.4
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: [PATCH] init-live: default to initrd shell if image isn't found 2012-12-17 11:29 [PATCH] init-live: default to initrd shell if image isn't found Alex DAMIAN @ 2012-12-17 12:04 ` Burton, Ross 2012-12-17 12:09 ` Otavio Salvador ` (2 subsequent siblings) 3 siblings, 0 replies; 13+ messages in thread From: Burton, Ross @ 2012-12-17 12:04 UTC (permalink / raw) To: Alex DAMIAN; +Cc: damien.lespiau, dvhart, otavio, openembedded-core On 17 December 2012 11:29, Alex DAMIAN <alexandru.damian@intel.com> wrote: > + # don't wait for more than 3 seconds 3 is very short for slower hardware, please make the timeout a bit longer. Ross ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] init-live: default to initrd shell if image isn't found 2012-12-17 11:29 [PATCH] init-live: default to initrd shell if image isn't found Alex DAMIAN 2012-12-17 12:04 ` Burton, Ross @ 2012-12-17 12:09 ` Otavio Salvador 2012-12-17 12:14 ` Burton, Ross 2012-12-17 12:55 ` [PATCH v2] " Alex DAMIAN 2012-12-18 12:38 ` [PATCH v3] " Alex DAMIAN 3 siblings, 1 reply; 13+ messages in thread From: Otavio Salvador @ 2012-12-17 12:09 UTC (permalink / raw) To: Alex DAMIAN Cc: Darren Hart, damien.lespiau, Patches and discussions about the oe-core layer On Mon, Dec 17, 2012 at 9:29 AM, Alex DAMIAN <alexandru.damian@intel.com> wrote: > From: Alexandru DAMIAN <alexandru.damian@intel.com> > > If the init live fails to find and mount a root-fs image, > we should dump to a shell so that the developer can figure > what's wrong. > > Prior art in Ubuntu. Also, leaving a system stale isn't good form. > > Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com> I don't like to get a shell at users as he might be an end user and don't know what to do so I'd prefer to have a proper error message and support the shell as fallback depending on a boot param or so (so it can be used during development). Another issue is the amount of time waiting ... I have hardware that takes up to 8s to be ready so 3s is too short and the amount of time. The time to wait should be configurable by bootparam too (and documented in commitlog). Regards, -- 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 ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] init-live: default to initrd shell if image isn't found 2012-12-17 12:09 ` Otavio Salvador @ 2012-12-17 12:14 ` Burton, Ross 0 siblings, 0 replies; 13+ messages in thread From: Burton, Ross @ 2012-12-17 12:14 UTC (permalink / raw) To: Otavio Salvador Cc: damien.lespiau, Alex DAMIAN, Darren Hart, Patches and discussions about the oe-core layer On 17 December 2012 12:09, Otavio Salvador <otavio@ossystems.com.br> wrote: > I don't like to get a shell at users as he might be an end user and > don't know what to do so I'd prefer to have a proper error message and > support the shell as fallback depending on a boot param or so (so it > can be used during development). > > Another issue is the amount of time waiting ... I have hardware that > takes up to 8s to be ready so 3s is too short and the amount of time. > The time to wait should be configurable by bootparam too (and > documented in commitlog). At the end of the day this is a developer's rescue mode, so activating this based on the debug-tweaks distro feature makes sense. Ross ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v2] init-live: default to initrd shell if image isn't found 2012-12-17 11:29 [PATCH] init-live: default to initrd shell if image isn't found Alex DAMIAN 2012-12-17 12:04 ` Burton, Ross 2012-12-17 12:09 ` Otavio Salvador @ 2012-12-17 12:55 ` Alex DAMIAN 2012-12-17 17:06 ` Darren Hart 2012-12-18 12:38 ` [PATCH v3] " Alex DAMIAN 3 siblings, 1 reply; 13+ messages in thread From: Alex DAMIAN @ 2012-12-17 12:55 UTC (permalink / raw) To: openembedded-core, ross.burton, damien.lespiau, dvhart, radu.moisan, otavio Cc: Alexandru DAMIAN From: Alexandru DAMIAN <alexandru.damian@intel.com> Adds "debugshell" command line parameter for live/install images. If the init live fails to find and mount a root-fs image, dumps to a shell after timeout so that the developer can figure what's wrong. Timeout defaults to 30 seconds, but it can be changed as param argument. Prior art in Ubuntu. Also, leaving a system stale isn't good form. Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com> --- meta/recipes-core/initrdscripts/files/init-live.sh | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/meta/recipes-core/initrdscripts/files/init-live.sh b/meta/recipes-core/initrdscripts/files/init-live.sh index c591f0d..d99a8ea 100644 --- a/meta/recipes-core/initrdscripts/files/init-live.sh +++ b/meta/recipes-core/initrdscripts/files/init-live.sh @@ -45,7 +45,13 @@ read_args() { console_params=$arg else console_params="$console_params $arg" - fi + fi ;; + debugshell*) + if [ -z "$optarg" ]; then + shelltimeout=30 + else + shelltimeout=$optarg + fi esac done } @@ -75,6 +81,7 @@ early_setup read_args echo "Waiting for removable media..." +C=0 while true do for i in `ls /media 2>/dev/null`; do @@ -90,6 +97,15 @@ do if [ "$found" = "yes" ]; then break; fi + # don't wait for more than $shelltimeout seconds, if it's set + if [ -n "$shelltimeout" ]; then + echo -n " " $(( $shelltimeout - $C )) + if [ $C -ge $shelltimeout ]; then + echo "..." + fatal "Cannot find root image on media, dropping to shell " + fi + C=$(( C + 1 )) + fi sleep 1 done -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH v2] init-live: default to initrd shell if image isn't found 2012-12-17 12:55 ` [PATCH v2] " Alex DAMIAN @ 2012-12-17 17:06 ` Darren Hart 2012-12-17 17:09 ` Otavio Salvador 2012-12-17 19:21 ` Damian, Alexandru 0 siblings, 2 replies; 13+ messages in thread From: Darren Hart @ 2012-12-17 17:06 UTC (permalink / raw) To: Alex DAMIAN; +Cc: damien.lespiau, otavio, openembedded-core On 12/17/2012 04:55 AM, Alex DAMIAN wrote: > From: Alexandru DAMIAN <alexandru.damian@intel.com> > > Adds "debugshell" command line parameter for live/install images. > > If the init live fails to find and mount a root-fs image, > dumps to a shell after timeout so that the developer can figure > what's wrong. > > Timeout defaults to 30 seconds, but it can be changed as param > argument. > > Prior art in Ubuntu. Also, leaving a system stale isn't good form. > > Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com> > --- > meta/recipes-core/initrdscripts/files/init-live.sh | 18 +++++++++++++++++- > 1 file changed, 17 insertions(+), 1 deletion(-) > > diff --git a/meta/recipes-core/initrdscripts/files/init-live.sh b/meta/recipes-core/initrdscripts/files/init-live.sh > index c591f0d..d99a8ea 100644 > --- a/meta/recipes-core/initrdscripts/files/init-live.sh > +++ b/meta/recipes-core/initrdscripts/files/init-live.sh > @@ -45,7 +45,13 @@ read_args() { > console_params=$arg > else > console_params="$console_params $arg" > - fi > + fi ;; > + debugshell*) > + if [ -z "$optarg" ]; then > + shelltimeout=30 > + else > + shelltimeout=$optarg > + fi > esac > done > } > @@ -75,6 +81,7 @@ early_setup > read_args > > echo "Waiting for removable media..." > +C=0 > while true > do > for i in `ls /media 2>/dev/null`; do > @@ -90,6 +97,15 @@ do > if [ "$found" = "yes" ]; then > break; > fi > + # don't wait for more than $shelltimeout seconds, if it's set > + if [ -n "$shelltimeout" ]; then > + echo -n " " $(( $shelltimeout - $C )) > + if [ $C -ge $shelltimeout ]; then > + echo "..." > + fatal "Cannot find root image on media, dropping to shell " I'd recommend being explicity about what it is looking for when debugshell is used. Which devices where probed, what was the file it looked for. Save the developer from having to find this script in the repository and look it up. -- Darren > + fi > + C=$(( C + 1 )) > + fi > sleep 1 > done > > -- Darren Hart Intel Open Source Technology Center Yocto Project - Technical Lead - Linux Kernel ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2] init-live: default to initrd shell if image isn't found 2012-12-17 17:06 ` Darren Hart @ 2012-12-17 17:09 ` Otavio Salvador 2012-12-17 17:12 ` Burton, Ross 2012-12-17 19:21 ` Damian, Alexandru 1 sibling, 1 reply; 13+ messages in thread From: Otavio Salvador @ 2012-12-17 17:09 UTC (permalink / raw) To: Darren Hart Cc: damien.lespiau, Alex DAMIAN, Patches and discussions about the oe-core layer On Mon, Dec 17, 2012 at 3:06 PM, Darren Hart <dvhart@linux.intel.com> wrote: > > > On 12/17/2012 04:55 AM, Alex DAMIAN wrote: >> From: Alexandru DAMIAN <alexandru.damian@intel.com> >> >> Adds "debugshell" command line parameter for live/install images. >> >> If the init live fails to find and mount a root-fs image, >> dumps to a shell after timeout so that the developer can figure >> what's wrong. >> >> Timeout defaults to 30 seconds, but it can be changed as param >> argument. >> >> Prior art in Ubuntu. Also, leaving a system stale isn't good form. >> >> Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com> One possible improvement (not for this patch but long term) is to use initramfs-framework for this. It provides a modular system and has some nice featues for debug and shell handling so you can say: debug=before:udev shell=after:e2fs Just an example. Another good thing about it is it allow for less code duplication. -- 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 ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2] init-live: default to initrd shell if image isn't found 2012-12-17 17:09 ` Otavio Salvador @ 2012-12-17 17:12 ` Burton, Ross 2012-12-17 17:20 ` Otavio Salvador 0 siblings, 1 reply; 13+ messages in thread From: Burton, Ross @ 2012-12-17 17:12 UTC (permalink / raw) To: Otavio Salvador Cc: Darren Hart, Alex DAMIAN, damien.lespiau, Patches and discussions about the oe-core layer On 17 December 2012 17:09, Otavio Salvador <otavio@ossystems.com.br> wrote: > One possible improvement (not for this patch but long term) is to use > initramfs-framework for this. It provides a modular system and has > some nice featues for debug and shell handling so you can say: > > debug=before:udev shell=after:e2fs > > Just an example. Another good thing about it is it allow for less code > duplication. Good point - I only noticed last week that we've duplicated udev logic in the live scripts and the initramfs-framework (that isn't used by oe-core). Clearly this is Wrong and if we're shipping a framework for a initramfs, we should be using it in our initramfs... Ross ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2] init-live: default to initrd shell if image isn't found 2012-12-17 17:12 ` Burton, Ross @ 2012-12-17 17:20 ` Otavio Salvador 0 siblings, 0 replies; 13+ messages in thread From: Otavio Salvador @ 2012-12-17 17:20 UTC (permalink / raw) To: Burton, Ross Cc: Darren Hart, Alex DAMIAN, damien.lespiau, Patches and discussions about the oe-core layer On Mon, Dec 17, 2012 at 3:12 PM, Burton, Ross <ross.burton@intel.com> wrote: > On 17 December 2012 17:09, Otavio Salvador <otavio@ossystems.com.br> wrote: >> One possible improvement (not for this patch but long term) is to use >> initramfs-framework for this. It provides a modular system and has >> some nice featues for debug and shell handling so you can say: >> >> debug=before:udev shell=after:e2fs >> >> Just an example. Another good thing about it is it allow for less code >> duplication. > > Good point - I only noticed last week that we've duplicated udev logic > in the live scripts and the initramfs-framework (that isn't used by > oe-core). Clearly this is Wrong and if we're shipping a framework for > a initramfs, we should be using it in our initramfs... When I wrote the framework I had this on mind and we've been using the framework extensively as it is quite flexible. I do believe all initramfs scripts that are available today in oe-core would be quite simple to convert. -- 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 ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2] init-live: default to initrd shell if image isn't found 2012-12-17 17:06 ` Darren Hart 2012-12-17 17:09 ` Otavio Salvador @ 2012-12-17 19:21 ` Damian, Alexandru 2012-12-17 19:50 ` Darren Hart 1 sibling, 1 reply; 13+ messages in thread From: Damian, Alexandru @ 2012-12-17 19:21 UTC (permalink / raw) To: Darren Hart Cc: Damien Lespiau, otavio, Patches and discussions about the oe-core layer [-- Attachment #1: Type: text/plain, Size: 3064 bytes --] IMHO, if the system has to fatal() here, something VERY wrong is going on. This isn't your general debug option, this is a last-resort emergency rescue. I suppose that if you need to debug this, the system is so problematic you need to deep-dive into it anyway. I suggest taking it as it is now, and fill in a bugzilla entry about handling it better in initramfs-framework as it should be. Alex On Mon, Dec 17, 2012 at 7:06 PM, Darren Hart <dvhart@linux.intel.com> wrote: > > > On 12/17/2012 04:55 AM, Alex DAMIAN wrote: > > From: Alexandru DAMIAN <alexandru.damian@intel.com> > > > > Adds "debugshell" command line parameter for live/install images. > > > > If the init live fails to find and mount a root-fs image, > > dumps to a shell after timeout so that the developer can figure > > what's wrong. > > > > Timeout defaults to 30 seconds, but it can be changed as param > > argument. > > > > Prior art in Ubuntu. Also, leaving a system stale isn't good form. > > > > Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com> > > --- > > meta/recipes-core/initrdscripts/files/init-live.sh | 18 > +++++++++++++++++- > > 1 file changed, 17 insertions(+), 1 deletion(-) > > > > diff --git a/meta/recipes-core/initrdscripts/files/init-live.sh > b/meta/recipes-core/initrdscripts/files/init-live.sh > > index c591f0d..d99a8ea 100644 > > --- a/meta/recipes-core/initrdscripts/files/init-live.sh > > +++ b/meta/recipes-core/initrdscripts/files/init-live.sh > > @@ -45,7 +45,13 @@ read_args() { > > console_params=$arg > > else > > console_params="$console_params $arg" > > - fi > > + fi ;; > > + debugshell*) > > + if [ -z "$optarg" ]; then > > + shelltimeout=30 > > + else > > + shelltimeout=$optarg > > + fi > > esac > > done > > } > > @@ -75,6 +81,7 @@ early_setup > > read_args > > > > echo "Waiting for removable media..." > > +C=0 > > while true > > do > > for i in `ls /media 2>/dev/null`; do > > @@ -90,6 +97,15 @@ do > > if [ "$found" = "yes" ]; then > > break; > > fi > > + # don't wait for more than $shelltimeout seconds, if it's set > > + if [ -n "$shelltimeout" ]; then > > + echo -n " " $(( $shelltimeout - $C )) > > + if [ $C -ge $shelltimeout ]; then > > + echo "..." > > + fatal "Cannot find root image on media, dropping to shell " > > I'd recommend being explicity about what it is looking for when > debugshell is used. Which devices where probed, what was the file it > looked for. Save the developer from having to find this script in the > repository and look it up. > > -- > Darren > > > + fi > > + C=$(( C + 1 )) > > + fi > > sleep 1 > > done > > > > > > -- > Darren Hart > Intel Open Source Technology Center > Yocto Project - Technical Lead - Linux Kernel > [-- Attachment #2: Type: text/html, Size: 4136 bytes --] ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2] init-live: default to initrd shell if image isn't found 2012-12-17 19:21 ` Damian, Alexandru @ 2012-12-17 19:50 ` Darren Hart 2012-12-18 8:53 ` Damian, Alexandru 0 siblings, 1 reply; 13+ messages in thread From: Darren Hart @ 2012-12-17 19:50 UTC (permalink / raw) To: Damian, Alexandru Cc: Damien Lespiau, otavio, Patches and discussions about the oe-core layer On 12/17/2012 11:21 AM, Damian, Alexandru wrote: > IMHO, if the system has to fatal() here, something VERY wrong is going on. > > This isn't your general debug option, this is a last-resort emergency > rescue. I suppose that if you need to debug this, the system is so > problematic you need to deep-dive into it anyway. > > I suggest taking it as it is now, and fill in a bugzilla entry about > handling it better in initramfs-framework as it should be. > I mentioned the below because it is something I've had to verify on several occasions. It is a fairly simple add, and you have the print statement there anyway. If you choose to skip the extra output, I suppose I can send a patch to add it next time I run into it. -- Darren > Alex > > > On Mon, Dec 17, 2012 at 7:06 PM, Darren Hart <dvhart@linux.intel.com > <mailto:dvhart@linux.intel.com>> wrote: > > > > On 12/17/2012 04:55 AM, Alex DAMIAN wrote: > > From: Alexandru DAMIAN <alexandru.damian@intel.com <mailto:alexandru.damian@intel.com>> > > > > Adds "debugshell" command line parameter for live/install images. > > > > If the init live fails to find and mount a root-fs image, > > dumps to a shell after timeout so that the developer can figure > > what's wrong. > > > > Timeout defaults to 30 seconds, but it can be changed as param > > argument. > > > > Prior art in Ubuntu. Also, leaving a system stale isn't good form. > > > > Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com <mailto:alexandru.damian@intel.com>> > > --- > > meta/recipes-core/initrdscripts/files/init-live.sh | 18 +++++++++++++++++- > > 1 file changed, 17 insertions(+), 1 deletion(-) > > > > diff --git a/meta/recipes-core/initrdscripts/files/init-live.sh b/meta/recipes-core/initrdscripts/files/init-live.sh > > index c591f0d..d99a8ea 100644 > > --- a/meta/recipes-core/initrdscripts/files/init-live.sh > > +++ b/meta/recipes-core/initrdscripts/files/init-live.sh > > @@ -45,7 +45,13 @@ read_args() { > > console_params=$arg > > else > > console_params="$console_params $arg" > > - fi > > + fi ;; > > + debugshell*) > > + if [ -z "$optarg" ]; then > > + shelltimeout=30 > > + else > > + shelltimeout=$optarg > > + fi > > esac > > done > > } > > @@ -75,6 +81,7 @@ early_setup > > read_args > > > > echo "Waiting for removable media..." > > +C=0 > > while true > > do > > for i in `ls /media 2>/dev/null`; do > > @@ -90,6 +97,15 @@ do > > if [ "$found" = "yes" ]; then > > break; > > fi > > + # don't wait for more than $shelltimeout seconds, if it's set > > + if [ -n "$shelltimeout" ]; then > > + echo -n " " $(( $shelltimeout - $C )) > > + if [ $C -ge $shelltimeout ]; then > > + echo "..." > > + fatal "Cannot find root image on media, dropping to shell " > > I'd recommend being explicity about what it is looking for when > debugshell is used. Which devices where probed, what was the file it > looked for. Save the developer from having to find this script in the > repository and look it up. > > -- > Darren > > > + fi > > + C=$(( C + 1 )) > > + fi > > sleep 1 > > done > > > > > > -- > Darren Hart > Intel Open Source Technology Center > Yocto Project - Technical Lead - Linux Kernel > > -- Darren Hart Intel Open Source Technology Center Yocto Project - Technical Lead - Linux Kernel ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2] init-live: default to initrd shell if image isn't found 2012-12-17 19:50 ` Darren Hart @ 2012-12-18 8:53 ` Damian, Alexandru 0 siblings, 0 replies; 13+ messages in thread From: Damian, Alexandru @ 2012-12-18 8:53 UTC (permalink / raw) To: Darren Hart Cc: Damien Lespiau, otavio, Patches and discussions about the oe-core layer [-- Attachment #1: Type: text/plain, Size: 4300 bytes --] Ok, I'll add the print. And re-submit. Alex On Mon, Dec 17, 2012 at 9:50 PM, Darren Hart <dvhart@linux.intel.com> wrote: > > > On 12/17/2012 11:21 AM, Damian, Alexandru wrote: > > IMHO, if the system has to fatal() here, something VERY wrong is going > on. > > > > This isn't your general debug option, this is a last-resort emergency > > rescue. I suppose that if you need to debug this, the system is so > > problematic you need to deep-dive into it anyway. > > > > I suggest taking it as it is now, and fill in a bugzilla entry about > > handling it better in initramfs-framework as it should be. > > > > I mentioned the below because it is something I've had to verify on > several occasions. It is a fairly simple add, and you have the print > statement there anyway. If you choose to skip the extra output, I > suppose I can send a patch to add it next time I run into it. > > -- > Darren > > > Alex > > > > > > On Mon, Dec 17, 2012 at 7:06 PM, Darren Hart <dvhart@linux.intel.com > > <mailto:dvhart@linux.intel.com>> wrote: > > > > > > > > On 12/17/2012 04:55 AM, Alex DAMIAN wrote: > > > From: Alexandru DAMIAN <alexandru.damian@intel.com <mailto: > alexandru.damian@intel.com>> > > > > > > Adds "debugshell" command line parameter for live/install images. > > > > > > If the init live fails to find and mount a root-fs image, > > > dumps to a shell after timeout so that the developer can figure > > > what's wrong. > > > > > > Timeout defaults to 30 seconds, but it can be changed as param > > > argument. > > > > > > Prior art in Ubuntu. Also, leaving a system stale isn't good form. > > > > > > Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com<mailto: > alexandru.damian@intel.com>> > > > --- > > > meta/recipes-core/initrdscripts/files/init-live.sh | 18 > +++++++++++++++++- > > > 1 file changed, 17 insertions(+), 1 deletion(-) > > > > > > diff --git a/meta/recipes-core/initrdscripts/files/init-live.sh > b/meta/recipes-core/initrdscripts/files/init-live.sh > > > index c591f0d..d99a8ea 100644 > > > --- a/meta/recipes-core/initrdscripts/files/init-live.sh > > > +++ b/meta/recipes-core/initrdscripts/files/init-live.sh > > > @@ -45,7 +45,13 @@ read_args() { > > > console_params=$arg > > > else > > > console_params="$console_params $arg" > > > - fi > > > + fi ;; > > > + debugshell*) > > > + if [ -z "$optarg" ]; then > > > + shelltimeout=30 > > > + else > > > + shelltimeout=$optarg > > > + fi > > > esac > > > done > > > } > > > @@ -75,6 +81,7 @@ early_setup > > > read_args > > > > > > echo "Waiting for removable media..." > > > +C=0 > > > while true > > > do > > > for i in `ls /media 2>/dev/null`; do > > > @@ -90,6 +97,15 @@ do > > > if [ "$found" = "yes" ]; then > > > break; > > > fi > > > + # don't wait for more than $shelltimeout seconds, if it's set > > > + if [ -n "$shelltimeout" ]; then > > > + echo -n " " $(( $shelltimeout - $C )) > > > + if [ $C -ge $shelltimeout ]; then > > > + echo "..." > > > + fatal "Cannot find root image on media, dropping to > shell " > > > > I'd recommend being explicity about what it is looking for when > > debugshell is used. Which devices where probed, what was the file it > > looked for. Save the developer from having to find this script in the > > repository and look it up. > > > > -- > > Darren > > > > > + fi > > > + C=$(( C + 1 )) > > > + fi > > > sleep 1 > > > done > > > > > > > > > > -- > > Darren Hart > > Intel Open Source Technology Center > > Yocto Project - Technical Lead - Linux Kernel > > > > > > -- > Darren Hart > Intel Open Source Technology Center > Yocto Project - Technical Lead - Linux Kernel > [-- Attachment #2: Type: text/html, Size: 5871 bytes --] ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v3] init-live: default to initrd shell if image isn't found 2012-12-17 11:29 [PATCH] init-live: default to initrd shell if image isn't found Alex DAMIAN ` (2 preceding siblings ...) 2012-12-17 12:55 ` [PATCH v2] " Alex DAMIAN @ 2012-12-18 12:38 ` Alex DAMIAN 3 siblings, 0 replies; 13+ messages in thread From: Alex DAMIAN @ 2012-12-18 12:38 UTC (permalink / raw) To: openembedded-core, ross.burton, damien.lespiau, dvhart, radu.moisan, otavio Cc: Alexandru DAMIAN From: Alexandru DAMIAN <alexandru.damian@intel.com> Adds "debugshell" command line parameter for live/install images. If the init live fails to find and mount a root-fs image, dumps to a shell after timeout so that the developer can figure what's wrong. Timeout defaults to 30 seconds, but it can be changed as param argument. Prior art in Ubuntu. Also, leaving a system stale isn't good form. Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com> --- meta/recipes-core/initrdscripts/files/init-live.sh | 22 +++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/meta/recipes-core/initrdscripts/files/init-live.sh b/meta/recipes-core/initrdscripts/files/init-live.sh index c591f0d..e8d7f70 100644 --- a/meta/recipes-core/initrdscripts/files/init-live.sh +++ b/meta/recipes-core/initrdscripts/files/init-live.sh @@ -45,7 +45,13 @@ read_args() { console_params=$arg else console_params="$console_params $arg" - fi + fi ;; + debugshell*) + if [ -z "$optarg" ]; then + shelltimeout=30 + else + shelltimeout=$optarg + fi esac done } @@ -75,6 +81,7 @@ early_setup read_args echo "Waiting for removable media..." +C=0 while true do for i in `ls /media 2>/dev/null`; do @@ -90,6 +97,19 @@ do if [ "$found" = "yes" ]; then break; fi + # don't wait for more than $shelltimeout seconds, if it's set + if [ -n "$shelltimeout" ]; then + echo -n " " $(( $shelltimeout - $C )) + if [ $C -ge $shelltimeout ]; then + echo "..." + echo "Mounted filesystems" + mount | grep media + echo "Available block devices" + ls /dev/sd* + fatal "Cannot find rootfs.img file in /media/* , dropping to a shell " + fi + C=$(( C + 1 )) + fi sleep 1 done -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 13+ messages in thread
end of thread, other threads:[~2012-12-18 12:54 UTC | newest] Thread overview: 13+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-12-17 11:29 [PATCH] init-live: default to initrd shell if image isn't found Alex DAMIAN 2012-12-17 12:04 ` Burton, Ross 2012-12-17 12:09 ` Otavio Salvador 2012-12-17 12:14 ` Burton, Ross 2012-12-17 12:55 ` [PATCH v2] " Alex DAMIAN 2012-12-17 17:06 ` Darren Hart 2012-12-17 17:09 ` Otavio Salvador 2012-12-17 17:12 ` Burton, Ross 2012-12-17 17:20 ` Otavio Salvador 2012-12-17 19:21 ` Damian, Alexandru 2012-12-17 19:50 ` Darren Hart 2012-12-18 8:53 ` Damian, Alexandru 2012-12-18 12:38 ` [PATCH v3] " Alex DAMIAN
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox