Archive for the ‘FreeBSD’ Category.

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

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.

Installing Windows 7 into a virtual machine on FreeBSD using VirtualBox

My job at LANDesk requires that I write code in C# for an application that only runs on Windows Server.  I also have to test a lot of code on Windows 7. Like me, so many people are forced to run a version of Windows because they have special windows applications at work or because that is the platform we are developing for in our jobs.

If running windows is a must for you, as it is for me, then moving to FreeBSD exclusively is just not an option.  I want to run an FreeBSD, but running Windows 7 is a must too.

At first VMWare Workstation looked like it was going to solve this problem. But while its early versions worked on FreeBSD, they failed to port newer versions over.  Quemu just never could get to level of usability needed.  Well, along comes VirtualBox from Sun.  Sun, now Oracle, released an open source edition cleverly named VirtualBox Open Source Edition (OSE).  Like many of Sun’s code, it is duel licensed.

Prerequisites

  1. A FreeBSD desktop – Hopefully you are here because you already have this.  If you don’t have a FreeBSD desktop, you can follow my guide to build one.
    How to install and configure a FreeBSD 8 Desktop with Xorg and KDE?
    Or you can install and use PC-BSD which is a nice desktop version of FreeBSD.
  2. A Windows 7 DVD or ISO and a product key.  Please do not pirate!

Step 1 – Installing VirtualBox OSE on FreeBSD 8.1

Installing VirtualBox is not complex. It involves only a few steps.

  1. Go to the directory for virtualbox-ose in your ports tree.
    # cd /usr/ports/emulators/virtualbox-ose
  2. Configure your installation.
    # make config
  3. Select Guest Additions, as it is not selected by default.
    Note: The defaults are Qt4, DBUS, X11, NLS and they should remain checked.
  4. You may also want to select VNC.
  5. Install virtualbox-ose
    # make install

Step 2 – Configuring FreeBD for Virtual Box

There are few things we need to configure on the FreeBSD system to make VirtualBox work.

  1. Add users to the vboxusers.
  2. Configure CD/DVD drive access.
  3. Configure VirtualBox kernel modules to load.

Step 2.1 – Adding use to the vboxusers group

  1. To add users to the group, use this command:
    FBSD# pw groupmod vboxusers -m SomeUserName

Step 2.2 – Configure CD/DVD drive access

Note: This is a copy of what is in my document for building a FreeBSD Desktop.

FreeBSD is more secure by default, so something as simple as accessing a CD or DVD or USB drive is not actually allowed by default. You have enable this.

These steps assume that your user is a member of the operator group. Remember above during the installation, I mentioned to make your user a member of both the wheel and operator groups.

  1. Access a shell and su to root.
    Note: The easiest shell to access now that you are in KDE is Konsole. To access Konsole, click the K and go to Applications | System | Terminal. Also you can add the shell icon to your panel by right-clicking on the icon and choosing Add to Panel.
  2. Enable vfs.usermount.
    FBSD# sysctl -w vfs.usermount=1
  3. Configure vfs.usermount to be enabled on boot.
    FBSD# echo vfs.usermount=1 >> /etc/sysctl.conf

  4. Open the following file with an editor: /etc/devfs.conf
    FBSD# ee /etc/devfs.conf

  5. Add the following lines:
    # Allow all users to access CD’s
    perm /dev/acd0 0666
    perm /dev/acd1 0666
    perm /dev/cd0 0666
    perm /dev/cd1 0666# Allow all USB Devices to be mounted
    perm /dev/da0 0666
    perm /dev/da1 0666
    perm /dev/da2 0666
    perm /dev/da3 0666
    perm /dev/da4 0666# Misc other devices
    perm /dev/pass0 0666
    perm /dev/xpt0 0666
    perm /dev/agpart 0666
    perm /dev/uscanner0 0666

    Note: Yes, I copied these from a PC-BSD install’s version of this file.

    Note: Change to 0660 to only allow users in the operator group to mount drives.

  6. Edit the /etc/devfs.rules file.
    FBSD# /etc/devfs.rules

  7. Edit the following file: /usr/local/etc/PolicyKit/PolicyKit.conf
    FBSD# ee /usr/local/etc/PolicyKit/PolicyKit.conf

  8. Change the xml’s config section from this…
    <config version="0.1">
        <match user="root">
            <return result="yes"/>
        </match>
        <define_admin_auth group="wheel"/>
    </config>
    

    …to this:

    <config version="0.1">
            <define_admin_auth group="operator"/>
            <match action="org.freedesktop.hal.storage.mount-removable">
                    <return result="yes"/>
            </match>
            <match action="org.freedesktop.hal.storage.mount-fixed">
                    <return result="yes"/>
            </match>
            <match action="org.freedesktop.hal.storage.eject">
                    <return result="yes"/>
            </match>
    </config>
    
  9. Edit the following file with ee: ee /etc/fstab
    FBSD# ee /etc/fstab

  10. See if there is a line in the fstab for your CD/DVD-Rom. Comment out or remove the line for your /cdrom. I usually just comment it out by adding a # sign as shown:
    #/dev/acd0 /cdrom cd9660 ro,noauto 0 0
  11. Restart the computer.

You should now be able to mount CD, DVD, and USB drives. You also should be able to both read and write to them, burn disks, write and format USB drives, etc…

Step 2.3 – Configure VirtualBox kernel modules to load

  1. As root, edit the /boot/loader.conf file.
    # ee /boot/loader.conf
  2. Add the following text:
    # VirtualBox
    vboxdrv_load=”YES”
  3. Save and close the file.
  4. Edit the /etc/rc.conf file.
  5. Add the following text.
    # VirtualBox
    vboxnet_enable
  6. Save and close the file.

Step 3 – Creating your Windows 7 VirtualBox

  1. Launch Virtual Box.
    Note: VirtualBox registers itself with the KDE menu.  On my installation, it was in Lost & Found, but on PC-BSD it was under System.  Either way you can type VirtualBox in the KDE menu search and find it.  Also, VirtualBox is the command and it should in $PATH so you should be able to open any shell from your desktop environment and run VirtualBox and have it open.
  2. Click New. This brings up a Wizard.
  3. Follow the wizard.
    Ok, if you need help with the wizard, here are my steps.
  4. Read and click Next.
  5. Choose an easy name.  I used “W7”.
  6. Make sure the Operating System is set to Microsoft Windows.
  7. Change the Version to Windows 7 (64-bit) or if you are on 32 bit hardware still use just Windows 7.
  8. Click Next.
  9. Allow at least 1536 MB (1.5 GB) for the base memory size.  You can get away with less if you need to. You can do better with more if
  10. you want to.
  11. Click Next.
  12. The Virtual Hard Disk page is already configured correctly, Boot Hard Disk is checked and Create new hard disk is selected. So just click next.
  13. Read and click Next.
  14. For Hard Disk Storage Type, I left it set at Dynamically expanding storage.
    Comment: This means that even if you use a 100 GB drive, it will only physically use as much space as Windows 7 has used in the Virtual Drive. So if Windows 7 is using 10 GB, even if you have 100 GB drive, the physical size on disk is only 10 GB.  This is important information for the next screen.
  15. Click Next.
  16. I change the drive size to 50 or 100 GB.
    Comment: It doesn’t really matter, but it is best to not run out of space either virtually or physically. Read my comment in the previous step.
  17. Click Next.
  18. Read and click Finish.

You virtual Machine now shows in the list.

Lets move to the next step.

Step 4 – (Optional) Changing Settings on your Windows 7 VirtualBox

I make two changes to my Windows 7 virtual box. As noted above this is optional, but I like to do them.

  1. Click the settings.
  2. Click System.
  3. Change the boot order to be hard drive first.
    Note: I make this change because it annoys me it when I install and then reboot the machine after the install and it boots right back to the install media. So I make this change and the press F12 during boot to the CD once.
  4. Uncheck and get rid of the floppy. (Does anyone still use those?)

  5. Now click on Storage.
  6. Under the Storage Tree, select your optical drive.
  7. If you are using an ISO, change the CD/DVD Device to point to the ISO. If you are using a DVD, as I am, choose Host Drive.  My host drive says: Host Drive Optiarc DVD RW AD-7910A (cd0).  I assume everyone drive will show up slightly different, but should start with Host Drive.
  8. Click OK.

Your settings should be good to go.

Step 5 – Install Windows 7

Now it is time to install Windows 7.

Don’t pirate! Use a legal product key. Again, just because I like open source does not make me anti closed source. I am not a Microsoft hater and I would hope you aren’t either. Even if you are, that is no excuse for pirating.

  1. Insert the DVD into your DVD drive, unless you are using an ISO and have already connected it.
  2. Click the Start icon.
  3. A new installation window will popup.
    Important! You may get a lot of popups telling you about important tips for using VirtualBox. Take time to read them. If you don’t read them or don’t already know what they are telling you, you will wish you had read them.
  4. Click in the window and to have it take control of your mouse and keyboard.
  5. Press F12 to choose your boot option.
     

    Note: If you miss this, that is OK,  you can restart the VM and try to be quicker.

  6. Once you have pressed F12 in time, you will see the following screen. At this screen, press the letter next to DVD drive.
  7. Press a key when prompted to boot to the Windows 7 media.

Well, you are off to installing Windows 7.  Hopefully you can get Windows 7 installed on your own, cause I am not here to walk you through doing that. Don’t worry, the install media for Windows 7 should be easy enough for you to follow if this is your first time.

Once finished, you will be running Windows 7 on FreeBSD.

Step 6 – Install VirtualBox Guest Additions

Even though all the devices are virtual, drivers are still needed. VirtualBox guest additions installs most of these drivers as well as other features of VirtualBox.

  1. Log in to your Windows 7 install.
  2. Select Device | Install Guest additions.

    This will mount an ISO and start the installer for VirtualBox Guest Additions inside Windows 7.

  3. Click Run VBoxWindowsEditions.exe.
  4. Follow the wizard.
    Note: I use the default install location and I check the option to Use Direct 3D support.
  5. Reboot when prompted.

Step 7 – Install the sound card driver

The sound card driver must be installed. VirtualBox uses a virtual device representing the Realtek AC’97 sound card.

  1. Log back into Windows 7.
  2. Go to the following web site:
    http://download.cnet.com/Realtek-AC-97-Driver-Windows-Vista-Windows-7/3000-2120_4-10962344.html
  3. Download and install the Realtek AC’97 Driver.
  4. Reboot when prompted.

Your Finished

You now have Windows 7 running. Now you can have the great experience of using FreeBSD as your primary OS and load Windows 7 when you need something requires windows, like I do.

Sources:
http://wiki.freebsd.org/VirtualBox
http://forums.freebsd.org/showthread.php?t=18699
The virtualbox-ose port’s pkg-message

GUBUG: Let's start meeting again


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.

The KDE Network Configuration tool on FreeBSD

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.

Installing the NVIDIA driver on FreeBSD 8.1

Ok, so it is one thing to have Xorg just autodetect settings, it is another to install and take advantage of a powerful NVIDIA driver and all its features.

To install the NVIDIA driver on FreeBSD 8.1, do the following.

  1. This needs to be done as root, so su to root.
  2. Install the NVIDIA driver. (Obviously only do this if your video card is NVIDIA)
    #
    #
    cd /usr/ports/x11/nvidia-driver
    make install

    Note: You will be prompted for the build configuration. Check the ACPI box because I suspect ACPI is needed if you want to sleep and resume. If you have Linux compatibility enabled or plan to use it later, leave that checked, otherwise uncheck it and hit ok.

  3. Edit the /boot/loader.conf file.
    # ee /boot/loader.conf
  4. Add the following line to configure the NVIDIA module to load at startup.
    nvidia_load=”YES”
  5. Install the NVIDIA configuration tool.
    #
    #
    cd /usr/ports/x11/nvidia-xconfig
    make install
  6. Use Xorg to create an xorg.conf. The following command creates and xorg.conf.new in /root.  This might detect the NVIDIA driver, or not. Whether it detects it or not if may not make all the desired settings.  The nvidia-xconfig tool will make the xorg.conf file settings work more accurately for the NVIDIA driver.
    # Xorg -configure
  7. Copy the file to the appropriate location
    # cp /root/xorg.conf.new /etc/X11/xorg.conf
  8. Run nvidia-xconfig
    # nvidia-xconfig
  9. Edit the /etc/X11/xorg.conf.
    # ee /etc/X11/xorg.conf
  10. Add this line in the driver section or “Section Device” to enable transparancy.
    Option Overlay

Ok, you should have your NVIDIA card working. There are probably many more tweaks you could make. If you know of any other options that your would recommend, please comment and let my readers and I know.

BSD Magazine October Issue Released

Hey all,

The BSD Magazine October Issue Released.

This month the title is VPN and BSD.

Remember, it is a free PDF publication.
http://bsdmag.org/magazine/1542-vpn-and-bsd

Configuring sudo on FreeBSD 8.1 and allowing sudo to open GUI applications

The goal is to install sudo and configure it in a way that allows GUI apps to run.

Without proper configuration the following error occurs when trying to run GUI apps:

No protocol specified
No protocol specified
Error: cannot open display: :0.0

To cofigure sudo, follow these steps below.

  1. Install sudo.
    cd /usr/ports/security/sudo
    make install
  2. Configure sudo be editing the /usr/local/etc/sudoers file.
    ee /usr/local/etc/sudoers
  3. Make the following configuration changes.  The first ones make sudo work with GUI apps.
    Defaults env_keep += “HOME”
    Defaults env_keep += “XAPPLRESDIR XFILESEARCHPATH XUSERFILESEARCHPATH”
    Defaults env_keep += “QTDIR KDEDIR”
    Defaults env_keep += “XDG_SESSION_COOKIE”
    root ALL=(ALL) ALL
    %wheel ALL=(ALL) ALL

Utah Open Source Conference 2010

Hey all,

The Utah Open Source Conference 2010 was pretty fun.  It was really my first open source conference.  Yes, I have been into open source for 10 years, specifically FreeBSD, but somehow I haven’t really attended the conferences.

I will probably attend conferences more often.

What was there about FreeBSD?

PC-BSD and the folks as iXSystems sent me with some swag.  Howard Logsdon helped me man the GUBUG booth.

There was a great presentation on FreebSD Jails given by Chris Edwards. (http://www.utosc.com/presentation/157/) Supposedly they are going to post a recording of the presentation. Until then, check it here: (http://wiki.zelut.org/doku.php/presentations:freebsd-jails)

Who else was there?

So Novell SUSE brought some nice laptop bags, and they were pretty good.  I have a nice Ogio laptop back pack, so I am giving this laptop bag to my wife.  It is just big enough to fit her 17″ HP laptop.

There was Fedora, Ubuntu, KDE, and GNOME.  There was a boot on XDMC and MythTV.

There was a very cool company there called Fusion-IO.  They have an awesome hard drive, though they are not cheap. 7k for the cheapest drive. But for some companies, it would be worth it.
When is the next Conference?

You can go here to see upcoming events: http://www.freebsd.org/events/events.html

There is the Meet BSD California 2010 conference November 6 and 7th.

To see when the next Utah Open Source Conference is you should go to the site and register so that when the date is announced, you will be informed.

VirtualBox: It seems ready

Ok, so because my work has given me a license to VMWare Workstation, I have never really gone to the trouble of using VirtualBox.

But I really want to move to use FreeBSD (well, PC-BSD) on my laptop but I have to have a Windows 7 box for work.

So I had Windows 7 with PC-BSD in a VMWare Virtual Machine.

However, I am switching that as we speak.

I now have PC-BSD installed as my primary operating system, and Windows 7 in a VirtualBox Virtual Machine.

There are some features we use at LANDesk a lot, such as many snapshots, and PXE booting, and more.  I will test and follow-up on whether this is a good solution for me.

Blogilo: Writing a post using Blogio, a KDE app on PC-BSD

Hey all,

I decided to try a post using Blogio. Supposedly it is a nice tool where I can write my blogs offline, save them locally, and post them when I can.

So lets see how some of the features work.

This is a heading 1

However, after creating heading 1 and then hitting enter, it did not make the next line’s type to Paragraph. I changed it to paragraph and it was still wrong. I had to click Html editor and then click back to the visual editor to make this work.

This is a heading 2

Same problem with heading 2.

Here is a quote

Ending quote was easy. Just hit the quote button again with the mouse.

  1. This is a numbered
  2. list of items
  3. And we will see if it works.

The font size works, except not for headings.

Well, I am going to be using SilverStripe in a few months. I wonder if it will integrate with that.

Update: There was an issue where when I published this, it didn’t show up right away and said it “missed schedule” whatever that means.  I updated it and now shows up.

How to log all sql statements in Postgresql running on FreeBSD?

Enabling SQL Statement Logging in Postgresql

It is often nice to see what SQL statements an application will run.  Maybe there is a gui app to add a user and you want to script adding one thousand users and you want to make sure you know how users are add.

So in Microsoft SQL Server there is a SQL Profiler tool that will show you all the SQL statements.  However, when using Postgresql on FreeBSD, there is often nothing but the command line.

You can easily have all SQL statements logged to a file in Postgresql on FreeBSD.

Note: I already have a post on Installing and Using Postgresql on FreeBSD.

Logging all SQL statements

Here is how to do it:

Step 1 – Configure the postgresql.conf

  1. Open the postgresql.conf file.
    ee /usr/local/pgsql/data/postgresql.conf
    
  2. Find the log_statement value in the log. Uncomment it and set it to all.
    log_statement = 'all'                   # none, ddl, mod, all
    
  3. Close and save the postgresql.conf file.

Step 2 – Configure the syslog.conf

  1. Open the syslog.conf file.
    ee /etc/syslog.conf
    
  2. Add the following line to the end of the log.
    local0.*                                        /var/log/pgsql.log
    
  3. Close and save the syslog.conf file.

Step 3 – Create the log file

  1. Create the log file.
    touch /var/log/pgsql.log
    
  2. Make the file a little more secure.
    chmod 600 /var/log/pgsql.log
    

Step 4 – Restart Posgresql and Syslog services

  1. Restart the postgresql service.
    /usr/local/etc/rc.d/postgresql restart
    
  2. Or in FreeBSD 8.1 and later, you can use this syntax.

    service postgresql restart
    
  3. Restart the syslogd service.
    /etc/rc.d/syslogd restart
    

    Or in FreeBSD 8.1 and later, you can use this syntax.

    service syslogd restart
    

Ok, now you should be able to capture the sql statements.  Here is a log entry from my /var/log/pgsql.log.

Sep  9 22:10:26 FBSD81 postgres[18507]: [5-1] LOG:  statement: select * from "Member";

Logging the time it takes to execute the SQL statement

Ok, this assumes you have already done the steps above.

Step 1 – Configure the postgresql.conf

  1. Open the postgresql.conf file.
    ee /usr/local/pgsql/data/postgresql.conf
    
  2. Find the log_min_duration_statement value in the log. Uncomment this line and set it to zero.
    log_min_duration_statement = 0          # -1 is disabled, 0 logs all statements
                                            # and their durations, > 0 logs only
                                            # statements running at least this number
                                            # of milliseconds
    

    NOTE: It is interesting to note that you can have the log_statement value on or off.  So technically, enabling the log_min_duration_statement will also log all SQL statements if it is set to 0.

  3. Close and save the postgresql.conf file.

Step 2 – Restart Posgresql

  1. Restart the postgresql service.
    /usr/local/etc/rc.d/postgresql restart
    
  2. Or in FreeBSD 8.1 and later, you can use this syntax.

    service postgresql restart
    

Ok, now you should be able to capture the sql statements.  Here is a log entry from my /var/log/pgsql.log.

Sep  9 22:26:06 FBSD81 postgres[18759]: [4-1] LOG:  statement: select * from "Member";
Sep  9 22:26:06 FBSD81 postgres[18759]: [5-1] LOG:  duration: 0.957 ms

Logging SQL queries that take too long to execute

If the log_statement value is on.  All SQL

Step 1 – Configure the postgresql.conf

  1. Open the postgresql.conf file.
    ee /usr/local/pgsql/data/postgresql.conf
    
  2. Find the log_min_duration_statement value in the log. Uncomment this line and set it to a value in milisecond.  For example, to log any statement that takes longer than 3 seconds, use 3000.
    log_min_duration_statement = 3000     # -1 is disabled, 0 logs all statements
                                          # and their durations, > 0 logs only
                                          # statements running at least this number
                                          # of milliseconds
    
  3. Find the log_statement value in the log. Comment out the line or set the value to none (or both).
    #log_statement = 'none'                   # none, ddl, mod, all
    
  4. Close and save the postgresql.conf file.

Step 2 – Restart Posgresql

  1. Restart the postgresql service.
    /usr/local/etc/rc.d/postgresql restart
    
  2. Or in FreeBSD 8.1 and later, you can use this syntax.

    service postgresql restart
    

Ok, I don’t really have a SQL statement that will take 3 seconds, so I configured it for 10 milliseconds and I could see that statements that took less than 10 milliseconds were not logged while those that took more were logged.

IMPORTANT! Turn logging off when you are done

Don’t forget to turn this logging off when you are finished as this is a huge performance hit.  Leaving this on is not efficient and can result in slowness.

Drupal, Joomla, WordPress, SilverStripe, or other, which Content Management System (CMS) is best for a BSD user?

Choosing a Content Management System

Ok, so as today, August 26, 2010, my blog is hosted by WordPress.com.  It will be this way for some time.

However, I am probably going to eventually have my own server hosted somewhere. Probably with my brother’s company, Fusion Networks.

So I will probable build a FreeBSD server that will host my site.  At this point, I think I will stop using WordPress and use a different Content Management System.

Content Management Systems Lists

So I went into this having done reasearch before, so I knew what I was getting into.  There are plenty of different Content Management Systems and unfortunately there is no way I could find time to test them all.

Wikipedia had a great list of Content Management Systems.
http://en.wikipedia.org/wiki/List_of_content_management_systems

Ok, now that  you have seen the very large list of Content Management Systems, you realize that I have to narrow my list down without really testing them all.

Narrowing down the list

First, let me document what I would like and see if which fit into the list.  These are not in order of priority, and some are important and some are not.

I want it to

  1. use PHP
  2. have a large community
  3. use a BSD License
  4. use Postgresql (as it is BSD licensed and MySQL is not)
  5. import my existing WordPress blog
  6. have great feature sets
  7. have common plugins
  8. support multiple Blogs with one install
  9. manages website as well as blog
  10. manages multiple sites
  11. have a descent editor
  12. be well documenated

PHP-Based

They have their lists separated  into tables by programming language.  The PHP table has the most options and since I for sure want to use PHP, it is the only table I will focus on.  These tables even lists the license.

However, I did look at the other tables, just in case one was mostly PHP-based but didn’t show up in the PHP list.  For the full PHP list, go here:
http://en.wikipedia.org/wiki/List_of_content_management_systems#PHP_2

Large community

So the big three Content Management Systems seems to be these.  I don’t have any data to back this up.  I think this is just because these three seem to be more mentioned when doing Google searches.

  • Drupal
  • Joomla
  • WordPress

BSD Licensed

However, none of those are BSD Licensed, which I prefer. I am not opposed to GPL or LGPL, but I feel more comfortable with BSD licenses software.

The Content Management Systems that are PHP-based and use the BSD License are these:

Had one of the Big 3 been BSD licensed, my decision would have probably been easy.  However, obviously I am going to have to test some of the three BSD licensed Content Management Systems.

Supports Postgresql

Of the six Content Management Systems listed above, the following support Postgresql.

  • Drupal
  • Serendipity
  • SilverStripe

Can import my WordPress blog

It appears that they all can do this.

I am worried about links, however.  My blog entries often link to each other.  I question whether they do it perfectly.  For example, a link to one of my WordPress blogs might be this:

http://rhyous.com/2010/08/25/freebsd-now-has-the-service-command/

So the link has this format:

http://homepage/YYYY/MM/DD/name-of-blog-entry/

So if I go with something other than WordPress, then after importing my blogs, are all the links going to be broken?

Making the Decision

So here is the rating, after a very small overview of the different CMS web sites, and before verifying their marketing claims.

I am giving 0 to 3 points for each feature. (This is subject to change over time, should I want to come back after the decision and report on something).

Features Worpress Drupal Joomla Serendipity SilverStripe Pimcore
1. PHP-Based 3 3 3 3 3 3
2. Large community 3 3 3 1 1 1
3.BSD License 0 0 0 3 3 3
4. Postgresql Support 0 3 0 3 3 0
5. Imports WordPress 3 1 ? 1 1 ?
6. Great Feature set 3 3 3 1 3 ?
7. Has common plugins 3 3 3 3 2 ?
8. Multiple Blogs 3 3 3 3 2 ?
9. Manages Website as well as blog 3 3 3 0 3 ?
10. Multiple Sites 2 3 ? 0 3 ?
11. Editor 3 3 ? 2 3 ?
12. Documenation 3 3 ? 1 3 ?
Score: 29 31 ? 21 30 ?

Here is what I am going to do:

I am going to build a BSD, Apache, PHP, Postgresl virtual machine and test Drupal and Serendipity to see how the import goes.

Perhaps I will have a follow-up some time because:

  1. I have to test these different CMSes
  2. I am sure there are a dozen other items that should be scored 1-3 that I haven’t thought of.

Serendipity

I started out looking at Serendipity first.

Positives

http://rhyous.wordpress.com/wp-admin/post.php?post=2212&action=edit&message=1
There was a FreeBSD port.

The install was painless.

Negatives

Their web site didn’t seem very good, which is a big turn off for a company that is a CMS.

The links to their Forum on their web site and other pages were broken.  I did find that the forum does exist, so the links are just broken.

I tried to sign up for the Forum to report the broken links.  I registered, but was supposed to be sent a confirmation email, which I never received, even after re-requesting it, so I have never reported the broken links.  They are still broken a day later. Also, there appear to only be a handful of people on their forums at any given time. Both suggest they have a small community.

I couldn’t figure out how to design my home page. It seemed the blog was my home page.  I couldn’t figure out how to move my blog entries to a different page.

Result

If you want one blog and nothing else, this would work for you.

I need more. I stopped trying and have dropped Serendipity from the list.

SilverStripe

I looked at SilverStripe second and I way more pleased with its feature set.

Positives

Though I had some install problems, I found solutions on their forums.

There are a number of theme available for download.

The default web site had some common pages premade:

  • Home
  • About Us
  • Contact Us
  • Page not found

They had both Site Management and Blog management.

There are many extensions: modules, themes, widgets.

Modules include a Blog Modules and Sub-site module, so I could manage multiple sites and multiple blogs.

It is simple to download and install modules.

The user interface is simple and easy to use.

The documentation is sufficient.

Negatives

I had install/setup problems (that were resolved) by the Forum.  Supposedly they only occur with Postgresql.

Not a lot is included in the default install.

The community is smaller than I would like.

The documentation is only sufficient.

Conclusion

I really like the SilverStripe interface.

It had almost everything I am looking for.  It is BSD Licensed.  It supports Postgresql.

It is a Content Management System first, and has modules to add to it.  There a blog module, a multi-site module, which really interested me.

However, while it has a module to import a WordPress xml, I have yet to get it to work.  That is something I can live with, but I would prefer it to work.

Drupal

Positives

It has many features, and any feature it lacks is pretty much filled by an add-on or widget.

The documentations seems thorough.

The community looks to be large.

Negatives

I had to install a different version of wordpress to support multiple blogs.

It is GPL instead of BSD Licensed.

The admin site seemed rather overwhelming. There were almost too many options.

Conclusion

If this were BSD licensed, it would be my pick.  It seems great.

WordPress

Positives

It is popular and familiar.  The most common platform of the blogging world.

It has many features, and any feature it lacks is pretty much filled by an add-on or widget.

Migrating from my existing WordPress blog is flawless.

The community is huge.

The documentation is a plenty.

Negatives

It doesn’t support Postgresql.

It is GPL instead of BSD Licensed.

Joomla

I almost feel like apologizing to Joomla.  I had two BSD servers, one with FreeBSD, Apache, PHP, MySQL where I installed WordPress a year ago for testing.  I have another brand new server with FreeBSD, Apache, PHP, and Postgresql where I tested all the postgresql capable CRMs.  However, I installed Joomla to the wordpress server and it just didn’t work.  The page was blank.  I actually think there was a php error, not a Joomla error.

Unfortunately, Joomla doesn’t support postgresql, it isn’t BSD licensed.  I did research and it appears like it would score high with WordPress, Drupal, and Silverstripe, but I can’t really see how it would be any better than Drupal, or Silverstripe so I really had to cut it loose.  Lets be honest.  As a BSD users, it was beaten out by Drupal and Silverstripe for the same reason I am looking to replace WordPress.  It doesn’t support Postgresql.

Others

There are two other Content Management Systems that I feel are worth mentioning.

Django is also a CMS that is BSD licensed and supports Postgresql. However, it runs on Python, a language which I have occasionally touched but never really developed in.  If you know Python, this might be the choice for you.

Bricolage is also a CMS that is BSD licensed and supports Postgresql. However, it runs on Perl, which I have written a few things with, but not as much as PHP.  If you know Python, this might be the choice for you.

My Decision

I know, you all want to know which I chose to use.

Drumb roll please….

I have chosen…

But don’t expect my blog to move to Silverstripe tomorrow.  It move slowly with things like this.  It could take months or get delayed for a year.

Anyone who might choose a CMS differently would be completely happy with any of the others they evaluate and feel meets their needs.  I am not saying I chose the best.  I am saying I chose the best for my needs.  Hopefully, you know your needs and this will help you choose the best Content Management System for your needs.

The Utah Open Source Conference – October 7th, 8th, and 9th

Hey all,

I am going to be attending the Utah Open Source Conference and manning the BSD table for maybe part of or the majority of the time.

Here are some details:

There will probably be some BSD swag if you attend, courtesy of iXsystems and PC-BSD.

You can schedule a BSD Certification exam if you desire.

Hope all you computer geeks in Utah can attend.

If you aren’t into Open Source, then then this conference is especially for you. If you don’t know much about Open Source, then you are missing out.

If you are into Open Source, then you probably know about this conference already.

Installing and Using Postgresql on FreeBSD

Postrgesql is an excellent alternate to MySQL.

It is BSD Licensed instead of GPL, which is especially more attractive if you need to distribute the database software.  In fact, if you are reselling a product, and paying a license fee to MySQL you probably should save your company the money and move to Postgresql.  LANDesk, the company I work for, had just such an experience with our Management Gateway device.

Setting up FreeBSD

Ok, so I already have a post on this here:

How do I install FreeBSD?

Also, make sure to download ports.

What are the first commands I run after installing FreeBSD

Installing Postgresql on FreeBSD

As always, installing software on FreeBSD is simple using the ports system.

#
#
cd /usr/ports/databases/postgresql84-server
make WITH_OPTIMIZED_CFLAGS=true BATCH=yes install clean

Post-installation Setup

There a few post-installation steps.

Initialize the database

# /usr/local/etc/rc.d/postgresql initdb

Or starting with FreeBSD 8.1, you can now run this command:

# service postgresql initdb

Make any changes to the postgresql.conf

The postgresql.conf is located in /usr/local/pgsql/data.

Open the file and read through it and make any desired changes.

Common Changes

Here are two common changes.

Enabled remote connections

If the database is to be accessed by the network, then you should at least uncomment the setting #listen_addresses = 'localhost' and change it to listen_addresses = '*'.

Changing the default TCP Port

Uncomment the setting #port = 5432 and change the port number to the desired value.

Configure password authentication

  1. Change to the /usr/local/etc/pgsql/data directory.
  2. Edit the pg_hba.conf and change the default authentication method to something more secure, such as md5.
    # TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD# &quot;local&quot; is for Unix domain socket connections only
    local   all         all                               md5
    # IPv4 local connections:
    host    all         all         127.0.0.1/32          md5
    # IPv6 local connections:
    host    all         all         ::1/128               md5
    

Configure the postgresql server service to start on reboot

Add the string postgresql_enable="YES" to /etc/rc.conf.

# echo ‘postgresql_enable=”YES”‘ >> /etc/rc.conf

Creating a Database

To create a database, su to pgsql and run createdb.

#
$
su pgsql
createdb MyDBName

Note: Similarly, use dropdb to drop a database.

Creating a User or Role

To create a user, su to pgsql and run createuser.

#
$
su pgsql
createuser -P

Enter name of role to add: MyUserOrRoleName
Enter password for new role:
Enter it again:
Shall the new role be a superuser? (y/n) y

If you are not using password authentication, then you can exclude the -P.

Using psql client

A simple way to connect to postgresql is using the shell-based client, psql.

Connecting

To connect, use the following command.

$ psql MyDBName

MyDBName-#

You are now at the psql prompt.

Connecting as a different user

To connect, use the following command.

$ psql MyDBName MyUserOrRoleName

MyDBName-#

You are now at the psql prompt.

Changing a a User or Role Password

To change a password, use the following syntax.

MyDBName-# alter role pgsql with password ‘pw’;

Show Databases

To show database, simply type \l, (which is the lowercase letter L not the number 1) which is short hand in psql for this query:
SELECT datname FROM pg_database;

MyDBName-# \l

Show Tables

To show tables in the current database, simply type \d, which is short hand in psql for this query:
SELECT table_name FROM information_schema.tables WHERE table_schema = 'public';

MyDBName-# \d

Show Tables

To show columns of a table in the current database, simply type \d table, which is short hand in psql for this query:
SELECT column_name FROM information_schema.columns WHERE table_name ='table';

MyDBName-# \d MyTableName

Creating a Table

To create a table, use the following syntax:

MyDBName-# CREATE TABLE Users (
FirstName text,
LastName text,
DateOfBirth date
);

Inserting data into a Table

To insert data into a table, use the following syntax:

MyDBName-# CREATE TABLE Users (
UserId serial,
FirstName text,
LastName text,
DateOfBirth date
);

Ok, from here you should be able to start figuring everything out on your own.

Resources:
http://www.postgresql.org/docs/8.4/interactive/index.html


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.

FreeBSD now has the service command

So I was reading the FreeBSD 8.1 release notes today and noticed that FreeBSD added the services command.

Basically there are a lot of start up scripts in /etc/rc.d that are enabled in the /etc/rc.conf.  However, if you wanted to restart them, you always had to run /etc/rc.d/someservice start.  And if you didn’t remember the exact service syntax, you had to ls the dir.

Anyway, now with the services command, you can simple type this:

service someservice start

service someservice restart

I am familiar with this already as that is how Red Hat gets things done with their services.

If it was just /etc/rc.d scripts that this worked for, then this command doesn’t really save much typing. But it also works for installed services or services from ports. The start up scripts for services for ports are in /usr/local/etc/rc.d.

So after installing something you can use the simple service command to start it, instead of typing in the longer path.

Of course, service has other features, such as listing the start up scripts in the two directories: /etc/rc.d and /usr/local/etc/rc.d

Take a second to run man service to see all its options.