No pax command in Rocky 9.5

I have been using “pax” to create and extract archives.

The is no “pax” command in Rocky 9.5.

There is one available for download, pax-3.4-41.el8.x86_64.rpm It is not in the el9 repos. It does install and I was able to list a pax archive.

What is the preferred archive utility? bzip2? Something else.

It existed in epel for el8, but not for el9.

The ones I use are ‘tar’, ‘jar’, ‘cpio’ and ‘zip’, and there’s also gnu ‘ar’.

1 Like

You could ask EPEL by making a package request to see if someone will package pax for EPEL9.

1 Like

I switched to pax when cpio’s man page started with:

WARNING
The cpio utility is considered LEGACY based on POSIX specification. Users are encouraged to use other archiving tools for archive creation.

That was many years ago and cpio’s man page still says that. But, cpio is still here.

pax can read and write both cpio and tar formats. pax is in the POSIX standard. It was written as a Usenix/IEEE POSIX replacement for TAR and CPIO.

I assumed it was in all unixlike distros. Assumptions are, well …
It is in Fedora and has been for a long time.

Seems like it must not have a broad user base. I use bzip2 for compression of single files, but it is not considered an archiver.

I installed the EPEL8 version from an rpm. I will request EPEL for a package.

I just use tar. If I want to create a bz2 file, I ensure bzip2 is installed and then:

tar -cvjf myfile.tar.bz2 /path/to/directory-to-archive

never used pax or cpio in my entire Linux life of like 20+ years.

I have some bash scripts that automate some archiving tasks that use pax.

Yeah. I’ve been at this a while, too. I started with SUSE about 30 years age. I was on SCO Unix and HPUX before that.

Guess I could modify all my scripts to use tar.

I was in the middle of requesting a package on Fedora EPEL when you posted.

Fedora EPEL 9 Bugzilla package request. 2336940 – Please branch and build pax in epel9

2 Likes

I had not even heard of pax before.

cpio … is/was it used to unpack/repack initrd images? I have a faint recollection of doing that once or twice.

I’ve used star (“unique standard tape archiver”) as it could do something (extra attributes?) that plain tar did not. Alas, the star is not in el9 either.

As I remember it, tar did not handle selinux context and pax did.

Looking at tar, I see it has an Extended file attributes which includes --selinux now.

1 Like

I guess modifying my scripts to use tar with the -j option is probably best since tar and bzip2 seem to be here for a while.

cpio was the “preferred” utility to backup an UX system.

Just figured our why I use pax. find var/www ! -name *~ | pax -wvf ${dirName}/${fileName}

I pipe the output of find commands to pax and it happily makes archives.

tar will not take a file list from standard in, and tar has a error exit when I put the find command like this: tar -cvjf myfile.tar.bz2 find /var/www ! -name \*~

Some of my find commands are somewhat complex.

tar has the -T option which will allow a list from stdin:

find /var/www ! -name \*~ | tar cvfzT ${dirName}/${fileName} -

Thanks. I appreciate that.

Tried it. I am making a relative archive without the leading / while in the root directory. Resulted in errors.

find var/www ! -name *~ | tar -cvjfT ~/tmp/test.tar.bz2 -
tar: Removing leading `/’ from member names
tar: /root/tmp/test.tar.bz2: Cannot stat: No such file or directory
tar: -: Cannot stat: No such file or directory
tar: Exiting with failure status due to previous errors

But whether I use an absolute or relative archive, it still gives the errors.

Try removing the ‘-’ before the ‘c’ in the tar arguments, or do:

find var/www ! -name *~ | tar -cvj -f ~/tmp/test.tar.bz2 -T -
1 Like

Removing the ‘-’ before the ‘c’ in the tar arguments worked.

Thank you for following up.

Yeah that was my mistake there lol. I put it in my post, but going through bash history shows I never used the minus. Doh.

This looks better to me, keep the - before ‘c’, but remember that -f expects to be followed by the name of a file.

Thanks.

This seems the clearest and conforms to the “info tar” documentation.

Yes, ‘info tar’ but also ‘man tar’ has a clear intro showing the different style of command line switches, traditional (old) and unix (new). You can also do a lot without needing the pipe and find command.