Ubuntu Chronicles Feisty
From Some Wiki
Contents |
About this page
Note: some of this stuff is a bit outdated by now...
On 05/20/2007, I installed Ubuntu Feisty on my Dell Inspiron 5150 laptop. I am going to keep a log of customizations that I have made to the system and the way I set it up for my (and your) future reference. If you are curious, you can also see my first Ubuntu Chronicles page for Ubuntu Breezy and Dapper.
Basic System Setup
Unlike my previous setup with dual-boot for Ubuntu and Windows XP, I have decided to dedicate my entire drive to Ubuntu, and use Windows only through VMware virtualization. This way I don't have to keep a separate partition for Windows, nor a separate FAT32 partition for sharing data between the two. I have found that I hardly ever used the Windows part of the system, so decided it was time to just stick Windows into VMware.
I decided to have a separate partition for / and /home. This way if I find need later on, I can easily make a fresh install of Ubuntu onto the / partition, without worrying about all my data in /home. I have also decided to have a larger swap partition. On my prior setup, I went with just 500MB for the swap, which, after several weeks of uptime and playing with large datasets in R, had a tendency to run out of memory, and basically hang on me. This time, 3 GB should give quite a lot of slack space.
So, here's the basic system setup (on a total 40 GB drive, with actual usable space of 37 GB):
- /: 10 GB
- swap: 3 GB
- /home: 24 GB (the rest of the drive)
During the install, I just chose the manual partitioner, and created 3 primary partitions with these sizes, and chose ext3 partition type for / and /home.
Beryl Setup
Setting up beryl was a cinch, since it worked with the default xorg.conf using the open source 'ati' driver (the 5150 came with ATI Mobility Radeon 9000 graphics card). I followed the basic instructions from this page of the Beryl project website. Here they are in summary:
- Add this beryl repository to /etc/apt/sources.list:
deb http://ubuntu.beryl-project.org feisty main
- Add the beryl GPG signing key to apt-get, with the following command:
wget http://ubuntu.beryl-project.org/root@lupine.me.uk.gpg -O- | sudo apt-key add -
- Update repository listings and install beryl:
sudo apt-get update sudo apt-get install beryl-manager beryl-settings emerald-themes
- To start beryl, just enter this command in a terminal:
beryl-manager
Setting up a Beryl Session for GDM
- First, we create a startberyl.sh script in /usr/local/bin:
gksudo gedit /usr/local/bin/startberyl.sh
- with the following content:
#!/bin/bash beryl-manager sleep 4 exec dbus-launch --exit-with-session gnome-session
- Change permissions to executable:
sudo chmod a+x /usr/local/bin/startberyl.sh
- Create the session file
gksudo gedit /usr/share/xsessions/Beryl.desktop
- with the following content:
[Desktop Entry] Encoding=UTF-8 Name=Beryl Exec=/usr/local/bin/startberyl.sh Icon= Type=Application
- This will make the Beryl session show up in the session list on the login page in GDM. Enjoy. :)
VMware Setup
I used this tutorial: http://www.ubuntugeek.com/how-to-install-vmware-server-from-canonical-commercial-repository-in-ubuntu-feisty.html brief summary to come later.
Temperature and Fan Sensors
There is a nice gnome-panel applet called sensors-applet, that can display various hardware information in the panel, such as CPU temperature, fan speed, hard drive temperature, and just about anything else you have hardware monitors for. It can read info from multiple modules. First, we have to install the sensors-applet package (and the hddtemp package, for good measure, so we can have the HD temp in the applet, too).
I have a Dell Inspiron 5150 (as you already know if you read the intro), so for my sensors I have to install and load the i8k kernel module. (Note that the i8k module will only be useful for you if you have a Dell Laptop. If you have something else, you might want to try the lm_sensors package.)
Here's what we do:
- Install i8k, sensors-applet, hddtemp:
sudo apt-get install i8kutils sensors-applet hddtemp
- Load the i8k module:
sudo modprobe i8k
- Enable the i8k module to load on boot: edit the file /etc/modules and add one line containing
i8k
Now, you can right click on any empty spot in your gnome panel, and select Add to panel, and choose the "Hardware Sensors Monitor". That will show the applet in your panel. Right click on the applet, and select "Preferences", select the Sensors tab, and place checkmarks next to whatever sensors you want displayed. One "folder" of sensors in the list should be called "i8k". Now, you are a proud observer of CPU temperature (and other stuff), right on your panel.
Now, when you reboot, the i8k module should be loaded without you having to do anything, and your sensors-applet will continue to display your information.
Setting custom temperature thresholds for your system fans
I find that my 5150 runs rather hot (the CPU fan doesn't even kick in until the temperature is 55C). That seems a little hot to me, so I wanted to have it run cooler. Now, there is a program in the i8kutils package (which was mentioned in the previous section) called "i8kfan" that can be used to manually turn the fan on and off. But that would mean I have to do it all the time and pay attention to the temp in my sensors-applet.
Luckily, there is an even better way - the same i8kutils package has "i8kmon", which can be run as a daemon (a system service), and control the fans automatically, as per your temperature settings. To do this, we first create an i8k config file, /etc/i8kmon (of course do it with sudo, since /etc is a system directory). Here are my contents of this file:
# Run as daemon, override with --daemon option
set config(daemon) 1
# Automatic fan control, override with --auto option
set config(auto) 1
# Temperature thresholds: {fan_speeds low_ac high_ac low_batt high_batt}
# These were tested on the I8000. If you have a different Dell laptop model
# you should check the BIOS temperature monitoring and set the appropriate
# thresholds here. In doubt start with low values and gradually rise them
# until the fans are not always on when the cpu is idle.
set config(0) {{- 0} -1 40 -1 45}
set config(1) {{- 1} 38 50 40 50}
set config(2) {{- 2} 45 55 45 55}
set config(3) {{- 2} 50 128 50 128}
# end of file
The last four config lines with all the numbers set the temperature thresholds and fan speeds. Since the 5150 only has one controllable fan, and the one fan is detected as "fan2", notice the "-" for the first fan. On each line, first pair of temperatures is for when you are running on AC, and the second is when you are running on battery. For more details about the config file, see "man i8kmon".
Now, to start the daemon, just enter the command:
i8kmon
and you are good to go. Now, if you want it to be started automatically at boottime, we need to take care of another config file. First, as root, create the file /etc/init.d/i8kmon, using command
sudo nano /etc/init.d/i8kmon
and paste the following contents into it:
#!/bin/sh
#
# i8kmon initscript to control i8kmon daemon
# This file should be placed in /etc/init.d,
# and linked to /etc/rcX.d directories using command update-rc.d
#
# Author: nanotube <nanotube@users.sf.net>
#
# Version: @(#)i8kmon 1.5 31-May-2006 nanotube@users.sf.net
#
set -e
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DESC="Hardware Monitoring for Dell Inspiron daemon"
NAME=i8kmon
DAEMON=/usr/bin/$NAME
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
# Gracefully exit if the package has been removed.
test -x $DAEMON || exit 0
# Read config file if it is present.
#if [ -r /etc/default/$NAME ]
#then
# . /etc/default/$NAME
#fi
. /lib/lsb/init-functions
#
# Function that starts the daemon/service.
#
d_start() {
start-stop-daemon --start --quiet --background --make-pidfile --pidfile $PIDFILE \\
--exec $DAEMON
}
#
# Function that stops the daemon/service.
#
d_stop() {
start-stop-daemon --stop --quiet --pidfile $PIDFILE
}
case "$1" in
start)
log_begin_msg "Starting $DESC: $NAME..."
d_start
log_end_msg $?
;;
stop)
log_begin_msg "Stopping $DESC: $NAME..."
d_stop
log_end_msg $?
;;
restart|force-reload)
#
# If the "reload" option is implemented, move the "force-reload"
# option to the "reload" entry above. If not, "force-reload" is
# just the same as "restart".
#
log_begin_msg "Stopping $DESC: $NAME..."
d_stop
log_end_msg $?
sleep 1
log_begin_msg "Starting $DESC: $NAME..."
d_start
log_end_msg $?
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
exit 1
;;
esac
exit 0
Save and exit. Set the script to be executable with
sudo chmod 755 /etc/init.d/i8kmon
Finally, we need to update our startup directories with this new script. To do this, run command
sudo update-rc.d i8kmon defaults
And from now on, it should be started automatically on boot.
Firewall
By default ubuntu comes without a configured firewall. But the good news is, iptables (a firewall!) is already running by default. It is just set to allow everything to pass through. That's no good, is it now? You can search the web to find long and convoluted iptables config files. But here is one that I am using for my firewall.
#!/bin/sh # # a simple iptables ruleset # iptables="/sbin/iptables" # flush any existing chains and set default policies $iptables -F INPUT $iptables -F OUTPUT $iptables -F FORWARD # set default parameters $iptables -P INPUT DROP $iptables -P OUTPUT ACCEPT $iptables -P FORWARD DROP # this is our main rule, to allow established connections in $iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT # allow all packets on the loopback interface (so that gnome can function) $iptables -A INPUT -i lo -j ACCEPT $iptables -A OUTPUT -o lo -j ACCEPT
It allows you to make outbound connections, and accepts all already established connection packets. It also allows all communication on the loopback device. Make sure to let the loopback be - if you do not, GNOME will freeze on startup and shutdown, because some processes that GNOME runs apparently communicate via the loopback. When loopback is blocked, bam! dead GNOME.
If you want to allow subsequent connections in (for example, for bittorrent, or if you want to put up an ssh server or a web server, you would put in rules of the following type:
$iptables -A INPUT -p tcp --dport 22 -j ACCEPT
where the "-p tcp" part specifies which protocol you want to pass through (for most applications you just want TCP, although bittorrent likes both TCP and UDP), and "--dport 22" specifies which port you want to allow connections on (port 22, as shown here, is the default port for SSH server).
Now, you take your nice ruleset, and save it in a file named something like "firewall.iptables", and put it in the directory "/etc/init.d". Then, you make it executable by issuing
sudo chmod 755 /etc/init.d/firewall.iptables
and then you load it up into the firewall by executing it:
sudo /etc/init.d/firewall.iptables
To make the firewall initialize by default on startup, use the update-rc.d command to automatically create all the right startup links to your firewall script. For example, you might do:
sudo update-rc.d firewall.iptables defaults 13
This will create symlinks to your firewall script in runlevels 2-5 (the "defaults"), with priority 13.
As an alternative to all this, you could just install the package "firestarter" which will help you configure your firewall through a graphical interface. But I am a fan of the commandline.
Set up System Monitor (Conky)
There is a nifty little piece of software called conky that can display a lot of useful system info right on your desktop. It is somewhat of a pain to set up, since it can only be configured with a text configuration file, but once you have it fixed up, it's really nice. Below is my .conkyrc file. If you want to use it as base, just copy the contents and save it into a text file called ".conkyrc" in your home directory.
There is also a nice thread on the Ubuntu forums with various users' config files and screenshots that you may want to take a look at as examples.
# UBUNTU-CONKY
# A comprehensive conky script, configured for use on
# Ubuntu / Debian Gnome, without the need for any external scripts.
#
# Based on conky-jc and the default .conkyrc.
# INCLUDES:
# - tail of /var/log/messages
# - netstat connections to your computer
#
# -- Pengo (conky@pengo.us)
#
# Create own window instead of using desktop (required in nautilus)
own_window yes
own_window_type override
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes
# fiddle with window
use_spacer yes
use_xft no
#use_xft yes
#xftfont HandelGotD:size=9
#xftfont Courier:size=9
#xftalpha 0.5
# Update interval in seconds
update_interval 3.0
# Minimum size of text area
# minimum_size 250 5
# Draw shades?
draw_shades no
# Text stuff
draw_outline no # amplifies text if yes
draw_borders no
font arial
uppercase no # set to yes if you want all text to be in uppercase
# Stippled borders?
stippled_borders 8
# border margins
border_margin 9
# border width
border_width 1
# Default colors and also border colors, grey90 == #e5e5e5
default_color white
own_window_colour brown
own_window_transparent yes
# Text alignment, other possible values are commented
#alignment top_left
alignment top_right
#alignment bottom_left
#alignment bottom_right
# Gap between borders of screen and text
gap_x 10
gap_y 25
# hdb3: ${fs_free_perc /media/hdb3}% ${fs_bar 6 /media/hdb3}
# ${time %a,}${time %e %B %G} ${color #00ff00}${time %H:%M:%S}
# stuff after 'TEXT' will be formatted on screen
TEXT
${color blue}SYSTEM ${hr 2}$color
$sysname $kernel ${alignr}Uptime: ${uptime}
AC Adapter: ${acpiacadapter} ${alignr}Battery: $battery
${color blue}CPU ${hr 2}$color
${color #00ff00}Temp: ${i8k_cpu_temp} ${alignr}Fan: ${i8k_right_fan_rpm} ${i8k_right_fan_status}${color}
${freq}MHz Avg Load: ${loadavg}
Load: ${cpu}% $cpubar
${color}${cpugraph 000000 ffffff}
NAME ${alignr}PID CPU% MEM%
${color #92ff9a} By CPU Usage
${color}${top name 1} ${alignr}${top pid 1} ${top cpu 1} ${top mem 1}
${color}${top name 2} ${alignr}${top pid 2} ${top cpu 2} ${top mem 2}
${color}${top name 3} ${alignr}${top pid 3} ${top cpu 3} ${top mem 3}
${color #92ff9a} By Mem Usage
${color}${top_mem name 1} ${alignr}${top_mem pid 1} ${top_mem cpu 1} ${top_mem mem 1}
${color}${top_mem name 2} ${alignr}${top_mem pid 2} ${top_mem cpu 2} ${top_mem mem 2}
${color}${top_mem name 3} ${alignr}${top_mem pid 3} ${top_mem cpu 3} ${top_mem mem 3}
Processes: $processes ${alignr}Running: $running_processes
${color blue}MEMORY / DISK ${hr 2}$color
RAM: $mem/$memmax ${alignr 80}- ${memperc}% ${membar 6}$color
Swap: $swap/$swapmax ${alignr 80}- $swapperc% ${swapbar 6}$color
/: ${fs_used /}/${fs_size /} ${alignr 80}- ${fs_used_perc /} % ${fs_bar 6 /}$color
/home: ${fs_used /home}/${fs_size /home} ${alignr 80}- ${fs_used_perc /home} % ${fs_bar 6 /home}$color
HDD I/O: $diskio
${diskiograph 000000 ffffff}
${color blue}NETWORK (External IP: ${execi 600 wget -q -O - 'http://www.whatismyip.org'})${hr 2}$color
${color #000000}eth0 (${addr eth0})
${color}Down: $color${downspeed eth0} k/s ${alignr}Up: ${upspeed eth0} k/s
${downspeedgraph eth0 25,140 000000 ff0000} ${alignr}${upspeedgraph eth0
25,140 000000 00ff00}$color
Total: ${totaldown eth0} ${alignr}Total: ${totalup eth0}
${color #000000}eth1 (${addr eth1}) ${alignr}Signal: ${linkstatus eth1}%
${color}Down: $color${downspeed eth1} k/s ${alignr}Up: ${upspeed eth1} k/s
${downspeedgraph eth1 25,140 000000 ff0000} ${alignr}${upspeedgraph eth1
25,140 000000 00ff00}$color
Total: ${totaldown eth1} ${alignr}Total: ${totalup eth1}
Inbound: ${tcp_portmon 1 32767 count} Outbound: ${tcp_portmon 32768
61000 count}${alignr}Total: ${tcp_portmon 1 65535 count}
$stippled_hr
${color blue}Inbound Connection ${alignr} Local Service/Port$color
${tcp_portmon 1 32767 rhost 0} ${alignr} ${tcp_portmon 1 32767 lservice 0}
${tcp_portmon 1 32767 rhost 1} ${alignr} ${tcp_portmon 1 32767 lservice 1}
${tcp_portmon 1 32767 rhost 2} ${alignr} ${tcp_portmon 1 32767 lservice 2}
${color blue}Outbound Connection ${alignr} Remote Service/Port$color
${tcp_portmon 32768 61000 rhost 0} ${alignr} ${tcp_portmon 32768 61000 rservice 0}
${tcp_portmon 32768 61000 rhost 1} ${alignr} ${tcp_portmon 32768 61000 rservice 1}
${tcp_portmon 32768 61000 rhost 2} ${alignr} ${tcp_portmon 32768 61000 rservice 2}
${tcp_portmon 32768 61000 rhost 3} ${alignr} ${tcp_portmon 32768 61000 rservice 3}
${tcp_portmon 32768 61000 rhost 4} ${alignr} ${tcp_portmon 32768 61000 rservice 4}
${tcp_portmon 32768 61000 rhost 5} ${alignr} ${tcp_portmon 32768 61000 rservice 5}
$stippled_hr
${color blue}LOGGING ${hr 2}$color
${color black}Messages:
$color${execi 30 tail -n 3 /var/log/messages | fold -w50}
${color black}Security:
$color${execi 30 tail -n 2 /var/log/auth.log | fold -w50}
${color blue}FORTUNE ${hr 2}$color
${execi 120 fortune -as | fold -w50}
Fix Right Alt Key
If you notice that your right Alt key does not work, try the following:
System -> Preferences -> Keyboard -> Layout Options -> Alt/Win key behavior -> Alt and Meta are on the Alt keys (default)
