I just setup a new server with a minimal installation of AlmaLinux 8. AlmaLinux is a variant of free Red Hat Enterprise Linux 8. It’s like a CentOS 8, but will have a full support until the end of RHEL 8 life cycle.
This server is to serve as a new proxy for all VMs inside my home lab. I want to use tinyproxy
which is need to be compiled from source as the RPM package is not available as of the time writing. After downloading the source code, and try to decompress it, I was presented with the following error message:
[user@proxy1 soft]$ tar -xjf tinyproxy-1.11.0.tar.bz2
tar (child): bzip2: Cannot exec: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
Well, what’s going on here? Did I use the wrong flag for a bzip2
?
[user@proxy1 soft]$ man tar | grep -E -A2 -- '--bzip2'
-j, --bzip2
Filter the archive through bzip2(1).
A brief explanation of what I did above. First I ran man tar
, and I’d like to grep
just the relevant section containing --bzip2
. I need to pass -E
(for extended regex '--bzip2'
, without it, I’d need to escapte the --
as \-\-
), -A2
(to display 2 lines after the matched regex).
The above output confirms that it was the right flag: -j
. So let’s re-examine the error message. It said bzip2: Cannot exec: No such file or directory
. As mentioned, the OS of this server is AlmaLinux, and I already knew that the package that provides bzip2
command is called bzip2
. In the event that we don’t know the package, we can run dnf provides bzip2
to help looking up the name of the package.
[user@proxy1 soft]$ rpm -q bzip2
package bzip2 is not installed
Okay, that’s interesting. It looks like tar
depends on bzip2
command in order to (de)compress a bzip2 archive. It might look obvious, but this is the first time that I had to explicitly install bzip2 for this purpose.
After installing bzip2
package, I was able to decompress the bzip2 archive.
[user@proxy1 soft]$ tar -xjf tinyproxy-1.11.0.tar.bz2
[user@proxy1 soft]$ echo $?
0
[user@proxy1 soft]$ ls
tinyproxy-1.11.0 tinyproxy-1.11.0.tar.bz2
So I learn something today. It’s pretty trivial, but kinda interesting. If you’re reading this blog post all the way to the end, maybe, just maybe - you may not know about this as I did. :)