newbie learning experience
Joe Warner initially posted a message
to a couple of FreeBSD mailing
lists (Newbies and Advocacy). Within hours, he received
a few responses of support and encouragement for his work. They also suggested that
he submit the story to DaemonNews and The FreeBSD Diary. Unfortunately, DaemonNews
just published their monthly edition a few days ago, so that means his article appears
here first.
If you like this article, and wish to encourage Joe to continue to write
about his experiences, be sure to email him with your words of support.
Thanks Joe.
Joe’s story
I’ve had a real learning experience with my FreeBSD (3.4) system at work
over the past couple of days and at the risk of making myself look like an idiot, I felt
it important enough to share. Since I’m a newbie and hope to help other newbies when
facing similar situations, this email is directed mainly at freebsd-newbies.
However, I also felt it important enough to share with freebsd-advocacy because of how
amazed I am with the OS. Instead of a little cartoon devil, maybe the mascot should
be the Energizer Bunny? FreeBSD keeps going and going and going… 8^) Anyway,
please bear with me. This is probably going to be pretty lengthy, so for those of
you don’t like to read or are uninterested, just close this email and delete it now. For
the rest of you, read on…
When I came into work last Thursday morning, I noticed that
my PC (Compaq Deskpro 2000), running FreeBSD 3.4 was at the login prompt and my WIN NT
machine was at the boot up password. I realized then that the inevitable had
happened….Power Outage! Thinking that power outages/cold reboots meant death to
most UNIX systems, I hurried to prevent this from happening again and hooked up an APC
Smart-UPS 1000 that we had sitting in one of our storage closets. Hooking it up to
my FreeBSD machine was easy enough. I just plugged the power cord into a receptacle and
then plugged the power from the CPU and monitor into the back of the UPS. I finished
by attaching the serial cable on the UPS to the serial port on the back of the CPU (COM1)
– there is only one serial port available for Compaq Deskpro’s. After hooking it up,
I realized that I would need to install some software that could communicate with the UPS
through the serial line and allow me to do a graceful shutdown in the event of power loss.
I went to APC’s web site and though they had their Powerchute software available
for many commercial versions of UNIX, I didn’t see anything that was designed specifically
for any of the BSDs. They even had a Linux version and I learned later that at least
one person was running this successfully under Linux emulation on his FreeBSD 3.4 system.
I didn’t want to run this under Linux emulation if I didn’t have to. Later, I
came across an application in the ports collection called UPSD – 2.0 that seemed to be
designed specifically to work with the APC Smart-UPS models. I loaded the 4th CD from the
CD ROM set and from /usr/ports/sysutils/upsd/ I typed make install
and installed it. I noticed that there wasn’t any documentation included with this
port, not even a man page. It loaded only 2 files, the upsd executable in /usr/local/sbin
and the configuration file (upsd.conf) in /usr/local/etc. I
su’d to root and attempted to spawn the daemon by cd’ng to /usr/local/sbin and
typing # ./upsd. At this point, my whole system locked up tighter than a
drum! I couldn’t kill X and couldn’t switch to another terminal. Nothing!
I had to cold-reboot my system again! After I booted back up, I looked at my
logs and noticed a message indicating there was a permission problem with /dev/cuaa0.
This device is owned by uucp and belongs to the dialer group. I su’d to root again
and adjusted the permissions so that other users would have access and then tried to
execute the program again. Same thing happened, complete lockup! At this
point, I was pretty frustrated and none the information I had read in my books or the
answers I received from posting to FreeBSD-Questions seemed to help. I cd’d to /usr/ports/sysutils/upsd
and typed make deinstall and went home.
When I came in Friday morning, I noticed an email from someone who said they were using
a port called UPSMON – 2.1.3 with an APC Smart-UPS on their FreeBSD system without any
problems. This port wasn’t on the CD ROM set, so when I installed it, it had to
fetch it from an ftp site. No problem, right? Wrong! I installed this
port and decided to reboot. Big mistake! Now, during boot-up, my system would just hang
at:
local package initialization: Cannot open /dev/cuaa0: Permission denied upsmond
After hearing the voice of Ralph from the Simpsons in my head, going Ha! Ha!.., I
thought, now what do I do! After going through all my books and documentation and
trying to boot into single-user mode, fixit mode from the 2nd cd in the cd rom set and
even from kernel.GENERIC, I realized I wasn’t getting anywhere. My machine would
always hang when trying to launch the upsmond daemon during boot up. As a last
resort, I posted to FreeBSD-Questions and got the answer I was looking for. I was
told to go into single-user mode. At the beginning of the boot-up process, there is
a ten second count down that tells you to either hit enter or wait for the count down to
finish for system boot-up. Before the counter finishes, you hit the space bar and
you’re presented with a prompt where you can specify different boot options. I
specified boot -s for single user mode. In The
Complete FreeBSD, it tells you to boot into single-user mode and run fsck
on / by issuing: fsck -y / <cr> I ran this on / and
/dev/wd0s1a. Then it tells you to mount / by typing: mount
-u /. I did this and it let me mount it. Lastly, it says to mount /usr
by typing: mount /usr. It would let me mount this but only with read
access. I needed write access so that I could go into /usr/local/etc/rc.d/
and either remove or change the upsmond.sh file which was causing my system to
hang. I got a response from someone telling me to mount /usr by typing the
following: mount -rwf /usr. This worked and I was able to edit upsmond.sh
so that it was pointing to /dev/cuaa1 and not cuaa0. This got
my system booting. I found out later that I could have successfully mounted /usr
with r/w access if I would have first fsck’d it by issuing: fsck -y /usr (I
probably should have done this for /var too).
I got my system booting again (whew!) but still haven’t figured out why /dev/cuaa0
causes problems. I seems as if some kind of conflict is going on, maybe something
else is using this device? I haven’t found the answer to this yet. I got an
email response back from APC, saying they did have an application that would work with
FreeBSD but I would need to purchase their Simple UNIX Serial cable for $39.00 in order
for it to work. So, now I don’t know if it’s a device conflict or the cable but I
doubt I’ll shell out the money for a new cable. Maybe my manager will let me order
it and reimburse me?
I’ve always thought that cold reboot/shutdowns were death to UNIX systems, especially
if you did it more than 5 or 6 times. I’ve completely trashed my systems this way
when I was using Red Hat 6.x and Caldera 2.x in the past. Cold booted more than 5
times and got the dreaded "kernel panic" message and had to reinstall. I
ended up cold booting my FreeBSD system more than 12 times the last couple of days and
it’s still going! 8^). So, the moral of this story? FreeBSD is forgiving, you
just need to tell it how to forgive you!
And…forgive me for such a long story… 8^}
Joe
—
FreeBSD = The Power to Serve ..Simply put = FreeBSD Rocks!