# tar error when installing phpMyAdmin-3.5.8.1 port



## ChristoDeluxe (May 1, 2013)

Hi,

Today while updating ports, I'm getting a 
	
	



```
tar: Unrecognized archive format
```
 error when installing the phpMyAdmin-3.5.8.1 port. I'm on FreeBSD 8.2-RELEASE.

I've checked that the file has downloaded correctly in /usr/ports/distfiles and `xz -t` reports no errors in the downloaded file.  tar won't verify that file though, with the same "unrecognized archive format" error.  It would seem that the ports process is using tar to verify that file?  Do later versions of FreeBSD tar support xz for compression?

Any suggestions? I guess I could hack up the port to use a .gz version of the install file for now to get it to build?

I'm getting:

```
===> Fetching all distfiles required by phpMyAdmin-3.5.8.1 for building
===>  Extracting for phpMyAdmin-3.5.8.1
=> SHA256 Checksum OK for phpMyAdmin-3.5.8.1-all-languages.tar.xz.
tar: Unrecognized archive format
tar: Error exit delayed from previous errors.
*** Error code 1

Stop in /usr/ports/databases/phpmyadmin.
*** Error code 1
```

Thanks in advance for your suggestions.

Chris


----------



## SirDice (May 2, 2013)

ChristoDeluxe said:
			
		

> I'm on FreeBSD 8.2-RELEASE.


Please upgrade to 8.3, 8.2 is End-of-Life and not supported anymore.


----------



## cgigeek (May 2, 2013)

I am having the same problems on some ports. phpmyadmin is just a script you can download manually and install it, is pretty easy. As per other ports with problems, this is what I am currently doing: (pretty sure there is a better way short of upgrading the box) go to distfiles, unpack, configure, `make`, `make install`; won't be registered in pkg_db but may save your day.


----------



## wblock@ (May 2, 2013)

No, please don't do that.  Installing source without using ports is a temporary hack that you will come to regret.  It means no easy way to upgrade or deinstall, no easy way to get security checks, no FreeBSD-specific patches to make it work right.


----------



## richdawes (May 3, 2013)

*tar: Unrecognized archive format  -- Ports error on FreeBSD 8.2, as of 2013-04-29*

Hi, Chris!

The reason that this issue has come up for the mentioned port -- and no doubt has or will come up for more and more other ports, as well -- is because of this recent change to Mk/bsd.port.mk.  Instead of the ports extraction processing having to determine the archive format of the distribution file, in order to follow the traditional approach of calling the correct command with that file and pipe the decompressed data to tar, all that will now be handled by tar in the first place.

However, the tar that shipped with FreeBSD 8.2 (actually, /usr/bin/bsdtar) is unable to recognize xz-formatted archives compressed at levels -7 through -9.  This is the case for databases/phpmyadmin as you discovered, for graphics/png which I just tried building on an old 8.2 installation I have, and for who knows how many other ports that are based upon the xz archive format at compression levels over -6.  Most such files are currently distributed at level -6 (the xz default) or less, to keep the memory requirement for decompression within reason, and/or for speed, and so will present no such problem -- for now.  Honoring what was a reasonable default on the average computer of a few years ago may nowadays seem overly cautious to many a distribution builder.  But I digress...

Yes, on 8.2 you can use xz to decompress such files (since xz was never the problem), and pipe the output to tar, writing to a manually-created work subdirectory, and pick up the ports building at the make patch target or later.  Note that the ports system writes empty breadcrumb files to work...  E.g. graphics/png/work/.extract_done.png._usr_local is created once the extract make target completes for graphics/png...  You might need to manually create that first, for things to work correctly thereafter -- I really don't know.  But all that is quite a lot of trouble, and probably won't work anyway if you like to use anything like portmaster or portupgrade, unless you take extra care to find and use whatever "no clean before building" option may exist.  Too much trouble!

To buy you at least a little more convenient ports-building time on 8.2, try installing archivers/libarchive.  That will include a shiny new bsdtar, to which you must symbolically link from /usr/bin/tar in order for affected ports to extract.  I.e., after building and installing archivers/libarchive as usual...


```
# cd /usr/bin
# ls -l *tar
-r-xr-xr-x  1 root  wheel  62904 Nov 30  2011 bsdtar
lrwxr-xr-x  1 root  wheel     21 Nov 30  2011 tar -> /usr/bin/bsdtar
# rm tar
# ln -s /usr/local/bin/bsdtar tar
-r-xr-xr-x  1 root  wheel  62904 Nov 30  2011 bsdtar
lrwxr-xr-x  1 root  wheel     21 May  3 06:36 tar -> /usr/local/bin/bsdtar
```

The ports handling within Mk/bsd.port.mk is hard-coded to expect something at /usr/bin/tar, so the symlink is necessary.  The base-system bsdtar and libarchive files will remain in place.

Having made you read to the end of this verbose post for your solution/payoff, I will now comment that @SirDice is absolutely correct -- you really need to upgrade to 8.3 (legacy) -- or, better yet -- 9.1 ...  Our revered Ports committers are no longer concerned with whether or not an improvement they have in mind breaks port-building on 8.2, but at least this one can be easily accommodated.  The time to move on was quite some time ago...  The best bet now is to use some of the time this solution might buy you, and plan and execute your upgrade.

Cheers,

-Rich


----------



## ChristoDeluxe (May 6, 2013)

Thank you Rich for that detailed, excellent response!  I'll probably go with installing libarchive for a replacement tar for the short-term.  We will be upgrading that server's OS soon.


----------



## jhriggs (May 17, 2013)

Actually, you don't need to mess with changing symlinks. Just install libarchive and set 
	
	



```
TAR=/usr/local/bin/bsdtar
```
 in /etc/make.conf.


----------

