bookmark_borderSo Long CrunchBang, And Thanks For All The Fish

They say nothing lasts forever, and sadly that statement seems to have been proven true again. Yesterday, Philip Newborough (aka corenominal) announced that he would no longer be developing CrunchBang Linux.

In his post, Philip stated that he felt that it “…no longer holds any value…,” and that “… it would be in the best interest of its users, who would benefit from using vanilla Debian.” I couldn’t disagree more Philip. For those of us who were trying to escape the trappings of increasingly bloated distributions like Ubuntu, Fedora, Mint, and their ilk, CrunchBang, with its light-weight Openbox window manager, was an asylum. A minimalist distribution; designed to be efficient and customizable, CrunchBang struck the right balance between speed and functionality. I still think there is a demand for such a distribution.

I can’t tell you how profoundly sad I am about this news. I of course wish Philip the very best in whatever the future may bring. He should be very proud of his creation, and he should know that CrunchBang Linux will always hold a special place in my heart.

bookmark_borderInstall and Configure CrunchBang Linux on the Lenovo T410 Laptop

(20120629- This post has been amended to address changes in current versions of CrunchBang and GParted — iceflatline)

This post will describe how I installed and configured CrunchBang Linux for use on a Lenovo ThinkPad T410, the challenges that I encountered, and how those challenges were overcome.

CrunchBang is a Debian-based distribution featuring the light-weight Openbox window manager. The distribution is essentially a minimalistic Debian system customized to offer a good balance between speed and functionality. The Lenovo ThinkPad T410 that I purchased has the following specifications:

  • Windows 7 Professional (x64)
  • Intel Core i7-620M processor (2.66 GHz)
  • Elpida RAM 4MB (1066 MHz)
  • Seagate 300GB HDD (7200 RPM)
  • Intel 82577LM Gigabit Ethernet adapter
  • 11b/g/n wireless LAN Mini-PCI Express Adapter II
  • NVIDIA NVS 3100m Graphics Adapter

For those of you who may still be contemplating your purchase of this laptop, you may want to consider carefully the wireless adapter choices offered by Lenovo. The Lenovo 11b/g/n wireless adapter (Realtek is the OEM) is not natively supported in CrunchBang at the current time, which required me to compile and install an appropriate driver from Realtek. This was not difficult as you’ll see in the steps below, however you may wish to consider purchasing the machine with the Intel Centrino-based adapter option instead. To the best of my knowledge, this adapter is natively supported in CrunchBang, as well as many other Linux distributions, including Ubuntu.

In addition, if you choose to purchase the laptop with the Nvidia graphics option, be aware that CrunchBang utilizes the in-kernel graphics driver Nouveau. This driver generally works well, however its performance in 3D-based games or desktop effects that require hardware graphics acceleration is limited. Nvidia makes available its proprietary driver, however the installation and configuration of this driver are beyond the scope of this post.

Installation

Among my goals when purchasing the T410 was to be able to dual-boot between Windows 7 and various Linux distributions and/or *BSD. The following steps describe how I reduced the size of the existing Windows 7 partition and re-partition the remaining unallocated disk space in order to install CrunchBang. The Window 7 Boot Configuration Data Editor (BCDEdit) was used to configure the Windows 7 bootloader to display a menu at boot time that allowed me to choose between Windows 7 and CrunchBang. If you’re not interested in preserving your existing Windows 7 install, or plan to install CrunchBang on a virtual machine using an application such as QEMU or VirtualBox then simply skip these steps and proceed with installing CrunchBang directly to the physical or virtual disk.

While I’ve never encountered a situation where the following steps destroyed existing disk data, you should make sure you backup any files you feel are critical before proceeding.

    Reducing the Windows 7 Partition

The first thing that I needed to do was reduce the size of the existing Windows 7 partition. I found Windows 7’s own Disk Management tool to be the most efficient method for accomplishing this task. The Disk Management tool can be accessed by using Win+r and entering diskmgmt.msc. I right-clicked on the Windows 7 partition (C:) and selected “Shrink Volume.” Then I entered the amount of space (in Megabytes) that the partition should shrink (which in turn becomes the amount of space available to install CrunchBang), then selected “Shrink” (See Figure 1). CrunchBang needs a minimum of approximately 5 Gigabytes (GB) of free disk space. I chose 80 GB (80000 MB), within which I will create a ~31 GB partition for CrunchBang, a ~1 GB partition for Linux swap, and a ~16 GB NTFS partition that I will use to share files between CrunchBang and Windows 7. The remaining space I will hold in reserve for additional logical partitions. I then exited out of the Disk Management tool and rebooted the system, eventually arriving at the Windows 7 logon screen. Along the way I saw Windows perform a disk check – that’s normal, and only occurred once as a result of this procedure.

Screenshot showing the Windows partition reduced using the Windows Disk Management tool

Figure 1
    Partitioning for CrunchBang

To partition the newly created free disk space, I booted the system from a USB-based flash memory drive containing a stable release of GParted Live. After accepting the default settings for keymap, language, and X-window configuration, I arrived at the GParted desktop (See Figure 2).

Screenshot of the GParted desktop

Figure 2

I could see the ~80 GB of free disk space that I created currently labeled as unallocated. The hard drive is limited to four primary partitions, so in this unallocated space I created a new extended partition by left-clicking on this space to highlight it, then selecting “New” to create a new partition. I made this partition an Extended Partition, then selected “Add” (See Figure 3).

Screenshot showing the creation of a new Extended Partition in GParted

Figure 3

Once the new extended partition was created, I left-clicked on its unallocated space to highlight it and then selected “New” to create a new partition. I made this partition a Logical Partition and the file system ext4. I reduced the size of this partition to ~31 GB by moving the slider to the left until I reached the desired size (alternatively you can do this by typing in the value in the New Size field) then selected “Add” (See Figure 4).

Screenshot showing the creation of a new Logical Partition in GParted

Figure 4

In the remaining unallocated space, I created two additional logical partitions following the steps above. One was a linux-swap file system and sized to ~1 GB, the second was a NTFS file system consuming ~16GB. I reserved the remaining space unallocated for future use. When completed, I had a partition layout that resembled Figure 5.

Screenshot of the new partition layout created for CrunchBang using GParted

Figure 5

After review the newly created partition layout, I selected “Apply All Operations” and GParted proceeded with writing the changes to the disk. After a few minutes I could see the re-partitioned drive (See Figure 6).

Screenshot of the new CrunchBang partitions with device names assigned by GParted

Figure 6

GParted retained the device designations /dev/sda1, /dev/sda2, and /dev/sda4 for Windows 7 but had now also assigned the appropriate device designations to my newly minted extended and logical partitions:

/dev/sda3 – (Extended partition)
/dev/sda5 – ext4 (Logical partition)
/dev/sda6 – Linux-Swap (Logical partition)
/dev/sda7 – NTFS (Logical partition)

I exited out of GParted and reboot the system, confirming that I could see the 16 GB NTFS partition that I had created (designated as drive letter E) in Windows 7.

    Installing CrunchBang

I downloaded the 64-bit BPO version of CrunchBang and burned it to a CD, then booted the system using this disk. I chose the “Graphical Install” option and continued through the installation process until I arrived at “Partition disks” where I selected “Manual” to advance to an overview of my existing partitions and mount points (See Figure 7). This is where I instructed CrunchBang which mount points and file systems to use on the partitions I had created.

Screenshot of the CrunchBang partition preparation screen

Figure 7

I selected partition #5 and “Use as:” in the subsequent screen, where I was presented with several file system options. I selected the “Ext4 journaling file system” and chose to format the partition. Then I set its mount point to / since partition #5 will serve as the root partition for CrunchBang. When completed, I selected “Done setting up the partition,” which returned me to screen showing an overview of my partitions and mount points (See Figure 8).

Screenshot of the CrunchBang prepare partition screen

Figure 8

Following similar steps, I selected partition #6 and under “Use as:” selected “Swap area.” The mount was then automatically set and there was no need (or option) to format this partition. Partition #7, the NTFS partition, was left alone for the moment. I will add this partition to /etc/fstab in a later step so that CrunchBang will automatically mount it at boot time. After doing a final review, I selected “Finish partitioning and write changes to disk,” then confirmed my choices by selecting “Yes” in the subsequent screen prompting the installer to write the changes to the partitions (See Figure 9).

Screenshot of the CrunchBang confirm partitions screen

Figure 9

CrunchBang needs to be told where to install its bootloader GRUB. Because I will be using the Windows boot loader to boot both operating systems, I elected not to write over it by installing GRUB on the hard drive’s Master Boot Record. Instead, I chose to install GRUB on the partition that will contain the CrunchBang operating system – in my case partition #5 (/dev/sda5) (See Figure 10).

Screenshot of the CrunchBang bootloader install screen

Figure 10

When the installation completed I was asked to reboot the system where I once again arrived at the Windows 7 logon screen.

    Configuring for Dual Boot

With the partitions created and CrunchBang installed, it was time to set up the system so that it could boot to Windows 7 or CrunchBang. This involves creating a .bin file containing the boot record of the CrunchBang partition, then copying that file to Windows 7. Window 7’s BCDEdit utility is then used to create a new entry in its BCD store that will point to this file. Windows 7 will then display a menu at boot time that will provides a choice between Windows 7 and CrunchBang.

I once again booted the system using the GParted disk, then opened a terminal and created a temporary mount point:

Then mounted the device representing the 16GB NTFS partition to this mount point:

Using the venerable dd command, I wrote the first 512 bytes of the CrunchBang partition to a .bin file and copied that file to the NTFS partition:

I exited GParted and reboot to Windows 7. I navigated to the NTFS partition (E:) where I found the crunch.bin file, and moved that file to the root of the my Windows 7 partition (C:). Next I used BCDEdit to add an entry to Windows 7’s BCD store. Administrative privileges are required to use BCDEdit, so I navigated to Start->All Programs->Accessories, right-clicked on Command Prompt and selected “Run as administrator.” Alternatively you can open the run box using Win+r, enter cmd and then use Ctrl+Shift+Enter. First, I created an menu entry for CrunchBang:

BCDEdit will return an alphanumeric identifier for this entry that I will refer to as {ID} in the remaining steps. You’ll need to replace {ID} by the actual returned identifier. An example of {ID} is {d7294d4e-9837-11de-99ac-f3f3a79e3e93}. Next I specified which windows partition hosts a copy of the crunch.bin file:

The path to the crunch.bin file:

An entry to the displayed menu at boot time:

How long Windows 7 should display the menu:

That’s it. I rebooted and was presented with a menu where I could choose to boot to Windows 7 or CrunchBang. When I choose CrunchBang, I’m taken to the GRUB menu where I can continue booting to CrunchBang.

By the way, if at any time you want to eliminate the CrunchBang menu option, simply delete the BCD store entry you created using the following command:

Configuration

    Internet Connection

After booting to CrunchBang for the first time it was time to establish an Internet connection. Using the T410’s Ethernet port presented no problems, however its 11b/g/n wireless adapter, based on the Realtek 8192SE chipset, is not currently supported by CrunchBang. So, before I could establish a wireless connection, I needed to download and install the appropriate Linux header files, then download, compile and install the Realtek 8192SE Linux wireless driver:

I navigated to the directory where I had downloaded and extracted the Realtek driver file, then changed into the resulting directory to compile and install it:

After the Realtek driver was installed I reboot the system. To establish a wireless connection, I simply left-clicked on the Network Manager applet icon and selecting my access point. I entered my “WPA and WPA2 Personal” passphrase and was connected to the Internet within a few seconds (See Figure 11).

Screenshot showing a wireless connection established using the Network Manager in CrunchBang

Figure 11
    Run the Post-install Script

With an Internet connection established, I decided to run CrunchBang’s optional post-installation script cb-welcome, designed to help with the initial configuration of a new CrunchBang installation. The script presented me with a series of options that allowed me to update the system’s software package repositories and installed packages, add printer and Java support, and install LibreOffice.

    Install and Configure the Pantech UML290 Modem

I own a Pantech UML290, Verizon’s 4G LTE USB Modem. To configure it to work under CrunchBang, I plugged the device in to a USB port, waited for a few moments until the device’s LED began flashing blue, indicating it had found the Verizon network, then left-clicked on the Network Manager applet icon on the bottom desktop panel and selected “New Mobile Broadband (GSM) connection.” I proceeded through the connection wizard until I arrived the “Choose your Provider” screen. Since Verizon was not among the choices on the list, I selected “I can’t find my provider and wish to enter it manually” where I entered the term Verizon in the “provider” field. In the subsequent “Choose your billing plan” screen, I entered the term vzwinternet in the “Selected plan APN (Access Point Name)” field. I then proceeded to the connection wizard’s remaining screen and selected “apply.” I removed the Pantech UML290, rebooted the laptop, plugged it back in and waited for LED to flash blue. Then I left-clicked on the Network Manager applet icon and selected “Verizon connection”, and after a few moments was connected to Verizon’s 4G LTE network.

    Configure the Bash Shell

I spend a lot of time at the terminal when using Linux so I configured BASH (“Bourne Again Shell”), CrunchBang’s default shell, so that it contained my favorite aliases and other tweaks. When you start a terminal session in CrunchBang, Bash will read commands from ~/.bashrc. You can add your own command aliases and other changes directly to ~/.bashrc, or simply uncomment and modify some or all of the ones that are provided as examples in that file if desired. The approach that I prefer, however, is to create a separate file containing these modifications, then simply point to that file from within ~/.bashrc. This approach allows me to easily port these changes from one system to another:

Then I added my aliases and other tweaks to this file. Here’s an example of my ~/.bash_aliases file:

Next, I opened ~/.bashrc and uncommented the following lines:

Then I restarted Bash in order for these changes to take effect:

    Configure Terminator

The default terminal emulator in CrunchBang is Terminator, one of my favorites, second only perhaps to Terminal, Xubuntu’s default lightweight terminal emulator.

What Terminator displays in its titlebar is dependent on the environment variable PROMPT_COMMAND. If this variable is not set, the titlebar will display “None” on it’s titlebar. To configure this so it displays the user name and the current directory, I added the following lines to my ~/.bash_aliases file:

To enable window transparency in Terminator I made the cairo composite manager run full time by uncommenting the line (sleep 10s && cb-compmgr –cairo-compmgr) & in ~/.config/openbox/autostart.sh. A fixed transparency setting can be set by right-clicking in the Terminator window and selecting Preferences->Profiles->Background and selecting “Transparent background,” then adjusting the slider to the desired transparency. However I wanted the ability to adjust the level of window transparency using a mouse scroll wheel. To enable this capability I opened ~/.config/openbox/rc.xml and added the following lines in the context name=”Titlebar” area under the mouse section:

Then I restarted Openbox in order for these changes to take effect:

Now I can place the mouse pointer on the Terminator titlebar and adjust the window transparency using CTRL + mousewheel. Note that now if you select “Transparent backgound” under Preferences->Profiles->Background, the slider bar determines the minimum transparency achieved using the mouse scroll wheel.

    Partition Mounting and Permissions

To ensure that CrunchBang mounts my Windows 7 and NTFS partition at boot time with the correct directory and file permissions, I created two mount points in /media:

Then added the following lines to /etc/fstab:

    Access Windows Shares

Unfortunately, CrunchBang’s Thunar file manager is unable to discover Windows hosts on a network and then automatically mount/unmount their shared folders. Consequently, in order to access a shared folder, one can either use Gigolo, a small utility included with CrunchBang that acts as a frontend to manage connections to local and remote filesystems using GIO/GVfs, or manually mount the remote shares yourself. I chose the latter. First I installed smbfs, a CIFS compatibility package that adds support for the old SMB/CIFS filesystem types smbmount, smbumount, and mount.smbfs:

Created a mount point in /media:

Then mounted the Windows share on this mount point with the correct directory and file permissions using the IP address of the Windows host, the name of the shared folder, and Windows user name:

To cut down on the amount of typing required each time I needed to mount this share, I added the following command alias in my ~/.bash_aliases file:

Note: A similar mount command can be added to /etc/fstab if there is a desire to have the shared folder mounted automatically when CrunchBang starts.

    Enable the Volume, Mute and Microphone Controls

Unfortunately, the audio volume, audio mute, and microphone mute buttons on the T410’s keyboard were not recognized by CrunchBang. To fix that I opened ~/.config/openbox/rc.xml and added the following lines in the keyboard section:

Getting the microphone mute button to function properly required a small work-around because, unlike the audio mute control (XF86AudioMute), the system does not support the toggle behavior for this key – in other words, the ability to push the button once to mute the microphone, then once again to unmute it. The work-around was to introduce a second key to the setup so that I could mute the microphone using the microphone mute button, then unmute it and set the microphone level to 80% by holding CTRL key and pushing the microphone mute button. Ugly I know, but it works.

    Increase The Maximum Audio level

After setting up the volume controls, I noticed that the maximum audio loudness level in CrunchBang was substantially lower when compared to Windows 7. To correct this problem I right-clicked the volume icon in the panel/taskbar, selected “Preferences” and changed value of “Volume adjustment” to 100. Then I opened the file /etc/modprobe.d/alsa-base.conf and added the following line at the end of the file, then rebooted the system:

    Install and Configure Iceweasel

Iceweasel is the default web browser in CrunchBang. Iceweasel is a fork from Firefox with the following purpose: backporting of security fixes to declared Debian stable version; no inclusion of trademarked Mozilla artwork. Beyond that it is functionally the same as Firefox, and as such, can be configured in the same way.

      Make the backspace key work

Oddly, the backspace key in Iceweasel does not cause the browser to go back to the previous page as it does in under Windows. To fix that I entered about:config in the address bar, entered browser.backspace_action in the Filter field, double-clicked on its value and changed it from 2 to 0, then restarted Iceweasel.

      Force last tab to close

The default behavior in Iceweasel prevents the user from closing the last open tab without also closing the browser. To enable the ability to close the last tab but not the entire browser, I opened about:config, entered browser.tabs.closeWindowWithLastTab in the Filter field, double-clicked on its value and changed it from “true” to “false,” then restarted Iceweasel.

      Avoid the Favicons

Favicons are those small icons made available by web sites that are displayed in front of their respective bookmark and tab in Iceweasel. To save on some disk space and speed up browsing, I prevented Iceweasel from loading these icons. To do this I opened about:config and modified the following parameters:

browser.chrome.favicons set to “false”
browser.chrome.image_icons.max_size set to 0
browser.chrome.site_icon set to “false”

      Eliminate the new tab button

Iceweasel features a small green “+” symbol adjacent to the tab(s) that provides the user with the ability to open a new tab by clicking on it. This is a feature I don’t use, preferring instead to open new tabs using Ctrl+t. To eliminate this feature, as well as some others I don’t use, I created the file ~/.mozilla/firefox/1jp2ynoh.default/chrome/userChrome.css. Note: your default firefox profile directory will be different than the 1jp2ynoh.default directory shown in following example:

Then opened this file and added the following lines:

Then I restarted Iceweasel in order for these changes to take affect.

Look and Feel

    Modify the GRUB Bootloader Menu

By default, the GRUB menu displays at a resolution of 640*480. Hoping to improve on that I installed and ran hwinfo, a tool to help determine which resolutions the T410’s Nvidia GPU could support:

The following sample output from the preceding command suggested a number of resolutions that could be supported. Through some trial and error, I settled on 1024*768:

I opened /etc/default/grub and uncommented and modified the following line:

While I had this file opened, I also changed the value of GRUB_TIMEOUT to 180 so that the GRUB menu would stay onscreen for 3 minutes rather than the default 5 seconds.

In addition to the issue of resolution and menu duration, the GRUB bootloader menu contained the entry “Windows Recovery Environment,” an entry that I considered superfluous. To eliminate it, I opened /etc/grub.d/30_os-prober and added the following highlighted lines after the section of code that starts around line 92:

[text firstline=”92″ highlight=”102,103,104,105,106,107″][/text]
for OS in ${OSPROBED} ; do
DEVICE=”echo ${OS} | cut -d ':' -f 1
LONGNAME=”echo ${OS} | cut -d ':' -f 2 | tr '^' ' '
LABEL=”echo ${OS} | cut -d ':' -f 3 | tr '^' ' '
BOOT=”echo ${OS} | cut -d ':' -f 4

if [ -z “${LONGNAME}” ] ; then
LONGNAME=”${LABEL}”
fi

# Added to remove the Windows Recovery entry
if [ “$LONGNAME” = “Windows Recovery Environment (loader)” ] && [ “${DEVICE}” = “/dev/sda1” ] ; then
continue
fi

Then I updated GRUB in order for these changes to take effect:

    Stop the Clipboard Manager from Launching

I don’t use the Clipboard Manager so there was no need for this to launch at system boot. To stop it I opened ~./config/openbox/autostart.sh and commented out the following line:

    Move the Panel/Taskbar

By default CrunchBang places its panel/taskbar at the top of the screen. Relocating it to the bottom of the screen was accomplished by opening the file ~/.config/tint2/tint2rc and changing the line Top center horizontal to Bottom center horizontal in the #panel section, then restarting Tint2:

    Configure Conky

One of my favorite things about using CrunchBang is its inclusion of Conky, a light-weight free and open source system monitor that can display nearly any information about my system. Using sets of variables in Conky’s configuration file I can define what Conky should monitor and where those monitored parameters are displayed on the desktop. The look and feel of how this information is displayed is also highly customizable.

Conky’s default configuration file ~/.conkyrc can be used as a starting point. When configuring Conky for my system I decided to dispense with fancy network graphs and other eye candy and go with a more minimalistic approach instead. I settled on four areas for Conky to monitor, which provide just the information I need while not burdening system resources.

System – Basic system information showing kernel version, uptime, total RAM and Swap usage, etc.

Processor – Shows the top five applications or processes based on CPU usage.

Memory – Shows the top five applications or process based on system RAM usage.

Network – Shows basic information regarding wired and wireless connections, including IP address, inbound and outbound speed, connection quality, etc.

Conky includes support for the use of conditional statements within its configuration file. The ${if_up} variable, for example, checks for the existence of an interface passed to it as an argument. If that interface exists and is up, Conky will display everything between ${if_up} and the matching ${endif}. I used this particular variable to my advantage when configuring the network monitoring section. Instead of displaying information about all my wired and wireless interfaces, even when they were not active, I chose instead to have Conky display information about them only if they were being used. Here’s the configuration file I’m currently using. Feel free use it as is or change it to fit your needs.

In order for Conky to recognize any changes you’ve made you’ll need to reboot the system or use the following command:

Here’s what this Conky configuration looks like running on my CrunchBang desktop:

Screenshot of Conky running on my CrunchBang desktop

Figure 12

Screenshot of Conky's output

Figure 13

Finishing Steps

At this point the installation and basic configuration of CrunchBang on my Lenovo T410 was complete. All that was left for me to do was to download and install/uninstall some applications, stop a few applications and processes from starting automatically, and organize the Openbox menu.

CrunchBang includes a nice set of default applications, however, there were a few not included that I could not do without, including:

ethtool – A utility for controlling network drivers and hardware
Filezilla – An FTP client.
Geeqie – A graphics file browser.
Hamachi – A hosted VPN service now known as “LogMeIn.”
htop – An interactive process viewer for Linux.
locate – A utility that scans one or more databases of filenames and displays any matches.
ntpdate – A client for setting system time from NTP servers.
Notepad++ – A text editor (run under wine).
OpenVPN – A VPN software and server application.
Pidgin – An instant messenger client
sysv-rc-conf – A utility to examine run-level services.
Truecrypt – Disk encryption software
tsclient – A program for remotely accessing and viewing Windows desktops.
Wine – Windows emulator.

All of these were applications were available through the package manager. I also took the opportunity to uninstall some of the default applications that I knew I wouldn’t use. Abiword, Catfish, GIMP, gFTP, Gnumeric, and Viewnior fell into this category.

After installing/uninstalling applications, I fired up sysv-rc-conf to examine run-level services:

The default layout displays a grid of all services that have symlinks in /etc/init.d/ and which run-levels they are activated in (See Figure 14). For example, where the cups row and column 2 intersect, if there is an “X” there that means the service will be turned on when entering run-level 2 (run-level 2 through 5 are full multi-user modes and are equivalent in CrunchBang). If there is no X it can mean that either there are no links to the service in that specific run-level, or that the service is turned off when entering that run-level. If more configuration detail is needed, sysv-rc-conf can be started using the priority option.

The priority layout also uses a grid, but instead of X’s there are text boxes that can have different values. If the text box starts with the letter S the service will be started when entering that runlevel. The two digits following is the order in which the services are started. If the text box starts with the letter K the service will be stopped when entering that runlevel. If the text box is blank that means there isn’t a symlink in that run-level for that service and it will not be started or stopped.

Using the sysv-rc-conf default layout I toggled the bluetooth, hddtemp, openvpn, rc.local, rsync, and ntp services off.

Screenshot of sysv-rc-conf running

Figure 14

With those tasks out of the way it was time to clean up and organize the Openbox menu. The Openbox menu is very flexible, displaying virtually anything, but it does have the downside of not automatically updating to show newly installed applications, these need to be added manually.

There are two ways of editing the Openbox menu, a GUI tool called obmenu, or editing the menu file directly. obmenu can be accessed by right-clicking anywhere on the desktop (alternatively you can use Win+Spacebar) and selecting Settings–>Openbox Config–>GUI Menu Editor. Using obmenu is pretty self explanatory, to edit an entry select it and edit the various fields at the bottom, or to add an entry select “New menu” or “New item” from the top. You can also move an entry to another location by selecting “Edit” and either “Move up” or “Move down.” To edit the menu file directly open ~/.config/openbox/menu.xml. The menu.xml file can also be accessed from the Openbox menu by selecting Settings–>Openbox Config–>Edit menu.xml. I setup my Openbox menu so that I had quick access to Terminator, Firefox, Thunar, Gedit, and VLC via the menu labels Terminal, Web Browser, File Manager, Text Editor, and Media Player respectively, and access to all other applications through six top-level menu categories: Communications, Graphics, Multimedia, Office, and Utilities (see Figure 15). I retained CrunchBang’s default settings for everything else in the Openbox menu.

Screenshot of my Openbox menu in CrunchBang

Figure 15

Once my changes were complete I restarted Openbox so that they would take effect:

Conclusion

This concludes the post on how I installed and configured CrunchBang Linux 10 “Statler” R20111125 on my Lenovo T410 laptop. Many of the choices made throughout the installation and configuration steps that I’ve described were of course based on my personal preference. You are encouraged to make your own choices. I suspect that any challenges you encounter along the way can easily be overcome. In short, CrunchBang works well on this laptop.

References

https://iceflatline.com2009/09/how-to-dual-boot-windows-7-and-linux-using-bcdedit/
http://technet.microsoft.com/en-us/library/cc709667%28WS.10%29.aspx
Newham, C., and Bill Rosenblatt. Learning the bash Shell. 2nd ed. Sebastopol, CA, USA: O’Reilly, 1998. Print.
https://iceflatline.com2009/10/configure-command-line-aliases-in-bash
https://answers.launchpad.net/terminator/+faqs
http://linux.die.net/man/8/mount.cifs
http://openbox.org/wiki/Help:Bindings
http://techpatterns.com/forums/about1435.html
http://ubuntuforums.org/showthread.php?t=1287602
https://iceflatline.com2009/12/my-conky-configuration/

bookmark_borderMy Conky Configuration

One of my favorite things about using Linux and BSD is Conky. Conky is a free, light-weight system monitor that can display nearly any information about your system directly on your desktop. Originally a fork of Torsmo, Conky’s torsmo-based code is BSD licensed. New code in Conky has been licensed under the GPL 3.0.

Installation is easy. On a Debian-based distribution like Ubuntu:

On Fedora-based distributions:

And on BSD, if you’ve installed the Ports collection:

Or if you would prefer to add the package:

Conky is very simple to configure. Using a pre-defined set of variables in a configuration file you define what Conky should monitor and where those monitored parameters are displayed on your desktop. The look and feel of what’s displayed is highly customizable.

On most systems the default configuration file location is /etc/conky/. There you will find the sample configuration file conky.conf. You’ll want to copy it to ~/.conkyrc and then start modifying it.

When setting up my Conky configuration, I decided to dispense with the fancy network graphs and other eye candy that I’ve seen in so many others use and go with a more utilitarian approach. I settled on four areas for Conky to monitor:

  • System – basic system information showing kernel version, uptime, total RAM and Swap usage, etc.
  • Processor – shows the top five applications or processes based on CPU usage
  • Memory – shows the top five applications or process based on system RAM usage
  • Network – shows basic information regarding wired and wireless connections, including IP address, inbound and outbound speed, connection quality, etc.

This minimalistic approach looks good (less “cluttered”) in my humble opinion, and provides just the information I need while not straining system resources.

One of the many cool things about Conky is its support for the use of conditional statements within its configuration file. The ${if_existing} variable, as an example, checks for the existence of a file passed to it as an argument and will display everything between ${if_existing} and the matching ${endif}. I used this particular variable to my advantage when configuring the network monitoring section. Instead of displaying information about each wired and wireless interface, even when they weren’t up, I chose instead to display information about them only if they were up by using the existence of a particular interface (e.g., eth0) in /proc/net/route.

Anyhoo, here’s the configuration file I’m currently using. Feel free use it as is or change it to fit your needs and taste. Post your Conky configuration in the comment section.

And here are some screenshots:

 Screenshot of Conky running on my Crunchbang linux desktop

Figure 1

 Screenshot of Conky running on my Crunchbang linux desktop

Figure 2

bookmark_borderHow to Install Apache, MySQL and PHP on CrunchBox Linux

So, you’re a CrunchBang Linux user but you want to get a little web development work done? This post will describe how to install and configure Apache, MySQL, and PHP on your box. Once set up, you’ll be able to use your LAMP server to do basic web development and code testing, maintain local copies of your web sites, etc.

The software discussed in this post are free and open source. Apache is licensed under the terms of the Apache License, a free-software license authored by the Apache Software Foundation. MySQL is available under the terms of the GNU GPL. PHP is distributed under the PHP license v3.01, an open source, BSD-style license certified by the Open Source Initiative. The remaining software, phpMyAdmin and WordPress, are not required, however, they are available under the terms of the GNU GPL. The versions for the software discussed in this post are as follows:

  • Apache v2.2.11-2ubuntu2
  • MySQL v5.1.30really5.0.75-0ubuntu10
  • PHP v5.2.6.dfsg.1-3ubuntu4
  • phpMyAdmin v4:3.1.2-1
  • WordPress v2.8.5

Let’s get started.

Install Apache

Let’s grab the latest version of the Apache HTTP server:

Once successfully installed, the Apache server will start automatically. You may notice Apache complaining with “Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName.” No worries, it simply means that Apache could not find a qualified domain name like foo.com in its configuration file. Let’s prevent this message from popping up though by binding the server name to the localhost IP address. Open /etc/apache2/apache2.conf as root and append the following line to the end of the file:

Now restart the Apache server with the following command:

Let’s also make sure now that the server is working. Open a web browser and enter http://localhost. You should see Apache’s time tested “It Works!” message.

Install MySQL.

Now that the Apache HTTP server is up and running, let’s download and install the MySQL server:

During the installation you’ll be asked several times to enter a password. You can leave it blank, but for obvious security reasons and to avoid configuration problems later, I would strongly suggest entering a password. Like Apache, once the MySQL server is installed, it will will start automatically. Now, let’s make sure the server is bound to the local host IP address like we did with Apache. Open /etc/mysql/my.cnf as root and make sure the following line exists. If not, simply append it to the end of the file:

Now restart the MySQL server with the following command:

Install PHP

Almost there. Let’s download and install PHP:

Brilliant. Now let’s test to make sure PHP was installed correctly. Navigate to /var/www/ (Apache’s web root folder) and create the following file:

Open that file as root and enter the following PHP function:

[php light=”true”]

[/php]

Open your web browser and enter http://localhost/phpinfo.php. You should see a page providing some information regarding your PHP installation (See Figure 1).

Screenshot of the of the phpinfo function output

Figure 1

A completely optional but handy package to have for administering your MySQL server is phpMyAdmin. This package gives you the ability to create, copy, rename, alter and drop databases and tables using a web interface instead of the terminal. To install phpMyAdmin:

During the installation you’ll be asked to chose the web server that should be automatically configured to run phpMyAdmin. You’ll want to chose Apache2. PhpMyAdmin will also indicate that it needs to have a database installed and configured before it can be used, and offer to set up a temporary configuration for you using db-config. Since we already have our MySQL server up and running we should choose No here. Once the install finishes, open your web browser and enter http://localhost/phpmyadmin. You should see the logon page for phpMyAdmin (See Figure 2).

Screenshot of the phpMyAdmin logon page

Figure 2

That’s it for the installation. Now let’s move on make sure everything works together.

Testing our LAMP installation using WordPress

WordPress is a full-featured blogging tool (This web site was built using WordPress. The author is not full-featured) that makes heavy use of Apache, MySQL and PHP. We’ll install it on our LAMP server to ensure we have these packages installed correctly. Let’s start by downloading WordPress directly from the developers site. You can also download and install using Aptitude but I don’t recommend it as the repository’s release is a version or two behind the most current release. Navigate to your home directory (or wherever you’d prefer to download the package to) and download and untar the package:

Let’s move the extracted wordpress/ directory to Apache’s web root folder:

Now let’s create an MySQL database for our WordPress installation. Open phpMyAdmin in your browser. Enter root for the Username and the password you set during the MySQL installation (or simply leave this field blank if you skipped entering a password). To create a database, enter a name for it in the Create a new database field. For purposes of our example, let’s use wordpress as the name. Now select Create (See Figure 3).

Screenshot of a database being created through phpMyAdmin

Figure 3

Now we need to do a little pre-configuration on one of the wordpress files in preparation for installation. First, navigate to /var/www/wordpress/. As root, copy the file wp-config-sample.php to wp-config.php. Open the latter file and enter the database name as well as your MySQL login and password. If you chose not to create a password when you installed the MySQL server, make sure to leave two single quotes with nothing in between in DB_PASSWORD. When complete, it should look like the following:

Now let’s install WordPress. Open your web browser and navigate to http://localhost/wordpress/wp-config.php. If everything is configured as it should be you will be greeted with WordPress’s installation wizard (See Figure 4).

Screenshot of the wordpress install wizard

Figure 4

Final thoughts

One issue you may encounter is phpMyAdmin complaining that it can’t load the MySQL extension. More than likely the problem in this case is that phpMyAdmin wants the MySQL PHP module loaded automatically when Apache starts (it isn’t by default). To fix this, open /etc/php5/apache2/php.ini and uncomment following line extension=mysl.so. Save the file and restart Apache.

Finally, you may not want your LAMP server running continuously but rather only when needed. There’s a couple of ways to keep Apache and MySQL from running at boot time. First, you could simply remove their corresponding entries from /etc/rc2.d. A more elegant way to manage these daemons, however, is to download and install sysv-rc-conf.

sysv-rc-conf provides an easy to use interface for managing rc.d symlinks. The interface comes in two different flavors, one that simply allows turning services on or off and another that allows for more fine tuned management of the symlinks. To use it just enter sysv-rc-conf on a command line as root.

When you want to use your LAMP server again you’ll need to start Apache and MySQL from the command line:

Well, that’s it. With a couple of open source packages and a few minutes of your time you can a get a fully configured web server up and running on your CrunchBang Linux box.

References

http://httpd.apache.org/
http://dev.mysql.com/doc/refman/5.1/en/
http://php.net/index.php
http://www.phpmyadmin.net/home_page/index.php
http://wordpress.org/

bookmark_borderHow to Install VirtualBox Linux Guest Additions

(20140911 — The steps in this post were amended to address changes in recent versions of software. Minor editorial corrections were also made — iceflatline)

This post will describe how to install VirtualBox Guest Additions on your Linux guest operating system.

Oracle’s VirtualBox is a general-purpose x86 machine virtualizer that runs on Windows, Linux/Unix, and OpenSolaris hosts. It supports a large number of guest operating systems, including Linux (kernel versions 2.4 and 2.6) and the usual Windows flavors. Guest Additions consist of drivers and kernel modules that improve the usability and performance of the guest operating system, including the ability to share the mouse pointer seamlessly between the guest and host systems without the need to free the pointer from the guest OS first; the ability to share the clipboard between the guest and host OS; and, better video support through the use of guest drivers for the X Window system that provide higher (and non-standard) video modes as well as accelerated video. VirtualBox and its Guest Additions addon are free software licensed under the GNU GPL.

The versions for the software discussed in this post were as follows:

  • CrunchBang Linux v11
  • VirtualBox v4.3.14
  • Windows 7 Pro

So, let’s get started.

Download and Mount

VirtualBox Guest Additions are designed to be installed to the guest OS after it has been installed. So, if you haven’t already installed your Linux guest OS make sure you do that first.

VirtualBox Guest Additions is provided as a single image. To install, you mount this image as your guest OS’s virtual CD/DVD-ROM drive and install it directly from the drive from within the guest OS. Start your guest OS and release your mouse pointer. Navigate up to the top of the window and select Devices->Install Guest Additions CD Image. The image should automatically mount as your guest OS’s virtual CD/DVD-ROM drive. (you may see a disk icon of some sort on your guest OS desktop). Now, let’s install the Guest Additions. Open up a terminal and navigate to the directory where your virtual CD/DVD-ROM is mounted (e.g.,/media/cdrom0). List the contents of the directory and you’ll notice several scripts. You’ll want to run the Linux script from this directory with the following command:

The script will do a self-check to verify the integrity of the image, then it will proceed with uncompressing files, building new kernel modules, and installing drivers. After the script finishes, you should reboot your guest OS to ensure that Guest Additions is actually used.

Troubleshooting

One problem I’ve encountered is that the installation will fail, complaining that headers for the current kernel were not found. To fix this problem make sure to first update your packages, then install the necessary kernel headers. For example, in CrunchBang, Ubuntu, and other Debian-based distributions, run the following commands:

Conclusion

I’m starting to use VirtualBox a lot now to help test and evaluate various BSD and Linux distributions in a more flexible way. Guest Additions is easy to set up and makes working in your guest OS a much better experience.

iceflatline