Category Archives: Unix

Upgrade FreeBSD and The ‘pw’ command exited with unexpected status 74

I have a vps account and got problem with pw  and also from sysinstall  after upgrade FreeBSD from 8.2 to 8.3.

# uname -a
FreeBSD alamsyah-rasyid.cust.arpnetworks.com 8.2-RELEASE-p3 FreeBSD 8.2-RELEASE-p3 #0: Tue Sep 27 18:45:57 UTC 2011 root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC amd64

# freebsd-update upgrade -r 8.3-RELEASE

….6680….6690….6700….6710….6720….6730….6740….6750….6760….6770….6780….6790….6800….6810….6820….6830….6840….6850….6860….6870….6880….6890….6900….6910….6920….6930….6940….6950….6960….6970….6980….6990….7000….7010….7020….7030….7040….7050….7060….7070….7080….7090….7100….7110….7120….7130….7140….7150….7160….7170….7180….7190….7200….7210….7220….7230….7240….7250….7260….7270….7280….7290….7300….7310….7320….7330….7340….7350….7360….7370….7380….7390….7400….7410….7420….7430….7440….7450….7460….7470….7480….7490….7500….7510….7520….7530….7540….7550….7560….7570….7580….7590….7600….7610….7620….7630….7640….7650….7660….7670….7680….7690….7700….7710….7720….7730….7740….7750….7760….7770….7780….7790….7800….7810….7820….7830….7840….7850….7860….7870….7880….7890….7900….7910….7920….7930….7940….7950….7960….7970….7980….7990….8000….8010….8020….8030….8040….8050….8060….8070….8080….8090….8100….8110….8120….8130….8140….8150….8160….8170….8180….8190….8200….8210….8220….8230….8240….8250….8260… done.
Applying patches…

# The following changes, which occurred between FreeBSD 8.2-RELEASE and
FreeBSD 8.3-RELEASE have been merged into /etc/group:
— current version
+++ new version
@@ -1,6 +1,6 @@
-# $FreeBSD: src/etc/group,v 1.35.10.1.6.1 2010/12/21 17:09:25 kensmith Exp $
+# $FreeBSD: src/etc/group,v 1.35.10.2.2.1 2012/03/03 06:15:13 kensmith Exp $

you should check this file and see if tis fit your setting.

Mergemaster work as expected and time for freebsd-update install.
# freebsd-update install
Installing updates…
Kernel updates have been installed. Please reboot and run
“/usr/sbin/freebsd-update install” again to finish installing updates.

After restart the machine I need to add new account but got this error :

The ‘pw’ command exited with unexpected status 74

Further search lead me to this command  :

cd /etc && pwd_mkdb -p master.passwd

This command work well and solve my problem.

Find out which lan card device is active

I used to work with FreeBSD till I resign after working for 10 years. Not touch server for long time make bit nervous when a client ask me to install and configure new server using various OS but mainly still in Linux or BSD environment.

When client change lan card position or change rj45 location system will get error message and not working.

Identify lan card and its ip address in Linux

# ifconfig -a | more

eth0 Link encap:Ethernet HWaddr 00:21:5e:6b:f6:76
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Memory:91a80000-91aa0000

eth1 Link encap:Ethernet HWaddr 00:21:5e:6b:f6:77
inet addr:192.168.1.10 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::221:5eff:fe6b:f677/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:4607 errors:0 dropped:0 overruns:0 frame:0
TX packets:7707 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:394554 (394.5 KB) TX bytes:10255745 (10.2 MB)
Memory:91980000-919a0000

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:226 errors:0 dropped:0 overruns:0 frame:0
TX packets:226 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:36231 (36.2 KB) TX bytes:36231 (36.2 KB)

usb0 Link encap:Ethernet HWaddr 02:21:5e:6b:f6:79
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

# ifconfig -s
Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg
eth1 1500 0 4627 0 0 0 7724 0 0 0 BMRU
lo 16436 0 226 0 0 0 226 0 0 0 LRU

How about FreeBSD??

# ifconfig -a
re0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=9b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM>
ether 00:16:3e:9f:46:a1
inet 216.24.200.111 netmask 0xfffffff8 broadcast 216.24.200.199
media: Ethernet autoselect (100baseTX <full-duplex>)
status: active
plip0: flags=108810<POINTOPOINT,SIMPLEX,MULTICAST,NEEDSGIANT> metric 0 mtu 1500
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3
inet6 ::1 prefixlen 128
inet 127.0.0.1 netmask 0xff000000

another FreeBSD machine

$ ifconfig -a
em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=219b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4,WOL_MAGIC>
ether 5c:f3:fc:2a:53:35
inet 118.97.168.200 netmask 0xffffff00 broadcast 118.97.168.255
media: Ethernet autoselect (100baseTX <full-duplex>)
status: active
em1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=219b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4,WOL_MAGIC>
ether 5c:f3:fc:2a:53:36
inet 10.36.2.9 netmask 0xffffff00 broadcast 10.36.2.255
media: Ethernet autoselect (100baseTX <full-duplex>)
status: active
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
options=3<RXCSUM,TXCSUM>
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3
inet6 ::1 prefixlen 128
inet 127.0.0.1 netmask 0xff000000
nd6 options=3<PERFORMNUD,ACCEPT_RTADV>

Message from this post :

1. use ifconfig -s in linux to check which lan card device connected with cable.

2. See status in FreeBSD to check which lan card connected with lan cable.

Sender address rejected: Domain not found

I have an order for reinstall email server. I accept the job and finish it in one day ( I use FreeBSD 8.2 release for OS and Postfix for MTA but the longest session during reinstall is backup and migrating mailbox).

Everything seem ok until mail server deployed, local delivery work well except sending to outside. Any email to other email server rejected with ‘domain not found’ message.

I’ve change /etc/resolv.conf to use opendns and google public ip but still not work, the error message still appear and make me little confuse.

After look around finally I got the solution. Its about postfix local resolv.conf file. Postfix has its own resolv.conf file located in /var/spool/postfix/etc.

mail# ls
hosts           localtime       resolv.conf     services

Yes, that resolv.conf file is still holding the value of local dns server I use during installation process.

Change the ip to isp dns server clear my problem and everything seem fine.

Time to set spf record and dkim.

See you.

Quick Setting Bind on FreeBSD 8.1

I’m big fan of djbdns and I already write some post about djbdns and dnscache in the past.

Today, my friend ask me to install or configure bind for his FreeBSD that run 8.1 version. I ask him to follow FreeBSD manual but he said he already follow the guide but still face error.

I agree to help him set quick dns server using bind on his FreeBSD box. I think I have to test it first before give another suggestion and maybe I’ll need it in the future.

Lets get start!

Target : domain example.com will be resolved to 192.168.12.108

1. Enable bind on start up by add this line in /etc/rc.conf

named_enable=”YES”

2. Change a few things on /etc/namedb/named.conf

– Listen to ip 192.168.12.108

//      listen-on       { 127.0.0.1; };
listen-on       { 192.168.12.108; };

– Set forwarders to ip address of router / isp dns

forwarders {
192.168.12.1;
};

– Add zone for example.com

zone “example.com”{
type master;
file “/etc/namedb/master/example.com”;
};

3. Add zone file content (for example.com)

ee /etc/namedb/master/example.com

add fill this lines:

$TTL 3600        ; 1 hour default TTL
example.com.    IN      SOA      ns1.example.com. admin.example.com. (
2006051501      ; Serial
10800           ; Refresh
3600            ; Retry
604800          ; Expire
300             ; Negative Response TTL
)

; DNS Servers
IN      NS      ns1.example.com.
IN      NS      ns2.example.com.

; MX Records
IN      MX 10   mx.example.com.
IN      MX 20   mail.example.com.

IN      A       192.168.12.108

; Machine Names
localhost       IN      A       127.0.0.1
ns1             IN      A       192.168.12.108
ns2             IN      A       192.168.12.107
mx              IN      A       192.168.12.108
mail            IN      A       192.168.12.108
www             IN      A       192.168.12.108
@               IN      A       192.168.12.108

save the file.

4. Add the address to /etc/resolv.conf

echo ‘nameserver 192.168.12.108’ >> /etc/resolv.conf

5. Restart dns server

# /etc/rc.d/named restart

Stopping named.
Waiting for PIDS: 2130.
Starting named.

6. Testing resolver

# dig example.com

; <<>> DiG 9.6.2-P2 <<>> example.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 26178
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 2

;; QUESTION SECTION:
;example.com.           IN      A

;; ANSWER SECTION:
example.com.    3600    IN      A       192.168.12.108

;; AUTHORITY SECTION:
example.com.    3600    IN      NS      ns1.example.com.
example.com.    3600    IN      NS      ns2.example.com.

;; ADDITIONAL SECTION:
ns1.example.com. 3600   IN      A       192.168.12.108
ns2.example.com. 3600   IN      A       192.168.12.107

;; Query time: 0 msec
;; SERVER: 192.168.12.108#53(192.168.12.108)
;; WHEN: Sun Jun 19 23:19:07 2011
;; MSG SIZE  rcvd: 121

Beautiful, quick and dirty way to get working dns server :-)

Tips :

always watch /var/log/messages for error message(s).

How to install Debian KFreeBSD

This post got delayed very long, I’ve already create the video since Februari 22 2011 but still have no time to publish. I just curious on how Debian and FreeBSD work in one place called Debian KFreBSD and as always everything just start from installation step and that is the main reason why I write this post.

Lets get start!

Get latest version of Debian KFreeBSD  and do installation with VMWare.

Choose Default Install.

Photobucket

Choose English as installation language.

Photobucket

Select Location : I choose United States.

Continue reading