# bzip2 error on pkg_create



## scryptkiddy (Oct 17, 2013)

Odd issue. 

I noticed that my server (FreeBSD 8.3-RELEASE-p3 amd64) had bzip2(1) v.1.0.5 and I needed to install the bzip2(1) package from the ports tree to upgrade it to v.1.0.6. That was successful. 

Next, I tried to create a backup package from the installed bzip2(1) port and received an error. Below is the sequence of commands:


```
[CMD]# portsnap fetch extract[/CMD]
[CMD]# portinstall bzip2[/CMD]
[CMD]# mv /usr/bin/bzip2 /usr/bin/bzip2.basefile[/CMD]
[CMD]# mv /usr/local/bin/bzip2 /usr/bin/bzip2[/CMD]
[CMD]# bzip2 --version[/CMD]
bzip2, a block-sorting file compressor.  Version 1.0.6, 6-Sept-2010.
...
[CMD]# pkg_create -Rb bzip2-1.0.6[/CMD]
tar: bin/bzip2: Cannot stat: No such file or directory
tar: Error exit delayed from previous errors.
pkg_create: make_dist: tar command failed with code 256
```

A couple of questions:

Obvious is: how do I fix this? I need to create a backup of the package so I can add that package to another mirror machine that is not on the network.
Why is tar() looking in bin/bzip2 instead of /usr/bin/bzip2?
Thanks, 

SK


----------



## cpm@ (Oct 17, 2013)

Try `# cd /usr/ports/archivers/bzip2/ && make package`. The package obtained should be located in the /usr/ports/packages/archivers directory.


----------



## scryptkiddy (Oct 17, 2013)

Hey cpm, 

Thanks for the reply, but no go. Here are the results of running that command:


```
[CMD]# cd /usr/ports/archivers/bzip2/ && make package[/CMD]
....
===>  Installing for bzip2-1.0.6
===>   Generating temporary packing list
===>  Checking if archivers/bzip2 already installed
===>   bzip2-1.0.6 is already installed
      You may wish to ``make deinstall'' and install this port again
      by ``make reinstall'' to upgrade it properly.
      If you really wish to overwrite the old port of archivers/bzip2
      without deleting it first, set the variable "FORCE_PKG_REGISTER"
      in your environment or the "make install" command line.
*** Error code 1

Stop in /usr/ports/archivers/bzip2.
#
```

Should I deinstall bzip2(1) using the instructions it gives, or pkg_delete and reinstall it using portmaster instead of portinstall?


----------



## cpm@ (Oct 17, 2013)

Yes, you should deinstall it first. Normally `make package` is used for ports that haven't been installed yet. After finish to install it creates the *.tbz package


----------



## jb_fvwm2 (Oct 17, 2013)

It may not complete the [cmd=]make package[/cmd], though (without extra effort).  I think it is a conflict between what was actually installed and the  pkg-plist .   One can create the package afterwards, maybe, but it might not install elsewhere cleanly.  Persons subscribed to the ports mailing list are maybe working out a solution to this error.

(edit) It did, vs  compat7x, compat8x  (etc). here.


----------



## scryptkiddy (Oct 17, 2013)

Interesting results. 


```
[CMD]# pkg_delete -f bzip2-1.0.6[/CMD]
[CMD]# cd /usr/ports/archivers/bzip2 &&  make clean install[/CMD]
[CMD]# rehash[/CMD]
[CMD]# pkg_info | grep -i bzip2[/CMD]
bzip2-1.0.6         Block-sorting file compressor
[CMD]# which bzip2[/CMD]
/usr/bin/bzip2
[CMD]# /usr/bin/bzip2 --version[/CMD]
bzip2, a block-sorting file compressor.  Version 1.0.6, 6-Sept-2010
...
[CMD]# pkg_create -Rb bzip2-1.0.6[/CMD]
[CMD]# ls -l bzip2-1.0.6.tbz[/CMD]
-rw-------  1 root  wheel  488403 Oct 17 20:34 bzip2-1.0.6.tbz
```

looks like I'm good, although, I'm not quite sure what I did to fix it, other than reinstalling it.


----------



## cpm@ (Oct 17, 2013)

For me it's okay. I use the `make package` command to select configuration options that I really want when creating the package, e.g.  

```
# cd /usr/ports/www/chromium
# make package -DBATCH -DWITH_CODECS -DWITHOUT_PULSEAUDIO
```

Indeed, both commands serve to the same purpose.


----------

