Get yourself acquainted with mock to build rpm

Package management is one the key areas in the world of GNU/Linux system administration. Not only for system administrators but also for normal linux users it is an inevitable part that they need to be aware of in their day to day job. Even though hundreds of linux distros exist around us, number package management systems are very limited (in numbers). dpkg used by Debian with .deb format, RPM created by Red Hat with .rpm format, pacman used in Arch linux, portage by Gentoo etc are some of the popular ones among them. Considering the most used RPM and DEB packages, they both have proven to work flawless. It’s just a matter of personal taste to select one from the other. Here we discuss on how to build RPM based packages for different distros which makes you of .rpm to install softwares. Here is how a rpm package would like:

<name>-<version>-<release>.<architecture>.rpm
such as:

samba-4.2.3-1.fc23.x86_64.rpm

where <name> is samba, <version> is 4.2.3, <release> is 1.fc23 and <architecture> is x86_64. <release> part is often a combination of a positive integer with a distribution tag appended at its end. See here for more details.

Continue reading

Convert your packages from Debian to RPM with alien

package-managersThere are situations in which some of your required software packages are not available from standard repositories configured by default. During those times we attempt to download the corresponding .rpm or .deb package accordingly based on our OS type. What if a particular application is not available in you OS-supported package type? I think its better if I explain how I hacked in such a situation to get rid of the problem.

Continue reading

dpkg error-“subprocess pre-removal script returned error exit status 2” SOLVED (for distros based on debian packages)

Screenshot from 2013-07-21 17:58:19

I don’t know how many of you have encountered such an error while trying to re-install some packages through synaptic package manager. It was necessary for me to fix the error because it happened while re-installing one of the most important package ‘bash’. Recently when I tried to re-install bash, after downloading the .deb file installation was terminated showing the above error. There may be other methods different from the one described below. But I prefer this one.

Make sure to close synaptic and open up the terminal. Keep a copy of the following file into the home folder incase of any errors.
cp /var/lib/dpkg/status status
Open up the file for editing.
nano /var/lib/dpkg/status
Now search for the exact name of the package with problems and find it. In my case, I found the entry for the package bash(marked in the figure above). Select and delete that information and that much information only, i.e. you will remove “Package: bash” to “Description: “. Remember, package description may be multiline and you will need to remove all the lines till a blank line. Don’t forget to leave a line blank between the package description above and the one below. Save the file and exit. Launch synaptic and then search for the package. You will see the package as not installed. Mark it for installation and install it.

For me, since it was bash causing the problem I couldn’t even execute some of the commands and I was fed up. This method was completely successful. Hope this will be helpful for some of you in solving package installation errors. If the error still remains, after performing the above steps, please let me know through your valuable comments.