# How do recompile everything?



## ph0enix (Mar 20, 2009)

I would like to rebuild the whole system, upgrade the ports and all the dependencies.  I tried the following procedure:

1.  rm -rf /usr/obj 
2.  cd /usr/src     
3.  make buildworld
4.  make buildkernel KERNCONF=YOUR_KERNEL_HERE  
5.  make installkernel KERNCONF=YOUR_KERNEL_HERE  
6.  reboot        (in single user mode: boot -s from the loader prompt).
7.  mergemaster -p
8.  make installworld
9.  make delete-old
10.  mergemaster -ia
11.  reboot
12.  make delete-old-libs 
13.  portsnap update
14.  portupgrade -all

Unfortunately, a lot of packages didn't get reinstalled and there were all kinds of dependency issues with the ports.  Is there a clean, simple way of rebuilding the whole system using the latest sources?

Thank you! 

J.


----------



## DutchDaemon (Mar 20, 2009)

portsnap fetch update
portupgrade -af


----------



## ph0enix (Mar 20, 2009)

Does this upgrade/reinstall packages that were fetched/installed using pkg_add too?


----------



## DutchDaemon (Mar 20, 2009)

Not in package form; it will reinstall/upgrade everything as ports. Look into the -P and -PP flags to portupgrade. Something like portupgrade -afP or -afPP is entirely possible.


----------



## ph0enix (Mar 20, 2009)

That's fine.  I don't need it in package form.  As long as everything gets upgraded.

Thanks! 

J.


----------



## ph0enix (Mar 21, 2009)

So I tried that and it complained about a stale dependency and told me to run "pkgdb -F" so I did but I can't figure out what I'm supposed to do here.  It's not really asking anything but it wants me to answer:

--->  Checking the package registry database
Stale dependency: compiz-fusion-0.7.8 -> gnome-icon-theme-2.22.0_1 (misc/gnome-icon-theme):
gnome-vfs-2.24.0 (score:31%) ? ([y]es/[n]o/[a]ll) [no]


----------



## DutchDaemon (Mar 21, 2009)

You can usually just go with the default, which is [no] in this case. Just type enter. Then it will ask if you want to install that dependency. Answer yes to that. When you use a mix of packages and ports you may encounter pkgdb -F quite a few times. Just be patient. Keep in mind that pkgdb is not highly intelligent; it will just suggest a port that looks a bit similar, and it's rarely correct, but it may happen. In that case you can say 'yes' to the suggestion. Also keep an eye on /usr/ports/UPDATING, because some upgrades need some additional actions. Once you've cleared the entire minefield you will find that updating ports regularly is not rocket science.


----------



## ph0enix (Mar 21, 2009)

It gave me:

--->  Checking the package registry database
Stale dependency: compiz-fusion-0.7.8 -> kdebase-kompmgr-3.5.10 (x11-wm/kompmgr):
kdebase-workspace-4.2.1 (score:47%) ? ([y]es/[n]o/[a]ll) [no] 
Install stale dependency? ([y]es/[n]o/[a]ll) [yes] 

I hit yes to install and it started compiling, then said:

bs --cflags avahi-client` -L/usr/local/lib -o libdns_sd.la -rpath /usr/local/lib libdns_sd_la-compat.lo libdns_sd_la-txt.lo libdns_sd_la-unsupported.lo libdns_sd_la-warn.lo  -lssp
cc -shared  .libs/libdns_sd_la-compat.o .libs/libdns_sd_la-txt.o .libs/libdns_sd_la-unsupported.o .libs/libdns_sd_la-warn.o  -Wl,--rpath -Wl,/usr/local/lib -Wl,--rpath -Wl,/usr/local/lib -pthread -L/usr/local/lib /usr/local/lib/libavahi-common.so /usr/local/lib/libavahi-client.so -lssp  -pthread -pthread -pthread -pthread -pthread -Wl,-soname -Wl,libdns_sd.so.1 -o .libs/libdns_sd.so.1
(cd .libs && rm -f libdns_sd.so && ln -s libdns_sd.so.1 libdns_sd.so)
(cd .libs && rm -f libdns_sd.so && ln -s libdns_sd.so.1 libdns_sd.so)
ar cru .libs/libdns_sd.a  libdns_sd_la-compat.o libdns_sd_la-txt.o libdns_sd_la-unsupported.o libdns_sd_la-warn.o
ranlib .libs/libdns_sd.a
creating libdns_sd.la
(cd .libs && rm -f libdns_sd.la && ln -s ../libdns_sd.la libdns_sd.la)
sed -e 's,@prefix\@,/usr/local,g' \
	    -e 's,@libdir\@,/usr/local/lib,g' \
	    -e 's,@PTHREAD_CFLAGS\@,-D_THREAD_SAFE ,g' \
	    -e 's,@PTHREAD_LIBS\@,-pthread,g' \
	    -e 's,@PACKAGE_VERSION\@,0.6.24,g' avahi-compat-libdns_sd.pc.in > avahi-compat-libdns_sd.pc
--->  Installing the new version via the port
===>  Installing for avahi-libdns-0.6.24

===>  avahi-libdns-0.6.24 conflicts with installed package(s): 
      mDNSResponder-108

      They install files into the same place.
      Please remove them first with pkg_delete(1).
*** Error code 1

Stop in /usr/ports/net/avahi-libdns.
*** Error code 1

Stop in /usr/ports/net/avahi-libdns.
** Command failed [exit code 1]: /usr/bin/script -qa /tmp/portinstall20090320-14570-1vwwqbe-0 env make reinstall
** Fix the installation problem and try again.
--->  Skipping 'x11-wm/kompmgr' because a requisite port 'net/avahi-libdns' failed (specify -k to force)
** Listing the failed packages (-:ignored / *:skipped / !:failed)
	! net/avahi-libdns	(install error)
	* x11-wm/kompmgr
Command failed [exit code 1]: /usr/local/sbin/portinstall x11-wm/kompmgr

I'm really trying to be patient


----------



## ph0enix (Mar 21, 2009)

Something tells me that I'm currently running a hybrid of KDE 3.5 and 4.2 because the window decorations are fugly (even when I pick oxygen or keramik) and every time I start an X app. from the command line, I get messages like this:

:1: error: unexpected character `\1', expected keyword - e.g. `style'


...oh, and also, I ran kcontrol which told me that I'm running KDE 3.5-something-or-other.

"ps -A |grep -i kde" thinks it's KDE 4:

 1137  ??  Is     0:00.00 /usr/local/kde4/bin/kdm-bin
 1156  ??  Is     0:00.01 /bin/sh /usr/local/kde4/bin/startkde
 1206  ??  Is     0:00.04 kdeinit4: kdeinit4 Running... (kdeinit4)
 1209  ??  S      1:54.87 kded4
 1220  ??  I      0:00.05 /usr/local/kde4/bin/kwrited
 1223  ??  I      0:00.27 /usr/local/kde4/bin/knotify4
 1224  ??  I      0:00.13 /usr/local/kde4/bin/nepomukserver
 1225  ??  S      0:00.28 /usr/local/kde4/bin/nepomukservicestub nepomukstorage
 1226  ??  I      0:24.84 /usr/local/kde4/bin/plasma
 1227  ??  S      0:05.76 /usr/local/kde4/bin/nepomukservicestub nepomukontologyloader
 1228  ??  S      0:00.15 /usr/local/kde4/bin/nepomukservicestub nepomukmigration1
 1229  ??  SN     0:00.17 /usr/local/kde4/bin/nepomukservicestub nepomukstrigiservice
 1230  ??  S      0:00.16 /usr/local/kde4/bin/nepomukservicestub nepomukqueryservice
 1231  ??  S      0:00.16 /usr/local/kde4/bin/nepomukservicestub nepomukfilewatch
 1234  ??  S      0:00.23 /usr/local/kde4/bin/kaccess
 1244  ??  S      0:00.71 /usr/local/kde4/bin/klipper
 1246  ??  S      0:13.64 /usr/local/kde4/bin/kmix
 1248  ??  S      0:04.28 /usr/local/kde4/bin/krunner
 1249  ??  S      0:00.26 /usr/local/kde4/bin/korgac -icon korgac


----------



## jb_fvwm2 (Mar 21, 2009)

how many ports do you have in /var/db/pkg?
more than a few and updating everything can be problematic.
I categorize them (sometimes even written down) and
update each type different ways.
.............
"stale dependency"
IMHO better to just 1... note what the missing
dependency is (you can in another TTY change to 
the port and find out while pkgdb waits)., then
answer N, N, "carriage return" , A
to
1... "this other dependency?
2...  "install stale dependency?
3..  new dependency?
4... skip this (y,n,a)
.........
and if pkgdb completes, you can manually
install the missing ones.
......................
I even put the "N N [return] A " , on a 
label on the monitor.


----------



## DutchDaemon (Mar 21, 2009)

You can also install portmaster for a minute and run portmaster -L. You only need to *portupgrade -f* the root ports (first block) and *portupgrade -Rf* the leaf ports (last block). The other two blocks of ports (trunk ports and branch ports) will be pulled in as dependencies. This will probably cut down on running pkgdb -F, though not entirely. At least you don't have to restart *portupgrade -af* every time.

And never mind the weird side-effects that are visible in the screen, that's to be expected. I usually do these massive tasks from the console.


----------



## ph0enix (Mar 21, 2009)

I went for the hard way - deinstalled all KDE and related stuff (about 30 pieces total) until pkgdb -F said that it didn't see anything stale.  Now I'm doing "portupgrade -af" (630 packages) and I'll recompile KDE4 once it's finished.  Hopefully that will do the trick.


----------



## ph0enix (Mar 21, 2009)

"make config" is slowing the process down.  I'm accepting the defaults every time it comes up since I don't know what most of the options are.  Is this a one time thing?  The next time I run "portupgrade -af" it should just use the config options I chose the first time.  Correct?  If not, would the "-y" option take care of the config screens?


----------



## DutchDaemon (Mar 21, 2009)

Set the environment variable BATCH to yes (use set, setenv or export, depending on your shell, e.g. bash uses 'export BATCH=yes'), and all ports will build with their defaults, or re-use the options that were found for previous installs.


----------



## ph0enix (Mar 21, 2009)

Can I also use "--make-args j5"?  Does this usually work with portupgrade?

```
BATCH="yes" portupgrade --make-args j5 -af
```


----------



## DutchDaemon (Mar 21, 2009)

Better not, it will almost always screw up the install due to race/concurrency issues. Port installation is a very serial process, not geared towards parallel processing.


----------



## ph0enix (Mar 21, 2009)

That seems like a huge waste of processing power and time.  Not to ruffle any feathers but Gentoo definitely has a big advantage in this area then.  It allows you to specify MAKEOPTS in make.conf and it actually uses them when doing "emerge -e world" (which rebuilds all the packages with dependencies).


----------



## icer (Mar 25, 2009)

man portmaster:
  Using portmaster to do a complete reinstallation of all your ports:
           1. portmaster -l > ~/installed-port-list
           2. Update your ports tree
           3. portmaster --clean-distfiles-all
           4. portmaster --check-port-dbdir
           5. portmaster -Faf
           6. pkg_delete '*'
           7. rm -rf /usr/local/lib/compat/pkg
           8. Manually check /usr/local and /var/db/pkg
              to make sure that they are really empty

           Now look at the list you generated in the first step and install
           the root and leaf ports that you want to have again.  The trunk
           and branch ports are dependencies, and will automatically be
           installed as needed.  You probably want to use the -D option for
           the installations and then run --clean-distfiles[-all] again when
           you are done.  You might also want to consider using the
           --force-config option when installing the new ports.


----------

