# switch from ports to packages



## fernandel (Jul 25, 2021)

After all those all years as I am using FreeBSD and ports I decided switch to packages.  I have clean installaed FreeBSD 13.0-RELEASE on laptop, all works good but do not like to use  laptop for building ports anymore, special llvm .
If I switched to packages could I expected some problems because everything is installed from ports? Should I deleted ports or keeping them and update them too? Any suggestions for easy way to make those changes, please?

Thank you.

fernandel


----------



## chrbr (Jul 25, 2021)

If you have a reasonable internet connection you could delete everything and reinstall the packages. Then you will notice soon if there is something unconsidered. Otherwise an issue might creep in later and unexpected. But if all ports have been compiled using default settings this should not be necessary. Please generate a list of the "main packages" as your favorite editor, mail program and so on. Then the dependencies will be installed but marked as dependency. Then a `pkg autoremove` can clean up easily. If you use ZFS it might be a good idea to take a snapshot first. After the transition there is no need to keep the ports tree up to date.


----------



## bakul (Jul 26, 2021)

On a 13.0-release machine I am using only packages. The only reason for not wanting to a package is if you want a different build time option other than the defaults. I think you can use `pkg query  -e '%#r = 0' %n` to find all the "leaf" packages (no one depends on them). Then blow away all your packages and install these leaf packages, which should pick up all the packages they depend on. You may wish to save the names of all the currently installed packages with `pkg query  %n` beforehand. Note: if you are using zsh or some other shell from /usr/ports/shells, do all this from /bin/sh command line. Basically make sure you have a working shell in case something goes wrong.


----------



## gnath (Jul 26, 2021)

For laptop it is good to use release and package system. As you are long time FreeBSD user, for clean install you can build system starting with Xorg and WM from 'latest' package. List of leaf packages or output from portmaster will help you. If you already installed from port you need to delete all ports/packages and then install packages first (better start fresh).


----------



## drhowarddrfine (Jul 26, 2021)

Now that I don't run my web dev business, I've been installing and updating all my software with packages. I have yet to have any issues over the past year.


----------



## fernandel (Jul 26, 2021)

Thank you to everyone...
First I need to delete /usr/ports and /var/db/ports and /var/db/pkg. Am I correct, please?


----------



## Deleted member 30996 (Jul 26, 2021)

Just jump right in and start installing from pkg on the machine you've been using ports on. That would be my advise and is my practice.

I've considered switching to pkg to save my Thinkpads. For the last week I've been using `portmaster -a` on each one. It takes 3 days to update everything and i still have laptops that need updating.

I could rebuild the whole thing from ports quicker so it doesn't make a lot of sense to me, but that's not unusual anymore.  

There are only a few programs that I do not use the default settings on. I used ports to install those programs and pkg for the rest when I switched my IBM T43 over from OpenBSD to FreeBSD.

It's been running fine and I just shut it down at over 30 days uptime to have room to work on the others.


----------



## SirDice (Jul 26, 2021)

fernandel said:


> First I need to delete /usr/ports and /var/db/ports and /var/db/pkg. Am I correct, please?


Why do you think they need to be removed? They're not used for packages that's correct but they won't interfere with them either. Just leave them be for now.


----------



## bakul (Jul 26, 2021)

fernandel said:


> First I need to delete /usr/ports and /var/db/ports and /var/db/pkg. Am I correct, please?



`pkg delete -y $(pkg query %n)` should do it. Though, no need to do that unless you want to start from a clean slate. You can delete the first directories to save space if you want. The last is used by pkg. I don’t know if it will be recreated if missing. You can try renaming first, before installing any packages. Make sure you do this from command line.


----------



## SirDice (Jul 26, 2021)

Do NOT remove /var/db/pkg/local.sqlite. It contains the registrations for your currently installed packages. And yes, that includes everything you installed as a port. Ports build packages, so in the end everything is a package, regardless if you built it from ports or not.

Want to switch from ports to packages? Just run `pkg upgrade` and everything that's not in order will be replaced by the package. There's really nothing more you need to do. You could do `pkg upgrade -f` and have it download and reinstall _everything_ if you want.


----------



## T-Daemon (Jul 26, 2021)

If you delete all packages and reinstall fresh it would pull in 'quarterly' packages, assuming the remote package repository configuration is unchanged. pkg.conf(5)

You have installed from ports until now, meaning 'latest' packages. If I were you I would set the package repository to 'latest':

/usr/local/etc/pkg/repos/FreeBSD.conf

```
FreeBSD: { enabled: no }

latest: {
  url: "pkg+http://pkg.FreeBSD.org/${ABI}/latest",
  mirror_type: "srv",
  signature_type: "fingerprints",
  fingerprints: "/usr/share/keys/pkg",
  enabled: yes
}
```

