how to rebuild sockstat and netstat

Installing and upgrading FreeBSD.

how to rebuild sockstat and netstat

Postby ivand58 » 18 May 2009, 12:31

Hi list,

after freebsd-update 7.0 -> 7.2 i have a problem with sockstat:
Code: Select all
# sockstat
sockstat: struct xtcpcb size mismatch
sockstat: struct xinpcb size mismatch
sockstat: struct xunpcb size mismatch
sockstat: struct xunpcb size mismatch
USER     COMMAND    PID   FD PROTO  LOCAL ADDRESS         FOREIGN ADDRESS


According [HTML]http://lists.freebsd.org/pipermail/freebsd-current/2007-December/081112.html[/HTML]
i have to rebuild sockstat and netstat:
Yes, I managed to build sockstat and netstat by adding a line
"CFLAGS+=-DLOCK_PROFILING" to apropriate Makefiles, then make clean,
make and make install did the trick.

My question is: how to do this? Where are these Makefiles and what exactly i have to do ?
ivand58
Junior Member
 
Posts: 34
Joined: 28 Nov 2008, 06:49
Location: Sofia, BULGARIA

Postby DutchDaemon » 18 May 2009, 12:52

If you're using freebsd-update, I assume you have the GENERIC kernel, which does not contain the LOCK_PROFILING option. Is your kernel in sync with the world? Is uname -r actually the same as your world's OS version/patch level (in /var/db/freebsd-update/tag)?

P.S.: comparing uname and the tag may not heed any results. The tag is only updated by the 'freebsd-update fetch' command. So if you don't install what you fetch, the tag file will be 'off-by-one', so to speak.
User avatar
DutchDaemon
Old Fart
 
Posts: 10467
Joined: 16 Nov 2008, 20:17
Location: The Netherlands

Postby SirDice » 18 May 2009, 13:05

It looks like you only updated the kernel and forgot to update world.
Senior UNIX Engineer at Unix Support Nederland
Experience is something you don't get until just after you need it.
User avatar
SirDice
Old Fart
 
Posts: 16196
Joined: 17 Nov 2008, 16:50
Location: Rotterdam, Netherlands

Postby ivand58 » 18 May 2009, 16:37

Thanks,
I just followed the instructions here: http://www.freebsd.org/releases/7.2R/announce.html
Code: Select all
freebsd-update upgrade -r 7.2-RELEASE
freebsd-update install
shutdown -r now
freebsd-update install
shutdown -r now

and my kernel is (was) untouched, GENERIC.
Code: Select all
 uname -a
FreeBSD aux.hobbylab.org 7.2-RELEASE FreeBSD 7.2-RELEASE #0: Fri May  1 08:49:13 UTC 2009     root@walker.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386

#cat /var/db/freebsd-update/tag
freebsd-update|i386|7.2-RELEASE|0|b6d6837d3363e50b4f04b250667e856227d40bfff6224698ac4591b12637de4f|1275350400


It looks like you only updated the kernel and forgot to update world.

Sorry but can you help me how to do this? In the Handbook, chapter 24 we can read
Do not use make world: A lot of older documentation recommends using make world for this. Doing that skips some important steps and should only be used if you are sure of what you are doing. For almost all circumstances make world is the wrong thing to do, and the procedure described here should be used instead.
but maybe this is something else?
ivand58
Junior Member
 
Posts: 34
Joined: 28 Nov 2008, 06:49
Location: Sofia, BULGARIA

Postby DutchDaemon » 18 May 2009, 16:47

Something else. The first [cmd=]freebsd-update install[/cmd] installs the new kernel, the second [cmd=]freebsd-update install[/cmd] installs the world and triggers a mergemaster-like config comparison tool.

I have no idea how a binary only system can produce the error you're seeing. I've not heard of this issue anywhere. I could tell you to roll-back the update and wait a while before trying again (maybe it's something that needs patching), but that's up to you.

I advise against 'polluting' the binary system with edited Makefiles and rebuilt/adjusted binaries (the sources are probably not even on your system -- I assume you have nothing in /usr/src/), because it will likely break the next run of freebsd-update.
User avatar
DutchDaemon
Old Fart
 
Posts: 10467
Joined: 16 Nov 2008, 20:17
Location: The Netherlands

Postby SirDice » 18 May 2009, 17:08

ivand58 wrote:Sorry but can you help me how to do this? In the Handbook, chapter 24 we can read
but maybe this is something else?


Sorry, old school bsd user :e Updating world actually consists of several steps these days.

I never use freebsd-update. I build everything from source.

Code: Select all
# make buildworld
# make buildkernel
# make installkernel
# reboot # to single usermode
# make installworld
# mergemaster
Senior UNIX Engineer at Unix Support Nederland
Experience is something you don't get until just after you need it.
User avatar
SirDice
Old Fart
 
Posts: 16196
Joined: 17 Nov 2008, 16:50
Location: Rotterdam, Netherlands

Postby ivand58 » 18 May 2009, 18:03

DutchDaemon wrote:...
I advise against 'polluting' the binary system with edited Makefiles and rebuilt/adjusted binaries ...

Edited by who? Do I have to modify some Makefiles (like in build custom kernel) or these Makefiles are modified by freebsd-update?
DutchDaemon wrote:... I assume you have nothing in /usr/src/...

No, /usr/src is not empty (i had to rebuild senmail with sasl).
ivand58
Junior Member
 
Posts: 34
Joined: 28 Nov 2008, 06:49
Location: Sofia, BULGARIA

Postby DutchDaemon » 18 May 2009, 22:16

You'd have to edit the Makefiles, like you stated in the first post.

The freebsd-update app doesn't use Makefiles, simply because it doesn't compile anything. That's the whole point of freebsd-update: installing already compiled binaries.

You compiling your own and replacing the ones installed by freebsd-update will probably lead to the failure of the next freebsd-update run, because it doesn't recognise your binaries. However, I do not know how freebsd-update handles such a case, because I compile everything myself. You may get away with it.
User avatar
DutchDaemon
Old Fart
 
Posts: 10467
Joined: 16 Nov 2008, 20:17
Location: The Netherlands

Postby vivek » 19 May 2009, 00:39

Try as follows (it may or may not work). You need to have src distribution installed.
Code: Select all
cd /usr/src/usr.bin/sockstat/
vi Makefile

Add CFLAGS+=-DLOCK_PROFILING.
Code: Select all
make install clean

If this failed, just rebuild everything.
Neither in this world nor elsewhere is there any happiness in store for him who always doubts. If you enjoyed my answer please consider donating some money to FreeBSD foundation @ http://www.freebsdfoundation.org/
User avatar
vivek
Member
 
Posts: 809
Joined: 17 Nov 2008, 08:19
Location: Hyper Space

Postby ivand58 » 20 May 2009, 04:12

Thanks you guys,
now i am back to freebsd 70 and everything looks fine. Is there some integration tests or some scripts that checks the integrity and functionality of the system? Because after these rebuilds, how can I be sure that everything is OK ?
ivand58
Junior Member
 
Posts: 34
Joined: 28 Nov 2008, 06:49
Location: Sofia, BULGARIA

Postby richardpl » 20 May 2009, 09:52

[man=1]ident[/man] is utility to check if version of files you have installed are same one as available from freebsd cvs repo.
richardpl
Member
 
Posts: 841
Joined: 17 Nov 2008, 17:02
Location: Croatia


Return to Installing & Upgrading

Who is online

Users browsing this forum: No registered users and 1 guest