Bash Script that installs curl gets stuck asking to restart services

Hits: 422

You need to put the following

sudo UCF_FORCE_CONFOLD=1 DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::=”–force-confdef” -o Dpkg::Options::=”–force-confold” -qq -y install curl

Even if you add -y to your apt command t still asks you whether it should restart services

  
  ┌───────────────────────────────┤ Configuring libssl1.1:amd64 ├────────────────────────────────┐
  │                                                                                              │
  │ There are services installed on your system which need to be restarted when certain          │
  │ libraries, such as libpam, libc, and libssl, are upgraded. Since these restarts may cause    │
  │ interruptions of service for the system, you will normally be prompted on each upgrade for   │
  │ the list of services you wish to restart.  You can choose this option to avoid being         │
  │ prompted; instead, all necessary restarts will be done for you automatically so you can      │
  │ avoid being asked questions on each library upgrade.                                         │
  │                                                                                              │
  │ Restart services during package upgrades without asking?                                     │
  │                                                                                              │
  │                                                                                     │
  │                                                                                              │

 

`apt-get install -y -qq ansible` This does not guarantee a non-interactive run. If you want a non-interactive run, you must use all the necessary parameters. For example: UCF_FORCE_CONFOLD=1 DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::=”–force-confdef” -o Dpkg::Options::=”–force-confold” -qq -y install ansible See the dpkg and ucf documentation to set the default behaviour as you actually want it.

Source: Comment #6 : Bug #1833013 : Bugs : ansible package : Ubuntu