# Checksum mismatch



## fernandel (Jan 16, 2016)

Hi!

I did run `pkg check -s` and I got "checksum mismatch" for some installed ports. Should I run `pkg check -r`, please or I need to do something different?
Thank you.


----------



## talsamon (Jan 16, 2016)

Packages will build approximate a  week later as the port updates. So you have for the newest packages different checksums.


----------



## fernandel (Jan 16, 2016)

talsamon said:


> Packages will build approximate a  week later as the port updates. So you have for the newest packages different checksums.



I am using ports all the time and install with "portmaster". Now I try to switch to synth and build ports by myself.


----------



## talsamon (Jan 16, 2016)

In other words: The versions on the "package-servers" and the "port-servers" are diffferent. `Pkg check` checks against the packageserver.


----------



## protocelt (Jan 16, 2016)

If you want to use synth(1), I would advise disabling the official pkg(8) repository by following the instructions in /etc/pkg/FreeBSD.conf then rebuilding all installed packages using it. IIRC, while supported, I _think_ it was kpa that mentioned recently using multiple pkg(8) repositories concurrently still had some quirks yet.


----------



## marino (Jan 16, 2016)

That shouldn't be necessary.  Synth tells pkg to exclusively use the synth local repository with the -r option.   Even if pkg(8) has issues with repository priority, that shouldn't be in play since it's only considering a single repository when invoked by Synth.


----------



## protocelt (Jan 16, 2016)

Ah, ok. I made that assumption based on past experience with pkg(8) and also wasn't aware synth(1) used the -r option when invoking pkg(8).


----------



## chrbr (Jan 16, 2016)

protocelt said:


> If you want to use synth(1), I would advise disabling the official pkg(8) repository by following the instructions in /etc/pkg/FreeBSD.conf


In my opinion this is still a good advice because pkg(8) can still by run by the user manually - unintentionally, short in time or whatever.


----------



## marino (Jan 17, 2016)

Well, the intention is that both the local synth repository and the official repository are valid.  Before synth reaches release 1.0, I'm hoping that it will provide the option to use prebuilt official binaries (not as the default, but as a configurable item).

From what I can tell, the pkg(8) priority doesn't seem to work when two conf files are in play.  The file that is first alphabetically wins, which is why the synth config file is 00_synth.conf, which forces pkg(8) to always prefer synth repo packages over official.


----------



## marino (Jan 17, 2016)

That being said, there's a difference between FreeBSD and DragonFly:
On DragonFly, there must be at least one conf file in $LOCALBASE/etc/pkg/repos, but for FreeBSD there generally isn't as the official site works without a conf file.  Maybe that affects what I said above, not sure.


----------



## kpa (Jan 18, 2016)

If you get a checksum mismatch on `pkg check -s` there is a real error somewhere. Unlike some people trying to claim, the checksums are part of the package metadata are not re-fetched from the remote repo at the time of the checking and should always match what is installed on the filesystem. The reasons for the checksum mismatches can be disk corruption at the worst case or it could be an error in the port itself where a file is marked as checksummed but it actually changes during the installation by a pkg-install script. The correct cure in case of corrupted files (followed by a good inspection of the hardware ofc) would be to `pkg install -f` the packages with non-matching checksums to forcefully update them from the remote repo and replacing the corrupted files with good ones. If the problem continues you should contact the port maintainer for assistance.


----------



## talsamon (Jan 18, 2016)

Sorry, I puzzled the commands. You're right kpa.


----------



## fernandel (Jan 19, 2016)

kpa said:


> If you get a checksum mismatch on `pkg check -s` there is a real error somewhere. Unlike some people trying to claim, the checksums are part of the package metadata are not re-fetched from the remote repo at the time of the checking and should always match what is installed on the filesystem. The reasons for the checksum mismatches can be disk corruption at the worst case or it could be an error in the port itself where a file is marked as checksummed but it actually changes during the installation by a pkg-install script. The correct cure in case of corrupted files (followed by a good inspection of the hardware ofc) would be to `pkg install -f` the packages with non-matching checksums to forcefully update them from the remote repo and replacing the corrupted files with good ones. If the problem continues you should contact the port maintainer for assistance.



Thank you.
I start to use synth and re install few mismatch ports and there are no more problems.


----------



## talsamon (Jan 19, 2016)

I run it on my system, got:

```
linux_base-c6-6.6_6: checksum mismatch for /compat/linux/etc/ld.so.cache
```

reinstall does not help.
(On 10.2a, 10.2i, 9.3a and 9.3i. Don't know if this causes problems).


----------



## kpa (Jan 19, 2016)

talsamon said:


> I run it on my system, got:
> 
> ```
> linux_base-c6-6.6_6: checksum mismatch for /compat/linux/etc/ld.so.cache
> ...



That's what I was talking about, the ld.so.cache file should not to be among the checksummed files because it gets updated every time new linux compat ports get installed.


----------

