rpmbuild: error: Installed (but unpackaged) file(s) found Solution

I‘m trying to build a RHEL 6 rpm of nginx server. But, I get the following error:

+ /usr/lib/rpm/brp-strip-comment-note
Checking for unpackaged file(s): /usr/lib/rpm/check-files /root/rpmbuild/BUILDROOT/nginx-1.0.5-1.el6.x86_64
error: Installed (but unpackaged) file(s) found:


RPM build errors:
Installed (but unpackaged) file(s) found:


How do I fix this problem and build rpm file?

To fix this error you need to specify the list of files that will be installed. This is done usong “%files” section. The syntax is as follows:


The above files can be set as follows in your .spec file (add before %changelog):

%config(noreplace) /usr/local/nginx/conf/*

The %files section identifies what files and directories were added by the package. Save and close the file. Now, you can rebuild an rpm as follows:
$ rpmbuild --bb nginx.spec

Recommend readings:

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 6 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersncdu pydf
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
6 comments… add one
  • Jerry McBride Aug 23, 2011 @ 16:21

    You have to tell rpm to include your config files. A great place to beging learning this is at:http://www.ibm.com/developerworks/library/l-rpm1/

  • Stefan Lasiewski Sep 21, 2011 @ 0:09

    I got this error for a different reason. I defined my BuildRoot as %{_topdir}/%{name}-%{version}-root . rpmbuild had left some files in my BuildRoot , and didn’t remove them. I had to remove these files manually.

    Several people on IBM Developerworks had the same problem. See http://www.ibm.com/developerworks/linux/library/l-rpm1/index.html#icomments. The solution proposed by bluebloodpole worked for me, but so did a simple `rm`.

    In fact, the instructions in that article didn’t work for me without some modifications.

  • Adam Oct 10, 2011 @ 2:46

    nginx.org has binary rpms on their website with the basic modules installed. If you want extra modules just add them in the src rpm spec file and rebuild it.


  • sysadmin Mar 16, 2012 @ 11:54

    A had the same issue as Stefan Lasiewski. Simply cleaning the buildroot dir solves the problem (of course, steps described in the article should be done too).

  • gyre007 May 21, 2012 @ 16:23

    If you don’t need those files/directories then just add %exclude macros with the paths and you are sorted – no need to delete from within spec file as when the RPM is built the buld and buildroot are deleted anyway …

  • Ramesh Jan 9, 2015 @ 10:09

    Nice artical…!!!

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum