# portsnap fetch issue



## BrunolPhilippe (Sep 1, 2017)

Hello,

I have an issue when I do this command:


```
# rm -rf /var/db/portsnap/*
# portsnap fetch
Looking up portsnap.FreeBSD.org mirrors... none found.
Fetching public key from portsnap.FreeBSD.org... done.
Fetching snapshot tag from portsnap.FreeBSD.org... done.
Fetching snapshot metadata... done.
Fetching snapshot generated at Fri Sep  1 00:08:26 UTC 2017:
f2eed63376e1ec0433b4138a86ecd964c79cbdbd17c0d5100% of   35 MB 3085 kBps 00m12s
Extracting snapshot... snap/7004d8ade7378bfbcbc00521e88d067bc386baafae08ef4a40252977ad7a9eb6.gz: truncated gzip input
tar: Error exit delayed from previous errors.
```

This error occurs during this step:

```
tar -xz --numeric-owner -f f2eed63376e1ec0433b4138a86ecd964c79cbdbd17c0d590d69bff298705943d.tgz snap/
```

My version is:

```
# uname -a
FreeBSD goodnies 11.1-RELEASE FreeBSD 11.1-RELEASE #0 r321309: Fri Jul 21 02:08:28 UTC 2017     root@releng2.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC  amd64
```

The configuration of portsnap is:

```
# egrep -v '(^#|^$)' /etc/portsnap.conf
SERVERNAME=portsnap.FreeBSD.org
KEYPRINT=9b5feee6d69f170e3dd0a2c8e469ddbd64f13f978f2f3aede40c98633216c330
INDEX INDEX-11 DESCRIBE.11
```

Thank for your help.

Regards,

Bruno PHILIPPE


----------



## SirDice (Sep 1, 2017)

File probably got corrupted during download. It can happen. Just remove it and fetch again.


----------



## BrunolPhilippe (Sep 1, 2017)

Thank for your response.

To verify, I would like compare the reel cheksum of the file vs my download. How to I obtain the original file's checksum ?

Regards


----------



## Sheekamoo (Sep 1, 2017)

I'm seeing the same issue, also on 11.1.


```
rm -rf /var/db/portsnap/*
```

That doesn't seem to have any affect.

There's another thread that popped up on this forum recently as well:
https://forums.freebsd.org/threads/62271/#post-359640

Here's some output from my terminal:

```
root@zabbix:/usr/ports # ll /var/db/portsnap/
total 37816
-rw-r--r--  1 root  wheel  37053494 Aug 31 17:39 f2eed63376e1ec0433b4138a86ecd964c79cbdbd17c0d590d69bff298705943d.tgz
-rw-r--r--  1 root  wheel       451 Sep  1 12:23 pub.ssl
-rw-r--r--  1 root  wheel       242 Sep  1 12:26 serverlist
-rw-r--r--  1 root  wheel       242 Sep  1 12:26 serverlist_full
-rw-r--r--  1 root  wheel        35 Sep  1 12:26 serverlist_tried
drwxr-xr-x  2 root  wheel   1548288 Aug 31 17:20 snap/
-rw-r--r--  1 root  wheel       758 Aug 31 17:44 tINDEX.new
-rw-r--r--  1 root  wheel        85 Sep  1 12:26 tag.new
root@zabbix:/usr/ports # rm -rf /var/db/portsnap/*
root@zabbix:/usr/ports # ll /var/db/portsnap/
total 0
root@zabbix:/usr/ports # portsnap fetch update
Looking up portsnap.FreeBSD.org mirrors... 6 mirrors found.
Fetching public key from your-org.portsnap.freebsd.org... done.
Fetching snapshot tag from your-org.portsnap.freebsd.org... done.
Fetching snapshot metadata... done.
Fetching snapshot generated at Thu Aug 31 17:08:26 PDT 2017:
f2eed63376e1ec0433b4138a86ecd964c79cbdbd17c0d5100% of   35 MB 1875 kBps 00m19s
Extracting snapshot... snap/7004d8ade7378bfbcbc00521e88d067bc386baafae08ef4a40252977ad7a9eb6.gz: truncated gzip input
tar: Error exit delayed from previous errors.
```


----------



## BrunolPhilippe (Sep 1, 2017)

Strange, this issue comes on same file for several users on several servers.


```
snap/7004d8ade7378bfbcbc00521e88d067bc386baafae08ef4a40252977ad7a9eb6.gz
```

Regards


----------



## stratacast1 (Sep 2, 2017)

My solution:
Fetch always failed, so I deleted the data base at: rm -rf /var/db/portsnap/*

Then I did a checkout with subversion:
`svn checkout https://svn.FreeBSD.org/ports/head /usr/ports`

Finally, doing portsnap fetch said everything was up to date and I ran portsnap extract for the heck of it, and now all seems to be good. I noticed portsnap fetch was grabbing a 35MB file each time, but after doing my svn method it turned out being 76MB as I remember. Hopefully that works for others.


----------



## Sheekamoo (Sep 2, 2017)

Thank you for the reply stratacast1 .

I was going to do your solution, but I decided to give it one more shot today and it looks like it's working now. I didn't change anything on my end.


----------



## SirDice (Sep 4, 2017)

stratacast1 said:


> Then I did a checkout with subversion:
> svn checkout https://svn.FreeBSD.org/ports/head /usr/ports
> 
> 
> Finally, doing portsnap fetch said everything was up to date and I ran portsnap extract for the heck of it, and now all seems to be good. I noticed portsnap fetch was grabbing a 35MB file each time, but after doing my svn method it turned out being 76MB as I remember. Hopefully that works for others.


Use SVN _or_ portsnap(8). Not both. They're going to interfere with each other because they have different techniques of keeping track of changes.


----------



## stratacast1 (Sep 5, 2017)

I found that to be the case when whereis wasn't working. I just thought it a temporary solution to hopefully prime my local pull of the ports tree. Perhaps it was just a coincidence that svn worked and later portsnap did and that there was just a bad snapshot?


----------



## BrunolPhilippe (Sep 5, 2017)

Yesterday, the cmd portsnap fetch was working correctly. I confirm, the size of snap file is 76MB.

If anyone have an explanation for this issue ? Other that the download  Thank to share this.

Regards


----------



## HL1234 (Sep 6, 2017)

If I run in trouble with the ports, it do every time this and it works
(I think https://forums.freebsd.org/members/1677/ has give me the tip for some years)

Delete all and Create new Ports 
-------------------------------
config file is: /etc/portsnap.conf
`rm /var/db/portsnap/tag`
`rm -rf /var/db/portsnap/files`
`rm -rf /usr/ports/*`
`cd /usr/ports`
`portsnap fetch`
`portsnap extract update`

Whether /var is too small to hold the database you can set
in /etc/portsnap.conf
   # default: WORKDIR=/var/db/portsnap
   #changed in (i.e.)
   WORKDIR=/tmp/db/portsnap
`mv /var/db/portsnap /tmp/db/portsnap`
`ln -s /tmp/db/portsnap /var/db/portsnap`

To Upgrading Ports
------------------

To update an already installed Ports Collection, use portsnap update
`portsnap update`

or later on:
`portsnap fetch update extract`

Sometimes when I have a long time (about month) not installing some from the ports and anything goes wrong I do first these steps above.


----------



## SirDice (Sep 7, 2017)

HL1234 said:


> `portsnap fetch update extract`


This is pointless. The update will update the ports tree and the extract removes the whole tree and does a _full_ extract. To _update_ use `portsnap fetch update`. To extract a brand new ports tree from scratch use `portsnap fetch extract`.


----------

