Solved Switch from ports to packages

Hi, I have this system:

Code:
# freebsd-version
10.1-RELEASE-p24

I started using ports. Now I would like to switch to packages system.
Since it is a remote physical server (and I have no KVM or similar to managed it remotely), I wondering if it is possible / clean / recommended to uninstall all ports and reinstall packages.

In case. should I first upgrade from 10.1-RELEASE to 11.1-RELEASE (directly?)?
Or is better to first remove ports and reinstall all needed software by packages?
Downtime is not a matter.. it is not yet a production system.

Thank you!
 
In case. should I first upgrade from 10.1-RELEASE to 11.1-RELEASE (directly?)?
Do this first. For two reasons, the first is that 10.1 is end-of-life, the second is that you need to reinstall all ports/packages after a major release anyway. Better to kill two birds with one stone.

There's no need to "convert" anything from ports to packages. Ports build packages so in the end they're all packages. After the upgrade just follow this:
Code:
pkg-static install -f pkg
pkg upgrade -f
You'll be instructed to do this anyway.

Note that the official packages are always built using default options. So make sure your system doesn't deviate too far from the default.
 
Hi, I just upgrade from 10.1-RELEASE-p24 to 10.1-RELEASE-p41 , but now I get:

Code:
# freebsd-update upgrade -r 11.1-RELEASE
Looking up update.FreeBSD.org mirrors... 4 mirrors found.
Fetching metadata signature for 10.1-RELEASE from update5.freebsd.org... done.
Fetching metadata index... done.
Fetching 1 metadata patches. done.
Applying metadata patches... done.
Inspecting system... done.

The following components of FreeBSD seem to be installed:
kernel/generic world/base world/lib32

The following components of FreeBSD do not seem to be installed:
world/doc world/games

Does this look reasonable (y/n)? y

Fetching metadata signature for 11.1-RELEASE from update5.freebsd.org... done.
Fetching metadata index... done.
Fetching 1 metadata patches. done.
Applying metadata patches... done.
Fetching 1 metadata files... done.

The update metadata is correctly signed, but
failed an integrity check.
Cowardly refusing to proceed any further.

I read about some other bug (Thread 56060), so I have to upgrade to 10.3 first?

Thank you again.
 
I read about some other bug (Thread 56060), so I have to upgrade to 10.3 first?
No, it's the same issue. I'm suspecting the update to 10.1-RELEASE-p41 wasn't completed. So you may still have a freebsd-update(8) with the bug in it.

If you're sure the update worked, try removing the files in /var/db/freebsd-update/. It's possible there's some old stuff still lingering.
 
I got no luck:

Code:
cd /var/db/freebsd-update/
rm -rf *

# freebsd-update upgrade -r 11.1-RELEASE
Looking up update.FreeBSD.org mirrors... 4 mirrors found.
Fetching public key from update6.freebsd.org... done.
Fetching metadata signature for 10.1-RELEASE from update6.freebsd.org... done.
Fetching metadata index... done.
Fetching 2 metadata files... done.
Inspecting system... done.

The following components of FreeBSD seem to be installed:
kernel/generic world/base world/lib32

The following components of FreeBSD do not seem to be installed:
world/doc world/games

Does this look reasonable (y/n)? y

Fetching metadata signature for 11.1-RELEASE from update6.freebsd.org... done.
Fetching metadata index... done.
Fetching 1 metadata patches. done.
Applying metadata patches... done.
Fetching 1 metadata files... done.

The update metadata is correctly signed, but
failed an integrity check.
Cowardly refusing to proceed any further.
 
Odd, I'm fairly certain FreeBSD-EN-16:09 fixed this issue. So anything later than 10.1-RELEASE-p37 should have the fix included. Oh, well, would you mind taking the 10.3-RELEASE detour?

Unrelated tip:
Code:
cd /var/db/freebsd-update/
rm -rf *
Careful with commands like that. I once nuked my entire /usr/ filesystem (including /usr/home!) because the cd(1) didn't work and I was still the 'wrong' directory. Better use rm -rf /var/db/freebsd-update/* to prevent similar situations.
 
Odd, I'm fairly certain FreeBSD-EN-16:09 fixed this issue. So anything later than 10.1-RELEASE-p37 should have the fix included. Oh, well, would you mind taking the 10.3-RELEASE detour?

Ok! In case on any issue I wil update you


Careful with commands like that. I once nuked my entire /usr/ filesystem (including /usr/home!) because the cd(1) didn't work and I was still the 'wrong' directory. Better use rm -rf /var/db/freebsd-update/* to prevent similar situations.

Eheh sure!
 
Do this first. For two reasons, the first is that 10.1 is end-of-life, the second is that you need to reinstall all ports/packages after a major release anyway. Better to kill two birds with one stone.

There's no need to "convert" anything from ports to packages. Ports build packages so in the end they're all packages. After the upgrade just follow this:
Code:
pkg-static install -f pkg
pkg upgrade -f
You'll be instructed to do this anyway.

Sorry SirDice, I have one doubt: I just upgrade from 10.3-RELEASE to 11.1-RELEASE (no problem at all), rebooted server, did another /usr/sbin/freebsd-update install and now... :

Code:
# /usr/sbin/freebsd-update install
Installing updates...
Completing this upgrade requires removing old shared object files.
Please rebuild all installed 3rd party software (e.g., programs
installed from the ports tree) and then run "/usr/sbin/freebsd-update install"
again to finish installing updates.
root@luther:~# pkg version -vL=
pkg: Warning: Major OS version upgrade detected.  Running "pkg-static install -f pkg" recommended
bash-4.3.42                        <   needs updating (index has 4.3.42_1)
cmake-3.3.1                        <   needs updating (index has 3.4.1)
cmake-modules-3.3.1                <   needs updating (index has 3.4.1)
curl-7.45.0                        <   needs updating (index has 7.46.0_1)
dmidecode-2.12                     <   needs updating (index has 2.12_2)
mc-4.8.14_1                        <   needs updating (index has 4.8.15)
pkg-1.6.1_2                        <   needs updating (index has 1.6.2)
png-1.6.19                         <   needs updating (index has 1.6.20)
py27-setuptools27-17.0             <   needs updating (index has 18.7)
talloc-2.1.3_1                     <   needs updating (index has 2.1.5)
tdb-1.3.7_1,1                      <   needs updating (index has 1.3.8,1)
tevent-0.9.25                      <   needs updating (index has 0.9.26)
vim-7.4.922                        <   needs updating (index has 7.4.960)

Should I run pkg-static install -f pkg now or should I first rebuild all ports?

Thankyou.
 
Thank you, I did both commands.

I don't understand this:

Code:
# pkg version -vL=
autoconf-2.69_1                    >   succeeds port (port has 2.69)
bash-4.4.12_2                      >   succeeds port (port has 4.3.42)
bison-3.0.4,1                      >   succeeds port (port has 2.7.1,1)
bonnie++-1.97.3                    >   succeeds port (port has 1.97_3)
ca_root_nss-3.32.1                 >   succeeds port (port has 3.20.1)
cmake-3.8.2                        >   succeeds port (port has 3.3.1)
cmake-modules-3.8.2                >   succeeds port (port has 3.3.1)
curl-7.55.1                        >   succeeds port (port has 7.45.0)
db5-5.3.28_6                       >   succeeds port (port has 5.3.28_2)
dialog4ports-0.1.6                 >   succeeds port (port has 0.1.5_2)
e2fsprogs-libuuid-1.43.4           >   succeeds port (port has 1.42.12)
expat-2.2.1                        >   succeeds port (port has 2.1.0_3)
fusefs-libs-2.9.5                  >   succeeds port (port has 2.9.4)
fusefs-ntfs-2017.3.23              >   succeeds port (port has 2015.3.14_3)
gettext-runtime-0.19.8.1_1         >   succeeds port (port has 0.19.6)
gettext-tools-0.19.8.1             >   succeeds port (port has 0.19.6)
glib-2.50.2_3,1                    >   succeeds port (port has 2.44.1_2)
gmake-4.2.1_1                      >   succeeds port (port has 4.1_2)
help2man-1.47.4                    >   succeeds port (port has 1.43.3_1)
indexinfo-0.2.6                    >   succeeds port (port has 0.2.4)
jsoncpp-1.8.1                      >   succeeds port (port has 0.6.0.r2_2)
libX11-1.6.5,1                     >   succeeds port (port has 1.6.3,1)
libarchive-3.3.1,1                 >   succeeds port (port has 3.1.2_4,1)
libedit-3.1.20170329_2,1           >   succeeds port (port has 3.1.20150325_1)
libevent-2.1.8                     ?   orphaned: devel/libevent
libiconv-1.14_10                   >   succeeds port (port has 1.14_9)
libidn-1.33_1                      >   succeeds port (port has 1.31)
liblz4-1.7.5,1                     >   succeeds port (port has 131)
libnghttp2-1.23.1                  ?   orphaned: www/libnghttp2
libpthread-stubs-0.4               >   succeeds port (port has 0.3_6)
libslang2-2.3.1                    >   succeeds port (port has 2.3.0)
libssh2-1.8.0,3                    >   succeeds port (port has 1.6.0_1,2)
libublio-20070103_2                >   succeeds port (port has 20070103)
libuv-1.12.0                       >   succeeds port (port has 1.7.5)
libxcb-1.12_2                      >   succeeds port (port has 1.11.1)
libxml2-2.9.4                      >   succeeds port (port has 2.9.3)
lzo2-2.10_1                        >   succeeds port (port has 2.09)
m4-1.4.18,1                        >   succeeds port (port has 1.4.17_1,1)
mc-4.8.19_3                        >   succeeds port (port has 4.8.14_1)
mysql56-client-5.6.37              >   succeeds port (port has 5.6.27)
mysql56-server-5.6.37              >   succeeds port (port has 5.6.27)
p5-Locale-gettext-1.07             >   succeeds port (port has 1.06)
pcre-8.40_1                        >   succeeds port (port has 8.37_4)
perl5-5.24.1_1                     ?   orphaned: lang/perl5.24
pkg-1.10.1                         >   succeeds port (port has 1.6.1_2)
pkgconf-1.3.7,1                    >   succeeds port (port has 0.9.12_1)
png-1.6.29                         >   succeeds port (port has 1.6.19)
popt-1.16_2                        >   succeeds port (port has 1.16_1)
portmaster-3.17.10                 >   succeeds port (port has 3.17.8_1)
py27-Babel-2.3.4                   >   succeeds port (port has 2.1.1)
py27-Jinja2-2.9.5                  >   succeeds port (port has 2.8)
py27-MarkupSafe-1.0                >   succeeds port (port has 0.23)
py27-docutils-0.13.1               >   succeeds port (port has 0.12)
py27-imagesize-0.7.1               ?   orphaned: graphics/py-imagesize
py27-pygments-2.2.0                >   succeeds port (port has 2.0.2)
py27-pytz-2016.10,1                >   succeeds port (port has 2015.7,1)
py27-setuptools-36.0.1             ?   orphaned: devel/py27-setuptools
py27-six-1.10.0                    >   succeeds port (port has 1.9.0)
py27-sphinx-1.4.8_2,1              >   succeeds port (port has 1.3.1_2)
py27-sphinx_rtd_theme-0.2.4        >   succeeds port (port has 0.1.8)
python27-2.7.13_7                  >   succeeds port (port has 2.7.10_1)
readline-7.0.3                     >   succeeds port (port has 6.3.8)
rhash-1.3.4                        >   succeeds port (port has 1.3.3)
rsync-3.1.2_7                      >   succeeds port (port has 3.1.1_4)
ruby-2.3.4_1,1                     ?   orphaned: lang/ruby23
scons-2.5.1_1                      >   succeeds port (port has 2.3.0_1)
talloc-2.1.9                       >   succeeds port (port has 2.1.3_1)
tcl86-8.6.6_2                      >   succeeds port (port has 8.6.4)
tdb-1.3.12,1                       >   succeeds port (port has 1.3.7_1,1)
tevent-0.9.31                      >   succeeds port (port has 0.9.25)
xproto-7.0.31                      >   succeeds port (port has 7.0.28)

Code:
# pkg upgrade
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
Checking for upgrades (0 candidates): 100%
Processing candidates (0 candidates): 100%
Checking integrity... done (0 conflicting)
Your packages are up to date.

Should I completely remove /usr/ports directory now?

Thank you
 
Ah, the difference is probably due to pkg(8) using the quarterly branch and your ports tree is using latest. The quarterly packages are updated once every three months (and for security/stability issues). You can switch to the latest packages if you want, that will bring it more in line with the ports versions. Or you can keep the quarterly packages (less updating required).

If you want to switch to the latest packages, create a file /usr/local/etc/pkg/repos/FreeBSD.conf:
Code:
FreeBSD: {
  url: "pkg+http://pkg.FreeBSD.org/${ABI}/latest"
}

When you're only using packages the ports tree /usr/ports can be removed completely, it's not needed.
 
I think this happens because, during upgrading (from 10.1-RELEASE to 10.3-RELEASE and after to 11.1-RELEASE), I never used portsnap fetch and portsnap update, so ports versions are "out-of-sync" maybe.
My doubt remain: can I safely remove /usr/ports?
Thankyou!
 
I never used portsnap fetch and portsnap update, so ports versions are "out-of-sync" maybe.
Oh, right. That's indeed what's happening. Your ports tree is just really old.

My doubt remain: can I safely remove /usr/ports?
Yes, it's not needed for pkg(8) to work. You only 'need' the ports tree if you actually build from ports. You can safely remove it. A rm -rf /usr/ports is enough.
 
Hi, okay, I just removed ports tree, even if I got this error:

Code:
# rm -rf /usr/ports
rm: /usr/ports: Device busy

anyway:

Code:
# du -sh /usr/ports/
512B    /usr/ports/
# ls -l  /usr/ports/
total 0

I just noticed this, too, when using lsof:

Code:
# lsof |head
lsof: WARNING: compiled for FreeBSD release 11.0-RELEASE-p12; this is 11.1-RELEASE-p1.
COMMAND    PID  USER   FD   TYPE             DEVICE           SIZE/OFF   NODE NAME
kernel       0  root  cwd   VDIR      208,272695541                 26      4 /
kernel       0  root  rtd   VDIR      208,272695541                 26      4 /
init         1  root  cwd   VDIR      208,272695541                 26      4 /
init         1  root  rtd   VDIR      208,272695541                 26      4 /
zfskern      6  root  cwd   VDIR      208,272695541                 26      4 /
zfskern      6  root  rtd   VDIR      208,272695541                 26      4 /
..
..

Should I be concerned about this mismatch?
Thank you for your patience
 
Hi, okay, I just removed ports tree, even if I got this error:

Code:
# rm -rf /usr/ports
rm: /usr/ports: Device busy
Maybe you still have a shell open in that directory? That would prevent you from deleting it. Either that or some other process is still using it.
 
Back
Top