# Unspecified Services Autloading After: freebsd-update



## vask (Oct 1, 2012)

How can I stop FreeBSD from loading all these services and just boot with minimal services loaded?

Currently my system seems to load all possible services. This is evident by typing:
`netstat -na | grep LIST`

Consequently on boot I have to have local access and run the following comands to get networking going again:

```
ipfw disable firewall
route flush
route add -net default 192.168.0.1
```

Please advise.

MORE INFO:
Originally FreeBSD 6.2 upgraded to 9.0


```
# uname -a
FreeBSD 9.0-RELEASE-p3 FreeBSD 9.0-RELEASE-p3 #0: Tue Jun 12 01:47:53 UTC 2012
     [email]root@i386-builder.daemonology.net[/email]:/usr/obj/usr/src/sys/GENERIC  i386
```

Files that seem to be ignored:
/etc/rc.conf
/etc/defaults/rc.conf


----------



## Crest (Oct 1, 2012)

Please provide the output from 
	
	



```
sockstat -l46
```
 and 
	
	



```
service -e
```
.


----------



## wblock@ (Oct 2, 2012)

Do not edit /etc/defaults/rc.conf.  Those are defaults that should only be overridden by /etc/rc.conf.

If you upgraded from FreeBSD 6 to 9 in one step, it would be a really, really good idea to fully run mergemaster(8) and
`# cd /usr/src && make check-delete-old`


----------



## vask (Oct 2, 2012)

```
[root@blue /root]# sockstat -l46
USER     COMMAND    PID   FD PROTO  LOCAL ADDRESS         FOREIGN ADDRESS      
root     bsnmpd     2229  5  udp4   *:*                   *:*
root     bsnmpd     2229  6  udp4   *:161                 *:*
root     ftpd       2217  5  tcp6   *:21                  *:*
root     ftpd       2217  6  tcp4   *:21                  *:*
root     nfscbd     2165  3  tcp4   *:7745                *:*
root     sshd       2129  3  tcp6   *:22                  *:*
root     sshd       2129  4  tcp4   *:22                  *:*
root     ypserv     1919  3  udp4   *:*                   *:*
root     ypserv     1919  5  udp4   *:863                 *:*
root     ypserv     1919  6  tcp4   *:863                 *:*
root     timed      1717  3  udp4   *:525                 *:*
daemon   rwhod      1710  3  udp4   *:513                 *:*
root     lpd        1556  6  tcp6   *:515                 *:*
root     lpd        1556  7  tcp4   *:515                 *:*
root     nfsuserd   1413  3  udp4   *:1021                *:*
root     nfsuserd   1412  3  udp4   *:1021                *:*
root     nfsuserd   1411  3  udp4   *:1021                *:*
root     nfsuserd   1410  3  udp4   *:1021                *:*
root     nfsuserd   1408  3  udp4   *:1021                *:*
root     keyserv    1395  4  udp6   *:966                 *:*
root     keyserv    1395  5  tcp6   *:641                 *:*
root     keyserv    1395  6  udp4   *:857                 *:*
root     keyserv    1395  7  tcp4   *:822                 *:*
root     kdc        1376  3  udp6   ::1:88                *:*
root     kdc        1376  4  tcp6   ::1:88                *:*
root     kdc        1376  5  udp4   192.168.0.23:88       *:*
root     kdc        1376  6  udp4   127.0.0.1:88          *:*
root     kdc        1376  7  udp4   10.0.0.1:88           *:*
root     kdc        1376  8  tcp4   192.168.0.23:88       *:*
root     kdc        1376  9  tcp4   127.0.0.1:88          *:*
root     kdc        1376  10 tcp4   10.0.0.1:88           *:*
root     amd        1335  4  udp4   *:1023                *:*
root     amd        1335  5  udp4   *:1022                *:*
root     amd        1335  6  tcp4   *:609                 *:*
root     amd        1335  7  udp4   *:856                 *:*
root     rpcbind    1257  4  udp6   *:*                   *:*
root     rpcbind    1257  6  udp6   *:111                 *:*
root     rpcbind    1257  7  udp6   *:996                 *:*
root     rpcbind    1257  8  tcp6   *:111                 *:*
root     rpcbind    1257  9  udp4   *:111                 *:*
root     rpcbind    1257  10 udp4   *:676                 *:*
root     rpcbind    1257  11 tcp4   *:111                 *:*
root     syslogd    1127  6  udp6   *:514                 *:*
root     syslogd    1127  7  udp4   *:514                 *:*
root     routed     1007  5  udp4   *:520                 *:*
root     route6d    996   3  udp6   *:521                 *:*
[root@blue /root]# service -e
/etc/rc.d/hostid
/etc/rc.d/hostid_save
/etc/rc.d/ip6addrctl
/etc/rc.d/cleanvar
/etc/rc.d/devd
/etc/rc.d/newsyslog
/etc/rc.d/syslogd
/etc/rc.d/dmesg
/etc/rc.d/virecover
/etc/rc.d/motd
/etc/rc.d/sshd
/etc/rc.d/sendmail
/etc/rc.d/cron
/etc/rc.d/mixer
/etc/rc.d/gptboot
/etc/rc.d/bgfsck
```


----------



## SirDice (Oct 2, 2012)

None of those services should be running by default.

How did you upgrade from 6.2 to 9.0?


----------



## vask (Oct 2, 2012)

*mergemaster worked!*

@wblock@, mergemaster worked! Adding thanks!

```
# netstat -na | grep LIST
tcp4       0      0 *.22                   *.*                    LISTEN
tcp6       0      0 *.22                   *.*                    LISTEN
```
MORE INFO:

It took me a bit to get comfortable with mergemaster ie) reading docs/tutorials. It took me 1 hour do download /usr/src with csup (mergemaster told me I needed it). After that there were ~346 files I had to merge, which took about 2 hours with some careful comparison. Total time it took me was probably around 4 hours

Commands used:

```
# cp -R /etc /etc.2012-10-02
# mv /usr/src /usr/src.2012-10-02

# vi ports-supfile
# csup ports-supfile
# mergemaster
# pwd_mkdb -p /etc/master.passwd
```

Note: At this point everthing is solved.

The rest of this thread is because the following commands nearly killed my system (Ironicolly they were advised along with mergemaster, which was the solution to my problem):
# cd /usr/src
# make check-old
# make delete-old
# make check-old-libs
# make delete-old-libs


----------



## SNK (Oct 2, 2012)

Just perform a clean install. That will save these headaches. You will have to recompile all ports anyway because of the big jump in version.


----------



## vask (Oct 2, 2012)

SirDice said:
			
		

> None of those services should be running by default.
> 
> How did you upgrade from 6.2 to 9.0?



Starting with a FreeBSD 6.2

```
freebsd-update -r 8.3-RELEASE upgrade
freebsd-update -r 9.0-RELEASE upgrade
```
MORE INFO

It was very difficult to update. At first my freebsd-update(8) version was so old it didn't allow the upgrade command, so I overwrote it with freebsd-update(8) from a working FreeBSD-7.2-RELEASE system. Then it said my kernel was custom so it had to build a generic kernel. I got lost somewhere along the way trying to "upgrade" to various versions prior to FreeBSD 8.3. Some of my struggle on different occations:
 - Confusion at: http://www.freebsd.org/doc/handbook/updating-upgrading-freebsdupdate.html
 - freebsd rollback
 - freebsd-update was trying to delete critical files on certain releases
 - screwed up the bootup because of some syntax errors  ie) undeleted <<<<<< after doing freebsd-update
 - upgrading ports was long and tricky
 - needed to get local access to the server
All and all I probably spent about a week with several hours per day trying to get to the point where I posted on here. Much of the time was tedious babysitting of the installation for when input is required.

Hope things are ok now.


----------



## wblock@ (Oct 2, 2012)

vask said:
			
		

> The check-delete-old command didn't work but maybe it's ok.
> # make check-delete-old
> make: don't know how to make check-delete-old. Stop



My fault, brain going faster than fingers.

```
# cd /usr/src
# make check-old
# make delete-old
# make check-old-libs
# make delete-old-libs
```


----------



## SirDice (Oct 3, 2012)

vask said:
			
		

> At first my freebsd-update(8) version was so old it didn't allow the upgrade command, so I overwrote it with freebsd-update(8) from a working FreeBSD-7.2-RELEASE system.


Bad idea as you already found out.


----------



## vask (Oct 4, 2012)

SirDice said:
			
		

> Bad idea as you already found out.



Is there a recommended way to upgrade FreeBSD 6.2 currently? FreeBSD 6.2 was last released in 2008 (4 Years ago). See:
https://en.wikipedia.org/wiki/Freebsd#Timeline

Also, with regard to overwriting freebsd-update with version from the 7.2-RELEASE that supported the [upgrade] option. Initially the upgrade from FreeBSD 6.2 to 6.3 worked even with rebooting, but like I mentioned earlier I got lost somewhere along the way. And from docs: "Beginning with FreeBSD 6.2-RELEASE, binary upgrades between RELEASE versions (and snapshots of the various security branches) are supported using the freebsd-update(8) utility." See:
http://www.freebsd.org/relnotes/7-STABLE/relnotes/upgrade.html


----------



## vask (Oct 4, 2012)

wblock@ said:
			
		

> My fault, brain going faster than fingers.
> 
> ```
> # cd /usr/src
> ...



After deleting all "old" files when prompted system still boots but I get a system error when trying to login and can't go any further. Probably time for a fresh install.

MORE info:

After I realized some critical files were deleted and not replaced I tried to run freebsd-update again (before rebooting) but it wouldn't "update to the same version again" ie) 9.0


----------



## wblock@ (Oct 4, 2012)

I should have also pointed to http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/make-delete-old.html.


----------



## vask (Oct 4, 2012)

I was able to copy over some of the deleted "/lib" and "/usr/lib" files from a working system via USB.

Currently I am trying to follow instructions to rebuild world at:
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/makeworld.html 

Still trying to resurrect this system.

More info:

Initially I could boot into single user mode but the following failed:

```
make buildworld
nslookup
```
Some critical files missing:

```
libmd.so
lib_opie.so
```
At one point I couldn't even load /bin/sh because of an error I tried to do:
`# cp -R /media/usb/lib /lib`

However, using a usb stick and the FreeBSD-9.0-RELEASE CD's "LiveCD" option I was able to recover a bit.


----------



## vask (Oct 4, 2012)

SNK said:
			
		

> Just perform a clean install. That will save these headaches. You will have to recompile all ports anyway because of the big jump in version.



Is there a way to do a non-destructive (re)install from the FreeBSD-9.0-RELEASE CD?


----------



## jb_fvwm2 (Oct 5, 2012)

I upgraded v6 > v9, and even wrote a thread about it if I recall.  But it took multiple rsync's,a thumbdrive (details in the other post...), and a working v9 to copy files from as the installworld (from a thumbdrive, v9) failed repeatedly until it completed.  The system is upgraded, but not really upgradable again without trouble, its disk is too small. (Unsure if it answers the most recent question here...)


----------



## vask (Oct 5, 2012)

@jb_fvwm2, glad not to be the only one with difficulties going from v6 > v9.

We will see what happens when I try:
`# make installworld`


----------



## SNK (Oct 5, 2012)

vask said:
			
		

> Is there a way to do a non-destructive (re)install from the FreeBSD-9.0-RELEASE CD?



What do you mean by non-destructive? The incremental downtime is probably not too big, because you need to compile all ports again anyway.


----------



## vask (Oct 6, 2012)

SNK said:
			
		

> What do you mean by non-destructive? The incremental downtime is probably not too big, because you need to compile all ports again anyway.



Non-Destructive meaning if I had a drive with one partition as / and did a reinstall it wouldn't format the drive (just overwrite the necessary files).


----------



## vask (Oct 10, 2012)

To close up this thread a bit, post #6 is about as far as is useful to read.

More Info:

I was able to recover from:
# cd /usr/src
# make check-old
# make delete-old

I had to copy some random files from a working system and rebuild the kernel and the world like at:
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/makeworld.html
(because I couldn't use freebsd-update and internet was broken)

However, now I am on FreeBSD-10.0-CURRENT.


----------



## SNK (Oct 10, 2012)

vask said:
			
		

> Non-Destructive meaning if I had a drive with one partition as / and did a reinstall it wouldn't format the drive (just overwrite the necessary files).



Then I would do a clean install and repartition the drive as well. You could do a "non-destructive" install but would have to fiddle around to get rid of the old libs.



			
				vask said:
			
		

> To close up this thread a bit, post #6 is about as far as is useful to read.
> 
> More Info:
> 
> ...



Great! BTW, did you disable most debugging in -CURRENT? The defaults have a big impact on performance.


----------

