switch from ports to packages

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
 
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.
 
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.
 
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).
 
Thank you to everyone...
First I need to delete /usr/ports and /var/db/ports and /var/db/pkg. Am I correct, please?
 
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.
 
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.
 
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.
 
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
Code:
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).
 
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.
 
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?
 
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)
 
Thank you again to everyone.
It work and I do not have a problem except it installed pulseadio which I never had.
 
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).
 
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.

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.
 
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.
 
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).

Code:
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.
 
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).

Code:
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.
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. :D
 
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.
 
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.
 
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
Code:
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.
 
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.
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.

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?
 
Back
Top