It could be the case that some files in a given home directory should not be owned by the user. If you think this might be the case, your best course of action is to restore the home directories from backups. Speaking of which…. If you have a good and recent backup, restoring that backup might be a great option. Performing a restore can give you the peace of mind that all the files on the system have the proper permissions and ownership.
Nevertheless, there is a possibility of an issue arising at a later date. A restore reduces this probability even further. You could also use a hybrid approach where you run through the above process and selectively restore parts of the system. The downside of performing a restore is that it can be slower that using the process outlined above. Please Share! If this fixes your issue, great! If not, or you want to be thorough, continue reading. Examples of Errant chmod and chown Commands A common way a chmod or chown command can go wrong is by using recursion while making a typing mistake or providing an incorrect path.
Fixing File Ownerships and Permissions with the RPM Command Continuing with our example, you should be able to execute the following command with root privileges and return to a fairly stable state: rpm --setugids -a This command will return the owner and group membership for every file that was installed via an RPM package.
Because of this, we need to restore the permissions on the files as well: rpm --setperms -a Now every file that is known by rpm will have the same permissions as when it was initially installed. Example: systemctl restart postfix The service fails to start. In a source RPM are not only the original program source code files but scripts that allow the code to be recompiled automatically, to be installed automatically, and to be removed automatically. There are no end-user executable files in a source RPM.
Usually, only developers are interested in a source RPM. Binary RPM filenames identify the host architecture for the contents. For example, the binary RPM file:. To update your system with the latest version of a package, you will need the most recent binary RPM for it.
Each RPM package is contained in a single file. The filename has several fields to fully identify the contents of the package. While the RPM tools themselves do not rely upon the filename itself, you should understand the filename convention to help you identify or download the proper package.
Here is an example RPM filename:. The filename is composed of several parts:. The RPM [version] and [release] fields are not always strictly numeric and may contain other characters besides ordinary digits.
Sometimes picking the most recent version can be tricky. Here is how RPM itself compares version and release numbers internally:. Compare the remaining strings character-by-character, left-to-right until a digit is encountered. Finally, the seventh line installs the myprogram. As you can see, both methods of fixing poorly written Makefile install programs can be tedious. The first method, using diff and patch , is a little more difficult, but it can be the better method for a package that installs a large number of files.
The second method of calling install manually is easier for a small number of files, but it can be difficult to keep track of for programs with a large number of files.
You may even need to use a Makefile to install the main program and manually install supplementary files from other source packages. For example, you can easily call the useradd program if you need to create a new user on the system for the program. Also make sure that this is all done without requiring intervention. The last thing you want to do is make an RPM that requires human intervention during the install.
In fact, to look at a worst-case scenario, suppose that your RPM made it onto the distribution CD for a particular flavor of Linux. Remember, if the end users wanted to fiddle with things themselves, they would be compiling and installing the program from the source package.
The whole idea behind RPM packages, besides keeping a clean and coherent system, is to make installing programs easy for Linux users. Good housekeeping The next part of any. This script provides a little housekeeping for the build system. Insert the following into your rpmproc. First it checks for the existence of the BuildRoot directory; if BuildRoot exists, the script removes it completely.
Adding the files to your RPM The next section of the. This is a very important section as it tells RPM which files must be included in the binary packages. The second line provides the default attributes for the files in the list. The next line identifies which files are part of the documentation.
This has a dual purpose. The first is to identify the documentation files. Finally, you can list files and directories. In the case of our rpmproc. It internally adds that macro before every file.
Conclusion You now know how to install files to your BuildRoot environment and a few methods to circumvent installation procedures that are not friendly to RPM packages.
0コメント