Unattended grub configuration after kernel upgrade

Posted by bouke on Ask Ubuntu See other posts from Ask Ubuntu or by bouke
Published on 2012-09-13T13:08:14Z Indexed on 2012/09/18 21:53 UTC
Read the original article Hit count: 389

Filed under:
|
|

Today I have been working on automatic deployment of an ubuntu server. I got stuck on automatic updating of the server using apt-get upgrade trying to upgrade to a new kernel. The log looks like this:

Setting up linux-image-3.2.0-24-generic (3.2.0-24.39) ...
Testing for an existing GRUB menu.lst file ... found: /boot/grub/menu.lst
(...)

Then a question is presented:

Package configuration

    +---------------------------------¦  +---------------------------------+    
    ¦ A new version of /boot/grub/menu.lst is available, but the version   ¦    
    ¦ installed currently has been locally modified.                       ¦    
    ¦                                                                      ¦    
    ¦ What would you like to do about menu.lst?                            ¦    
    ¦                                                                      ¦    
    ¦      install the package maintainer's version                        ¦    
    ¦      keep the local version currently installed                      ¦    
    ¦      show the differences between the versions                       ¦    
    ¦      show a side-by-side difference between the versions             ¦    
    ¦      show a 3-way difference between available versions              ¦    
    ¦      do a 3-way merge between available versions (experimental)      ¦    
    ¦      start a new shell to examine the situation                      ¦    
    ¦                                                                      ¦    
    ¦                                                                      ¦    
    ¦                                <Ok>                                  ¦    
    ¦                                                                      ¦    
    +----------------------------------------------------------------------+    

The desired outcome would be to select the first option and to continue:

Replacing config file /run/grub/menu.lst with new version
Updating /boot/grub/menu.lst ... done

After running the upgrade by hand, I used debconf-get-selections to inspect the correct answer for the question (see other settings). It seems like update_grub_changeprompt_threeway is the question that should be answered. However, setting this using debconf-set-selections presented me with the same question:

debconf-set-selections <<< "grub grub/update_grub_changeprompt_threeway select install_new"
apt-get -y dist-upgrade

How can this question be automated?

© Ask Ubuntu or respective owner

Related posts about grub2

Related posts about upgrade