Archive for the ‘ FreeBSD8 ’ Category

ntpq timed out on freeBSD

I was running locally on a server and wanted to check in on ’s status. ntpq -p was not producing any output even though was running.

# ntpq -p
localhost: timed out, nothing received
***Request timed out

This is because I had the option “restrict default ignore” set in /etc/.conf. ntpq. This makes ntpd ignore EVERYTHING, even queries to the loopback interface. Ntpq queries ntpd over the loopback interface at 127.0.0.1. To allow these local queries, add:

 restrict 127.0.0.1

to /etc/ntp.conf, then also add restrict lines for your other upstream ntp servers.

restart ntpd:

/etc/rc.d/ntpd restart

Now ntpq -p will show you status of it’s peers

# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 dns3.untangle.c .INIT.          16 u    -   64    0    0.000    0.000   0.000
 mirror          .INIT.          16 u    -   64    0    0.000    0.000   0.000
 153.16.4.133    .INIT.          16 u    -   64    0    0.000    0.000   0.000

Updating FreeBSD ports nicely using nice

Thanks to: http://scottspare.com/bsdfun/?p=75 for pointing me in the right direction. port updates can take a while and slow down your server. What you can do is use the ‘nice’ utility to force the processes to a lower priority. This will help your server to run almost normally during an .

When you use the ‘nice’ command inside of csh or tcsh, you need to mind that you give the full path to the binary so you dont use the built-in ‘nice’ command.

# /usr/bin/nice -n 10 {your update command}

What i use is:

# /usr/bin/nice -n 10  -aRrP

Man page for ‘nice’: http://www.freebsd.org/cgi/man.cgi?query=nice&apropos=0&sektion=0&manpath=FreeBSD+8.0-RELEASE&format=html

Freebsd-update fetch interupted

I lost power while fetch was downloading patches up to 8.0-Release-p3. When the server came back online, I ran a fetch again and it still found two files that needed updating. after running install, got this error:

# - install
Installing updates...gunzip: (stdin): unexpected end of file
gunzip: (stdin): unexpected end of file
 done.

I guess a patch archive was corrupted. no problem though, just remove the download:

# rm -r /var/db/freebsd-update/files

now you can run

# freebsd-update fetch
Looking up update.FreeBSD.org mirrors... 3 mirrors found.
Fetching metadata signature for 8.0-RELEASE from update5.freebsd.org... done.
Fetching metadata index... done.
Fetching 2 metadata files... done.
Inspecting system... done.
Preparing to download files... done.
Fetching 2 files... done.

The following files will be updated as part of updating to 8.0-RELEASE-p3:
/boot/kernel/kernel.symbols
/boot/kernel/nfsclient.ko.symbols
# freebsd-update install
Installing updates... done.

no problems

ZFS Cant rm: No space left on device

If you completely fill up a pool, it wont let you delete files on it. What you CAN do, is pick a scapegoat file to wipe out or remove a snapshot. Then you will be able to use the . what I did:


# df -h
     Size    Used   Avail Capacity  Mounted on
themirror       39G     39G      0B   100%    /home/jacob/themirror
# rm 3gfile
rm: 3gfile: No space left on device
#  if=/dev/null of=3gfile
0+0 records in
0+0 records out
0 bytes transferred in 0.000046 secs (0 bytes/sec)
# rm 3gfile

FreeBSD error in /boot/loader.conf

While experimenting with in , I made some tweaks to the vk.kmem_size variable in /boot/loader.conf. when setting it like this:

#/boot/loader.conf
vm.kmem_size="1024"

everything worked, but I wanted to see what would happen if i doubled it. Unfortunately, setting vm.kmem_size to 2048 kept the FreeBSD kernel from booting. At startup it would just do this:

panic: kmem_suballoc: bad status return of 3
cpuid = 0

To fix the erroneous variable setting, I had to :

1. Reboot.

2. Wait for the FreeBSD Boot menu. (the screen that lists Default, ACPI disabled, safe, and single user modes)

3. Press 6 to select “Escape to loader prompt”

4. At the loader prompt, type “show”. This will provide all the default variable settings. press the spacebar to page down. In my case, at the end, the incorrect variable was: vm.kmem_size=”2048″.

5. to switch it back and allow the system to boot, type

set (variable)=(correct value)

in my case this was:

set vm.kmem_size=1024M

6. type

boot

When you are finished with all that fun, you should edit the /boot/loader.conf file back so you don’t have to do this again.
Thanks to “crsd” from the FreeBSD IRC channel for the help.