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

Bug#813506: zipl-installer: set up re-IPL to boot newly installed Debian/Linux



Hi Philipp,

On Sun, Feb 07, 2016 at 01:31:49AM +0100, Philipp Kern wrote:
> On Tue, Feb 02, 2016 at 05:40:34PM +0100, Hendrik Brueckner wrote:
> > --- a/debian/zipl-installer.postinst
> > +++ b/debian/zipl-installer.postinst
> > @@ -57,8 +57,5 @@ EOF
> >  sed -e 's/^do_bootloader.*$/do_bootloader = yes/' < /target/etc/kernel-img.conf > /target/etc/kernel-img.conf.$$
> >  mv /target/etc/kernel-img.conf.$$ /target/etc/kernel-img.conf
> >  
> > -mount -t proc none /target/proc || true
> > -
> > -log-output -t zipl-installer chroot /target /sbin/zipl
> > -
> > -umount /target/proc || true
> > +# Run zipl in the installed target instance
> > +in-target /sbin/zipl -V
> 
> I'm a bit sad that this loses the zipl-installer tagging in
> /var/log/syslog because in-target does not support customized logging.
> It will log everything as "in-target".
> 
> At least there's prior art here in grub-installer calling in-target
> if $ROOT is /target. in-target does a bunch of stuff with policy-rc.d,
> for instance. But I guess that should be safe then...

For me "in-target" seems to be more convenient.  Of course, logging target
is different but I think that it is OK for zipl.  The alternative would be
something like this:

=========================================================
--- a/debian/zipl-installer.postinst
+++ b/debian/zipl-installer.postinst
@@ -57,8 +57,18 @@ EOF
 sed -e 's/^do_bootloader.*$/do_bootloader = yes/' < /target/etc/kernel-img.conf > /target/etc/kernel-img.conf.$$
 mv /target/etc/kernel-img.conf.$$ /target/etc/kernel-img.conf
 
-mount -t proc none /target/proc || true
+mount -o bind /proc /target/proc || true
+mount -o bind /sys /target/sys || true
+mount -o bind /dev /target/dev || true
 
-log-output -t zipl-installer chroot /target /sbin/zipl
+rc=0
+if ! log-output -t zipl-installer chroot /target /sbin/zipl -V; then
+       # Unmount the bound file systems before exiting
+       rc=1
+fi
 
+umount /target/dev || true
+umount /target/sys || true
 umount /target/proc || true
+
+exit $rc
=========================================================

The point here is that if zipl fails, the file systems needs to un-mounted.
The "set -e" causes the script to end but with the file systems still mounted.
Because that's exactly what in-target does, I preferred it rather than
sending the patch above.  I am also fine with the patch above if you like
that approach more and keep the zipl logging idenntifier.

> 
> > diff --git a/finish-install.d/70chreipl b/finish-install.d/70chreipl
> > new file mode 100755
> > index 0000000..ff8bcb9
> > --- /dev/null
> > +++ b/finish-install.d/70chreipl
> > @@ -0,0 +1,3 @@
> > +#!/bin/sh -e
> > +
> > +in-target chreipl /boot || true
> 
> Did you test that /usr/sbin is in PATH? For zipl we specify /sbin
> explicitly. (And yes, those might well be different execution
> environments...)

Yep, I tested this several times.  Of course, using /sbin/chreipl would
be safer here.

Thanks and kind regards,
  Hendrik

-- 
Hendrik Brueckner
brueckner@linux.vnet.ibm.com      | IBM Deutschland Research & Development GmbH
Linux on z Systems Development    | Schoenaicher Str. 220, 71032 Boeblingen


IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Martina Koederitz
Geschaeftsfuehrung: Dirk Wittkopp
Sitz der Gesellschaft: Boeblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294


Reply to: