FreeBSD: HOWTO install vim from ports WITHOUT X-Windows.

I’m normally a manually-compile-from-source type of guy, but I thought I’d give FreeBSD’s ports system a try. Right away I ran into an annoyance, and something that underscores a constant battle: trading customizability for ease-of-use. Yes, ports makes installing things easier, but you lose a certain level of control and customizability.

Installing vim from ports seems easy enough, right? Sure, if you want tons of bloat included! A simple make; make install in /usr/ports/editors/vim started a flurry of downloads for things like X11toolkits, X11R6.8.2, etc, etc.. in other words, installing vim from ports was trying to also install X-Windows on my machine!! This is a server, I do NOT need the bloat of X-Windows simply to run a frickin’ text editor like vim.

So, after some research, I discovered that you can in fact control port installs with various arguments. Here’s how I installed vim:
cd /usr/ports/editors/vim
make WITHOUT_X11=yes
make WITHOUT_X11=yes install

PRESTO, a nice, clean, bloat-free, non-X-Windows install of vim. As a general tip, you can look inside the port’s Makefile to see various arguments that you can pass in.

A caveat though, if you ever upgrade all your ports with portupgrade, all of your ports will upgrade with the default arguments. So if I ran portupgrade and a new version of vim was available, it would install vim and all the X-Windows crap along with it.

Luckily, FreeBSD provides a way to automatically provide arguments to auto-upgrades via portupgrade: Simply open up /usr/local/etc/pkgtools.conf and fill in the MAKE_ARGS tag like so:
MAKE_ARGS = {
'editors/vim' => 'WITHOUT_X11=YES',
}

Now the next time you upgrade vim using portupgrade, the WITHOUT_X11 argument will be automatically included, so you won’t have to worry about all that extra X11 crap being included in your install.

RealTek RTL8100S LAN on FreeBSD 5.4: no carrier

I just installed FreeBSD 5.4 on my Abit AA8-DuraMax, but I’ve run into some troubles with my networking. It seems that the on-board NIC doesn’t properly detect when a cable is plugged in. ifconfig shows it as “status: no carrier

I know it’s not the router or the cable, because they both work fine on other machines. The 8100S chipset is listed as supported on the FreeBSD 5.4 Hardware compatibility list, as well as the man pages for the re driver.

Some other weirdness: If I plug the ethernet cable from the BSD machine to another machine’s NIC, it is properly detected. It only doesn’t detect when connected to my router. Also, if I manually set the card to 10baseT/UTP using ifconfig’s media parameter, it also works. It doesn’t work on autoselect, or any other media setting besides 10baseT/UTP.

Anyone have any ideas? Some info:
ifconfig:
--------------------------------------
re0: flags=8843<up ,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
options=18<vlan_mtu ,VLAN_HWTAAGGING>
inet 192.168.1.31 netmask 0xffffff00 broadcast 192.168.1.255
inet6 ...
ether 00:50:8d:eb:e5:be
media: Ethernet autoselect (none)
status: no carrier
lo0: flags=8049<up ,LOOPBACK,RUNNING,MULTICAST> mtu 16384
inet 127.0.0.1 netmask 0xff000000
inet6 ::1 prefixlen 128
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x4Relevant dmesg:
--------------------------------------
re0: <realtek 8169S Single-chip Gigabit Ethernet> port 0xee00-0xeeff mem 0xfbfff000-0xfbfff0ff irc 16 at device 1.0 on pci1
miibus0: <mii bus> on re0
rgephy0: <rtl8169s /8110S media interface> on miibus0
rgephy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseTX, 1000baseTX-FDX, auto
re0: Ethernet address: 00:50:8d:eb:e5:bepciconf -lv:
--------------------------------------
re0@pci1:1:0: class=0x020000 card=0x1039147b chip=0x816910ec rev=0x10 hdr=0x00
vendor = 'Realtek Semiconductor'
device = 'RTL8169 Gigabit Ethernet Adapter'
class = network
subclass = ethernet
 
pciconf -r pci1:1:0 0:0xff
--------------------------------------
816910ec 02b00007 02000010 00002008
0000ee01 fbfff000 00000000 00000000
00000000 00000000 00000000 1039147b
00000000 000000dc 00000000 40200110
00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000
00000000 00000000 00000000 f7c20001
00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000

phplist/Sendmail/FreeBSD: X-Authentication-Warning

If you enable the $message_envelope variable in the config.php file of phplist for processing bounces, sendmail will probably complain with the following header in your email:
X-Authentication-Warning: your.domain.com: httpd set sender to account@domain.com using -f
This is because only “trusted users” are allowed to change the message envelope. By default, sendmail only considers root, daemon, and uucp as trusted users, so if you try changing the message envelope as the user Apache is running under (in my case httpd) sendmail will attach that nasty warning header to all your outgoing mails. Spam blockers don’t like this!

There are a couple of ways to fix this:

  1. Add httpd (or whatever user Apache is running under) to the daemon group:
    pw groupmod daemon -M httpd
  2. Add httpd (or whatever user Apache is running under) to Sendmail’s trusted-users file. Open up /etc/mail/your.domain.com.submit.mc in vi and insert the following line:
    FEATURE(`use_ct_file') dnl # Trusted users
    Save & Exit.
    Now you must create the trusted-users file in /etc/mail:
    touch /etc/mail/trusted-users
    Open /etc/mail/trusted-users with vi and on one line simply add the name of the user under which Apache is running:
    httpd
    Save & Exit. Run the following commands in /etc/mail to commit the changes to Sendmail and restart the server:
    make install
    make restart

That’s it, you should be good to go. Mail sent via PHP/Apache will no longer contain the X-Authentication-Warning header.

Note that there is a downside to this. Any user on your system can now use PHP to send email with “forged” headers. You basically just gave everyone on your system “Trusted User” status to Sendmail, so be sure that you trust your users before actually doing this!

UPDATE: How to do the same in Linux

libpng on FreeBSD: “ld: invalid BFD target”

Ran into a little problem installing libpng 1.2.8 on FreeBSD 5.4. Running make gives the following:
ld -b +s +h libpng12.sl.0 -o libpng12.sl.0.1.2.8 png.pic.o pngset.pic.o pngget.pic.o pngrutil.pic.o pngtrans.pic.o pngwutil.pic.o pngread.pic.o pngrio.pic.o pngwio.pic.o pngwrite.pic.o pngrtran.pic.o pngwtran.pic.o pngmem.pic.o pngerror.pic.o pngpread.pic.o
ld: invalid BFD target `+s'
*** Error code 1Stop in /usr/src/libpng-1.2.8-config.

I found out that there is a typo in the INSTALL file that tells you to use the wrong makefile. It tells you to cp scripts/makefile.hpgcc makefile when in fact you should cp scripts/makefile.freebsd makefile. Using the correct makefile, of course, make works as expected!