13 November 2007

Linux rpm package failed to install,How can I fix this?

Problem Statement:

I downloaded an RPM file to a Windows machine using Internet Explorer then transferred it to my Linux machine. When I try to install it with the RPM command, I immediately get a prompt back and it does not install.

Solution:

When downloading a file, IE sometimes places square brackets in the resulting filename. When the rpm command is run on a file with square brackets, it fails with no error message and does not install the package. The square brackets are a part of the Linux bash shell and are reserved for a technique called file globbing.

To fix this, rename the RPM with the mv command. When specifying the filename of the RPM at a shell prompt,type the
first few letters, then use the Tab key to autocomplete the name. This ensures that the brackets in the filename are properly delimited. Rename the file to so that it does not contain square brackets. For example:

mv kernel-2\[1\].4.21-20.EL.i686.rpm kernel-2.4.21-20.EL.i686.rpm
Alternatively, you can enclose the file in single quotes, like so:
mv 'kernel-2[1].4.21-20.EL.i686.rpm' kernel-2.4.21-20.EL.i686.rpm

After renaming the file, the rpm command can be used to install the package successfully.

No comments: