Problem with User Data during created Droplet

September 29, 2017 127 views
API Ubuntu 16.04

Hi,

recently I can't created droplet by API with User Data. User Data is not executed. When I tried run commands manually I noticed that after

sudo apt-get update -y
sudo apt-get dist-upgrade -y

ubuntu shows me statement

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>

How can I prevent to shows this statement or HowCan I click 'OK'in the User Data commands?

1 Answer

Adding the following to your user-data shell script should do the trick:

export DEBIAN_FRONTEND=noninteractive;

This sets the environment for apt to be noninteractive and will automatically accept the default on most things like this that the -y flag alone may not.

Have another answer? Share your knowledge.