Thursday, January 28, 2010

OpenBSD NC4200: Alpine trough OpenSMTPD went fine.

Ah, done testing Alpine email client with OpenSMTPD and it's working fine. In Alpine, I go to "Setup" to configure Alpine and choose "Config". Then in the "SMTP Server (for sending)" line, I just put localhost as the value and then exit the setting. I composed an email and it went through just fine. Great. Bye bye sendmail.

Saturday, January 23, 2010

OpenBSD NC4200: iwi0 wireless & kismet.

After unsuccessful attempts to get my iwi0 wireless to work with dstumbler, I downloaded and installed kismet.

After installation, I vi /usr/kismet/kismet.conf and add this line to the "source" section:


then in term, running "kismet" displays the scan using the iwi0 device. Great! At last!. I'll find something about the dstumbler issue later. I haven't tested the wireless connection as there's no AP that I can test on. Something on that later when I have the opportunity.

OpenBSD NC4200: from SendMail to OpenSMTPD, from GNU/screen to tmux.

Heyya, while seaching for any OpenBSD related goodies, I found a few interesting things. First of all is tmux, a terminal multiplexer a-la GNU/Screen. I used screen a lot if I'm not in wmii and tmux is a BSD-licensed equivalent. Hurrah! In OpenBSD 4.6, tmux is already in default installation so no need to get a package for it. man tmux if you're interested. As fer me, it's time to say goodbye to screen ;).

Then it's the OpenSMTPD. From the official website:

"OpenSMTPD is a FREE implementation of the Simple Mail Transfer Protocol.

The OpenSMTPD project was started as a separate project after a developer suffered from eyes bleeding while trying to slightly alter sendmail configuration. It was imported in the OpenBSD tree in November 2008 to help speed up development."

In OpenBSD 4.6, OpenSMTPD is readily available but not enabled by default. 4.6 still uses Sendmail. I tried finding the way to enabled it using 4.6 man smtpd but there's no installation details. However, using man smtpd (OpenBSD -current, more details than in my default 4.6 manual) is much better. Also, you can read here that OpenSMTPD is still heavily in development. For a personal machine like my laptop, OpenSMTPD will have no issue. I've already enabled the OpenSMTPD using the online manual and so far, it's ok. Haven't tested it yet. Soon OpenSMTPD will replace Sendmail in the base OpenBSD system.

Thursday, January 21, 2010

OpenBSD NC4200: Howto get battery status & put it on wmii's status bar.

Update: My Updated wmiirc Status Bar Script is the recent version, there's a bit of error in the script below so you guys better take a look at the most recent one. I'm keeping this post as an archive.

Hola. After searching for an answer, I finally found out how to get the battery status for my NC4200 laptop. In case you're wondering where to look for more information, this is what I look at:

man acpi
man sysctl

This is the command and output of my primary laptop's battery. If you're using an extended battery pack like me, you'll see hw.sensors.acpibat1 got listed too. Here I just list the primary battery only:

$ sysctl hw.sensors.acpibat0
hw.sensors.acpibat0.volt0=11.10 VDC (voltage)
hw.sensors.acpibat0.volt1=12.40 VDC (current voltage)
hw.sensors.acpibat0.amphour0=4.04 Ah (last full capacity)
hw.sensors.acpibat0.amphour1=0.20 Ah (warning capacity)
hw.sensors.acpibat0.amphour2=0.04 Ah (low capacity)
hw.sensors.acpibat0.amphour3=3.95 Ah (remaining capacity), OK
hw.sensors.acpibat0.raw0=0 (battery idle), OK
hw.sensors.acpibat0.raw1=0 (rate)

Not forgetting that I also need to take a look at the AC Adapter. So I just use:

$ sysctl hw.sensors.acpiac0
hw.sensors.acpiac0.indicator0=On (power supply)

Update: Here's my simple script to display the battery percentage. I shamelessly take bits from here, here (FreeBSD) and a few others. Also, man sed, man bash is also usefull.

Update: I finally got most of the status for the battery that I wanted.

Update: I now includes the cpu usage & free memory using top. Bear in mind this is my first try so I need to clean the script more. Here's the update script:

Update: I tested the script using my extended battery and I saw garbage being display if the extended battery was taken off. So now I have tweak the script and now hopefully it fixed the issue. I done quite some testing and it seems to be ok now.

Here's some information regarding what the status bar will display from left to right:

- Display the CPU usage by system
- Display the Free Physical Memory capacity
- Display the percentage of the primary battery remaining, behind it display "+" if it's charging, "-" if it's discharging, "!" if the battery is critical and nothing if the battery is idle. As I'm using the extended battery, this status bar will also display the extended battery remaining charges the same as the primary one.
- Display the AC Adapter status. "On" if it's on AC or "Off" if not.
- Display the full date.

Ok so I vim ~/.wmii-3.5/wmiirc and insert the script below just before the # Event processing entry.

######### Script starts

# My wmii Status Bar script
status() {
 # This is for the main battery, if there's none, just display nothing.
 bat0=$(sysctl -n hw.sensors.acpibat0)
 if [ "${bat0} != "" ]; then
  bat0full=$(sysctl -n hw.sensors.acpibat0.amphour0 | sed s/.A.*//)
  bat0warn=$(sysctl -n hw.sensors.acpibat0.amphour1 | sed s/.A.*//)
  bat0low=$(sysctl -n hw.sensors.acpibat0.amphour2 | sed s/.A.*//)
  bat0now=$(sysctl -n hw.sensors.acpibat0.amphour3 | sed s/.A.*//)

  # Get the battery capacity in percentage
  bat0cap=`echo "100 * ${bat0now} / ${bat0full}" | bc`

  # Get the charging status of the battery, replace with symbols
  bat0s=$(sysctl -n hw.sensors.acpibat0.raw0 | sed 's/'0'.*//; s/'1'.*/-/; s/'2'.*/+/; s/'4'.*/!/')
  bat0p=`echo ""`
  bat0s=`echo ""`

 # This is for extended battery, if it's installed, display the status. Else just display nothing.
 bat1=$(sysctl -n hw.sensors.acpibat1)
 if [ "${bat1} != "" ]; then
  bat1full=$(sysctl -n hw.sensors.acpibat1.amphour0 | sed s/.A.*//)
  bat1warn=$(sysctl -n hw.sensors.acpibat1.amphour1 | sed s/.A.*//)
  bat1low=$(sysctl -n hw.sensors.acpibat1.amphour2 | sed s/.A.*//)
  bat1now=$(sysctl -n hw.sensors.acpibat1.amphour3 | sed s/.A.*//)

  # Get the battery capacity in percentage
  bat1cap=`echo "100 * ${bat1now} / ${bat1full}" | bc`

  # Get the charging status of the battery, replace with symbols
  bat1s=$(sysctl -n hw.sensors.acpibat1.raw0 | sed 's/'0'.*//; s/'1'.*/-/; s/'2'.*/+/; s/'4'.*/!/')
  bat1p=`echo ""`
  bat1s=`echo ""`

 # Get the AC Adapter status
 ac0=$(sysctl -n hw.sensors.acpiac0.indicator0 | sed s/.'('.*//)

 # Get the free memory data using top
 memfree=$(top | grep Memory | sed 's/.*Free:.//; s/.Swap.*//')

 # Get the CPU usage via top
 cpuuse=$(top | grep 'CPU states:' | grep 's/.*nice..//; s/.sys.*//')

 # Display the status bar
 echo CPU: $cpuuse '|' Mem: $memfree '|' Bat: ${bat0p}${bat0s} ${bat1p}${bat1s} '|' AC: $ac0 '|' $(date)

######### Scripts ended

So after I refresh the wmiirc ([MOD]+[A], wmiirc), the status bar displays something like:

CPU: 6.5% | Mem: 847M | Bat: 98% 97%+ | AC: On | Fri Jan 22 12:18:28 MYT 2010

The 1st battery doesn't have any "+" or "-" symbol behind it because it's currently idle. The 2nd battery is currently charging as you can see by the "+" symbol behind it. With this script there's no longer junks being displayed if the battery was taken off. Oh yeah I still didn't use the $bat0warn and $bat0low yet. I'll figure out how to manipulate it so low battery will shutdown the machine. Do use the script if you find it interesting. If you has improvement, please share.

- Display the battery percentage with "+" is the battery is charging.
- Display "AC" text if the machine is on AC adapter.
- Auto shutdown the machine if the "low capacity" indicator is reached.
- Display the wireless status (iwi0, still having headache on getting it to work with dstumbler).
- Display the CPU status. (clean this up).
- Display the RAM status (free memory, size).
- Simplifies the script (yeah well I'm no programmer).

Tuesday, January 19, 2010

OpenBSD NC4200: Howto change the web browser for NetBeans 5.5 & other issues.

Hola. NetBeans 5.5 can be installed using OpenBSD's package. I got mine installed and after playing with it, found a few things that might be interesting fer those who're using OpenBSD + NetBeans.

First of all, by default NetBeans have a few web browser listed in Tool > Options > General tab. If you have either Mozilla, Firefox or Netscape installed; there should be no issue but if you're like me, who installed Firefox 3.5 instead, the will be some problem. If you choose Firefox in NetBeans option, you'll get the browser not configured error as Firefox 3.5 will be installed as "firefox35". Well, previously I just create a symbolic link for "firefox" pointing to "firefox35" like this:

# ln -s /usr/local/bin/firefox35 /usr/local/bin/firefox

and wallah! NetBeans can use the web browser feature happily. Then just now I found out another way round. In NetBeans's Tool > Options window, click on the Advanced Options's button. Go to Options > IDE Configuration > Server and External Tool Settings and then expand the Web Browser link. You'll see Mozilla, Firefox, Netscape and Swing HTML Browser listed there. Right-click on the Firefox link and choose "rename". Rename it to Firefox35 (basically this is optional, it's just a name). Then click on the Firefox link, change the "Browser Executable" option in the Properties window to the right from:

firefox -remote "openURL({URL})"


firefox35 -remote "openURL({URL})"

so that the "Process" option is changed from "firefox" to "firefox35" and leaving "Arguements" text intact. Then click "Ok" and "Close" the Advanced Options window. Then try selecting the NetBeans "Help" link and it should open the requested page from firefox35. But as the NetBeans version is lagged behind the current NetBeans version, you'll mostly get "Page Not Found" page from NetBeans's website. Oh well.

I also found another issue with NetBeans. I think this is a problem for a wide variety of OpenBSD + NetBeans user regarding of the NetBeans's version. The not-so-famous "garbled output text" issue. In my case, when I build any project, the first few build will display boxes in the Output window instead of readable build results. So I need to hit F11 a few times before the build result will display the correct readable text. But unfortunately the Run (F6) and Debug (F5) function is much worst. The Output's result is ALWAYS displaying boxes instead of readable text. Why is it not so famous? Well I guess there's only a handful of people using NetBeans on OpenBSD. If I managed to get any similar issue from Google, there's no solution whatsoever. There was one person using Ubuntu and NetBeans 5.5 who had the same issue but there seems no follow up on it. Maybe he managed to find a solution? I'm not sure. In OpenBSD's camp, a guy did put the issue in mailing list and then he opted to go for Eclipse instead. So, no luck to find the solution fer now. I downloaded Eclipse and whoa, with so many modules I can choose; I don't think I have the time.

Anyway, in NetBeans's Tools > Options > Miscellaneous > Ant, I noticed that if I change the "Verbosity Level" from "Normal" to "Quiet", building my project will not display any garbled / boxes text. But then any project which will display any result to Output (System.out.println( ) for example), Running / Debugging the project is as useless as Output with unreadable text because "Quiet" level will not display any output result, just a simple "Build Successful (Total time: x seconds)". *Sigh*. If not for this issue, NetBeans will be just perfect. I'm not sure if this is related to Ant or the 5.5 version of NetBeans. But I do know nearly all people who have/had this problem is using OpenBSD.

I read somewhere that a person suggested to another OpenBSD+NetBeans user to install "dejavu" font but there's no follow up after that. So I don't know if that will resolve the issue or not. Maybe I'll find something the more I play with NetBeans. But still, if anyone out there now any info / solution for this problem, please just comment on my blog here so I can test and share it. Any link/workaround/script/module worth trying is, well, worth trying.

That's it fer now. Yeah well I started learning Java programming a few days ago. Still a newbie. Later.

Thursday, January 14, 2010

OpenBSD NC4200: calcurse 2.7 in on -current & freshclam.

Argh! The OpenBSD CVSweb for ports has confirmed it. The version 2.7 is on -current, not -stable. I don't think I'm ready to go for -current yet. So I need to find another calendar software (curse based preferably) and wait for OpenBSD 4.8 then. *sigh*.

In the mean time, I'm updating my ClamAV's virus definition. Well I might need it some day. Later then.

OpenBSD NC4200: Updating ports to -stable. Finally!

I'm currently updating my ports collection to OpenBSD's 4.6-stable. So far it's going ok. Not finished yet. Hopefully I'll get to install the latest version of calcurse so I can finally use the notification feature.

First cd to /usr/ports/. Then I su to gain superuser access. Then after choosing the anoncvs server to use, I issued the command:

# cvs -q -d anoncvs@some.anon.server:/cvs up -r OPENBSD_4_6 -Pd

So far it's updating a few folders and I didn't see the calcurse port is being updated. Uhh. I saw the 2.7 version is already in OpenBSD's port from but I'm not sure if it's in -stable or -current. Need to check with that later.

Thursday, January 07, 2010

OpenBSD NC4200: PostgreSQL & pgAdmin3, GIMP too.

I've installed Gimp graphic manipulation program. There was quite a lot of dependencies but luckily I'm using the same machine to manually download each one of it. After installation, I opened a new wmii workspace and hit [Mod]+[P] to open the program list. Then just type "gimp" then hit "Return". Wallah!, Gimp is running fine. Although I don't think I'll be using it anytime soon, but heck, might as well just install it.

Few days back, I installed PostgreSQL RDBMS. never got the chance to test it until now. As there's no other PostgreSQL user (except postgres) added since the installation, I got problem trying to access the database. As I'm currently lazy, I installed pgAdmin3 using OpenBSD package. Installed all the dependencies needed and down to testing.

I opened a new wmii workspace, eg: press [Mod]+[1-0]. Then on the blank workspace, I hit [Mod]+[P] to open the program list. After that I just type "pgadmin3" and the program starts. After I connect to the database, I create another role with my user id: "karl". I set the password and then I try to log in using the new PostgreSQL ID. So far so good. Why bother with psql when I already have pgAdmin3? Well, it's better if I play with both.

Now to re-learn PostgreSQL. Yum!

Wednesday, January 06, 2010

OpenBSD NC4200: Current experience status.

I have to make do with the version 2.5 of Alpine email software. My port system also have the same version, but I read somewhere that OpenBSD have stable version of the port system which includes version 2.7 (latest) of Alpine. As I'm still having problem with the darn proxy connection, I can't do anything with that. So that's my goal fer now, solving the proxy connection issue.

A few things I noticed about running OpenBSD with this Compaq NC4200 laptop:

The quicklaunch button:
- Mute button is working fine, I tried it with mp3blaster and it mutes/unmute the sound perfectly. But there's no light indicating it.
- Increase/Decrease volume button is not working.
- mp3blaster uses the "<" & ">" keys to decrease / increase the sound volume respectively. Somehow the ">" key works fine, but to decrease the sound, I have to press the quicklaunch's decrease volume key THEN the "<" key to decrease the sound volume 1 step. If let say, I want to decrease the volume from 100% to 60%, I need to press the quicklaunch key then the "<" key and repeat that until the volume goes down to 60% or something. Will find out about it later.

WiFi On/Off button:
- Works fine. It can turn on/off my iwi0 device just fine albeit without a functional indicator light. I read somewhere that the button will also turn the Bluetooth module on, but didn't check on that yet.

- I have problem when using shutdown -hp. Most of the time, the shutdown sequence will stuck at "Synchronizing disk ...." and I have to hit the shutdown key sequence or press the power button. If I use shutdown -r or just shutdown -h, it works just fine. The "power down" option for shutdown sometime will work but most of the time will have problem. I'll find an answer later.

- Find a way to solve the proxy connection issue. Many of my current problem can be solved if my machine (not just Firefox) can properly connect to the internet through proxy.

Later then.

Tuesday, January 05, 2010

OpenBSD NC4200: Ports system up, but still having proxy problem.

Installed the OpenBSD's port system but still having problem to connect via proxy. Darn proxy! So the only thing that can connect to the internet is my Firefox. AHHHH!

OpenBSD NC4200: Problem with calcurse.

Ughh. Found that there's a fatal bug in the installed calcurse. My box hanged after I tried to alter the "Notify" function's configuration. As stated in the program's news section, there's a bug in notification in version prior to 2.6. The version I installed from package is 2.5. Ouch. So now I have to install it from ports now. Hopefully OpenBSD's port system is not that different from FreeBSD's port system. Later

OpenBSD NC4200: Searching for ncurse calendar program.

I installed VLC media player just now. Installation went ok though there's quite a lot of dependencies I had to tackle. Luckily I retrieve the file using my OpenBSD machine so no more transferring packages using 2 machines. Oh well still have issue with my proxy connection, so pkg_add can't be run directly. Have to install stuff using a terminal, while using Firefox to download the data.

Currently I'm searching for calendar / reminder program which uses curse, looking at calcurse and wyrd (which uses remind, a calendar / reminder software). Not sure which is the best so I guess I'll try both and see. I love to know what other OpenBSD user out there use to manage their schedule etc.

Update: Oh, I went for calcurse. No dependencies, small, so it's great. Now to play with it. Later!

Monday, January 04, 2010

OpenBSD NC4200: Email with Alpine & can I have Magic Set Editor in my box?

Hi again.

I've installed Alpine and it's nice! Sent few emails and it's working fine. Haven't set my email add inside it yet but it'll be soon. So far my OpenBSD box is great! Really love the wmii and the other stuff I installed so far.

Oh yeah, I tried installing Magic Set Editor software, a program for Magic: The Gathering player/collector (or newbie, like *cough*me*cough*). There's linux port there but currently I'm having problem installing the darn script. I'll try and find an answer later.

Oh, speaking of Magic: The Gathering (MTG), I was sold to it a few days ago and currently building my Zendikar's set. I know the Comic World (or something) in MidValley sell the stuff so yesterday I went there and the friendly staff there welcomes me to (inofficially) join the club. Yeah!. Still haven't play my 1st game though, needs to build up my deck first. The shop also have single cards for sale (at used price, very cheap) and I got meself quite a bunch yesterday. Later!

6.5 amd64: Modify existing certbot certificates.

Hi, It's been quite some time eh. As you can see, I still upgrade my OpenBSD system regularly but currently I do not have the time to ...