Skip to content

Home

Installing add-ons globally on Firefox

Most often when creating different profiles in Firefox, you use them for various things. One profile might have all the web-developer tools and add-ons you need in order to be your geeky self, while profile number two has your gamer-add-ons, which you don’t want to mix. But what if you want certain add-ons to be global? So when you do create a second profile, you won’t have to reinstall the same add-on twice, or more. The answer? Installing things through the command line.

For instance, let’s take the add-on AdBlock Plus. Great add-on. I for one want it on every Profile. So instead of doing it through the browser-interface, installing it once for every profile, do it through the command line, globally.

Become root and grab the add-on:

And then install it globally:
firefox -install-global-extension /root/adblock_plus-1.0.2.xpi

And presto, the addon should now be located in /usr/lib/firefox/extensions, available for all profiles.
Nifty huh?

Fedora 11 on the Acer Aspire One

So here we are again! Fedora 11 is finally out, with the new XFCE 4.6 and a lot of other goodies. I recently removed Fedora 10 from my Acer Aspire One, and installed Fedora 11. And let me tell you, it’s -awesome-. Goes a lot faster than Fedora 10, and pretty much everything works out of the box! Even the camera! Just a few minor tweaks, and pretty much everything is up and running. You can read more about what is new with Fedora 11 at .

Now, a lot of what you read here will pretty much be the same as what I wrote on the Fedora 10-article. The steps are similar, but some things need changing. So instead of having you guys jump back and forth between two posts, I’ll do it this way. Ready? Here we go.

Preparing your USB-pen

Here we are again, preparing our USB-pen for Fedora 11. Unfortunately, the only way you can get hold of the ISO is by downloading it with a torrent, so it might take a while if you don’t have the right ports opened!

What we need to do is to install the Live CD to a USB-pen/drive. To do that download the torrent from here. With me having a stationary machine using Fedora 10, I’ll assume that you do as well. :D su to root and install the package livecd-tools:

# yum install livecd-tools

Once the package is installed, and the iso has been downloaded, plug in your USB-pen/drive. I will also assume that your USB-pen/drive has been given the name sdb1. You can check it with the command dmesg, just look at the bottom of output if it has detected it. It should look something like this:

sd 10:0:0:0: [sdb] Write Protect is off
sd 10:0:0:0: [sdb] Mode Sense: 00 00 00 00
sd 10:0:0:0: [sdb] Assuming drive cache: write through
sd 10:0:0:0: [sdb] Write Protect is off
sd 10:0:0:0: [sdb] Mode Sense: 00 00 00 00
sd 10:0:0:0: [sdb] Assuming drive cache: write through
sdb: sdb1
sd 10:0:0:0: [sdb] Attached SCSI disk

Now, with the USB-thingie plugged in, and your iso downloaded, execute the following command:

# livecd-iso-to-disk /home/jorge/downloads/Fedora-11-i686-Live-XFCE/Fedora-11-i686-Live-XFCE.iso /dev/sdb1

Fedora-11-i686-Live-XFCE.iso being the Live CD iso we just downloaded. This command will copy the Live CD iso to your USB-pen, making that your bootable device.

Installing Fedora 11

Now that the USB-pen is ready to go, reboot your Acer Aspire One, and at boot press F12 to be able to select what boot device to boot from. Your device should pop up in that list. Log in as usual, and double-click the icon that says Install to Hard Drive. Follow the process as normal, however, when it gets time to partition the disk, we’ll do this a little differently. :)

In my former howto we had to manually change from ext3 to ext2, because of the journaling, and how it made the system even slower. Well let me tell you folks, ext4 is working wonders. It’s going a lot quicker than everything did on the Fedora 10 system, you’ll see. :)

Anyway, enough rant from me, let’s continue.

We should be at the partitioning-screen now. Select Use Entire Drive (if you want to remove everything that is on the machine from before), and click the box that says Review and modify partitioning layout. When done, click Next.

Now we should be in a new screen. We’ll be modifying things a bit here. Thing is, I don’t want to use LVM, so I’m going with that. If you want to use LVM though, try checking out what I wrote on the Fedora 10-article.

Click on the line that says VolGroup and click Delete. Press Delete again to confirm it.

Now click on the line that says /dev/sda2 and click Edit. Change the Mount Point to /, File System Type to ext4, and make sure that you have selected Fill to maximum allowable size. When done, press OK, and then click Next. A question will pop up, telling you that you haven’t selected a swap partition, and if you still want to continue with this partitioning scheme. Select Yes, and then select Write changes to disk. Now go read a book, watch some TV, or have a cup of joe. When the formatting and installation is done, you can reboot your Acer, answer a few questions, and your system should be up and going.

Disabling SELinux

SELinux hasn’t changed much with Fedora 11. Still the ol’ pain in the butt. So we remove it like we did last time.

Once you’re in the system, press Alt-F2, type terminal, su to root, and edit the file /etc/selinux/config and set the variable SELINUX to disabled. Save and close the file.

Last time we had a whole section about how we converted from an ext3 system to ext2. Don’t need to this time, wohoo!

Optimizing Fedora 11

I assume that by now you are actually using the Fedora 11 installation. Here’s how to improve the system performance a bit.

Optimizing your disk

Quoting the Ubuntu wikipages:

Frequent writes to the SSD will cause failure eventually. We can reduce the number of writes to the SSD by moving our logs to a temporary filesystem in RAM that gets destroyed at ever reboot. Now this means your logs will not be persistent across reboots making debugging difficult in some cases. This step is optional of course, so if you need the logs for an extended period of time do not follow these steps.

Let’s assume that you want to do this. su to root, and open up the file /etc/fstab, and place these following lines there:

tmpfs      /var/log        tmpfs        defaults           0    0
tmpfs      /tmp            tmpfs        defaults           0    0
tmpfs      /var/tmp        tmpfs        defaults           0    0

Also, modify the first line in /etc/fstab to include the options noatime and nodiratime. When done, your /etc/fstab should look something like this:

UUID=6f651dc4-3d50-4a28-b3d0-fc91b41f737c /boot                   ext3    defaults,noatime,nodiratime        1 2
UUID=0dbcdea1-3f91-477a-b730-ea6033c45b5c /                       ext4    defaults,noatime,nodiratime        1 1
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  defaults        0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
tmpfs      /var/log        tmpfs        defaults           0    0
tmpfs      /tmp            tmpfs        defaults           0    0
tmpfs      /var/tmp        tmpfs        defaults           0    0

Save the file, and close it. The next thing we can do is to place the following into your /etc/rc.d/rc.local-file:

# Economize the SSD
sysctl -w vm.swappiness=1               # Strongly discourage swapping
sysctl -w vm.vfs_cache_pressure=50      # Don't shrink the inode cache aggressively

# As in the rc.last.ctrl of Linpus
echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo ondemand > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
cat /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate_max > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate

echo 1500 > /proc/sys/vm/dirty_writeback_centisecs
echo 20 > /proc/sys/vm/dirty_ratio
echo 10 > /proc/sys/vm/dirty_background_ratio

echo 1 > /sys/devices/system/cpu/sched_smt_power_savings
echo 10 > /sys/module/snd_hda_intel/parameters/power_save
echo 5 > /proc/sys/vm/laptop_mode

#Decrease power usage of USB while idle
[ -w /sys/bus/usb/devices/1-5/power/level ] && echo auto > /sys/bus/usb/devices/1-5/power/level
[ -w /sys/bus/usb/devices/5-5/power/level ] && echo auto > /sys/bus/usb/devices/5-5/power/level

/sbin/modprobe sdhci

Create a file named blacklist_msreader.conf in /etc/modprobe.d, with the following in it:

blacklist jmb38x_ms

Open up the file /boot/grub/grub.conf and add elevator=noop to the kernel-line, making this:

kernel /vmlinuz-2.6.29.4-167.fc11.i586 ro root=UUID=0dbcdea1-3f91-477a-b730-ea6033c45b5c rhgb quiet

Look like this:

kernel /vmlinuz-2.6.29.4-167.fc11.i586 ro root=UUID=0dbcdea1-3f91-477a-b730-ea6033c45b5c rhgb quiet elevator=noop

Proceed with rebooting your machine, and everything should be working fine. :)

Removing journaling

Another thing you can do to increase the speed of your disk is disabling journaling of the ext4 filesystem. I sure hope you have your USB-pen/drive in hand, because we’re going to need it. Reboot your machine, with your USB-thingie plugged in, and again press F12 at boot, selecting your USB-device as the boot device. When done booting to the Live CD, press Alt-F2 and type terminal, and su to root. Find out what the partition with Linux is named. If you’ve partitioned things according to this guide, it should be /dev/sdb2. It’s basically the partition that holds the root of your Linux.

What we first need to do is to edit the file /etc/fstab on your disk. Why? Some tools have yet to catch up. In particular, the version of e2fsprogs currently in Fedora 11 won’t read the UUIDs from such filesystems. And because the Fedora installer generates an /etc/fstab which identifies filesystems by UUID, if you just run the tune2fs-command we’ll be using, the system can’t find its root filesystem and so doesn’t get very far through the boot process.

So, in order to edit the /etc/fstab-file, we first mount up the partition /dev/sda2. So remember, Fedora 11 is now installed, but you boot on the LiveCD/LiveUSB, and have a terminal up and going. As root, execute the following commands:

# mkdir /mnt/disk
# mount /dev/sda2 /mnt/disk
# mount /dev/sda1 /mnt/disk/boot
# cd /mnt/disk/etc

Now open up the file named fstab. The two lines that currently look like this:

UUID=6f651dc4-3d50-4a28-b3d0-fc91b41f737c /boot                   ext3    defaults,noatime,nodiratime        1 2
UUID=0dbcdea1-3f91-477a-b730-ea6033c45b5c /                       ext4    defaults,noatime,nodiratime        1 1

Should look like this:

/dev/sda1 /boot                   ext3    defaults,noatime,nodiratime        1 2
/dev/sda2 /                       ext4    defaults,noatime,nodiratime        1 1

We simply replaced the UUID-strings with the partitions /dev/sda2 and /dev/sda1. Once you’ve edited the file, save it, and close it.

Now we need to update /boot/grub/grub.conf.

Execute this command:

# cd /mnt/disk/boot/grub/

And open up the file grub.conf. What used to look like this:

kernel /vmlinuz-2.6.29.4-167.fc11.i586 ro root=UUID=0dbcdea1-3f91-477a-b730-ea6033c45b5c rhgb quiet elevator=noop

Should now look like this:

kernel /vmlinuz-2.6.29.4-167.fc11.i586 ro root=/dev/sda2 rhgb quiet elevator=noop

Save the file, close it, and unmount the partitions like this:

# cd ~/
# umount /mnt/disk/boot/
# umount /mnt/disk/

Now that they both are unmounted, all we have to do is run the tune2fs-command to disable journaling from the ext4-partition:

# tune2fs -O ^has_journal /dev/sda2

Reboot your machine, and you should now have an ext4 filesystem with journaling disabled.

Optimizing Firefox

There are quite a few ways to make your Firefox go faster, one of them being to disable caching completely. Try these out, and let me know how they work. In your Firefox, type about:config as your URL, and press enter. Search for these values, and change them to what I’ve written up here:

Select all text when click on the URL bar

In Windows and Mac, Firefox highlights all text when you click on the URL bar. In Linux, it does not select all the text. Instead, it places the cursor at the insertion point. Regardless which platform you are using, you can now tweak it to either select all or place cursor at insertion point.

  • browser.urlbar.clickSelectsAll: true
Caching

When a page is loaded, Firefox will cache it into the hard disk so that it doesn’t need to be download again for redisplaying. The bigger the storage size you cater for Firefox, the more pages it can cache.

  • browser.cache.disk.enable: false

false disabled caching completely, true enables it. If you want to modify the amount of cache used though, have a look at browser.cache.disk.capacity.

Network

Config name: network.http.pipelining Default: False Modified value: True

Config name: network.http.proxy.pipelining Default: False Modified value: True

Config name: network.http.pipelining.maxrequests Default: 4 Modified value: any value higher than 4, but not more than 8

Config name: network.http.max-connections Default: 30 Modified value: 96

Config name: network.http.max-connections-per-server Default: 15 Modified value: 32

Enabling autologin

Enabling autologin isn’t too difficult, but it can be a bit tricky if you don’t know your way around. Word of warning though. There are a lot of things in the background that will break (like the permission to be able to suspend your machine) upon doing this. Haven’t investigated enough to give the proper permissions yet, but they will come with time.

If you’re still up for doing this, let’s execute these following commands. Remember that username is the user you want to automatically log in as:

$ su -
# cp /home/username/.bash_profile ~/username-bash_profile
# cp /etc/inittab ~/inittab.bak
# exit

At this point you should be logged in as the user you want to automatically log in as. Add the following lines to the file /home/username/.bash_profile:

if [ -z "$DISPLAY" ] && [ $(tty) == /dev/tty1 ]; then
startxfce4
fi

Save and close the file.

Now that we’ve backed up things, and made that change, become root again, open up /etc/inittab with your favorite editor, and comment out the following line like so:


Save and close the file. Then proceed to opening up /etc/event.d/tty1, and comment out this line like so:

#exec /sbin/mingetty tty1

and adding the following below:

exec /sbin/mingetty --autologin username tty1

Remember to replace username with the user you want to login automatically as. Now that we’re done with that part, open up /etc/sysconfig/desktop and comment out the line there like so:

#PREFERRED=startxfce4

Adding the following just below it:

DISPLAYMANAGER="console"

Upon a reboot now you should be automatically logged in as the user you specified! A shutdown/reboot by pressing the Logout button though isn’t working at the moment, but do the following to get it working. Become root and open up the file /etc/PolicyKit/PolicyKit.conf and add make the whole file look like this:


That should make a shutdown and reboot work properly through the Logoff button. You will also notice now though that the sound isn’t working (permission-issues again). The fix to this is by adding the user to the groups audio and video. Open up /etc/group and make the lines with those groups look like so:

audio:x:63:username
video:x:39:username

Sound should now hopefully be working.

Ways to extend your battery life

There are several things you can do to extend the battery life on your Acer Aspire One.

  • Turn the screen brightness down – your screen is the most power-intensive component in your laptop, and why turn the brightness all the way up if you already can see well enough?
  • When not in use, turn of the wireless and bluetooth functions.
  • If you have enough memory on your laptop, disable swapping (we’ve done it in this case). I would suggest putting in more memory, as swapping writes to virtual memory.
  • Journaling-filesystem on a SSD-disk = baaad. More writing to disk means more power used. Switch to ext2 instead.
  • Disable all services that just aren’t used. A lot of distributions come with say httpd enabled at start up. If you don’t need it, get rid of it.
  • When you’re in no need of sound – mute it!

Jason Farrel has these following tips to apply as well:

  • Use powertop to eliminate more power hogs.
  • If using mplayer to play video, and you see nasty horizontal tearing, it’s because the fast overlay isn’t being used by default. Edit ~/.mplayer/config and gui.conf to use vo=xv:port=XX where XX is the port returned from the xvinfo util for the overlay adaptor – this should be 79.
  • To cut the bootup time almost in half (down to 25 seconds here), disable uneeded services. Here’s a one-liner to disable them (run it as root): for s in atd auditd avahi-daemon bluetooth cups gpm ip6tables kerneloops mdmonitor nfslock portreserve rpcbind rpcgssd rpcidmapd sendmail setroubleshoot livesys livesys-late microcode_ctl; do echo “chkconfig $s off”; chkconfig $s off; done
  • This one makes a big difference: don’t forget to disable firefox’s disk cache or you’ll grind to death.

Thanks for the tips Jason (from the Fedora 10 post). :)

Now this next bit is VERY important, if you want your AAO to perform as best as it can. Keep in mind that this applied to Fedora 10, and applies to Fedora 11 as well:

I installed FC10 like you described. It works fine. I was a bit surprised the AAO appeared rather slow compared to my EEE 1000H. So I ran cat /proc/cpuinfo. It appeared the CPU ran at 800 Mhz. I first looked at the BIOS, but the CPU ran at 1600 Mhz over there. Then I looked at services and found cpuspeed running. This is for scaling the CPU speed. After disabling this service the cat /proc/cpuinfo reported 1600 Mhz CPU speed and the system runs much smoother (and most probably consumes more power!).

And he is completely right. Jaap (from the Fedora 10 post), thanks a million!

Minor troubleshooting
My Fn-Left/Right not only reduces/increases the brightness, but sends the machine into Suspend-mode. Why?

First off, a big thank you to Lesley Mitchell for having informed me of this issue. Quoting Lesley:

_The brightness/suspend thing is a bug in xfce4-powermanager 0.8beta.

There’s a link to the release 0.8.0 version that fixes it here: https://bugzilla.redhat.com/show_bug.cgi?id=505414.

Or you can wait for it to turn up in the updates repository. _

If you don’t want to wait for an update in the repository, do the following:

# wget http://kojipkgs.fedoraproject.org/packages/xfce4-power-manager/0.8.0/1.fc11/i586/xfce4-power-manager-0.8.0-1.fc11.i586.rpm
# yum --nogpgcheck localinstall xfce4-power-manager-0.8.0-1.fc11.i586.rpm

Reboot once it’s installed, and that should fix the issue.

Could not look up internet address for..

The complete errormessage is:

Could not look up internet address for NameOfYourMachine. This will prevent Xfce from operating correctly. It may be possible to correct the problem by adding NameOfYourMachine to the file /etc/hosts on your system.

The solution? Just like it says. If your machine name was howl.fbarr.lan, like mine is, you’d add the following:

127.0.0.1 howl.fbarr.lan howl

to /etc/hosts.

Make the sound work properly

When checking the initial volume-settings, you’ll notice that you can hear a little bit of sound, but not much, even if you’ve cranked up the volume to the max. Thing is, we need to specify a little something, just a line really, to make it work properly. Create a file named /etc/modprobe.d/sound.conf with the following in it:

options snd-hda-intel model=acer-aspire

If you were previously using options snd-hda-intel model=acer, change it to options snd-hda-intel model=acer-aspire. This should sort out your problem when plugging in a headphone, and the sound would still get out by the normal speaker at the same time. Thanks to Bruno Malone (from the Fedora 10 post) for the tip. :)

In my case, I’ve removed pulseaudio because I tend to play movies over NFS quite a bit, and pulseaudio always makes the sound turn choppy. So after having executed a yum remove pulseaudio, I add a volume-icon on my taskbar by right-clicking on it, selecting Add New Items.. and adding the application Mixer.

Reboot, and your sound should be working perfectly fine, even after you’ve resumed from suspend. :)

Using Fn-Arrow Up/Down to control the volume

You’ll probably come to notice that Fn-Left/Right works perfectly fine for adjusting the screen brightness. Unfortunately, Fn-Up/Down doesn’t work for controlling the volume. But that is easily fixed. :) A program that’s needed, named amixer, isn’t installed. So as root, install it this way:

# yum -y install alsa-utils

That should make things peachy again. ;)

Why is everything so big?

This is easily fixed. Press the tiny Fedora-icon on your menu, and go to Preferences, Appearance, go to the tab Fonts and click the Custom DPI Setting, and type 80. Done!

Double tap and scrolling doesn’t work on my Touchpad!

The new upstream Synaptics driver disables tapping and vertical edge scrolling by default. In order to fix this, place the following in a file called /etc/hal/fdi/policy/10-synaptics.fdi:

        synaptics
        1
       1

Save and close it, and reboot. Double tap should now be working.

If you want regular and circular scrolling enabled, you need to install the package gsynaptics, and running it from Alt-F2.

Enable the settings you want, and click OK. Now go to the XFCE start menu, Preferences, Session and Startup, and select the Application Autostart-tab. Add the application /usr/bin/gsynaptics-init to the startup list.

Settings should now be kept when rebooted.

Making suspend work when closing the lid

It seems that XFCE 4.6 comes with a native Suspend and Hibernate function, so this should work out of the box! Unfortunately, it doesn’t quite. Suspend works great, but I haven’t had success with Hibernate, yet. And thanks to EasyTarget, who commented on this post, I finally know why. Quoting EasyTarget:

Jorge, I think the reason your Hibernate fails is that the Swap has been removed (for good reasons, I don’t have swap on my A110 either).. IIRC linux uses the swapfile for it’s hibernate functions, and not having a swapfile (or not having enough free space on the swap for your system ram+currently swapped data!) causes this to fail. Strangely this means you need a Huge swapfile to reliably hibernate your system.. I think it’s simply a no-go for SSD based systems at the moment. https://lists.linux-foundation.org/pipermail/linux-pm/2007-July/013971.html You might also be interested in.. http://wiki.debian.org/Hibernation/Hibernate_Without_Swap_Partition

Thanks for the information. :)

Other tips and tricks

Here are a few other minor tips and tricks.

Enabling the rpmfusion-repository

Easily done. su to root, and execute the following command:

# rpm -Uvh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm

And that’s it! Search for a package by executing:

# yum search 
Installing yum-presto

The presto plugin for yum adds support for downloading deltarpms and using them to generate new packages. If user enables this plugin, it will make a substantial dent in the amount of data having to be downloaded for updates. In other words, normally if you need to upgrade a package, yum will remove the complete package, and download the complete new package, even if a lot of the content is just the same. By enabling yum-presto it will only download the difference between those packages, making it faster and goes easier on the bandwidth by up to 80%, in some cases. Simply enable it by installing the yum-presto package:

# yum install yum-presto

And you’re set.

Installing Flash

As always, we need Flash for our browser. Thing is though, there’s an Adobe-repository we can use. If someone is bound to release a new version of Flash first, it’s them. So do the following as root:

# wget http://linuxdownload.adobe.com/adobe-release/adobe-release-i386-1.0-1.noarch.rpm
# yum --nogpgcheck localinstall adobe-release-i386-1.0-1.noarch.rpm
# yum -y install flash-plugin

That’s it. Restart your browser, and you should now have Flash enabled.

Final words

So, that was it! This post will be constantly updated with new things I stumble upon, or suggestions from people posting comments. Anything you’d like to add to this post? Get in touch, I’ll look it over!

And so, we end this post with another screenshot. This time, Fedora 11 with XFCE:

fedora-11-with-xfce

As always, comments and feedback is always appreciated.

Good luck, and enjoy!

Code-fu 0.1.1 released

Seems the people over at the GeSHi Headquarters decided to release a new version of GeSHi, 1.0.8.4. So it was time for me to upgrade code-fu as well. You can as usual head over to the Atlantis Crew download section to grab it from there, and read more about code-fu at . A working up-to-date copy can always be found at .

Easy reloading of Varnish

A co-worker of mine made a nice little script to make reloading of the default VCL that Varnish uses a bit easier. Not wanting to telnet or use varnishadm manually, this script does the trick. This was taken from http://kristian.blog.linpro.no/2009/02/18/easy-reloading-of-varnish-vcl/:

#!/bin/bash
# Reload a varnish config
# Author: Kristian Lyngstol

FILE="/etc/varnish/default.vcl"

# Hostname and management port
# (defined in /etc/default/varnish or on startup)
HOSTPORT="localhost:6082"
NOW=`date +%s`

error()
{
    echo 1>&2 "Failed to reload $FILE."
    exit 1
}

varnishadm -T $HOSTPORT vcl.load reload$NOW $FILE || error
varnishadm -T $HOSTPORT vcl.use reload$NOW || error
echo Current configs:
varnishadm -T $HOSTPORT vcl.list

flac to mp3

for file in *.flac; do $(flac -cd "$file" | lame -h - "${file%.flac}.mp3"); done 

Fedora and SSHFS

I had heard about sshfs before, but didn’t attempt anything with it til today. And I find it pure genius. A little about sshfs.

This is a filesystem client based on the SSH File Transfer Protocol. Since most SSH servers already support this protocol it is very easy to set up: i.e. on the server side there’s nothing to do. On the client side mounting the filesystem is as easy as logging into the server with ssh.

