I am trying to run pacman from a script. The problem is that a package should be installed that conflicts and provides, but not replaces a currently installed package. As answered here I passed the --noconfirm option and since pacman's stdin is not pointing to a tty it assumed the default answer which is no. How can I enforce pacman to answer yes to all questions? Please note that I can't pass any input to pacman (it's run via makechrootpkg) so I'm unable to use the yes command or similar as suggested here.

Here is the output of pacman:

loading packages...
resolving dependencies...
looking for conflicting packages...
:: libinput-ubuntu and libinput are in conflict. Remove libinput? [y/N] 
error: unresolvable package conflicts detected
error: failed to prepare transaction (conflicting dependencies)
  • If this is in a chroot, why do you have a conflict in the first place?
    – HalosGhost
    Commented Apr 6, 2016 at 16:43
  • @HalosGhost I am installing some packages into the chroot and makechrootpkg doesn't install them at once but one after another; so the conflicting package gets installed due to a dependency of another one I pass via the -I flag
    – msrd0
    Commented Apr 6, 2016 at 16:53

2 Answers 2


There is an undocumented option (--ask BITMASK) to invert the default answer (used in pacman tests). The following bit-enums are defined (alpm.h):

   typedef enum _alpm_question_type_t {
        ALPM_QUESTION_REPLACE_PKG = (1 << 1),
        ALPM_QUESTION_CONFLICT_PKG = (1 << 2),
        ALPM_QUESTION_REMOVE_PKGS = (1 << 4),
        ALPM_QUESTION_IMPORT_KEY = (1 << 6)
    } alpm_question_type_t;

To automatically replace packages use:

sudo pacman -S  PKGNAME  --ask 4

Since there doesn't seem to be an option for achieving that, I looked into pacman source code and created a patch to add a --yes option to pacman: https://bugs.archlinux.org/task/48835

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .