# Upgrade to "newer" package



## Barney (Oct 9, 2019)

System A has rsync-3.1.3

pkg upgrade says there is no upgrade available

pkg search tells me that there's a pkg named rsync-3.1.3_1

You're trying to tell me that pkg can't upgrade this? 

Background: I don't care about upgrading this, but I'm trying to automate building a new system and installing the  necessary packages. But some of the packages installed on System A (which is about 3 weeks old) don't exist. 

Shouldn't pkg be smart enough to know that 3.1.3_1 is newer than 3.1.3? If I want to sync systems I either have to copy disks, use tarballs or create my own pkg repository?


----------



## talsamon (Oct 9, 2019)

```
cat /usr/local/etc/pkg/repos/FreeBSD.conf
FreeBSD: {
  url: "pkg+http://pkg.FreeBSD.org/${ABI}/latest",
  mirror_type: "srv",
  enabled: yes
}
```

Did you use quarterly or latest?


----------



## yuripv (Oct 9, 2019)

Could you please show all that in terms of commands you used and its output?


----------



## T-Daemon (Oct 9, 2019)

Force update the repository catalogue: `pkg update -f`. net/rsync is at version 3.1.3_1 in quarterly and latest repositories.

*[EDIT]*: Asuming you haven't neglected to run `pkg update` first*.*


----------



## SirDice (Oct 9, 2019)

Quarterly and latest should be relatively the same at this point in time. The new quarterly (2019Q4) was created just a few days ago.


----------



## Barney (Oct 9, 2019)

talsamon said:


> ```
> cat /usr/local/etc/pkg/repos/FreeBSD.conf
> FreeBSD: {
> url: "pkg+http://pkg.FreeBSD.org/${ABI}/latest",
> ...



Who knows? I don't have this file. What's the default if the file doesnt exist?

Adding this file updates the system to a different repository, but I still have the same exact problem. It tells me that pkg rsync-3.1.3 is up to date.


```
# pkg upgrade rsync-3.1.3
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
pkg: No packages available to upgrade matching 'rsync-3.1.3' have been found in the repositories
# pkg upgrade rsync-3.1.3_1
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
pkg: rsync-3.1.3_1 is not installed, therefore upgrade is impossible
Checking integrity... done (0 conflicting)
Your packages are up to date.
```

You're not answering the question I need answered.

Is there any universe where pkg is smart enough to upgrade installed pkg rsync-3.1.3 to rsync-3.1.3_1 without some sort of manual intervention?


----------



## SirDice (Oct 9, 2019)

Barney said:


> Who knows? I don't have this file. What's the default if the file doesn't exist?


Then the information from /etc/pkg/FreeBSD.conf is used.

I suspect your locally cached repository information is stale, run `pkg update -f` to force it to update the cache.


----------



## Barney (Oct 9, 2019)

Ok, more info. If I run "pkg upgrade" it tells me about all of the upgrades available. But I can't seem to figure out how to do it for just 1 package.

How can I just run upgrade on a single package? It doesnt seem to find it when specifying a single pkg.


----------



## shkhln (Oct 9, 2019)

Barney said:


> How can I just run upgrade on a single package?



`pkg remove -f <package> && pkg install <package>`


----------



## Barney (Oct 9, 2019)

shkhln said:


> `pkg remove -f <package> && pkg install <package>`


Well that's just dumb. I assume you're being snarky as usual.


----------



## SirDice (Oct 9, 2019)

Barney said:


> Well that's just dumb. I assume you're being snarky as usual.


He's not because that's exactly what `pkg upgrade <packagename>` does.


----------



## shkhln (Oct 9, 2019)

More to the point, I don't trust upgrade command to work properly in that case. I'm not quite sure how it handles dependencies.


----------



## Barney (Oct 9, 2019)

SirDice said:


> He's not because that's exactly what `pkg upgrade <packagename>` does.



it's not, because pkg upgrade packagename can't determine the new name of the package automatically (as it should). It seems that it can only get the new package name if a global upgrade is run. 

1) I don't want to have to manually determine the names of the 5 packages to be upgraded
2) I don't want to upgrade all packages on the system

So the only way I can see to do this would be to lock the ones that I don't want to upgrade?


----------



## SirDice (Oct 9, 2019)

Barney said:


> I don't want to upgrade all packages on the system


Why not?


----------



## Barney (Oct 9, 2019)

SirDice said:


> Why not?


Because upgrades can mess up some of the custom stuff we have, and we can't just willy-nilly upgrade 30 package and then have to figure out what broke. 1 thing at a time so you can easily determine the culprit.


----------



## Sevendogsbsd (Oct 9, 2019)

Would a custom local repository with packages built from ports using ports-mgmt/poudriere or ports-mgmt/synth be a better solution for you in the long run? You mentioned customizations, that's why I brought that up.


----------



## ljboiler (Oct 9, 2019)

I just did `pkg upgrade cmake` to update cmake from version 3.15.3 to version 3.15.4.

The `pkg` tools do just fine without needing to specify the version in the package name.


----------



## Barney (Oct 10, 2019)

ljboiler said:


> I just did `pkg upgrade cmake` to update cmake from version 3.15.3 to version 3.15.4.
> 
> The `pkg` tools do just fine without needing to specify the version in the package name.



I posted my output above. Feel free to tell me what I did wrong.


----------



## Barney (Oct 10, 2019)

Sevendogsbsd said:


> Would a custom local repository with packages built from ports using ports-mgmt/poudriere or ports-mgmt/synth be a better solution for you in the long run? You mentioned customizations, that's why I brought that up.



I've pretty much decided I'm sticking with a master repository for upgrading remote systems. The packages are good for building base systems. I'd like to get 80% of the system as base + needed pkgs and then use the repository for customized stuff and things that need to change regularly.


----------



## ljboiler (Oct 10, 2019)

Barney said:


> I posted my output above. Feel free to tell me what I did wrong.


`pkg upgrade rsync` is all you should need to do.


----------



## Minbari (Oct 14, 2019)

@OP stay with pkg if you don't want custom packages.



Sevendogsbsd said:


> Would a custom local repository with packages built from ports using ports-mgmt/poudriere or ports-mgmt/synth be a better solution for you in the long run? You mentioned customizations, that's why I brought that up.


That solution (poudriere or synth) it's OK if you have multiple machines or you don't want to "contaminate" de main system, otherwise ports-mgmt/portmaster it's the best solution for a single PC.
poudriere would have been a good solution to save time and machine resources if it would let you mix packages from FreeBSD official repository and the repository built by the user, but since it can't, the best solution for single desktop is portmaster/portpugrade.


----------



## D-FENS (Oct 14, 2019)

Barney said:


> Because upgrades can mess up some of the custom stuff we have, and we can't just willy-nilly upgrade 30 package and then have to figure out what broke. 1 thing at a time so you can easily determine the culprit.


Then just upgrade the rest of the packages one by one. When you're done and rsync is the only one left - go with upgrade all.


----------



## Barney (Oct 17, 2019)

roccobaroccoSC said:


> Then just upgrade the rest of the packages one by one. When you're done and rsync is the only one left - go with upgrade all.


Everyone has their own way of doing things. I've got it figured out now so thanks for the input and help.


----------

