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


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

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

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.

Submit an Answer