内核升级后无人参与的grub配置


16

今天,我一直在致力于自动部署ubuntu服务器。我被困在apt-get upgrade试图升级到新内核的服务器的自动更新上。日志如下所示:

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
(...)

然后提出一个问题:

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>                                  │    
    │                                                                      │    
    └──────────────────────────────────────────────────────────────────────┘    

理想的结果是选择第一个选项并继续:

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

手动运行升级后,我通常debconf-get-selections会检查问题的正确答案(请参阅其他设置)。似乎update_grub_changeprompt_threeway是应该回答的问题。但是,使用进行设置debconf-set-selections会给我一个相同的问题:

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

这个问题如何自动化?


也试过--force-yesyes | ...,但都无济于事
bouke

也尝试过-qq,但也没有去...
bouke

Answers:


15

export DEBIAN_FRONTEND=noninteractive在运行之前,我可以使用来解决此问题apt-get upgrade -y


3

在Ubuntu 16.04上,此序列应避免出现交互式对话框:

export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get upgrade -yq

请注意,该-q标志很重要。

(参考:关于devops的问题

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.