The idea of sshfs was taken from the SSHFS filesystem distributed with LUFS, which I found very useful. There were some limitations of that codebase, so I rewrote it. Features of this implementation are:

  • Based on FUSE (the best userspace filesystem framework for linux ;-)
  • Multithreading: more than one request can be on it’s way to the server
  • Allowing large reads (max 64k)
  • Caching directory contents

After having aquired my new VPS, I wanted to mount something over NFS to my workstation at home. Being that the VPS is running on OpenVZ, it doesn’t allow for normal NFS to work. I tried something called unfs3 instead, a user-space NFS-server. I ended up inventing new curse words yet again. So someone tipped me about sshfs, and it’s working like a dream. Mounting things is as easy as logging on to a remote system with regular ssh.

First install sshfs:

yum install fuse-sshfs

In some cases, after having installed fuse-sshfs, you will have to add the user to the group fuse. If that’s the case, you can do so like this:

gpasswd -a YourUserName fuse

Once you are in the group, you need to log out and in again for it to take effect. When logged in, you can mount things along the lines of:

sshfs user@server.example.com:/home/user/files /home/user/files

And that’s that! The only thing you have to worry about is that the folder you’re trying to mount on the remote machine has the same owner on your workstation. So the user jorge can pretty much mount anything on his workstation, from the remote machine, as long as it is owned by him.

To unmount something you can use:

fusermount -u /here/it/goes/

Enjoy!

One Time Password Calculator on Fedora

I have been annoyed SO many times of the lack of OTP-Calculators in Fedora. With Debian and Ubuntu you can find the program donkey. Unfortunately there’s nothing in sight for our beloved distribution. I managed to convert the donkey debian package to an rpm. Here’s how you do it.

First off we need to install alien, a package converter that converts between Red Hat rpm, Debian deb, Stampede slp, Slackware tgz, and Solaris pkg file formats.

Download the Deb-rpm package and html2text and install them with (as root):

# rpm --nodeps -Uvh deb-1.10.27-3.i586.rpm
# rpm --nodeps -Uvh html2text-1.3.2a-3.i586.rpm

Also install rpmbuild:

# yum install rpm-build

Once this is done, you need to download the alien-package and unpack it, then installing it:

# wget http://content.hccfl.edu/pollock/AUnix1/alien/alien_8.64.tar.gz
# tar -zxvf alien_8.64.tar.gz
# cd alien/
# perl Makefile.PL
# make PREFIX=/usr
# make PREFIX=/usr install

Now download the donkey debian package, and convert it to rpm:

# wget http://ftp.no.debian.org/debian/pool/main/d/donkey/donkey_0.5-17_i386.deb
# alien --to-rpm donkey_0.5-17_i386.deb
# yum --nogpgcheck localinstall donkey-0.5-18.i386.rpm

And that’s it. :)

If you’re not bothered to go through the whole process just to get hold of the donkey-package, you can find it here.

Nifty firewall

#!/bin/bash

IPTABLES='/sbin/iptables'

# Clear out any existing firewall rules, and any chains that might have
# been created. Then set the default policies.

$IPTABLES -F
$IPTABLES -F INPUT
$IPTABLES -F OUTPUT
$IPTABLES -F FORWARD
$IPTABLES -F -t mangle
$IPTABLES -F -t nat
$IPTABLES -X
$IPTABLES -P INPUT DROP
$IPTABLES -P OUTPUT ACCEPT
$IPTABLES -P FORWARD ACCEPT

# Begin setting up the rulesets. First define some rule chains to handle
# exception conditions. These chains will receive packets that we aren't
# willing to pass. Limiters on logging are used so as to not to swamp the
# firewall in a DOS scenario.
#
# silent       - Just dop the packet
# tcpflags     - Log packets with bad flags, most likely an attack
# firewalled   - Log packets that that we refuse, possibly from an attack

$IPTABLES -N silent
$IPTABLES -A silent -j DROP

$IPTABLES -N tcpflags
$IPTABLES -A tcpflags -m limit --limit 15/minute -j LOG --log-level 4 --log-prefix '** TCP-Flags ** -- '
$IPTABLES -A tcpflags -j DROP

$IPTABLES -N firewalled
$IPTABLES -A firewalled -m limit --limit 15/minute -j LOG --log-level 4 --log-prefix '** Firewalled ** -- '
$IPTABLES -A firewalled -j DROP

# These are all TCP flag combinations that should never, ever, occur in the
# wild. All of these are illegal combinations that are used to attack a box
# in various ways.

$IPTABLES -A INPUT -p tcp --tcp-flags ALL FIN,URG,PSH -j tcpflags
$IPTABLES -A INPUT -p tcp --tcp-flags ALL ALL -j tcpflags
$IPTABLES -A INPUT -p tcp --tcp-flags ALL SYN,RST,ACK,FIN,URG -j tcpflags
$IPTABLES -A INPUT -p tcp --tcp-flags ALL NONE -j tcpflags
$IPTABLES -A INPUT -p tcp --tcp-flags SYN,RST SYN,RST -j tcpflags
$IPTABLES -A INPUT -p tcp --tcp-flags SYN,FIN SYN,FIN -j tcpflags

# Allow selected ICMP types and drop the rest.

$IPTABLES -A INPUT -p icmp --icmp-type 0 -j ACCEPT
$IPTABLES -A INPUT -p icmp --icmp-type 3 -j ACCEPT
$IPTABLES -A INPUT -p icmp --icmp-type 11 -j ACCEPT
$IPTABLES -A INPUT -p icmp --icmp-type 8 -m limit --limit 1/second -j ACCEPT
$IPTABLES -A INPUT -p icmp -j firewalled

# The loopback interface is inheritly trustworthy. Don't disable it or
# a number of things will break.

$IPTABLES -A INPUT -i lo -j ACCEPT

# Now allow Internet hosts access to those services we provide. Note that
# enabling inbound FTP 20 & 21 tcp will also require allowing ports
# 1024-65534/tcp. Which in itself is good enough reason not to allow FTP
# connections and to only allow ssh/scp/sftp.

## SSH

# localhost
$IPTABLES -A INPUT -p tcp --dport 22 -s 127.0.0.1 -j ACCEPT

# example.com
$IPTABLES -A INPUT -p tcp --dport 22 -s 208.77.188.166 -j ACCEPT

# oidentd
$IPTABLES -A INPUT -p tcp --dport 113 -j ACCEPT

## HTTP access from anywhere

$IPTABLES -A INPUT -p tcp -s 0/0 --dport 80 -j ACCEPT

# Allow packets that are part of an established connection to pass
# through the firewall. This is required for normal Internet activity
# by inside clients.

$IPTABLES -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT

# Anything not already matched gets firewalled and logged.

$IPTABLES -A INPUT -j firewalled

Fedora 10 on the Acer Aspire One

Update: I have now reinstalled Fedora 10 on my Acer Aspire One, only this time I downloaded a spinoff, Fedora 10 XFCE Live CD, to see how it performed. And not a huge surprise, but it worked remarkably well, far better than Fedora 10 with GNOME. Not to mention that the battery time went from 1 hour and 50 minutes to 2 hours and 50 minutes. I’ve also modified this tutorial a bit, and I have followed these steps myself, so I know it works. But give me a shout anyway should you find that something is lacking.

Righty then. This is going to be one of those posts that probably is going to be a bit longer than usual (if you don’t include the Acer Aspire One-post).

I had settled down with Linpus on my Acer Aspire One, but it nagged me like mad that I had to just settle for it. I mean, Linpus is fine, but I want to have a system that’s up to date, I want to be able to remove packages as I see fit, without worrying that the hal-daemon breaks shakes his fist at Linpus. In any case, surfing the web yesterday, I came upon the post . So in fear of that post being lost at some point, I’m going to write something similar here, with my own hacks and modifications that I made. Here’s how I went about installing Fedora 10 on my Acer Aspire One.

Preparing your USB-pen

For starters, by installing Fedora 10 XFCE Live CD, mostly everything works out of the box. That means webcam, SD-cards, wireless, you name it. How brilliant is that! But I’m getting a bit ahead of myself here. What we need to do first is to install the Live CD to a USB-pen/drive. To do that download the torrent from here. With me having a stationary machine using Fedora 9, I’ll assume that you do as well. :D su to root and install the package livecd-tools:

# yum install livecd-tools

Once the package is installed, and the iso has been downloaded, plug in your USB-pen/drive. I will also assume that your USB-pen/drive has been given the name sdb1. You can check it with the command dmesg, just look at the bottom of output if it has detected it. It should look something like this:

sd 10:0:0:0: [sdb] Write Protect is off
sd 10:0:0:0: [sdb] Mode Sense: 00 00 00 00
sd 10:0:0:0: [sdb] Assuming drive cache: write through
sd 10:0:0:0: [sdb] Write Protect is off
sd 10:0:0:0: [sdb] Mode Sense: 00 00 00 00
sd 10:0:0:0: [sdb] Assuming drive cache: write through
sdb: sdb1
sd 10:0:0:0: [sdb] Attached SCSI disk

Now, with the USB-thingie plugged in, and your iso downloaded, execute the following command:

# livecd-iso-to-disk /home/jorge/downloads/Fedora-10-i686-Live-XFCE/F10-i686-Live-XFCE.iso /dev/sdb1

F10-i686-Live-XFCE.iso being the Live CD iso we just downloaded. This command will copy the Live CD iso to your USB-pen, making that your bootable device.

Installing Fedora 10

Now that the USB-pen is ready to go, reboot your Acer Aspire One, and at boot press F12 to be able to select what boot device to boot from. Your device should pop up in that list. Log in as usual, and double-click the icon that says Install to Hard Drive. Follow the process as normal, however, when it gets time to partition the disk, everything (and I mean everything) that is ext3, change it to ext2! Why? Because having a journaling system on a netbook that uses an SSD-disk is bad. You will experience that your system is pretty much crawling at the pace of a turtle. Anyway, when getting to the partition-section, remember to click on the box named Review and Modify Partitioning Layout, and press Next. In this next window, we want to remove the swap-partition. So click on the line that says Swap under Type, and click Delete. Now that the Swap-partition is gone, we still see that both / and /boot/ are ext3. Click on each line, select Edit, and select the volume corresponding to it, then Edit again. There you can change from ext3 to ext2. When done, click Okay. When pressing Next now, you’ll get a warning about not having a Swap partition. Ignore it and move on with the installation as usual.

Disabling SELinux

Once your installation is all done, you need to reboot for changes to take effect. Answer some questions, create a user, and you’re done! ..for now. Still have a lot of things to do. The first thing that comes to mind is to make your root-filesystem to be ext2. But didn’t we specify that when we partitioned? We sure did. Why the root partition STILL is ext3 is beyond me, but we need to fix that. The user Turnip mentioned that he didn’t really feel like having LVM, so he just deleted the big partition that held it, and recreated an unvarnished ext2 partition in it’s place. When he rebooted to change what he believed was ext3, it was in fact still ext2. I have to test this myself to be certain (I sure wish I had an Acer Aspire One for testing purposes).

Before we fix the whole LVM/ext3-problem though, we need to disable SELinux. SELinux is such a pain in the butt it’s unbelieveable. Press Alt-F2, type terminal, su to root, and edit the file /etc/selinux/config and set the variable SELINUX to disabled. Save and close the file.

Converting the filesystem from ext3 to ext2

I sure hope you have your USB-pen/drive in hand, because we’re going to need it. Reboot your machine, with your USB-thingie plugged in, and again press F12 at boot, selecting your USB-device as the boot device. When done booting to the Live CD, press Alt-F2 and type terminal, and su to root.

What we need to do next is to convert the root-partition of our system to ext2 (as it is currently ext3). The root filesystem is on an LVM-partition, so the way to change it isn’t exactly your usual way of doing it. Run the command vgscan, and it’ll look something like this:

# vgscan
Reading all physical volumes.  This may take a while...
Found volume group "VolGroup00" using metadata type lvm2

You can now find your root partition in /dev/VolGroup00/LogVol00. To convert this to ext2, run the following command:

# tune2fs -O ^has_journal /dev/VolGroup00/LogVol00
# e2fsck /dev/VolGroup00/LogVol00

When this is done, your system should be ext2. To test this, you can do the following things:

# mkdir /mnt/disk
# mount -t ext3 /dev/VolGroup00/LogVol00 /mnt/disk

This last command should fail, as we’re not mounting an ext3 partition. Try it with ext2, it should now work.

Next step is to update an important file, and making a new initrd.

Updating /etc/fstab and making a new initrd

Now that our filesystem is updated, we need to change the entries in /mnt/disk/etc/fstab to read and specify the root partition as ext2, and not ext3. So open up the file /mnt/disk/etc/fstab, and replace ext3 with ext2. When done, save and close the file. Remember that you need to do these changes as root!

We need to do some changes to the boot partition as well, so mount it up, and other things as well (thanks skug67!):

# mount /dev/sda1 /mnt/disk/boot/
# mount -o bind /sys /mnt/disk/sys
# mount -o bind /proc /mnt/disk/proc

What we will do now is to change our root-enviroment so that we’re working directly inside the mounted partitions. You can do that by running this command:

# chroot /mnt/disk/ /bin/bash

We’re now in the new enviroment. It’s time to create the new initrd. Now, the image-versions shown below does not necessarily have to be what you have. The iso you downloaded from the Fedora torrent might be newer than what I’m writing here, so just do an ls /boot/ to see what your image-file looks like. We proceed:

# mv initrd-2.6.27.5-117.fc10.i686.img initrd-2.6.27.5-117.fc10.i686.img.ext3
# mkinitrd initrd-`uname -r`.img `uname -r`

When this is done, you’ve created a new initrd. Follow up with exiting the enviroment, unmounting the partitions and rebooting:

# exit
# cd /root/
# umount /mnt/disk/boot/
# umount /mnt/disk/sys/
# umount /mnt/disk/proc/
# umount /mnt/disk/
# reboot

With SELinux gone, ext3 converted to ext2, and a new initrd created, you should be able to boot into your Fedora 10 on the Acer Aspire One. :)

And now, optimizing the system.

Optimizing Fedora 10

I assume that by now you are actually using the Fedora 10 installation. Here’s how to improve the system performance a bit.

Quoting the Ubuntu wikipages:

Frequent writes to the SSD will cause failure eventually. We can reduce the number of writes to the SSD by moving our logs to a temporary filesystem in RAM that gets destroyed at ever reboot. Now this means your logs will not be persistent across reboots making debugging difficult in some cases. This step is optional of course, so if you need the logs for an extended period of time do not follow these steps.

Let’s assume that you want to do this. su to root, and open up the file /etc/fstab, and place these following lines there:

tmpfs      /var/log        tmpfs        defaults           0    0
tmpfs      /tmp            tmpfs        defaults           0    0
tmpfs      /var/tmp        tmpfs        defaults           0    0

Also, modify the first line in /etc/fstab to include the options noatime and nodiratime. When done, your /etc/fstab should look something like this:

/dev/VolGroup00/LogVol00 /                       ext2    defaults,noatime,nodiratime        1 1
UUID=43882dc4-109b-40c9-b3eb-6e2c7ebd2758 /boot                   ext2    defaults        1 2
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
tmpfs                   /var/log            tmpfs   defaults        0 0
tmpfs                   /var/tmp                tmpfs   defaults        0 0
tmpfs                   /tmp                tmpfs   defaults        0 0

Save the file, and close it. The next thing we can do is to place the following into your /etc/rc.d/rc.local-file:

# Economize the SSD
sysctl -w vm.swappiness=1               # Strongly discourage swapping
sysctl -w vm.vfs_cache_pressure=50      # Don't shrink the inode cache aggressively

# As in the rc.last.ctrl of Linpus
echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo ondemand > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
cat /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate_max > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate

echo 1500 > /proc/sys/vm/dirty_writeback_centisecs
echo 20 > /proc/sys/vm/dirty_ratio
echo 10 > /proc/sys/vm/dirty_background_ratio

echo 1 > /sys/devices/system/cpu/sched_smt_power_savings
echo 10 > /sys/module/snd_hda_intel/parameters/power_save
echo 5 > /proc/sys/vm/laptop_mode

#Decrease power usage of USB while idle
[ -w /sys/bus/usb/devices/1-5/power/level ] && echo auto > /sys/bus/usb/devices/1-5/power/level
[ -w /sys/bus/usb/devices/5-5/power/level ] && echo auto > /sys/bus/usb/devices/5-5/power/level

/sbin/setpci -d 197b:2381 AE=47
/sbin/modprobe pciehp
/sbin/modprobe sdhci

Create a file named blacklist_msreader in /etc/modprobe.d, with the following in it:

blacklist jmb38x_ms

Open up the file /boot/grub/grub.conf and add elevator=noop to the kernel-line, making this:

kernel /vmlinuz-2.6.27.5-117.fc10.i686 ro root=/dev/VolGroup00/LogVol00 rhgb quiet

Look like this:

kernel /vmlinuz-2.6.27.5-117.fc10.i686 ro root=/dev/VolGroup00/LogVol00 rhgb quiet elevator=noop

Proceed with rebooting your machine, and everything should be working fine. :)

Ways to extend your battery life

There are several things you can do to extend the battery life on your Acer Aspire One.

  • Turn the screen brightness down – your screen is the most power-intensive component in your laptop, and why turn the brightness all the way up if you already can see well enough?
  • When not in use, turn of the wireless and bluetooth functions.
  • If you have enough memory on your laptop, disable swapping. I would suggest putting in more memory, as swapping writes to virtual memory.
  • Journaling-filesystem on a SSD-disk = baaad. More writing to disk means more power used. Switch to ext2 instead.
  • Disable all services that just aren’t used. A lot of distributions come with say httpd enabled at start up. If you don’t need it, get rid of it.
  • When you’re in no need of sound – mute it!

Jason Farrel has these following tips to apply as well:

  • Not exactly a performance tweak, but add vga=0×315 to the end of the kernel-line in grub.conf in order to see the fancy new plymouth solar bootup screen. Kernel mode setting isn’t yet supported for the intel gma display, so this vesa mode set workaround is needed.
  • Use powertop to eliminate more power hogs.
  • If using mplayer to play video, and you see nasty horizontal tearing, it’s because the fast overlay isn’t being used by default. Edit ~/.mplayer/config and gui.conf to use vo=xv:port=XX where XX is the port returned from the xvinfo util for the overlay adaptor – this should be 79.
  • To cut the bootup time almost in half (down to 25 seconds here), disable uneeded services. Here’s a one-liner to disable them (run it as root): for s in atd auditd avahi-daemon bluetooth cups gpm ip6tables kerneloops mdmonitor nfslock portreserve rpcbind rpcgssd rpcidmapd sendmail setroubleshoot livesys livesys-late microcode_ctl; do echo “chkconfig $s off”; chkconfig $s off; done

  • This one makes a big difference: don’t forget to disable firefox’s disk cache or you’ll grind to death.

Thanks for the tips Jason. :)

I installed FC10 like you described. It works fine. I was a bit surprised the AAO appeared rather slow compared to my EEE 1000H. So I ran cat /proc/cpuinfo. It appeared the CPU ran at 800 Mhz. I first looked at the BIOS, but the CPU ran at 1600 Mhz over there. Then I looked at services and found cpuspeed running. This is for scaling the CPU speed. After disabling this service the cat /proc/cpuinfo reported 1600 Mhz CPU speed and the system runs much smoother (and most probably consumes more power!).

And he is completely right. Jaap, thanks a million!

Minor troubleshooting

Make the sound work properly

When checking the initial volume-settings, you’ll notice that you can hear a little bit of sound, but not much, even if you’ve cranked up the volume to the max. Thing is, we need to specify a little something, just a line really, to make it work properly. Create a file named /etc/modprobe.d/sound with the following in it:

options snd-hda-intel model=acer-aspire

If you were previously using options snd-hda-intel model=acer, change it to options snd-hda-intel model=acer-aspire. This should sort out your problem when plugging in a headphone, and the sound would still get out by the normal speaker at the same time. Thanks to Bruno Malone for the tip. :)

Reboot, and your sound should be working perfectly fine, even after you’ve resumed from suspend. :)

Using Fn-Arrow Up/Down to control the volume

You’ll probably come to notice that Fn-Left/Right works perfectly fine for adjusting the screen brightness. Unfortunately, Fn-Up/Down doesn’t work for controlling the volume. But that is easily fixed. :) A program that’s needed, named aumix, isn’t installed. So as root, install it this way:

# yum -y install aumix

That should make things peachy again. ;)

Making the Wifi LED work

In order for you to have a functional Wifi LED working, you need to have madwifi installed. Upon installing madwifi, it will automatically blacklist the atheros-driver for your wireless card. Don’t get me wrong, your wireless will still work (and rumor has it that madwifi is faster). Another reason that you might want to use madwifi instead of the one included in the kernel is that there seems to be a weird bug where the wireless flakes to the point where it won’t work until you do a full power down (pulling battery and discharging the caps). To be able to install madwifi you need to have the rpmfusion-repository enabled. You can enable it by doing so:

# rpm -Uvh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm

Once that is done, you can continue by installing madwifi like this:

# yum -y install madwifi

Once it is installed, add the following to the bottom of the file /etc/sysctl.conf:

dev.wifi0.ledpin = 3
dev.wifi0.softled = 1

Now reboot your machine, and your Wifi LED on the front will now do the association blink, as well as blink based on wireless traffic.

Making suspend work when closing the lid

When closing the lid on your Acer Aspire One, you expect it to suspend, right? This behaviour does not come as default with the XFCE desktop. You can make it work by doing the following.

First you have to have acpid installed. Execute:

# yum install acpid

to install it. Once it is installed, create a file named lid.conf in /etc/acpi/events/ and place the following in it:

event=button/lid.*
action=/usr/sbin/pm-suspend

This will now suspend your machine when closing the lid.

If your wireless networking isn’t working after resuming from suspend, and you are using the madwifi driver instead of the native kernel provided driver, you can prevent that problem by placing the following content in a file named /usr/lib/pm-utils/sleep.d/06acerwifi:

#!/bin/sh

. "${PM_FUNCTIONS}"

unload_madwifi()
{
/usr/bin/madwifi-unload > /dev/null
}

load_madwifi()
{
/sbin/modprobe ath_pci > /dev/null
}

case "$1" in
hibernate|suspend)
unload_madwifi
;;
thaw|resume)
load_madwifi
;;
*) exit $NA
;;
esac

When done, change the permissions:

# chmod 755 06acerwifi

Reboot, and it should suspend when closing the lid. :) The only problem with this is that NetworkManager won’t automatically connect to your previous wireless network, so you’ll have to click and select it. I’ll see what I can find out about it. :)

Thanks to derge from the Fedoraforums for the tip about the resume-sound from suspend issue.

That’s pretty much what I have, so far. But I can’t end this post without an image. :) This is how my Fedora 10 XFCE desktop looks on the Acer Aspire One.

Good luck!

Oracle Tips and Tricks

Finding out if Oracle is running on the machine (Oracle always has a db-writer process running):

ps aux | grep dbw

Finding the name of the database-instance:

ps aux | grep -v grep | grep dbw | cut -d _ -f 3

Logging in as sysdba:

sqlplus "/ as sysdba"

Finding out where Oracle places the archive-logs:

> show parameter log_archive_dest;

Show general log information:

> show parameter log_archive;

Setting the archive-log path:

> system set log_archive_dest='/path/to/logs/arch';

Finding out where Oracle places the alert-log:

> show parameter background_dump_dest;

Healthchecking Oracle (if you are able to take down the database):

> shutdown abort;
> startup;
> shutdown;
> startup;
> select sysdate from dual;

Forcing Oracle to write to the archive-logs:

> alter system switch logfile;

Starting the database if it isn’t running:

> alter database open;