and run pkg-upgrade(8).


----------



## bakul (Jul 26, 2021)

I just checked that it is fine to delete /var/db/pkg *provided* a) you are deleting all the packages and b) you do this before installing any packages.
You will have to use -f flag to delete pkg itself, and should do this only after deleting all other packages. 

Good point about latest vs quarterly.


----------



## SirDice (Jul 26, 2021)

There's really no need to first remove everything you have installed now. That's just useless work.


----------



## astyle (Jul 26, 2021)

I use ports, because I don't like the minimal defaults provided by packages.   I guess my concern would be for dependency registration... For example, I havedatabases/akonadi compiled to use databases/sqlite3. Great results on my machine. I know that the default version of Akonadi from pkg repos will pull in MySQL from packages. Totally different deps. My concern is that this dependency difference will bring about unpredictable results. Any ideas on what can be done to ameliorate the fallout?


----------



## DanDare (Jul 27, 2021)

SirDice said:


> There's really no need to first remove everything you have installed now. That's just useless work.


As packages and ports shares the same /var/db/pkg/local.sqlite one could think that's just OK mixing ports and packages if they are the same source branch? (Let's say both are on the same quarterly branch)


----------



## fernandel (Jul 27, 2021)

Thank you again to everyone.
It work and I do not have a problem except it installed pulseadio which I never had.


----------



## DanDare (Jul 27, 2021)

astyle said:


> I use ports, because I don't like the minimal defaults provided by packages.   I guess my concern would be for dependency registration... For example, I havedatabases/akonadi compiled to use databases/sqlite3. Great results on my machine. I know that the default version of Akonadi from pkg repos will pull in MySQL from packages. Totally different deps. My concern is that this dependency difference will bring about unpredictable results. Any ideas on what can be done to ameliorate the fallout?


I'm also interested. Maybe the worst thing that can happen is some software breaking because some library/dependency wasn't installed. So a matter of discovering what package(s) to install to fix. (I hope it could work this way). Personal settings may be vanished in the next pkg update/upgrade. Then a matter to update ports and rebuild ones you have personal settings (again I hope i could work this way, not stating anything).


----------



## SirDice (Jul 27, 2021)

DanDare said:


> As packages and ports shares the same /var/db/pkg/local.sqlite one could think that's just OK mixing ports and packages


It's certainly doable, but care must be taken when dealing with changed defaults and dependency chains. It's not recommended to do, certainly not for new users as they're likely to mess everything up, then blame the package system for their own mishaps.



DanDare said:


> Maybe the worst thing that can happen is some software breaking because some library/dependency wasn't installed.


That's actually quite unlikely to happen. What will happen is that the packages are constantly going to try to replace MariaDB with MySQL for example because MySQL is the default for the packages. Or other dependencies will get removed because of a difference in the dependency chains. It's going to be a constant struggle trying to update your system. I really, really don't recommend doing that. If you really want to use different options and/or defaults I recommend setting up your own repository and install everything from that. That will give you the flexibility of ports (being able to set your own options/defaults) while keeping the ease of management from packages.


----------



## astyle (Jul 27, 2021)

SirDice said:


> It's certainly doable, but care must be taken when dealing with changed defaults and dependency chains. It's not recommended to do, certainly not for new users as they're likely to mess everything up, then blame the package system for their own mishaps.
> 
> 
> That's actually quite unlikely to happen. What will happen is that the packages are constantly going to try to replace MariaDB with MySQL for example because MySQL is the default for the packages. Or other dependencies will get removed because of a difference in the dependency chains. It's going to be a constant struggle trying to update your system. I really, really don't recommend doing that. If you really want to use different options and/or defaults I recommend setting up your own repository and install everything from that. That will give you the flexibility of ports (being able to set your own options/defaults) while keeping the ease of management from packages.


I guess in that case, the headache is updating the distfiles. I want fresh KDE tarballs compiled and properly installed with same options that I set for an earlier version.


----------



## SirDice (Jul 27, 2021)

astyle said:


> I want fresh KDE tarballs compiled and properly installed with same options that I set for an earlier version.


Two ways to achieve that. One is by adding those options to a make.conf so they're always applied when building. The other is by running `poudriere options` and setting them that way (those options are kept in specific directories linked to the ports and jail names).


```
root@molly:/usr/local/etc/poudriere.d # ll
total 166
drwxr-xr-x  316 root  wheel   316 Jan  3  2021 122-release-server-options/
-rw-r--r--    1 root  wheel  1018 Jul 10 18:09 122-release-server-package.lst
drwxr-xr-x  166 root  wheel   166 Jan 30 19:28 13-stable-server-options/
-rw-r--r--    1 root  wheel   834 May  3 18:11 13-stable-server-package.lst
drwxr-xr-x  340 root  wheel   340 Mar 20 19:07 130-release-desktop-options/
-rw-r--r--    1 root  wheel  1152 Jul 21 01:18 130-release-desktop-package.lst
drwxr-xr-x  342 root  wheel   342 Jun 21 21:21 130-release-server-options/
-rw-r--r--    1 root  wheel  1484 May  9 15:11 130-release-server-package.lst
drwxr-xr-x    2 root  wheel     6 Jul 22 09:22 hooks/
drwxr-xr-x    5 root  wheel     5 Jul 10 18:04 jails/
-rw-r--r--    1 root  wheel    73 Dec 24  2020 make.conf
drwxr-xr-x    5 root  wheel     5 Jul 27 16:06 ports/
-rw-r--r--    1 root  wheel    20 Nov 18  2018 server-make.conf
-rwxr-xr-x    1 root  wheel   388 Feb 17 09:58 up_all.sh*
```
I have three versions; 122-release, 130-release and 13-stable. Combined with two different option sets, a desktop and a server set. I know all the desktop sets are configured exactly the same, regardless if I build for 122-release, 130-release or 13-stable version. Same deal with the server set. Some common options, like the default MySQL version, are set in the common make.conf.


----------



## astyle (Jul 27, 2021)

SirDice said:


> Two ways to achieve that. One is by adding those options to a make.conf so they're always applied when building. The other is by running `poudriere options` and setting them that way (those options are kept in specific directories linked to the ports and jail names).
> 
> 
> ```
> ...


Thanks, SirDice ! I'd probably be wasting hours reading the manuals and trying to line things up, and still not getting to where I want to be, when all it takes is asking the right kind of question and getting an answer from someone who actually knows how things work.


----------



## SirDice (Jul 27, 2021)

It took me a while to set poudriere up but once you get the hang of it you wonder why you never used it before.


----------



## Deleted member 30996 (Jul 28, 2021)

I only change port option programs that use IPv6 by default.

I've had to use pkg 3-4 times on each machine I've updated over the past week to continue on. Once I got past that sticking point, it was ports to the end and has been smooth sailing since.


----------



## fernandel (Jul 29, 2021)

One question more, please... Is it possible to set in make.conf for example which packages I do not want to upgrade/install because I want to use ports for them. I want to remove pulseaudio. Also before with ports I had llvm11 as default and installed just 10 and 11 but now I have 9, 10, 11 and 12 and versions 10, 11 and 12 have  problem with 
	
	



```
llvm10 is missing a required shared library: libncursesw.so.9
llvm11 is missing a required shared library: libncursesw.so.9
llvm12 is missing a required shared library: libncursesw.so.9
```
which I didn't have with ports and I didn't have installed any compat version.

Thank you.


----------



## SirDice (Jul 29, 2021)

fernandel said:


> Is it possible to set in make.conf for example which packages I do not want to upgrade/install


make.conf has nothing to do with packages.


fernandel said:


> Also before with ports I had llvm11 as default


I suggest you stop mucking with the compiler settings and just let the system figure it out. 



fernandel said:


> installed just 10 and 11 but now I have 9, 10, 11 and 12 and versions 10, 11 and 12 have


Have you ever ran `pkg autoremove`?


----------



## Deleted member 30996 (Jul 29, 2021)

I had these as fail points on each machine I have updated:


```
pkg: gegl has a missing dependency: ilmbase
pkg: itstool has a missing dependency: py37-libxml2
pkg: gimp-app has a missing dependency: ilmbase
pkg: libinput has a missing dependency: py37-pyudev
```

Once I worked that out by minimally installing through pkg to where portmaster could take over again, I turned it loose. 

I don't edit anything by text and if that's what portmaster wants, that's what it gets. It works for me as trusted to do things right, so I don't tell it how to do the job. That's being a horrible boss.

I work it out from the command line to fix what stopped portmaster to begin with, then let it go at it.
Providing Support as needed, like I was taught in Management seminars my boss sent me to.


----------



## astyle (Jul 29, 2021)

FWIW, `# make config-recursive` makes a huge difference to `portmaster`! I'm still trying to figure out how to properly generate a dump that accurately shows the difference - comm(1) actually looks promising.


----------



## fernandel (Jul 29, 2021)

SirDice said:


> make.conf has nothing to do with packages.
> 
> I suggest you stop mucking with the compiler settings and just let the system figure it out.
> 
> ...


I never press "yes" for autoremove because there are many apps which I am using, for example scribus-devel, some py38-xxx, nmap, libosmesa...and more.


----------



## bsduck (Jul 29, 2021)

You can mark packages you don't want to be removed as manually installed: `pkg set -A 0 yourpackage`
... and then enjoy `pkg autoremove`


----------



## fernandel (Jul 30, 2021)

bsduck said:


> You can mark packages you don't want to be removed as manually installed: `pkg set -A 0 yourpackage`
> ... and then enjoy `pkg autoremove`


I did and it looks okay but llvm11 and 12 missing libncursesw.so.9


----------



## Deleted member 30996 (Jul 30, 2021)

Use `portmaster -I portname` for interactive mode.

It will list all the dependencies as usual and give you the opportunity to install or not install each program listed before starting the build.



fernandel said:


> I did and it looks okay but llvm11 and 12 missing libncursesw.so.9


Installing livm11 and livm12 how I would solve that. With pkg.


----------



## fernandel (Jul 30, 2021)

Trihexagonal said:


> Use `portmaster -I portname` for interactive mode.
> 
> It will list all the dependencies as usual and give you the opportunity to install or not install each program listed before starting the build.
> 
> ...


Packages are realy fast. Delete and reinstall llvm11 and 12 was less than 5 minutes


----------



## fernandel (Aug 3, 2021)

astyle said:


> I use ports, because I don't like the minimal defaults provided by packages.   I guess my concern would be for dependency registration... For example, I havedatabases/akonadi compiled to use databases/sqlite3. Great results on my machine. I know that the default version of Akonadi from pkg repos will pull in MySQL from packages. Totally different deps. My concern is that this dependency difference will bring about unpredictable results. Any ideas on what can be done to ameliorate the fallout?


I agree and apps which I use are built whith options which packages don't have and when I run `pkg upgrade` it wants to reinstall because options are  changed.


----------



## astyle (Aug 3, 2021)

fernandel said:


> I agree and apps which I use are built whith options which packages don't have and when I run `pkg upgrade` it wants to reinstall because options are  changed.


Well, fernandel, hanging around FreeBSD forums gave me the idea that I should try Poudriere, and use ports. After reading the manuals, I realized it's gonna take some time and effort to set it up to work the way I want, and will make for a fun project. Reading your posts has me thinking that the same thing just might work for you, too...


----------



## richardtoohey2 (Aug 3, 2021)

astyle said:


> hanging around FreeBSD forums gave me the idea that I should try Poudriere, and use ports. After reading the manuals, I realized it's gonna take some time and effort to set it up to work the way I want, and will make for a fun project. Reading your posts has me thinking that the same thing just might work for you, too...


I took the time and effort and I didn't enjoy the experience and scuttled back to portsnap and portmaster.  I'll have to give it another go one day.


----------



## astyle (Aug 3, 2021)

richardtoohey2 said:


> I took the time and effort and I didn't enjoy the experience and scuttled back to portsnap and portmaster.  I'll have to give it another go one day.


I guess I'll have to see for myself if I can be more stubborn than that in making it work for me. Right now, for me, my challenge is finding the time to do it, and taking  enough notes so that I can do a part, drop it, and come back without having to put in too much effort just getting back on track.


----------



## fernandel (Aug 3, 2021)

astyle said:


> Well, fernandel, hanging around FreeBSD forums gave me the idea that I should try Poudriere, and use ports. After reading the manuals, I realized it's gonna take some time and effort to set it up to work the way I want, and will make for a fun project. Reading your posts has me thinking that the same thing just might work for you, too...


Longer time ago I was ports-mgmt/synth user and it worked for me very good. But I have single desktop computer and now is the 'single desktop" computer Thinkpad T498 and I do not want to use ports on the laptop Poudriere or Synth build a lot of ports all the time when you update the system. Packages are very fast and laptop is not under stress anymore. I do not like just because packages have default settings and I cannot do anything except build from ports which I did in case of textproc/enchant.


----------



## Deleted member 30996 (Aug 4, 2021)

I used ports-mgmt/portupgrade before I found ports-mgmt/portmaster. 
If they leave portsnap as an option that would suit me.


----------



## fernandel (Aug 5, 2021)

Trihexagonal said:


> I used ports-mgmt/portupgrade before I found ports-mgmt/portmaster.
> If they leave portsnap as an option that would suit me.


I was/I am [ports]ports-mgmt/portmaster[/ports]user still but I left portsnap and start using [ports]net/gitup[/ports]. I just run `gitup ports` and it works as before with portsnap.


----------



## Deleted member 30996 (Aug 5, 2021)

portsnap good. Change bad.

Change anyway.  

Nature's Way Survival of the Fittest.


----------

