3

I am trying to write a non-interactive system update script.

Question:

if the following works well:

yes | dpkg --configure -a

will the following work also very well?:

yes | apt-get install --fix-broken
10

You have -y or --yes or --assume-yes parameters in apt-get.

Try something like

sudo apt-get install -y <package-name>

Details:

The manual page of apt-get (You can also refer to manual page with man apt-get command) mentions:

-y, --yes, --assume-yes

Automatic yes to prompts. Assume "yes" as answer to all prompts and run non-interactively. If an undesirable situation, such as changing a held package or removing an essential package, occurs then apt-get will abort. Configuration Item: APT::Get::Assume-Yes.

Contrary to this parameter, you also have

--assume-no

Automatic "no" to all prompts. Configuration Item: APT::Get::Assume-No.

Edit

For Vlastimil's comment, I tried

sudo apt-get install --fix-broken --assume-yes

And it works. The --fix-broken part of the command can be replaced with -f and --assume-yes with -y or --yes for convenience. This will not install any package in perticular but "can omit any packages to permit APT to deduce a likely solution", as mentioned on the manual page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.