Category Archives: freebsd

some random notes

maybe these nuggets of knowledge will help someone…

I spent almost an hour yesterday investigating why FreeBSD 9.1 hangs 1-2 minutes after bootup on Sun x4100.
Finally I noticed that powerd always came up in top right before the hang which led me to disabling ACPI throttle by adding hint.acpi_throttle.0.disabled=1 to the /boot/loader.conf file.
Everything has worked fine since that.
I haven’t tried any other FreeBSD versions on that hardware so I have no idea if the problem is present with the older versions of the OS too.

Just out of curiosity I measured power consumption of this machine, here are the results:

  • turned off, PSU fans spinning: ~35W
  • cold start, fans running in high speed for about a minute before BIOS appears: ~200W
  • FreeBSD idling, 4 cores running at 1Ghz: ~150W
  • FreeBSD under full load (buildworld -j16), 4 cores running at 2.2Ghz: ~250W

On a completely unrelated note, I spent some time configuring IPv6 on a dedicated server rented through Hetzner’s serverbidding process.
All the tutorials talking about Hetzner specific FreeBSD IPv6 configuration seemed to be rather complicated.

Well it seems Hetzner has since made their IPv6 network setup simpler and default routers are now always at link local address fe80::1 so all that I had to add to the /etc/rc.conf to get things working under FreeBSD 9.0 is something along the lines of:

ipv6_enable="YES"
ipv6_default_interface="re0"
ipv6_defaultrouter="fe80::1%re0"
ipv6_ifconfig_re0="2001:db8:a0:80a1::2 prefixlen 64"

FreeBSD & Huawei E630

I recently got Huawei E630 PCMCIA data card that can handle HSDPA/UMTS/EDGE/GPRS/GSM. Cursory look at the internet told me that this card should work under Linux so I was almost sure that I can get it working under FreeBSD (eventually). After plugging it in I was a little surprised to find that it presented itself to the system as a USB mass storage device and SCSI CD-ROM device cd0 tried to handle it (without much success). After doing some research I found that some of the Huawei cards contain this mass storage part that they use to store drivers for Windows and you have to send a magic request to it in order to force it into modem mode.

I found a small program by Hans Petter Selasky that tries to send this message and it indeed seemed to work at least as far as sending of the message is concerned but the problem for me was that the system had already recognized the device as a storage device and so I had no way of attaching ubsa/ucom devices to it. It might be that it would work if you remove the umass device from the kernel and load only the ubsa & ucom modules after running this program. Anyway instead of trying this I took proposed patch against OpenBSDs umsm driver that did the necessary poking in the initialization routine and hacked it into FreeBSDs ubsa driver (patch).

In general it seems to work quite well. Sometimes I get ucom0: ubsa_request: STALLED messages from the kernel when dialing, but it usually works fine at the next attempt.

Here’s what it outputs to the syslog when I insert the card:

ohci0: <NEC uPD 9210 USB controller> mem 0xb0207000-0xb0207fff irq 16 at device 0.0 on cardbus0
ohci0: [GIANT-LOCKED]
ohci0: [ITHREAD]
usb5: OHCI version 1.0
usb5: <NEC uPD 9210 USB controller> on ohci0
usb5: USB revision 1.0
uhub5: <NEC OHCI root hub, class 9/0, rev 1.00/1.00, addr 1> on usb5
uhub5: 1 port with 1 removable, self powered
ohci1: <NEC uPD 9210 USB controller> mem 0xb0208000-0xb0208fff irq 16 at device 0.1 on cardbus0
ohci1: [GIANT-LOCKED]
ohci1: [ITHREAD]
usb6: OHCI version 1.0
usb6: <NEC uPD 9210 USB controller> on ohci1
usb6: USB revision 1.0
uhub6: <NEC OHCI root hub, class 9/0, rev 1.00/1.00, addr 1> on usb6
uhub6: 1 port with 1 removable, self powered
ucom0: <HUAWEI Technologies HUAWEI Mobile, class 0/0, rev 1.10/0.00, addr 2> on uhub5
ucom0: Could not find interrupt in
device_attach: ucom0 attach returned 6
ucom0: <HUAWEI Technologies HUAWEI Mobile, class 0/0, rev 1.10/0.00, addr 2> on uhub5
ucom0: failed to set configuration: IOERROR
device_attach: ucom0 attach returned 6
ucom0: at uhub5 port 1 (addr 2) disconnected
ucom0: <HUAWEI Technologies HUAWEI Mobile, class 0/0, rev 1.10/0.00, addr 2> on uhub5

And here’s my /etc/ppp/ppp.conf file:

umts:
set device /dev/cuaU0
set speed 384000
set phone *99***1\#
set authname ""
set authkey ""
set dial "ABORT BUSY ABORT NO\\sCARRIER TIMEOUT 5 \
\"\" AT OK-AT-OK ATE1Q0 OK \\dATDT\\T TIMEOUT 40 CONNECT"
add default HISADDR
set ifaddr 10.0.0.1/0 10.0.0.2/0 0.0.0.0 0.0.0.0

To establish a connection I just use the command ppp -background umts

PS
It’s also a little annoying that the system always panics when you remove the card. It seems to be a known problem with the teardown ordering in the current USB stack and is said to be fixed in the FreeBSDs new USB stack that is currently still in the perforce.