Instruct dnf
to skip confirmation dialog and assume yes
for every question.
Ad hoc solution
By default you need to confirm every add/remove operation.
$ sudo dnf install which
Last metadata expiration check: 0:00:04 ago on Sun Apr 10 11:05:15 2022. Dependencies resolved. ==================================================================================================================================================================================== Package Architecture Version Repository Size ==================================================================================================================================================================================== Installing: which x86_64 2.21-27.el9 baseos 42 k Transaction Summary ==================================================================================================================================================================================== Install 1 Package Total download size: 42 k Installed size: 80 k Is this ok [y/N]: Operation aborted.
Specify an additional command-line option to automatically answer yes for every question.
$ dnf install --assumeyes which
Last metadata expiration check: 0:00:25 ago on Sun Apr 10 11:05:15 2022. Dependencies resolved. ==================================================================================================================================================================================== Package Architecture Version Repository Size ==================================================================================================================================================================================== Installing: which x86_64 2.21-27.el9 baseos 42 k Transaction Summary ==================================================================================================================================================================================== Install 1 Package Total download size: 42 k Installed size: 80 k Downloading Packages: which-2.21-27.el9.x86_64.rpm 165 kB/s | 42 kB 00:00 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Total 53 kB/s | 42 kB 00:00 Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Installing : which-2.21-27.el9.x86_64 1/1 Running scriptlet: which-2.21-27.el9.x86_64 1/1 Verifying : which-2.21-27.el9.x86_64 1/1 Installed: which-2.21-27.el9.x86_64 Complete!
Permanent solution
Try to remove package installed in the previous part.
$ sudo dnf remove which
Dependencies resolved. ==================================================================================================================================================================================== Package Architecture Version Repository Size ==================================================================================================================================================================================== Removing: which x86_64 2.21-27.el9 @baseos 80 k Transaction Summary ==================================================================================================================================================================================== Remove 1 Package Freed space: 80 k Is this ok [y/N]: Operation aborted.
Inspect current dnf
configuration.
$ cat /etc/dnf/dnf.conf
[main] gpgcheck=1 installonly_limit=3 clean_requirements_on_remove=True best=True skip_if_unavailable=False
Assume yes for every question by default.
$ echo assumeyes=True | sudo tee -a /etc/dnf/dnf.conf
Perform any package operation
$ sudo dnf remove which
Dependencies resolved. ==================================================================================================================================================================================== Package Architecture Version Repository Size ==================================================================================================================================================================================== Removing: which x86_64 2.21-27.el9 @baseos 80 k Transaction Summary ==================================================================================================================================================================================== Remove 1 Package Freed space: 80 k Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Erasing : which-2.21-27.el9.x86_64 1/1 Verifying : which-2.21-27.el9.x86_64 1/1 Removed: which-2.21-27.el9.x86_64 Complete!
No questions asked.
Additional notes
Alternatively, you can change the default answer from no
to yes
, which is enough most of the time.
$ cat /etc/dnf/dnf.conf
[main] gpgcheck=1 installonly_limit=3 clean_requirements_on_remove=True best=True skip_if_unavailable=False defaultyes=True
Notice, the default answer is altered, simply press enter to confirm.
$ sudo dnf install which
Last metadata expiration check: 0:18:06 ago on Sun Apr 10 11:05:15 2022. Dependencies resolved. ==================================================================================================================================================================================== Package Architecture Version Repository Size ==================================================================================================================================================================================== Installing: which x86_64 2.21-27.el9 baseos 42 k Transaction Summary ==================================================================================================================================================================================== Install 1 Package Total download size: 42 k Installed size: 80 k Is this ok [Y/n]: Downloading Packages: which-2.21-27.el9.x86_64.rpm 220 kB/s | 42 kB 00:00 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Total 48 kB/s | 42 kB 00:00 Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Installing : which-2.21-27.el9.x86_64 1/1 Running scriptlet: which-2.21-27.el9.x86_64 1/1 Verifying : which-2.21-27.el9.x86_64 1/1 Installed: which-2.21-27.el9.x86_64 Complete!