# metadata corrupt ?!



## nORKy (Dec 9, 2008)

Hi, 

I don't known what to do with this error :


```
# portsnap fetch update && portversion -l "<"
Looking up portsnap.FreeBSD.org mirrors... 3 mirrors found.
Fetching snapshot tag from portsnap1.freebsd.org... done.
Fetching snapshot metadata... done.
Updating from Mon Dec  8 14:40:05 CET 2008 to Tue Dec  9 07:14:40 CET 2008.
Fetching 3 metadata patches.. done.
Applying metadata patches... done.
Fetching 3 metadata files... /usr/sbin/portsnap: cannot open ca3d1528c2ecc4e2241979fac3ee3ce28ea68f9db12150f8ad3457929e69242d.gz: No such file or directory
metadata is corrupt.
```

Thanks for your help


----------



## artificer (Dec 9, 2008)

Try deleting the /var/db/portsnap directory and running "portsnap fetch" again.


----------



## nORKy (Dec 9, 2008)

Thanks you, it works.


```
# rm -Rf /var/db/portsnap/
pc-Joff# portsnap fetch update && portversion -l "<"
portsnap: Directory does not exist or is not writable: /var/db/portsnap
# mkdir /var/db/portsnap
# portsnap fetch update && portversion -l "<"
Looking up portsnap.FreeBSD.org mirrors... 3 mirrors found.
Fetching public key from portsnap2.freebsd.org... done.
Fetching snapshot tag from portsnap2.freebsd.org... done.
Fetching snapshot metadata... done.
Fetching snapshot generated at Tue Dec  9 01:43:15 CET 2008:
7a804d0d777e4786b5a895af34dfa476ff2eeb821d942c  8% of   54 MB  217 kBps 03m55s
```


----------



## nabsta (Jan 5, 2009)

I have the same issue, tried it with 4 different servers , same error. It still is amazing why this happened not to just one but 4 of my servers.

Anyways, deleting /var/db/portsnap and repopulating the ports tree helps.

thanks


----------



## ale (Jan 5, 2009)

I had some fun with some messages.


----------



## robertclemens (Jan 5, 2009)

I have yet to resolve the problem.


