[Thincrust-devel] [PATCH] Install grub in chroot to ensure correct ld-linux libs used.

Marek Goldmann mgoldman at redhat.com
Wed Aug 8 07:05:10 UTC 2012


Please remove also whitespace after the chroot command:

..."--batch", "--no-floppy"],
                              ^ here

--Marek

On 08.08.2012 08:56, Marek Goldmann wrote:
> Hi Marc,
>
> This patch looks good for me. One question - why do you umount /dev
> twice if rc != 0?
>
> --Marek
>
> On 03.08.2012 16:16, Marc Savy wrote:
>> Install Grub using chroot so that it uses the ld-linux.so downloaded for
>> the *appliance* rather than using the *host's* ld-linux.so which may be
>> invalid (the wrong arch type, etc).
>>
>>   From ce06bb9c95be57b4a3b4c88442e911d2404e5cee Mon Sep 17 00:00:00 2001
>> From: Marc Savy <msavy at redhat.com>
>> Date: Tue, 31 Jul 2012 16:03:18 +0100
>> Subject: [PATCH] Install grub in chroot to ensure correct ld-linux libs
>> used.
>> To: thincrust-devel at redhat.com
>>
>> ---
>>    appcreate/appliance.py | 9 +++++++--
>>    1 file changed, 7 insertions(+), 2 deletions(-)
>>
>> diff --git a/appcreate/appliance.py b/appcreate/appliance.py
>> index f9fc784..1a13182 100644
>> --- a/appcreate/appliance.py
>> +++ b/appcreate/appliance.py
>> @@ -287,7 +287,7 @@ class ApplianceImageCreator(ImageCreator):
>>            # Ensure all data is flushed to disk before doing grub install
>>            subprocess.call(["sync"])
>>
>> -        stage2 = self._instroot + "/boot/grub/stage2"
>> +        stage2 = "/boot/grub/stage2"
>>            setup = ""
>>
>>            i = 0
>> @@ -301,15 +301,20 @@ class ApplianceImageCreator(ImageCreator):
>>
>>            logging.debug("Installing grub to %s" % loopdev)
>>
>> -        grub = subprocess.Popen([self._instroot + "/sbin/grub",
>> "--batch", "--no-floppy"],
>> +        subprocess.call(["mount", "--bind", "/dev", self._instroot +
>> "/dev"])
>> +
>> +        grub = subprocess.Popen(["chroot", self._instroot,
>> "/sbin/grub", "--batch", "--no-floppy"],
>>                                    stdin=subprocess.PIPE)
>>
>>            grub.communicate(setup)
>>            rc = grub.wait()
>>
>>            if rc != 0:
>> +            subprocess.call(["umount", self._instroot + "/dev"])
>>                raise MountError("Unable to install grub bootloader")
>>
>> +        subprocess.call(["umount", self._instroot + "/dev"])
>> +
>>            logging.debug("Grub installed.")
>>
>>        def _install_grub2(self):
>>
>>
>> _______________________________________________
>> Thincrust-devel mailing list
>> Thincrust-devel at redhat.com
>> https://www.redhat.com/mailman/listinfo/thincrust-devel
>>
>
> _______________________________________________
> Thincrust-devel mailing list
> Thincrust-devel at redhat.com
> https://www.redhat.com/mailman/listinfo/thincrust-devel




More information about the Thincrust-devel mailing list