FreeBSD for a Linux Geek

I’ve been using Linux on a daily basis for about twenty years and have gotten to know its ins and outs fairly well. In the last couple of years I’ve had a FreeNAS server, which is built on FreeBSD, so I’ve had to learn a bit about that operating system.

On more than one occasion I’ve found myself unable to find things, or remember the name of the FreeBSD command I’ve needed. I often try the Linux equivalent and find it doesn’t work, or worse, it does something different on FreeBSD than on Linux.

This page holds notes of things I’ve learned to help me remember them the next time they come up.

Services

  • Services in FreeBSD are started and stopped by script files, analogous to those used in SysVinit distributions of Linux. The scripts are located in /etc/rc.d and /usr/local/etc/rc.d.
  • The scripts are controlled by the service command. For example:
    • service django stop
    • service django restart
  • Service configuration is in the file /etc/rc.conf. For example, to configure the ntpd service to automatically start on boot, put ntpd_enable=”YES” into that file.

System Info

  • Memory usage: vmstat fre (Linux equivalent: free -h)
  • Modules loaded: kldstat (Linux equivalent: lsmod)
  • To cause modules to be loaded on boot, add <module_name>_load=”YES” to /boot/loader.conf.

Speeding up Android Emulator

This is a reminder of the steps required to use kvm/hardware acceleration in the Android Emulator, in case I need to re-do them.

They’re taken from here: https://software.intel.com/en-us/android/articles/speeding-up-the-android-emulator-on-intel-architecture#_Toc358213272

(The link also has instructions for Windows and Mac, in case any of you haven’t switched to Linux yet.)

In brief, the steps are:

  1. Verify hardware support by typing
    egrep –c ‘(vmx|svm)’ /proc/cpuinfo

    (result should not be 0).
  2. Install required packages:
    sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils
  3. Add yourself to the kvm and libvirtd groups; log out and log in again.
  4. Install “Intel x86 Atom System Image” in Android SDK Manager
  5. (If using Eclipse, shut it down and restart it.)
  6. Create a new device in the Android Virtual Device Manager, selecting the new system image for the “CPU/ABI” option.