This post is part of the series FreeBSD on my laptop
I have a HP LaserJet 1020 which is shared from my linux workstation (CUPS). To use the printer from my FreeBSD laptop I have to add the driver, which is found in print/foo2zjs. CUPS has to be enabled in /etc/rc.conf with the line
cupsd_enable="YES"
After a reboot (or just a start of CUPS) the printer can be configured using the cups web interface at localhost:631
I have not tried this yet but by following the pkg-message you can supposedly set up the printer directly on the FreeBSD machine by downloading the firmware with the ‘getweb’ utility.
I also have a HP PSC 1300 printer/scanner. One should be able to install this using the guide in [1]
Resources:
[1] HP Linux Imaging & Printing on FreeBSD HowTo
[2] CUPS (freebsdwiki)
This post is part of the series FreeBSD on my laptop
The disk encruption chapter in the handbook [1] is not fully applicable as it only talks about encrypting real partitions. However a file can be attached as a device using mdconfig(8).
First a file of a proper size has to be made. Here the file is 1024 MB. dd(1) is used for the job:
dd if=/dev/zero of=/path/to/safe.img bs=1m count=1024
where /path/to/safe.img is the full path to the encrypted container.
Now the file is attached as a memory device using mdconfig:
mdconfig -f /path/to/safe.img
mdconfig will then output the devicename e.g. “md0″.
From here on the instructions in [1] can be followed with /dev/md0 as the device. (In the following the geli method is used)
Initialize the encryption
geli init /dev/md0
Attach it and create a filesystem and detach again
geli attach /dev/md0
newfs /dev/md0.eli
geli detach /dev/md0
Note that the decrypted device is at /dev/md0.eli!
Now the encrypted container is created.
When needing it mount it with:
mdconfig -f /path/to/file
geli attach /dev/md0
mount /dev/md0.eli /mnt/safe
Unmount it after use with
umount /mnt/safe
geli detach /dev/md0
mdconfig -d -u 0
Note that you are not necessarily given the device md0 but the first free one. Please take that into consideration.
Resources:
[1] Encrypting Disk Partitions
This post is part of the series “FreeBSD on my laptop”
LAN pretty much just works. In rc.conf I have the lines:
hostname="fynkyhostnamegoeshere.domainname"
ifconfig_bge0="DHCP NOAUTO"
ifconfig_wpi0="WPA DHCP NOAUTO"
The first one just sets my hostname (obviously).
The second says that my ethernet connection should use DHCP and not connect automatically. This is done because otherwise it tries to connect at boot until timeout — adding 30 s to boot when no cable is plugged. (In 8.0 NOAUTO is deprecated, maybe a better solution is found. Maybe startup in background)
The last line is for wireless. Same story with DHCP NOAUTO. WPA tells it to use WPA, or actually just wpa-supplicant… This is configured in /etc/wpa_supplicant.conf as follows:
network={
ssid="MyEssid"
psk="LongPasswordGoesHere"
priority=1000
}
This is for my home network using wpa with a pre shared key (psk). The priority is set to 1000 as my home network has the highest priority. (all other networks are added with priority < 1000).
For the wireless to work, I also had to load the wpi driver in /etc/loader.conf, as well as accept the licence:
if_wpi_load="YES"
wpifw_load="YES"
legal.intel_wpi.license_ack=1
An interface (wpi0 in the example) is brought up with the command
/etc/rc.d/netif start wpi0
(as root)
I have also configured a pptp vpn to my work. A description of this can be found here.
I need to connect to work using pptp vpn from my FreeBSD laptop. This can be done using mpd (version 5, in net/mpd5). I just created the sections startup: and default: and copied pptp_client from /usr/local/etc/mpd5/mpd.conf, all into /usr/local/etc/mpd5/mpd.conf. As the server at work is MS i also merged the MPPE lines from pptp_vpn. The final result is the following:
startup:
default:
load pptp_client
pptp_client:
#
# PPTP client: only outgoing calls, auto reconnect,
# ipcp-negotiated address, one-sided authentication,
# default route points on ISP's end
#
create bundle static B1
set iface route 1.2.3.146/28
set ipcp ranges 0.0.0.0/0 0.0.0.0/0
set bundle enable compression
set ccp yes mppc
set mppc yes e40
set mppc yes e128
set bundle enable crypt-reqd
set mppc yes stateless
create link static L1 pptp
set link action bundle B1
set auth authname ********
set auth password *****'**
set link max-redial 0
set link mtu 1460
set link keep-alive 20 75
set pptp peer 1.2.3.4
set pptp disable windowing
open
One thing to note is that I do not use “set iface route default” as in the sample conf file. This is because the work lan and wan has the same ip-range even tough some addresses are only on the lan and others are only on the internet. If the lan part of the network had a more traditional layout (as 192.168.1.*) the default should work…
This post is part of the series: FreeBSD on my laptop
This on is pretty easy. Basically I just had to load the driver. This is done permanently by adding:
snd_hda_load="YES"
to /boot/loader.conf.
In kde the phonon framework locks the sound channel. Thus I enable 4 channels in total, so I can also get sound from non-kde apps like firefox/flash and virtualbox. This is done with the following lines in /etc/sysctl.conf
dev.pcm.0.play.vchans=4
dev.pcm.0.rec.vchans=4
To enable the multimedia keys (mute, volume up, volume down) I had to define the correct mapping for X. This is done with the following commands:
xmodmap -e 'keycode 140 = XF86AudioMute'
xmodmap -e 'keycode 176 = XF86AudioRaiseVolume'
xmodmap -e 'keycode 174 = XF86AudioLowerVolume'
I added this to a (executable) script in ~/.kde4/Autostart. Another possiblity is to add it to .xprofile or something. The actual keycodes have been found using xev: just open it in a terminal and start pressing keys. It will then tell you the keycodes.
Resources:
The FreeBSD Handbook, 7.2 Setting Up the Sound Card
This post is part of the series: FreeBSD on my laptop
In this post I will try to document how I set up tcsh to my liking by modifieng .tcshrc. I have left out a lot of stuff, like how I have set my EDITOR variable and stuff, but you can find the .tcshrc file attached (not possible to attach text files)
First I alias grep and ls, to get some nice colors:
alias grep grep --color=auto
alias ls ls-F
Now comes the setup of the shell itself.
set addsuffix
set autolist
set cdpath = $HOME
set color
set nobeep
set rmstar
set history = 250
set histfile = "$HOME/.history"
set savehist = ( 125 merge )
set prompt = '%{33[1;33m%}[%T]%{33[0m%} %{33[32m%}%n%{33[0m%}@%{33[31m%}%m%{33[0m%} %{33[36m%}%c%{33[0m%} %# '
source /usr/share/examples/tcsh/complete.tcsh
bindkey "^[[3~" delete-char
bindkey -k up history-search-backward
bindkey -k down history-search-forward
addsuffix adds a ‘/’ when autocompleting directory names and autolist prints out all possibilities when there is more than one available.
cdpath allows one to type e.g. ‘cd Desktop’ from everywhere! You don’t have to be in $HOME/.
color adds color support to ls using the alias above.
nobeep disables the annoying beeping sound when doing something that would do that.
rmstar guards against ‘rm *’ and will prompt the user for confirmation.
the hist lines is just for saving the history
prompt gives a nice colour prompt showing a timestamp, username and hostname.
source ../complete.tcsh enables autocompletion of a lot of nice stuff.
the bindkeys just modifies some keybindings. The up and down keys now searches through the history so if you press e.g. scp it scroll back your last commands starting with scp!! really nice (just like in Matlab).
This is it for now, maybe more will be added.
Note that since my terminal emulator, konsole, cannot find the program names under FreeBSD with tchs (haven’t investigated further) I had to make make it set the tab title form the “Window title set by Shell”.
I am currently trying to get FreeBSD up and running on my HP nc4400 laptop. Up until now it’s going pretty well, but there is lots of small tips and tricks to remember. Therefore I’m writing a series of posts do document the steps I’ve taken. This is as much for my self to remember as it is for everyone to use.
Here’s a preliminary list of things to take care of:
- Usable tcsh
- Networking. LAN and Wireless.
- Power saving
- Touchpad (synaptics)
- Sound and multimedia keys
- Encrypted container in mountable file
- Printer / scanner
Note that there is no bullet point for Xorg. This is because the newest Xorg configures itself with no xorg.conf. Only settings for e.g. the touch pad should be done manually.
Remember that FreeBSD is wonderfully documented in the handbook and in the man pages. Most of the information for these posts I got from these.
Other useful resources: