Rhyous

December 3, 2010

FreeBSD Wireless – Configuring a wireless interface on FreeBSD 8.1

Filed under: FreeBSD,PC-BSD — J. Abram barneck @ 6:50 am
Tags: , , ,

FreeBSD Wireless

FreeBSD has strong support for wireless devices. Here is a quick overview of how to manage wireless interfaces on FreeBSD.

Prerequisites

For Wireless access requires the following:

  1. A wireless interface card
  2. wpa_supplicant
  3. An Access Point

Note: In later of versions of FreeBSD, since 2008, wpa_supplicant was included in base. If you are running an older version of FreeBSD, then wpa_supplicant was a port.  So if you are on FreeBSD 8, you have wpa_supplicant.

To complete this guide, we will also use:

  1. A FreeBSD desktop environment.
  2. wpa_gui

Note: wpa_gui is not included in the base system but is found in ports.

Step 1 – Determine what wireless interface card you have

Some wireless cards are built into the kernel, and may already be loaded.  If you know what card you have, skip this step.

  1. First, we need to find out what wireless card you have. Run ifconfig and look at the network cards you have.  Then to see which one is your wireless card, compare them to the wireless kernel module list here:
    http://www.freebsd.org/releases/8.1R/hardware.html#WLAN 

    $ ifconfig
    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 00:1e:37:d0:91:cb
            media: Ethernet autoselect
            status: no carrier
    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>

    Notice in the above configuration, no wireless card was discovered. Here is an example of one with a wireless card.

    em0: flags=8843&lt;UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST&gt; metric 0 mtu 1500
            options=219b&lt;RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4,WOL_MAGIC&gt;
            ether 00:1e:37:d0:91:cb
            media: Ethernet autoselect
            status: no carrier
    iwn0: flags=8843 metric 0 mtu 2290
            ether 00:1e:37:d0:91:cb
            media: IEEE 802.11 Wireless Ethernet autoselect mode 11g
            status: associated
    lo0: flags=8049&lt;UP,LOOPBACK,RUNNING,MULTICAST&gt; metric 0 mtu 16384
            options=3&lt;RXCSUM,TXCSUM&gt;
            inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3
            inet6 ::1 prefixlen 128
            inet 127.0.0.1 netmask 0xff000000
            nd6 options=3&lt;PERFORMNUD,ACCEPT_RTADV&gt;
  2. Most wireless cards are PCI devices.  Run pciconf to look for your wireless network card type. This outputs a lot of information, I have snipped my output to isolate only the information about the wireless PCI card.
    $pciconf -lv
    ...
    none1@pci0:3:0:0:       class=0x028000 card=0x10108086 chip=0x42308086 rev=0x61 hdr=0x00
        vendor     = 'Intel Corporation'
        device     = 'Intel Wireless WiFi Link 4965AGN (Intel 4965AGN)'
        class      = network
    ...
  3. Now go to the current release notes for FreeBSD and look through the wireless kernel modules to see which one supports your hardware.
    http://www.freebsd.org/releases/8.1R/hardware.html#WLAN
    
    Note: I searched for 4965AGN and found my kernel module immediately.
  4. Keep the link open as you move to Step 2.

Step 2 – Make sure the kernel module is loading

If your wireless card is already detected and loading, skip this step.  If not, configure /boot/loader.conf to load your wireless card.

  1. Read the man page for your wireless kernel module, there is a link to it in the hardware notes, to see any special information about loading the kernel module for your kernel module.
  2. Configure the /boot/loader.conf to load the kernel module and make any other required settings to use the kernel module.Example 1 – The Intel iwn kernel module requires a line to load the kernel module and a second line to load the firmware.
    # Wireless
    if_iwn_load="YES"
    iwn4965fw_load="YES"

    Example 2 – The Intel iwi kernel module requires that you accept a license agreement:

    # Wireless
    if_iwi_load="YES"
    legal.intel_iwi.license_ack=1
  3. Save and close the /boot/loader.conf
  4. Now you can either reboot, or you can use kldload to load the kernel modules without rebooting.

Step 3 – Configure the wireless settings in /etc/rc.conf

The rc.conf is where the wireless network card is configured.

  1. In FreeBSD 8 and later, all wireless interfaces should be configured to use the generic wlan device. Then to enable wpa_supplicant, the wlan should be configured to use WPA.
    To make these configurations, add these lines to the /etc/rc.conf. 

    wlans_iwn0="wlan0"
    ifconfig_wlan0="WPA DHCP"
  2. Save and close /etc/rc.conf.

Step 4 – Add your Access Point’s (AP) SSID to your /etc/wpa_supplicant.conf

There is a lot of information on how to add an SSID to your /etc/wpa_supplicant.conf file in the man page for wpa_supplicant.conf. But the process is simple.

  1. If you don’t know the SSID, discover or scan for the SSID by running ifconfig wlan0 scan.  Below is an example.
    $ ifconfig wlan0 scan
    SSID/MESH ID    BSSID              CHAN RATE   S:N     INT CAPS
    MyWifi          00:20:e1:96:54:32    6   11M -75:-95  100 E
    OpenNet         da:ce:41:d3:af:3a    6   54M -85:-95  100 IS
    MyWPA           00:24:7b:6b:71:27    1   54M -89:-95  100 EP   RSN WPA WPS
                    00:00:00:00:00:00    1   54M -89:-95  100 E
  2. Now add a network entry for the desired wireless device.  Examples are below:

    Open or no authentication

    network={
            ssid="MyWifi"
            key_mgmt=NONE
    }

    WPA or WPA2

    network={
            ssid="MyWPA"
            psk="SomeP@sswd!"
    }

    More examples

    For more examples, read the man page for wpa_supplicant.conf.

    $ man wpa_supplicant.conf

    Once the SSID is configured properly in the /etc/wpa_supplicant.conf, then an automatic connection to this AP will occur whenever the device is within range.

Step 5 – Install wpa_gui from ports

Often you don’t always know what wireless you are going to connect to and also often you don’t care to store the SSID configuration permanently in the /etc/wpa_supplicant.conf. This is common if you are getting online at an airport, coffee shop, or any hotspot that you don’t frequent. It would be nice to have a graphical interface that shows you the SSIDs available, allows you to connect, but doesn’t store the information. wpa_gui is this tool.

  1. Install wpa_gui from ports
    # cd /usr/ports/net/wpa_giu
    # make install
  2. Add the following two lines to the top of the /etc/wpa_supplicant.conf.
    ctrl_interface=/var/run/wpa_supplicant
    ctrl_interface_group=wheel
  3. Restart the wpa_supplicant.# /etc/rc.d/wpa_supplicant restart wlan0
  4. Run wpa_gui.
    $ wpa_gui
    Selected interface 'wlan0'
    Trying to connect to '/var/run/wpa_supplicant/wlan0'

    wpa_gui opens.

  5. Click Scan and a window listing the available SSIDs appears.
  6. Double-click on an SSID to get the configuration windows.  It will try to select the correct settings as best it can, so often you only need to add the psk or passkey, which is essentially a password.
  7. This will connect you to that SSID.

Note: If you do want to save the networks to the wpa_supplicant.conf by default, then add this line. Otherwise, they are not saved. You may or may not want them to be saved.

update_config=1

Additonal Notes

Note 1: PC-BSD has a network configuration tool, so if you are running PC-BSD, wpa_gui is not necessary.

Note 2: There is a command line tool called wpa_cli that is included in the base system.  wpa_cli is useful if you don’t have a graphical environment.

Note 3: I also configured link aggregation, or lagg, so my wired and wireless interfaces share the same MAC.

ifconfig_em0="up"
ifconfig_iwn0="`ifconfig em0 ether`"
ifconfig_iwn0="ether ${ifconfig_iwn0##*ether }"
wlans_iwn0="wlan0"
ifconfig_wlan0="WPA"
cloned_interfaces="lagg0"
ifconfig_lagg0="laggproto failover laggport em0 laggport wlan0 DHCP"

Resources

http://www.freebsd.org/doc/handbook/network-wireless.html

http://www.freebsd.org/releases/8.1R/hardware.html#WLAN

man wpa_supplicant
man wpa_supplicant.conf
man iwn
man iwi


Copyright ® Rhyous.com – Linking to this page is allowed without permission and as many as ten lines of this page can be used along with this link. Any other use of this page is allowed only by permission of Rhyous.com.

November 23, 2010

FreeBSD or Linux

Filed under: FreeBSD,OpenBSD,Operating Systems,OS X,PC-BSD,Red Hat,Ubuntu — J. Abram barneck @ 1:09 am

Ok, so if you have been on my site, you know that I started with Red Hat and never really got into it, and then, settles on FreeBSD.  Why would I choose FreeBSD over Linux? It fit me better.

I actually think that everybody needs to use what suits them.

This is NOT a FreeBSD versus Linux post.  It is a site to help others who are trying to decide whether to use FreeBSD or Linux see some pros and cons and get my recommendation.

FreeBSD

FreeBSD is not Linux or Unix exactly.  It is BSD. It has its own bsd kernel and an is surrounded by a base system.

Here are a list of positives about FreeBSD

  • It is open to proprietary code that just can’t be used in Linux, such as Sun’s ZFS.
  • It is easy to get a small install of just the base system with minimal to no features installed. (Security! Attach surface area is minimized when less software is included.)
  • Jails
  • The ports tree for compiling from source is unmatched by any Linux operating system, but if you prefer binaries, yes, it has them too.
  • Installing software has less problems as you compile it on the system, with the settings you need (rather than get binaries that may have been compiled for a different system or without the settings you need).
  • The documentation is far better than most other open source projects and better than most projects commercial or open source for that matter!
  • OS X chose to use much of FreeBSD in its underlying operating system and so when combining the OS X and FreeBSD market share, FreeBSD code is actually used on more systems than any operating system other than Windows.
  • There are not that many BSD distributions, and the ones that exist have clear focusses different than the others, that later they share.  FreeBSD is a solid server. PC-BSD is a desktop focussed on avoiding dependency problems with its software. OpenBSD is extremely securee. NetBSD is extremely compatible with lots of hardware.  They contribute back to each other often.
  • The License is free and gives everyone who uses it true freedom.
  • The License is free for commercial use.
  • Easy Editor. Newbies can actually use this editor included in the FreeBSD base system.  Don’t forget to learn vi though.
  • Patching is as simple as running freebsd-update.

Here are a list of negatives about FreeBSD

  • Hardware companies tend to make drivers for Windows and Linux first and often don’t include FreeBSD, though most hardware is soon supported.
  • There is not a native Flash Player in FreeBSD, instead the Linux version of Flash must be used.
  • There Desktop options for FreeBSD are not as rich as those for Linux (Example: KDE network settings doesn’t work on FreeBSD, but PC-BSD has their own settings now.)
  • IT/Developers forFreeBSD are harder to come by.

Linux

Linux was originally just a kernel.  The userland was separate.  Now there are plenty of projects that make a nice complete operating system using the Linux kernel and a nice base system surrounding it.

Here are a list of positives about Linux

  • It has a large user base.
  • Free to use.
  • There are plenty of distros to choose from.
  • It is no longer just a kernel but many different groups put out an actual system: Red Hat/Fedora, Debian/Ubuntu, CentOS, SUSE, Arch, Gentoo, etc…
  • A lot of work is going into the desktop environment
  • Development for any Linux platform could benefit all Linux platforms.
  • More and more hardware companies are including Linux drivers
  • Some Software companies make Linux software as well, and the number is increasing
  • Strong commercial backing (which doesn’t make sense for software licensed under the GPL)

Here are some negatives

  • There is often a lot of binary packages that just don’t work.
  • Lack of consolidation.  There are a lot of distributions of Linux and they are not the same. Which one do you choose.
  • Many Linuxes (not all) are now installing desktop software by default, and no longer are minimalistic. (Security! Attach surface area is increased when more software is included.)
  • The inability to write and distribute software that touches GPL software, without having to release your software as GPL too.
  • If you hope to do anything other than use the software or help the community, you need a lawyer to figure out how to interact with the various versions of GPL.
  • The security settings are usually not easy to use and are result in users just turning them off (i.e. SELinux)
  • Are Red Hat and SUSE open source or commercial, they sell support but the software is free, except you can’t get updates without buying support…confusing!
  • IT guys who claim to know Linux usually have done little more than run Ubuntu for a few days.

This is not a flame post and any responses that appear to be trolls will be deleted.

My recommendations

Ok, so what would I recommend if I were paid by a company for consulting?

Server (LAMP)

For a Server running Apache, PHP, SQL, often mis-termed LAMP (Linux Apache MySQL PHP) but really means any OS, Web Server, SQL, Script language.

Recommended OS: FreeBSD

Commerical Appliance

If you work for a company and you need a commercial appliance. Stay away from the dangers of the GPL, just don’t go there.

Recommended OS: FreeBSD

Open Source Desktop

For a quick desktop for a home user that has PC hardware but doesn’t have a license for Windows and doesn’t want to buy one.

Recommended OS: Ubuntu

Note: Sorry PC-BSD friends. Keep working on it.

Commerical Desktop for Employees

If you want a good commercial desktop, you should go with one of the following depending on certain factors, the primary being that some software you may need to use only runs on these two platforms.

Recommended OS: Windows 7 or OS X

However, Ubuntu, Red Hat, SUSE, Fedora, PC-BSD, are all very usable replacements depending on the situation.

Point of Sale (POS) Device

If you need to have to have a POS device for handling sales.

Recommended OS: Depends on needs

 

Share your thoughts

Hey, please comment.  No flame wars though.  I repeat, this is not a FreeBSD versus Linux post, but a FreeBSD or Linux post, with just some information from my experience. I appreciate all technology and any rude comments will be deleted.  However, feel free to challenge and provide facts, demand facts, etc…

 

November 19, 2010

Creating or opening a password protected zip file on FreeBSD

Filed under: FreeBSD,OS X,PC-BSD — J. Abram barneck @ 5:15 am

So this works on FreeBSD but it probably works on OS X, most Linuxes, Solaris, and other Unixes as well.

Installing prerequisites

In order to create a password protected zip file and later open it, two ports are needed:

  • zip
  • unzip

To install these using packages, do this as root:

#
#
pkg_add zip
pkg_add unzip

Or using ports:

#
#
#
#
cd /usr/ports/archivers/zip
make install
cd /usr/ports/archivers/unzip
make install

Creating a password protected zip file

There are a couple of different ways you may want to create a zip file. You may want to zip a sing file, or two or more files, or and entire directory and all its contents. You may also want to add a file to an existing zip file.

All of these actions can be done with a binary called zip.

Example 1 – Creating a password protected zip file containing one file

The syntax is simple. The -e parameter is to encrypt with a password. Always put the zip file first and the file to be zipped second.

# zip -e myarchive.zip myfile1

Example 2 – Adding a file to your password protected zip file

Since your zip file already is encrypted with a password and adding a file does not require decrypting, you don’t need the password to add a file to the zip file.

# zip myarchive.zip myfile2

Example 3 – Creating a password protected zip file containing multiple files

This is very similar to Example 1. The -e parameter is to encrypt with a password. Always put the zip file first and the files to be zipped last separated by a space.

# zip -e myarchive.zip myfile1 myfile2 myfile3

Example 4 – Creating a password protected zip file containing a directory and all is contents.

The -r parameter is to do a recursive zip (recursive means to include the folder and all its contents). The -e parameter is to encrypt with a password. Always put the zip file first and then the directory name.

# zip -r -e myarchive.zip mydirectory

Example 5 – Delete a file from the zip

This is easier than you think. Because you are not actually reading the contents of a file in the archive, the password is not needed to delete a file inside the zip file.

# zip -d myarchive.zip myfile1

Opening a password protected zip file

The syntax for unzipping a file is a lot easier.  It uses a different binary file called unzip.

# unzip myarchive.zip

The above prompts for the password automatically and unzips the files, assuming the correct password is provided.

November 12, 2010

Making a package from a port on FreeBSD

Filed under: FreeBSD,PC-BSD — J. Abram barneck @ 6:45 am

Some times is it the simple things that people don’t know. For example, I have always just installed software from ports. Every now and then I would use pkg_add -r to pull a pre-made package from a FreeBSD package server. But I have never actually made a package myself. I have been using FreeBSD for 10 years and many consider me an expert in some areas.  Well, like I always say, it is possible to be an expert in many areas and still be a newbie in some areas.

Recently, I am looking into steps to make a BSD appliance and so I want to keep the system as minimal as possible. So I want to build packages on on a separate build box. So I suddenly realized that I have never made a package myself and I wasn’t exactly sure how.

So is it hard to convert a port into a package? Of course not. If you want to make a package from a port, and you are familiar with ports already, then all you have to do is run make package, and you may want to make the dependent packages as well.

If you need some more granular steps, I will provide them. You just need to follow some simple steps:

FreeBSD make package

Lets assume you want to install lighttpd.

  1. Download the latest ports tree. See this article: How to install ports on FreeBSD?
  2. Search for the port you want.
    #
    #
    cd /usr/ports
    make search name=lighttpd

    The output should look as follows:

    Port: lighttpd-1.4.28_4
    Path: /usr/ports/www/lighttpd
    Info: A secure, fast, compliant, and very flexible Web Server
    Maint: mm@FreeBSD.org
    B-deps: libtool-2.2.10 pcre-8.10 pkg-config-0.25_1
    R-deps: pcre-8.10
    WWW: http://www.lighttpd.net/
  3. Look at the R-Deps. R is short for Run and deps is short for dependencies. If you want a package for lighttpd, it requires pcre-8.10 to run, so you will need a package for pcre-8.10 as well.
    Note: B-deps are not need. B is for Build. These dependencies are only need to build the package.  Once the package is built, they are not needed, so you don’t need to create packages for them.
  4. Make the lighttpd package:
    #
    #
    cd /usr/ports/www/lighttpd
    make package
  5. This creates the file in the /usr/ports/www/lightpd. You may have a directory or share where you store your packages, and you can copy it there if you want. Especially if this is a build machine in a vm that you plan to revert, you need to copy this off the machine or you will lose it when you revert.
  6. Make the pcre package.
    #
    #
    cd /usr/ports/devel/pcre
    make package
  7. This creates the file in the /usr/ports/www/lightpd. You may have a directory or share where you store your packages, and you can copy it there if you want. Especially if this is a build machine in a vm that you plan to revert, you need to copy this off the machine or you will lose it when you revert.

Hopefully this helps you if you ever need to make your packages on one box.

This is also something great to do before an install fest so you can have the latest packages available. Lets say you want to do an install fest for a FreeBSD desktop, you could have all the latest Xorg and Fluxbox or KDE or GNOME packages already built.

Build machine notes
On your build machine “make package” will actually install the package in the process of building the package. However, that is not really a concern as this is a build machine. My recommendation is that you create a build machine in VirtualBox and snapshot it after you download ports. Usually you just continue making packages. When you decide it is time to go back to a clean system, 1) revert your snapshot, 2) update your ports tree, 3) make your new packages.

November 9, 2010

A simple fix when /tmp is too small and you can't download a file in Firefox

Filed under: FreeBSD,PC-BSD — J. Abram barneck @ 11:57 pm

Firefox Problem

Recently using my FreeBSD desktop, I was unable to download a file in Firefox.

There is not enough room on the disk o save /tmp/IVpWYcrD.exe.part.

Remove unnecessary files from the disk and try again, or try saving in a different location.

So I got this as soon as I tried to download a file. It said there wasn’t enough space to download the file and recommending a different location, however, this error was before I even chose a download location.

Cause

So it appears it starts downloading immediately to /tmp, but since I installed FreeBSD without giving /tmp its own partition, it was dumped in the root partition, which doesn’t have much space.

Here are the partitions I have created.

[jared@slc-jab ~]$ df -aH
Filesystem            Size    Used   Avail Capacity  Mounted on
/dev/label/rootfs0    520M    259M    219M    54%    /
devfs                 1.0k    1.0k      0B   100%    /dev
/dev/label/var0       1.0G    164M    791M    17%    /var
/dev/label/usr0       143G     80G     51G    61%    /usr
procfs                4.1k    4.1k      0B   100%    /proc

So using Firefox as soon as I try to download anything over 219 MB, it would fail.

My first bad idea to fix this (Don’t do this!)

So the fix seemed simple. However, while this resolved the Firefox issue, this fix caused some problems with Xorg and KDE.

As root, I did this:

rm -fR /tmp
mkdir /usr/tmp
chmod 1777 /usr/tmp
ln -s /usr/tmp /tmp

I made sure that the /usr/tmp permissions look as follows: rwxrwxrwt. Yes, that is supposed to end with a ‘t’. Read this for more info: http://www.freebsd.org/doc/handbook/permissions.html

If you screw up your permissions for the /usr/tmp file, Firefox will likely let you know with the following error.

/tmp/LDVDKpa.exe.part could not be saved, because you cannot change the contents of that folder.

Change the folder properties and try again, or try saving in a different location.

So I got the permission issue fixed and then rebooted to try to fix the fact that no other windows would open because I switched the /tmp directory while in X and after that none of my windows would open.

However, when I rebooted, I got this error with kdm and it kdm didn’t start:

Nov  9 09:07:12 slc-jab kdm_greet[1576]: Cannot create $HOME
Nov  9 09:07:12 slc-jab kdm-bin: :0[1575]: Received unknown or unexpected command -2 from greeter
Nov  9 09:07:12 slc-jab kdm-bin: :0[1575]: Abnormal termination of greeter for display :0, code 1, signal 0

I tried to fix the KDE issue, but it seemed to be caused by the fact that /tmp was a link because /usr/tmp had proper permissions but still it didn’t seem to work.

My second bad attempt

I spent hours trying to find a way to change the temp directory in about.config and thought I had it with browser.cache.disk.parent_directory but alas, it never worked.

  1. Leave /tmp as it is.
  2. Create another temp directory:
    mkdir /usr/tmp
  3. Give it the correct permissions.
    chmod 1777 /usr/tmp
  4. Open Firefox.
  5. For the URL type: about:config
  6. Add a new string
    Name: firefox
    Value: /usr/tmp
  7. Restart Firefox.

My third attempt

I tried to create a TEMP environment variable.  In fact, if Firefox is launched from a shell with TEMP specified as ~/.tmp then it works.  However, when the KDE Menu launches Firefox, it never has that environment variable. I added the environment variable to .profile, .cshrc, and rebooted, but it never worked.

Resolution

I added this line to my /etc/fstab file and rebooted. That took care of it. Supposedly tmpfs is experimental, but it is working great.

tmpfs                   /tmp                    tmpfs           rw,mode=1777    0       0

Anyway, I hope this information helps you if you see this issue.

A simple fix when /tmp is too small and you can’t download a file in Firefox

Filed under: FreeBSD,PC-BSD — J. Abram barneck @ 11:57 pm

Firefox Problem

Recently using my FreeBSD desktop, I was unable to download a file in Firefox.

There is not enough room on the disk o save /tmp/IVpWYcrD.exe.part.

Remove unnecessary files from the disk and try again, or try saving in a different location.

So I got this as soon as I tried to download a file. It said there wasn’t enough space to download the file and recommending a different location, however, this error was before I even chose a download location.

Cause

So it appears it starts downloading immediately to /tmp, but since I installed FreeBSD without giving /tmp its own partition, it was dumped in the root partition, which doesn’t have much space.

Here are the partitions I have created.

[jared@slc-jab ~]$ df -aH
Filesystem            Size    Used   Avail Capacity  Mounted on
/dev/label/rootfs0    520M    259M    219M    54%    /
devfs                 1.0k    1.0k      0B   100%    /dev
/dev/label/var0       1.0G    164M    791M    17%    /var
/dev/label/usr0       143G     80G     51G    61%    /usr
procfs                4.1k    4.1k      0B   100%    /proc

So using Firefox as soon as I try to download anything over 219 MB, it would fail.

My first bad idea to fix this (Don’t do this!)

So the fix seemed simple. However, while this resolved the Firefox issue, this fix caused some problems with Xorg and KDE.

As root, I did this:

rm -fR /tmp
mkdir /usr/tmp
chmod 1777 /usr/tmp
ln -s /usr/tmp /tmp

I made sure that the /usr/tmp permissions look as follows: rwxrwxrwt. Yes, that is supposed to end with a ‘t’. Read this for more info: http://www.freebsd.org/doc/handbook/permissions.html

If you screw up your permissions for the /usr/tmp file, Firefox will likely let you know with the following error.

/tmp/LDVDKpa.exe.part could not be saved, because you cannot change the contents of that folder.

Change the folder properties and try again, or try saving in a different location.

So I got the permission issue fixed and then rebooted to try to fix the fact that no other windows would open because I switched the /tmp directory while in X and after that none of my windows would open.

However, when I rebooted, I got this error with kdm and it kdm didn’t start:

Nov  9 09:07:12 slc-jab kdm_greet[1576]: Cannot create $HOME
Nov  9 09:07:12 slc-jab kdm-bin: :0[1575]: Received unknown or unexpected command -2 from greeter
Nov  9 09:07:12 slc-jab kdm-bin: :0[1575]: Abnormal termination of greeter for display :0, code 1, signal 0

I tried to fix the KDE issue, but it seemed to be caused by the fact that /tmp was a link because /usr/tmp had proper permissions but still it didn’t seem to work.

My second bad attempt

I spent hours trying to find a way to change the temp directory in about.config and thought I had it with browser.cache.disk.parent_directory but alas, it never worked.

  1. Leave /tmp as it is.
  2. Create another temp directory:
    mkdir /usr/tmp
  3. Give it the correct permissions.
    chmod 1777 /usr/tmp
  4. Open Firefox.
  5. For the URL type: about:config
  6. Add a new string
    Name: firefox
    Value: /usr/tmp
  7. Restart Firefox.

My third attempt

I tried to create a TEMP environment variable.  In fact, if Firefox is launched from a shell with TEMP specified as ~/.tmp then it works.  However, when the KDE Menu launches Firefox, it never has that environment variable. I added the environment variable to .profile, .cshrc, and rebooted, but it never worked.

Resolution

I added this line to my /etc/fstab file and rebooted. That took care of it. Supposedly tmpfs is experimental, but it is working great.

tmpfs                   /tmp                    tmpfs           rw,mode=1777    0       0

Anyway, I hope this information helps you if you see this issue.

November 3, 2010

GUBUG: Let's start meeting again

Filed under: FreeBSD,PC-BSD — J. Abram barneck @ 6:58 am
Tags: , , , , ,


I live in Utah. The BSD users group is called: The Greater Utah BSD Users Group (GUBUG).

Unfortunately, I haven’t really seen any activity with this group in years. Sometimes I feel like the only active BSD user Utah, though I know this is far from true. I met some great people at the Utah Open Source Conference.

So I am kicking GUBUG into gear! Lets have a restart of the GUBUG meetings!

Date: Nov 17, 2010
Time: 7:00 pm – 8:30 pm
WHERE: LANDesk Building (see map)

I created a Facebook Group and added this as an event. Please join the group and RSVP if you can make it.

http://www.facebook.com/event.php?eid=119773334748668

Topics:
1. Contacting past members
2. GUBUG web site
3. A BSD topic (To be determined)
4. New GUBUG goals.

It will just be a fun meeting, to get things started again.

GUBUG: Let’s start meeting again

Filed under: FreeBSD,PC-BSD — J. Abram barneck @ 6:58 am
Tags: , , , , ,


I live in Utah. The BSD users group is called: The Greater Utah BSD Users Group (GUBUG).

Unfortunately, I haven’t really seen any activity with this group in years. Sometimes I feel like the only active BSD user Utah, though I know this is far from true. I met some great people at the Utah Open Source Conference.

So I am kicking GUBUG into gear! Lets have a restart of the GUBUG meetings!

Date: Nov 17, 2010
Time: 7:00 pm – 8:30 pm
WHERE: LANDesk Building (see map)

I created a Facebook Group and added this as an event. Please join the group and RSVP if you can make it.

http://www.facebook.com/event.php?eid=119773334748668

Topics:
1. Contacting past members
2. GUBUG web site
3. A BSD topic (To be determined)
4. New GUBUG goals.

It will just be a fun meeting, to get things started again.

October 29, 2010

Changing the prompt for csh on FreeBSD 8.1

Filed under: FreeBSD,PC-BSD,Red Hat,Ubuntu — J. Abram barneck @ 4:03 am
Tags:

The prompt by default for csh on FreeBSD is simply a sing percent symbol.

%

There is not space before or after this.  I don’t like it and it drives me crazy. I like a prompt to tell me three things:

  1. Who is logged in.
  2. The machine name.
  3. The current path.

This change is quite simple.  It can be made temporarily, permanently for all users, or permanently for a single user.

Temporary

Sometimes you don’t want to make a permanent change to the prompt.  Especially if you are on someone else’s system temporarily and using one of their shells.  In such a case, setting the prompt temporarily is desired.

To see the prompt temporarily, simply run this command:

set prompt = “[%n@%m %c]$ “

Your prompt should now look as follows:

[SomeUser@SomeComputer ~]$

This is only temporary. As soon as you close the shell, the settings is gone and any new shells will continue to have the old setting.

All Users

To make a change for all users, the file that needs to be edited is ~/.cshrc.

By default the file is empty except for some comments.  Line that are comments begin with the # character.

Add these lines to empty file:

if ($?prompt) then
        # An interactive shell -- set some stuff up
        set prompt = "[%n@%m %c]$ "
endif

After making this change, your prompt should look as follows:

[SomeUser@SomeComputer ~]$

If the file is not empty then you probably have to search yourself if the prompt is being set and replace it with the above.

Be careful that the prompt is not set for a single user because if it is, the user’s setting overrides the global settings.

Single User

The prompt can be set on a user by user basis.  The user’s settings will override the global setting.

To make a change for all users, the file that needs to be edited is /etc/csh.cshrc.

By default the file looks as follows:

# .cshrc - csh resource script, read at beginning of execution by each shell
#
# see also csh(1), environ(7).
#

alias h         history 25
alias j         jobs -l
alias la        ls -a
alias lf        ls -FA
alias ll        ls -lA

# A righteous umask
umask 22

set path = (/sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin /usr/local/bin $HOME/bin)

setenv  EDITOR  vi
setenv  PAGER   more
setenv  BLOCKSIZE       K

if ($?prompt) then
        # An interactive shell -- set some stuff up
        set filec
        set history = 100
        set savehist = 100
        set mail = (/var/mail/$USER)
        if ( $?tcsh ) then
                bindkey "^W" backward-delete-word
                bindkey -k up history-search-backward
                bindkey -k down history-search-forward
        endif
endif

After modification, my /etc/csh.cshrc looks like this:

# $FreeBSD$
#
# .cshrc - csh resource script, read at beginning of execution by each shell
#
# see also csh(1), environ(7).
#

alias h         history 25
alias j         jobs -l
alias la        ls -a
alias lf        ls -FA
alias ll        ls -lA

# A righteous umask
umask 22

set path = (/sbin /bin /usr/sbin /usr/bin /usr/games \
           /usr/local/sbin /usr/local/bin $HOME/bin \
           /usr/local/kde4/bin /usr/local/kde4/sbin \
           /usr/X11R6/kde4/bin /usr/X11R6/kde4/sbin \
           /usr/X11R6/kde4/lib/kde4/libexec)

setenv  EDITOR  vi
setenv  PAGER   more
setenv  BLOCKSIZE       K

if ($?prompt) then
        # An interactive shell -- set some stuff up
        set prompt = "[%n@%m %c]$ "
        set filec
        set history = 100
        set savehist = 100
        set mail = (/var/mail/$USER)
        if ( $?tcsh ) then
                bindkey "^W" backward-delete-word
                bindkey -k up history-search-backward
                bindkey -k down history-search-forward
        endif
endif

Your prompt should now look as follows:

[SomeUser@SomeComputer ~]$

Whatever you set the prompt to as a single user will override the global setting.

October 23, 2010

The KDE Network Configuration tool on FreeBSD

Filed under: FreeBSD,PC-BSD — J. Abram barneck @ 9:13 pm

I am looking for a Graphical Newtork Configuration tool for FreeBSD. However, my attempts to find one are unsuccessful.

KDE’s “Network Settings” tool

So, KDE on FreeBSD has a network configuration tool.  However, it doesn’t appear to work. PC-BSD has a working network management tool, that looks different.

I don’t have PC-BSD installed, but instead my own desktop build on FreeBSD, so I dont’ have a PC-BSD screen shot, but here is the screen shot from KDE’s regular Network Settings.

It flashes a little box that says, detecting platform and then the screen is empty of network cards.

I am on FreeBSD 8.1 64 bit.

I have these ports installed:

[jared@slc-jab ~]$ pkg_info |grep kde
akonadi-1.4.0_1     Storage server for kdepim
kde4-4.5.2          The “meta-port” for KDE
kde4-icons-oxygen-4.5.2 The Oxygen icon theme for KDE
kde4-shared-mime-info-1.0 Handles shared MIME database under ${KDE_PREFIX}
kde4-xdg-env-1.0    Script which hooks into startkde and helps KDE pick up XDG
kdeaccessibility-4.5.2 Accessibility applications for KDE4
kdeadmin-4.5.2      KDE Admin applications
kdeartwork-4.5.2    KDE Artworks Themes
kdebase-4.5.2       Basic applications for the KDE system
kdebase-runtime-4.5.2 Basic applications for the KDE system
kdebase-workspace-4.5.2 Basic applications for the KDE system
kdebindings-smoke-4.5.2 SMOKE bindings for Qt/KDE
kdeedu-4.5.2        Collection of entertaining, educational programs for KDE
kdegames-4.5.2      Games for the KDE integrated X11 desktop
kdegraphics-4.5.2   Graphics utilities for the KDE4 integrated X11 desktop
kdehier4-1.0.6      Utility port that creates hierarchy of shared KDE4 director
kdelibs-4.5.2       Base set of libraries needed by KDE programs
kdemultimedia-4.5.2 KDE Multimedia applications
kdenetwork-4.5.2    KDE Network applications
kdepim-4.4.6        Libraries for KDE-PIM applications
kdepim-runtime-4.4.6 Libraries for KDE-PIM applications
kdepimlibs-4.5.2    Libraries for KDE-PIM applications
kdeplasma-addons-4.5.2 Extra plasmoids for KDE4
kdesdk-4.5.2        KDE Software Development Kit
kdetoys-4.5.2       Collection of entertaining programs for KDE
kdeutils-4.5.2      Utilities for the KDE4 integrated X11 Desktop
kdeutils-printer-applet-4.5.2 Printer system tray utility for KDE4
kdevelop-4.0.0      Opensource IDE based on KDevPlatform, KDE and Qt libraries
kdevelop-php-1.0.0  PHP support for KDevelop
kdevelop-php-docs-1.0.0 PHP documentation for KDevelop
kdevplatform-1.0.0  KDE development platform
kdewebdev-4.5.2     Comprehensive html/website development environment
py26-kdebindings-kde-4.5.2 Python bindings for KDE
py26-kdebindings-pykdeuic4-4.5.2 An enhanced version of pyuic4
ruby18-kdebindings-4.5.2 Ruby bindings for Qt/KDE
system-config-printer-kde-4.5.2 KDE4 frontend for system-config-printer

So there according to the README in subversion for KDE’s network settings, this is supposed to work on FreeBSD. Maybe it doesn’t actually work.  I can configure my network from the command line, so it doesn’t affect me, it just affects me trying to get new users who don’t know how to configure the network from the command line.

Looks like no one has maintained this feature on the FreeBSD platform and it is not working.

PC-BSD’s “System Network Configuration” tool

PC-BSD has their Network Management tool available as a port it appears. /usr/ports/net/pcbsd-netmanager

However, when I installed it on FreeBSD, it didn’t really work either. Again, I am not on PC-BSD, just my own Xorg and KDE build on FreeBSD. It did work on PC-BSD when I was testing PC-BSD.

When I installed it to FreeBSD, it added a different network configuration option to the KDE System Settings called “System Network Configuration” which is different than the default one called “Network Settings”.

I sort of wish that instead of writing a new tool, the PC-BSD team had just worked with KDE to make the regular one work, but maybe there is a reason I am not aware of that made this a necessity. Anyway, that is besides the point, the GUI network configuration tool from PC-BSD didn’t work when installed to FreeBSD either.

It shows the network devices, physical, wireless, and virtual, but while it displays them, right-clicking and choosing the Configure option does absolutely nothing.

Any one know if GNOME has a GUI Network Configuration?

I didn’t check out GNOME’s options.  I don’t have GNOME installed and installing it is a bigger chore than I was planning on trying for finding a GUI network configuration tool

Conclusion

If you are running PC-BSD, the graphical System Network Configuration tool works.

If you are running FreeBSD, you may be out of luck using your own network configuration tool.

Options

The options seem to be these.

  1. We can contact the folks at PC-BSD and the folks at KDE and see if either have plans to make their tool work.
  2. We could step in and help either PC-BSD or KDE and fixing this ourselves and contributing our code.
  3. Write our own tool.

I like option 1 or 2. I guess I will contact PC-BSD and see what I can do to help.

Next Page »

The Rubric Theme Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.