RPM install file conflict from previous install

27,187

you cannot install twice the same rpm. Therefore if you want to install a newer version of the same rpm (mypackage in your case); you need to use the -U | --upgrade option. Typical usage of rpm goes like this:

rpm -Uvh mypackage-<new-version>.rpm
  • -U : upgrade mypackage to this version
  • -vh : nice display of progress.
Share:
27,187
Admin
Author by

Admin

Updated on September 18, 2022

Comments

  • Admin
    Admin over 1 year

    I am getting install failure due to file conflicts. I am facing this issue only on Red Hat Linux 7. Same spec file works on Ubuntu and other Linux distributions.

    I tried putting echo on %pre, %post, %preun and %postun sections but I never reached those messages. I tried %dump at the beginning of spec file which also didn't print anything. How do I trace the spec file execution?

    %files
    %defattr(-,root,root,-)
    @CPACK_PACKAGING_INSTALL_PREFIX@/sbin/MyExe
    @CPACK_PACKAGING_INSTALL_PREFIX@/share/doc/@CPACK_PACKAGE_FILE_NAME@/myconf.conf
    @CPACK_PACKAGING_INSTALL_PREFIX@/share/doc/@CPACK_PACKAGE_FILE_NAME@/README
    %if @IS_RHEL7@
    /etc/systemd/system/myoverride.conf
    %endif
    

    Error during install:

    Preparing packages...
        file /etc/systemd/system/myoverride.conf from install of mypackage-5.0.1.x86_64 conflicts with file from package mypackage-4.11.1.x86_64
        file /usr/sbin/myexe from install of mypackage-5.0.1.x86_64 conflicts with file from package mypackage-4.11.1.x86_64
    
    • Admin
      Admin over 6 years
      What method of installation are you using? I mean rpm or yum?
    • Admin
      Admin over 6 years
      I am using rpm, I do not want to use -U option for upgrade or --force or --replaceFiles etc. I want it to handle the upgrade itself.
  • hexbit1
    hexbit1 over 6 years
    Both rpms have different version of the config and installer, they include changes in configuration file and exe. I need to upgrade both with this install.
  • Chris Maes
    Chris Maes over 6 years
    If you want to install both rpms you'll need to rename one of them because you cannot install two rpms with the same name