Bash Script that installs curl gets stuck asking to restart services

Hits: 1790

Automation is often a lot of work, even just installing curl

Ubuntu is a social creature and does not like to be automated as much as you might expect. Very often your automation gets stuck because all of a sudden the folks at Canonical decided that they prefer human interaction. Often Ansible just hangs! For automatically installing curl on Ubuntu, 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 it 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 behavior as you actually want it.

Ansible also hangs while installing from a Git repo to a new server  / container.

Leave a Reply