[root@abyss /var/db]# rm -rf portsnap
[root@abyss /var/db]# mkdir portsnap
[root@abyss /var/db]# portsnap fetch
Looking up portsnap.FreeBSD.org mirrors... 2 mirrors found.
Fetching public key from portsnap1.FreeBSD.org... done.
Fetching snapshot tag from portsnap1.FreeBSD.org... done.
Fetching snapshot metadata... done.
Fetching snapshot generated at Sun Jan  4 19:38:12 EST 2009:
916e4693ea4689b7598778ef6358f1c2705c84aeaf4a79100% of   55 MB  713 kBps 00m00s
Extracting snapshot... done.
Verifying snapshot integrity... done.
Fetching snapshot tag from portsnap1.FreeBSD.org... done.
Fetching snapshot metadata... fetch: http://portsnap1.FreeBSD.org/t/ef1df878b5fba73256d50b9944b5fb8ee1e9d376fec917a60e52af5e02a861b7: Not Found
sha256: ef1df878b5fba73256d50b9944b5fb8ee1e9d376fec917a60e52af5e02a861b7: No such file or directory
[: !=: unexpected operator
mv: rename ef1df878b5fba73256d50b9944b5fb8ee1e9d376fec917a60e52af5e02a861b7 to tINDEX.new: No such file or directory
done.
grep: tINDEX.new: No such file or directory
look: tINDEX.new: No such file or directory

Portsnap metadata appears bogus.
Cowardly refusing to proceed any further.
[root@abyss /var/db]#


----------



## ale (Jan 5, 2009)

robertclemens said:
			
		

> # portsnap fetch
> Looking up portsnap.FreeBSD.org mirrors... 2 mirrors found.
> Fetching public key from portsnap1.FreeBSD.org... done.
> Fetching snapshot tag from portsnap1.FreeBSD.org... done.
> ...


That's what is was talking about 


EDIT:
I run portsnap several times per day and this is the first error message I've got
	
	



```
Cowardly refusing to downgrade from Mon Jan  5 18:36:54 CET 2009 to Mon Jan  5 14:06:34 CET 2009.
```
So I updated my clock with ntpdate and I got 
	
	



```
5 Jan 20:39:17 ntpdate[62802]: step time server 193.204.114.105 offset 812.242543 sec
```
So it was 812 secs behind!
Very strange!


----------



## ale (Jan 5, 2009)

It should work now.


----------



## eujedi (Jan 6, 2009)

I have the very same error with tINDEX.new: No such file or directory. I have updated my time and still it gives the same output. What should i do?


----------



## DutchDaemon (Jan 6, 2009)

Had this on three different servers today. It must be a problem with the portsnap mirrors. In one instance, deleting /var/db/portsnap and running portsnap fetch extract worked, but only after two tries (the first fetch extract produced the same error).


----------



## ale (Jan 6, 2009)

After my previous post I had no more errors.
I've always used portsnap3.freebsd.org since then.


----------



## DutchDaemon (Jan 6, 2009)

Maybe a side-effect of 7.1-RELEASE (end of ports freeze, loads of updates today).


----------



## eujedi (Jan 6, 2009)

My bad! I deleted the /var/db/portsnap and it all magically happened ok!
Sorry for the screaming


----------



## DutchDaemon (Jan 6, 2009)

It's not your bad. It's obviously a problem @FreeBSD. Or it _was_, it seems.


----------



## tangram (Jan 6, 2009)

There's some talk on the mailing list about sub-par performance on portsnap servers because of the new 7.1.

It's just a matter of updating in a couple of days.


----------



## gammamatrix (Jan 6, 2009)

*Portsnap failing in jails - metadata is corrupt*

I am unable to get my jails to fetch ports without failing.

The jail host server will fetch without any problems.

Here is the jail error:


```
portsnap fetch

Looking up portsnap.FreeBSD.org mirrors... 2 mirrors found.
Fetching snapshot tag from portsnap1.FreeBSD.org... done.
Fetching snapshot metadata... done.
Updating from Tue Dec 30 23:14:16 UTC 2008 to Tue Jan  6 15:30:58 UTC 2009.
Fetching 3 metadata patches. done.
Applying metadata patches... done.
Fetching 3 metadata files... /usr/sbin/portsnap: cannot open 7384b82098e057ca3c7de84565209471909d35edfac4d3d3d07368430f9dfe44.gz: No such file or directory
metadata is corrupt.
```

Portsnap is not downloading files into:

/var/db/portsnap/files/

Deleting the contents of the directory /var/db/portsnap does not solve the problem.

I have had this problem for months, if not longer. My workaround is to copy the files from the host to the jail. I may just mount the directory to be shared as I do for distfiles.

I have had this problem on 6.X to 7.X. I do not know how long ago it stopped working.

Anybody have any ideas?


----------



## tangram (Jan 6, 2009)

gammamatrix said:
			
		

> I am unable to get my jails to fetch ports without failing.
> 
> The jail host server will fetch without any problems.
> 
> ...



Just wait it out. I had same problem last night and a couple hours ago it worked fine again.

Just run


```
# freebsd-update upgrade -r 7.1-RELEASE
```

And follow the steps on the annoucement, http://www.freebsd.org/releases/7.1R/announce.html.

Regarding where freebsd-update places its files... freebsd-update defaults to /var/db/freebsd-update but you can specify another directory through the -d flag. Take a look here for more info, http://linux-bsd-sharing.blogspot.com/2008/12/tip-updating-freebsd-with-freebsd.html.


----------



## kamikaze (Jan 6, 2009)

There's been a mail on stable saying that this is due to the strong traffic because of the 7.1 release (mirrors have trouble synchronizing).

It will get better again by itself and a new mirror will be available, soon.


----------



## graudeejs (Jan 6, 2009)

*portsnap -I fetch*
resoved my problems


----------



## gammamatrix (Jan 6, 2009)

> Just wait it out. I had same problem last night and a couple hours ago it worked fine again.



This does not have to do with 7.1. This is broken for me in 6.2 and 6.3 for several months.

Portsnap works on the server holding the jails, but not inside the jails.


----------



## gammamatrix (Jan 6, 2009)

gammamatrix said:
			
		

> This does not have to do with 7.1. This is broken for me in 6.2 and 6.3 for several months.
> 
> Portsnap works on the server holding the jails, but not inside the jails.



To restate myself:

Portsnap is broken for me in jails for 6.2, 6.3, 7.0 and 7.1.

This problem has been around for me for quite some time.


----------



## francisloco (Apr 6, 2010)

how i fix this?

i add to /etc/services


```
http            80/tcp          www www-http    # WorldWideWeb HTTP
http            80/udp          www www-http    # HyperText Transfer Protocol
https           443/tcp                         # MCom                       
https           443/udp                         # MCom                       
gss-http        488/tcp                                                      
gss-http        488/udp                                                      
http-alt        8008/tcp                                                     
http-alt        8008/udp                                                     
http-mgmt       280/tcp                         # http-mgmt                  
http-mgmt       280/udp                         # http-mgmt                  
http-rpc-epmap  593/tcp                         # HTTP RPC Ep Map            
http-rpc-epmap  593/udp                         # HTTP RPC Ep Map
```


then portsnap work again, cuz removing the /var/db/portsnap, the problem back again.


----------



## SirDice (Apr 6, 2010)

gammamatrix said:
			
		

> To restate myself:
> 
> Portsnap is broken for me in jails for 6.2, 6.3, 7.0 and 7.1.


_All_ versions of FreeBSD use the _same_ ports tree.

Great, now I've replied to a year old post x(


----------



## SirDice (Apr 6, 2010)

francisloco said:
			
		

> i add to /etc/services


Those entries should already be there.



> then portsnap work again,


Coincidence.


----------



## francisloco (Apr 7, 2010)

i havent these lines, so when i add it this work again.

i post it, for someone searching on the same problem, then he can try the fix.


----------



## francisloco (Aug 26, 2010)

okey, i saw somepost with problem portsnaping inside of jail
i fix this
editing
/etc/make.conf

adding


```
PORTSDIR=/var/ports
```


with my /etc/make.conf as:


```
WRKDIRPREFIX=           /var/ports
DISTDIR=                /var/ports/distfiles
PACKAGES=               /var/ports/packages
INDEXDIR=               /var/ports
```

sorry 4 bump. But searching for my problem, i fix for myself, and how not see reply for the jail portsnap, i put it for someone in futher problem.


----------



## graudeejs (Aug 26, 2010)

Why the hell did you set PORTSDIR ?


----------



## francisloco (Aug 30, 2010)

cuz im in ezjail.


----------



## kriscom (Oct 20, 2011)

I try to portsnap fetch FreeBSD 7.4 for several days now and I get always error at metadata files 
	
	



```
... "cannot open... no such file or directory... metadata is corrupt"
```

I do always delete /var/db/portsnap, and as I have noticed, the hash for the missing file is not always the same.

Any ideas?


----------



## Bombardier (Dec 15, 2011)

Hi all. I also give error

```
mamuka# portsnap fetch
Looking up portsnap.FreeBSD.org mirrors... none found.
Fetching snapshot tag from portsnap.FreeBSD.org... done.
Fetching snapshot metadata... done.
Updating from Wed Dec 14 11:03:14 PETT 2011 to Thu Dec 15 10:16:49 PETT 2011.
Fetching 4 metadata patches. done.
Applying metadata patches... done.
Fetching 4 metadata files... /usr/sbin/portsnap: cannot open 18ecdb55c6c56d64bef878dad4732c82c290ec1188c0c262269a4b24e0df8268.gz: No such file or directory
metadata is corrupt.
```
There are multiple reason for this problem. Many people advice to remove /var/db/portsnap directory, but this is not decision, *if you are using proxy*. In my case, I've got this error when run portsnap via proxy. And I find solution on http://forum.sysadmins.su/index.php?showtopic=20449. The problem will occur if you set http_proxy variable instead of setting both HTTP_PROXY and HTTP_PROXY_AUTH. You  could see it with run  

```
portsnap --debug fetch
```
this is place with error 

```
Applying metadata patches... done.
Fetching 4 metadata files...
/usr/libexec/phttpget portsnap.FreeBSD.org f/18ecdb55c6c56d64bef878dad4732c82c290ec1188c0c262269a4b24e0df8268.gz
 f/bbe749ca16b778d8be945f3e7bfc4f18017bb76cd5fe1d53e4def53dcac239a5dff0679bcce77c24abc7746fa0d9c1643c8.gz
 f/ee040d95aadd43543ea8cc011f48597e8382e437987a8d168be03ca41ab2589f.gz
phttpget: [B]host = hz, port = strongpassword@192.168.1.25:3128[/B]: servname not supported for ai_socktype
/usr/sbin/portsnap: cannot open 18ecdb55c6c56d64bef878dad4732c82c290ec1188c0c262269a4b24e0df8268.gz: No such file or directory
metadata is corrupt.
```


and in the part of source code of phttpget

```
env_HTTP_PROXY = getenv("HTTP_PROXY");
		if (env_HTTP_PROXY == NULL)
				env_HTTP_PROXY = getenv("http_proxy");
		if (env_HTTP_PROXY != NULL) {
				if (strncmp(env_HTTP_PROXY, "http://", 7) == 0)
						env_HTTP_PROXY += 7;
				p = strchr(env_HTTP_PROXY, '/');
				if (p != NULL)
						*p = 0;
				p = strchr(env_HTTP_PROXY, ':');
				if (p != NULL) {
						*p = 0;
						proxyport = p + 1;
				} else
						proxyport = "3128";
		}
```

sorry for my english and big thanx to   Drunky from forum.sysadmins.su


----------

