On 06/22/2012 03:10 PM, Lucas Meneghel Rodrigues wrote:
> This fixes a problem where autotest will always
> fail to boot-once any kernels on Ubuntu (12.04,
> I assume other Ubuntu versions with grub2 are
> also affected).
>
> Ubuntu requires that we run 'update-grub' after
> 'grub-reboot', otherwise the changes won't be
> in effect on next boot. So, update boottool to
> execute that in case it's found.
>
> Signed-off-by: Lucas Meneghel Rodrigues <l...@redhat.com>
> ---
>   client/tools/boottool |   16 ++++++++++++++--
>   1 file changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/client/tools/boottool b/client/tools/boottool
> index 7a1cce1..8631081 100755
> --- a/client/tools/boottool
> +++ b/client/tools/boottool
> @@ -1442,8 +1442,20 @@ class Grubby(object):
>                              '%s',' ,'.join(grub_reboot_names))
>               return -1
>   
> -        return self._run_get_return([executable,
> -                                     '%s' % entry_index])
> +        rc_gr = self._run_get_return([executable, '%s' % entry_index])
> +        # If grub-reboot itself failed, return the rc right away
> +        if rc_gr:
> +            return rc_gr
> +
> +        # If all went well, on ubuntu we still have to run update-grub
> +        # for the changes to be set. If we didn't find it, then let's
> +        # just return grub_reboot's rc.
> +        update_grub = 'update-grub'
> +        executable = find_executable(update_grub)
> +        if executable is not None:
> +            return self._run_get_return([executable])
> +        else:
> +            return rc_gr
>   
>   
>       def boot_once_yaboot(self, entry_title):

Lucas,

I've not tested your proposal, but I'm confused at how this works. AFAIK 
'update-grub' runs 'grub-mkconfig', which regenerates the grub 
configuration file.

If /etc/default/grub has GRUB_DEFAULT=0 (the default) then the generated 
grub.conf will still have 'set default=0'. If we manually set 
GRUB_DEFAULT=saved in /etc/default/grub, then later runs of update-grub 
will do the right, that is set 'set default=${saved_entry}'. If what I'm 
saying is absolutely correct, both approaches involve editing a file and 
running and extra utility.

Can you confirm you have not edited /etc/default/grub?

Thanks,
CR.
_______________________________________________
Autotest mailing list
Autotest@test.kernel.org
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to