[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: some problems with d-i (and g-i)



Tiago Saboga wrote:
> The shell in my root partition ran, but I could not mount /usr, grub-install 
> didn't work (this is imho a bug in grub-install, which depends on programs 
> in /usr). And the error message, when I close the shell, was much clearer: 
> 
> Error running shell in /target: A shell (/bin/sh -i) was found on your root 
> filesystem (/dev/discs/disc0/part2), but an error occurred while running it. 
> 
> Now I see the error is raised just because the last command in the shell 
> returned an error. The wording could be even clearer, though.

Well, we could try testing if the shell worked before running it and
then ignore nonzero exit status from the actual interactive run.
Something like this:

Index: shell
===================================================================
--- shell	(revision 39756)
+++ shell	(working copy)
@@ -32,13 +32,16 @@
 }
 
 if [ -f /target/bin/sh ] && [ -x /target/bin/sh ]; then
-	chroot_run /bin/sh -i || shell_failed '/bin/sh -i'
+	chroot_run /bin/sh -c "true" || shell_failed '/bin/sh'
+	chroot_run /bin/sh -i || true
 elif chroot_has sash; then
-	chroot_run sash || shell_failed sash
+	chroot_run sash -c "true" || shell_failed sash
+	chroot_run sash || true
 elif chroot_has busybox; then
 	# Try this last even though busybox is useful, since it might fail
 	# due to a missing sh applet.
-	chroot_run busybox sh || shell_failed 'busybox sh'
+	chroot_run busybox sh -c "true" || shell_failed 'busybox sh'
+	chroot_run busybox sh || true
 else
 	db_capb
 	db_subst rescue/shell/not-found DEVICE "$RESCUE_ROOTDEV"

I'll let Colin decide if this is a good idea. There's obviously some
potential for this check to not catch all failure cases.

> For the grub reinstall operation, the operation failed with the same error 
> (20). When d-i returns to the "enter rescue mode" box, it doesn't clear 
> the "Installing boot loader" box, which stays in the background, and if I try 
> after that to open a new shell in the chroot, I have the shell with the blue 
> background and "Installing GRUB boot loader" box laying around.

I've fixed the coding error that caused this.

-- 
see shy jo

Attachment: signature.asc
Description: Digital signature


Reply to: