25afa HOWTO: FreeBSD Binary Upgrade (base system + packages) - The FreeBSD Forums
The FreeBSD Forums  

Go Back   The FreeBSD Forums > Miscellaneous > Howtos & FAQs (Moderated)

Howtos & FAQs (Moderated) Would you like to share some of your solutions for certain problems? Tips or tricks? Post here. All new topics are automatically moderated.

Reply
 
Thread Tools Display Modes
  #1  
Old September 13th, 2010, 10:49
vermaden's Avatar
vermaden vermaden is offline
Giant Locked
 
Join Date: Nov 2008
Location: pl_PL.lodz
Posts: 2,193
Thanks: 59
Thanked 633 Times in 349 Posts
Default HOWTO: FreeBSD Binary Upgrade (base system + packages)

There are many ways to upgrade FreeBSD along with installed packages to the newest version(s), most of them include compilation (buildworld/portmaster), this HOWTO will provide simple and fast way to upgrade FreeBSD system without needless compilation.

Upgrade if the base system is relatively easy, its about to type 4 commands, read and UNDERSTAND on screen comunicates, if it goes to packages, we will use the fact, that all packages are build to newest version along with newest *-RELEASE version.

0. CONFIGURATION BACKUP (rather not needed, but ...)
root # tar -czf /root/ETC.tar.gz /etc /usr/local/etc

1. BASE SYSTEM UPGRADE (I assume that 8.1-RELEASE is the current latest version)
root # freebsd-update upgrade -r 8.1-RELEASE
root # freebsd-update install
root # shutdown -r now
root # freebsd-update install

While doing the base system procedure we will be asked for installed 'datasets' and about modifications in config files, we only need to read and UNDERSTAND the on screen comunicats.


2. PACKAGES UPGRADE
root # pkg_info -qoa | sort > /root/packagelist
root # pkg_delete -a -f
root # rm -r -f /boot/modules /usr/local /var/db/pkg
root # while read PKG; do pkg_add -r $( basename ${PKG} ); done < /root/packagelist

At this point all old packages have been removed, and latest pacakges have been installed on their place, it works automatically, unless port nam has changed, like with VirtualBox, when its port name changed from emulators/virtualbox into emulators/virtualbox-ose, so the only 'risk' here, is that some packages will not be added automatically.


2.1. SEARCHING FOR MISSED PACKAGES
root # pkg_info -qoa | sort > /root/packagelist.NEW
root # diff -u /root/packagelist*

This way is probably the fastest and easiest to find missed packages.


3. CLEANUP
root # rm -r -f /root/packagelist*
root # rm -r -f /root/ETC.tar.gz

If we had made some bigger changes in the configuration, we may keep the old configuration (/root/ETC.tar.gz).

__________________
Religions, worst damnation of mankind.
"FreeBSD has always been the operating system that GNU/Linux should have been." Frank Pohlmann, IBM
http://vermaden.blogspot.com

Last edited by vermaden; December 3rd, 2010 at 07:26.
Reply With Quote
The Following 13 Users Say Thank You to vermaden For This Useful Post:
Caliante (October 3rd, 2010), garrych (March 4th, 2011), graudeejs (September 13th, 2010), hansivers (September 26th, 2010), hbokh (November 7th, 2010), mfaridi (September 14th, 2010), nemo (September 14th, 2010), psycho (September 13th, 2010), renice (September 13th, 2010), Sora_ (September 20th, 2010), toomanysecrets (September 21st, 2010), vertexSymphony (September 15th, 2010), YZMSQ (September 7th, 2011)
  #2  
Old September 13th, 2010, 13:52
psycho psycho is offline
Member
 
Join Date: Oct 2009
Location: universe
Posts: 128
Thanks: 34
Thanked 4 Times in 2 Posts
Thumbs up

great how-to, like usual...
__________________
Hiroshima '45 - Tschernobyl '86 - Windows '95 - Psycho '10
Reply With Quote
  #3  
Old September 13th, 2010, 16:20
graudeejs's Avatar
graudeejs graudeejs is offline
Style(9) Addict
 
Join Date: Nov 2008
Location: Riga, Latvia
Posts: 4,523
Thanks: 422
Thanked 607 Times in 475 Posts
Default

fix: s/probable/probably/ at the end of post

Nice howto

Last edited by graudeejs; September 13th, 2010 at 22:14.
Reply With Quote
The Following User Says Thank You to graudeejs For This Useful Post:
vermaden (September 13th, 2010)
  #4  
Old September 15th, 2010, 14:10
surgeon surgeon is offline
Junior Member
 
Join Date: Sep 2010
Location: Lubin
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

FBSD 7.3 is not supported?

Code:
# freebsd-update upgrade -r 8.1-RELEASE
Looking up update.FreeBSD.org mirrors... 4 mirrors found.
Fetching public key from update4.FreeBSD.org... failed.
Fetching public key from update5.FreeBSD.org... failed.
Fetching public key from update2.FreeBSD.org... failed.
Fetching public key from update3.FreeBSD.org... failed.
No mirrors remaining, giving up.
Reply With Quote
  #5  
Old September 16th, 2010, 10:27
vermaden's Avatar
vermaden vermaden is offline
Giant Locked
 
Join Date: Nov 2008
Location: pl_PL.lodz
Posts: 2,193
Thanks: 59
Thanked 633 Times in 349 Posts
Default

Quote:
Originally Posted by surgeon View Post
FBSD 7.3 is not supported?
Even 7.2-RELEASE have info about upgrade using freebsd-update, so its definitely supported, the question is why You could not found any mirrors, any network issues?

http://freebsd.org/releases/7.2R/announce.html
__________________
Religions, worst damnation of mankind.
"FreeBSD has always been the operating system that GNU/Linux should have been." Frank Pohlmann, IBM
http://vermaden.blogspot.com
Reply With Quote
  #6  
Old September 16th, 2010, 12:02
surgeon surgeon is offline
Junior Member
 
Join Date: Sep 2010
Location: Lubin
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by vermaden View Post
the question is why You could not found any mirrors, any network issues?
Nope.

I can easily browse http://update5.freebsd.org/ and http://update4.freebsd.org/.
But not http://update.freebsd.org/.
Reply With Quote
  #7  
Old September 19th, 2010, 19:56
Sora_ Sora_ is offline
Junior Member
 
Join Date: Sep 2010
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by surgeon View Post
You just have to wait... I had the same problem and after 10 minutes i tried it again and it worked.
Reply With Quote
  #8  
Old September 21st, 2010, 18:23
MrHien MrHien is offline
Junior Member
 
Join Date: Jul 2010
Posts: 1
Thanks: 3
Thanked 0 Times in 0 Posts
Default

Nice tut! It working for me..
Reply With Quote
  #9  
Old September 23rd, 2010, 12:09
surgeon surgeon is offline
Junior Member
 
Join Date: Sep 2010
Location: Lubin
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Maybe this is the problem?

Code:
# freebsd-update upgrade -v debug -r 8.1-RELEASE
Looking up update.FreeBSD.org mirrors... 4 mirrors found.
Fetching public key from update4.FreeBSD.org... fetch: http://update4.FreeBSD.org/7.3-STABLE/amd64/pub.ssl: Not Found
failed.                         
Fetching public key from update5.FreeBSD.org... fetch: http://update5.FreeBSD.org/7.3-STABLE/amd64/pub.ssl: Not Found
failed.                         
Fetching public key from update2.FreeBSD.org... fetch: http://update2.FreeBSD.org/7.3-STABLE/amd64/pub.ssl: Not Found
failed.                         
Fetching public key from update3.FreeBSD.org... fetch: http://update3.FreeBSD.org/7.3-STABLE/amd64/pub.ssl: Not Found
failed.                         
No mirrors remaining, giving up.
There is no 7.3-STABLE dir. Only 7.3-RELEASE. So, where to repair that?
Reply With Quote
  #10  
Old September 23rd, 2010, 21:53
oliverh's Avatar
oliverh oliverh is offline
Member
 
Join Date: Nov 2008
Location: 127.0.0.1
Posts: 557
Thanks: 51
Thanked 36 Times in 33 Posts
Default

@surgeon

Stable is development, there are no binary updates for it.
__________________
What was the goal of the Linux community--to replace Windows? One can imagine higher aspirations., Bill Joy
Reply With Quote
  #11  
Old September 23rd, 2010, 22:02
vermaden's Avatar
vermaden vermaden is offline
Giant Locked
 
Join Date: Nov 2008
Location: pl_PL.lodz
Posts: 2,193
Thanks: 59
Thanked 633 Times in 349 Posts
Default

Quote:
Originally Posted by surgeon View Post
There is no 7.3-STABLE dir. Only 7.3-RELEASE. So, where to repair that?
As You built *-STABLE by hand, You must now rebuilt it by hand into *-RELEASE.

You may of course stay 'STABLE' and update packages only, as step 2. and later will work as advertised (if I recall correctly packages for *-STABLE are rebuild wvery week).
__________________
Religions, worst damnation of mankind.
"FreeBSD has always been the operating system that GNU/Linux should have been." Frank Pohlmann, IBM
http://vermaden.blogspot.com
Reply With Quote
  #12  
Old September 26th, 2010, 09:11
hansivers hansivers is offline
Junior Member
 
Join Date: Nov 2008
Location: Quebec, Canada
Posts: 30
Thanks: 30
Thanked 5 Times in 4 Posts
Default

Quote:
Originally Posted by vermaden View Post
2. PACKAGES UPGRADE
root # pkg_info -qoa > /root/packagelist
root # pkg_delete -a -f
root # rm -r -f /boot/modules /usr/local /var/db/pkg
root # while read PKG; do pkg_add -r $( basename ${PKG} ); done < /root/packagelist
@Vermaden :

Many thanks again for your very informative post.

If my understanding of your script is correct, the removal of /usr/local directory (3rd line) will destroy all modifications to packages config files in /usr/local/etc. So, the admin will have to retype again all these modifications AFTER installation of newest packages. Would have been more efficient just to keep /usr/local/etc directory untouched, to provide the newest packages with the personalized version of config files?
Reply With Quote
  #13  
Old September 26th, 2010, 18:48
vermaden's Avatar
vermaden vermaden is offline
Giant Locked
 
Join Date: Nov 2008
Location: pl_PL.lodz
Posts: 2,193
Thanks: 59
Thanked 633 Times in 349 Posts
Default

Quote:
Originally Posted by hansivers View Post
@Vermaden :

Many thanks again for your very informative post.

If my understanding of your script is correct, the removal of /usr/local directory (3rd line) will destroy all modifications to packages config files in /usr/local/etc.
... but the 0. step BACKUPS the /usr/local/etc directory.
__________________
Religions, worst damnation of mankind.
"FreeBSD has always been the operating system that GNU/Linux should have been." Frank Pohlmann, IBM
http://vermaden.blogspot.com
Reply With Quote
  #14  
Old September 27th, 2010, 15:34
hansivers hansivers is offline
Junior Member
 
Join Date: Nov 2008
Location: Quebec, Canada
Posts: 30
Thanks: 30
Thanked 5 Times in 4 Posts
Default

Quote:
Originally Posted by vermaden View Post
... but the 0. step BACKUPS the /usr/local/etc directory.
Yes, I have noticed. My question was more about what to do after installation of newer packages. If I follow your script step by step, the older config files are not lost (because of the initial backup) but they are no longer installed in the /usr/local/etc directory.

So I understand that the admin have two possible courses of action:

a) untar the older config files in /usr/local/etc (but it will replace the newer config files, a risky operation)

b) manually merge older and newer config files (with diff or something like that?)

That why I asked previously whether it would have been more simple to just keep /usr/local/etc untouched (to avoid the manual merging).

Many thanks again for your feedback. It is much appreciated!
Reply With Quote
  #15  
Old September 27th, 2010, 16:00
vermaden's Avatar
vermaden vermaden is offline
Giant Locked
 
Join Date: Nov 2008
Location: pl_PL.lodz
Posts: 2,193
Thanks: 59
Thanked 633 Times in 349 Posts
Default

Quote:
Originally Posted by hansivers View Post
That why I asked previously whether it would have been more simple to just keep /usr/local/etc untouched (to avoid the manual merging).
I have done that in 8.0 --> 8.1 step, everything worked, that that was not a critical/important machine so I would fix it without any pressure.

As for NOT deleting /usr/local/etc, something like that my be usefull:
Code:
# cd /usr/local
# ls | grep -v etc | while read I; do rm -r -f "${I}"; done
__________________
Religions, worst damnation of mankind.
"FreeBSD has always been the operating system that GNU/Linux should have been." Frank Pohlmann, IBM
http://vermaden.blogspot.com
Reply With Quote
  #16  
Old November 7th, 2010, 19:52
hbokh's Avatar
hbokh hbokh is offline
Junior Member
 
Join Date: Nov 2008
Location: GRN, NL
Posts: 10
Thanks: 4
Thanked 0 Times in 0 Posts
Default

Be very careful! WHY do a "rm -rf" on the complete /usr/local but backup ONLY etc in that directory?
A lot of users have a whole lot of stuff in /usr/local (web-root / installers / certificates / etc.).
Reply With Quote
  #17  
Old November 8th, 2010, 06:57
vermaden's Avatar
vermaden vermaden is offline
Giant Locked
 
Join Date: Nov 2008
Location: pl_PL.lodz
Posts: 2,193
Thanks: 59
Thanked 633 Times in 349 Posts
Default

@hbokh

HOWTO creator assumes that You KNOW what You are doing ...
__________________
Religions, worst damnation of mankind.
"FreeBSD has always been the operating system that GNU/Linux should have been." Frank Pohlmann, IBM
http://vermaden.blogspot.com
Reply With Quote
  #18  
Old January 4th, 2011, 18:21
freeck freeck is offline
Junior Member
 
Join Date: Dec 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I get a "variable not defined" error at this step:

Code:
root # while read PKG; do pkg_add -r $( basename ${PKG} ); done < /root/packagelist
Reply With Quote
  #19  
Old January 5th, 2011, 10:30
vermaden's Avatar
vermaden vermaden is offline
Giant Locked
 
Join Date: Nov 2008
Location: pl_PL.lodz
Posts: 2,193
Thanks: 59
Thanked 633 Times in 349 Posts
Default

@freeck

You need to use POSIX sh(1) compatible for these commands.
__________________
Religions, worst damnation of mankind.
"FreeBSD has always been the operating system that GNU/Linux should have been." Frank Pohlmann, IBM
http://vermaden.blogspot.com
Reply With Quote
  #20  
Old July 28th, 2012, 16:33
sinbad sinbad is offline
Junior Member
 
Join Date: Jul 2012
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

oppps.
I'm getting "Illegal variable name" when tryiing step 4
Code:
#while read PKG ; do pkg_add -r $( basename ${PKG} ) ; done < /root/packagelist
Illegal variable name.
At first I thought its because I had csh as my shell. so I changed it back to chsh -s /bin/tcsh

but the same Illegal variable name is shown.

can someone please help me? my server is down now.
Reply With Quote
  #21  
Old July 28th, 2012, 20:18
vermaden's Avatar
vermaden vermaden is offline
Giant Locked
 
Join Date: Nov 2008
Location: pl_PL.lodz
Posts: 2,193
Thanks: 59
Thanked 633 Times in 349 Posts
Default

Both csh/tcsh are C-shells, use sh/zsh/fish/ksh/bash which are Bourne Shells.
__________________
Religions, worst damnation of mankind.
"FreeBSD has always been the operating system that GNU/Linux should have been." Frank Pohlmann, IBM
http://vermaden.blogspot.com
Reply With Quote
  #22  
Old July 28th, 2012, 21:39
sinbad sinbad is offline
Junior Member
 
Join Date: Jul 2012
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks so much for the reply. I was able to change to sh and run the command.
problem now is that I'm getting
Code:
unable to fetch 'ftp://ftp.package' protocol error
for all the packages.

my google turn that I need to add the http:// to the url but not sure how to apply to the command
Code:
while read PKG ; do pkg_add -r $( basename ${PKG} ) ; done < /root/packagelist
Any ideas what I can try?
thanks again.

Last edited by wblock@; July 28th, 2012 at 21:54. Reason: add [code] tags
Reply With Quote
  #23  
Old July 28th, 2012, 22:53
sinbad sinbad is offline
Junior Member
 
Join Date: Jul 2012
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Forget the upgrade. I was stupid enough to delete my www dir which was inside /usr/local. Damn me so stupid.
Please add to your initial post a warning so other stupid user like myself, who don't fall in the 'know what they doing' won't *beep**beep**beep**beep* up their sites so easily.
Feels like jumping from the roof now.

Last edited by wblock@; July 29th, 2012 at 04:38. Reason: Capitalization/spelling.
Reply With Quote
  #24  
Old July 29th, 2012, 04:39
wblock@'s Avatar
wblock@ wblock@ is offline
Moderator
 
Join Date: Sep 2009
Location: Milky Way galaxy
Posts: 7,723
Thanks: 432
Thanked 1,761 Times in 1,458 Posts
Default

Look at it this way:

A) It shows how valuable backups are.
B) When you recreate it, it will be better than before because of your experience.
Reply With Quote
Reply

Tags
binary, packages, portmaster, update, upgrade

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
HOWTO: WINE on amd64 (faster/binary way) vermaden Howtos & FAQs (Moderated) 25 January 25th, 2013 11:09
[Solved] Binary upgrade (freebsd-update) Base + Jails 8.0 -> 8.1 Predy Installing & Upgrading 4 October 13th, 2010 15:21
[Solved] Lots of binary packages missing Navigium Installation and Maintenance of FreeBSD Ports or Packages 7 September 16th, 2010 02:50
What's better for upgrade base system ? + Question about CFLAGS elvis4526 Installing & Upgrading 7 August 4th, 2010 04:33
Upgrade a binary package rainman82 Installation and Maintenance of FreeBSD Ports or Packages 1 September 9th, 2009 15:59


All times are GMT +1. The time now is 15:10.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
The mark FreeBSD is a registered trademark of The FreeBSD Foundation and is used by The FreeBSD Project with the permission of The FreeBSD Foundation.
Web protection and acceleration provided by CloudFlare
0