Wireless on Ubuntu 11.10 and Lenovo Thinkpad E420

Unlike 11.04 and earlier, Ubuntu 11.10 runs much better on Lenovo Thinkpad E420. The only glitch is the wifi drivers which don’t run by default, and it could be corrected easily

Using LiveCD or a running system

  • Press Super (Window) key, and open Terminal
  • Type sudo modprobe -r acer_wmi

That’s all. You should be able to connect to the wireless till next reboot.

Making the change permanent

Edit the file /etc/modprobe.d/blacklist.conf and in the end type

blacklist acer_wmi

Reboot and you’re done. If you’re doing it entirely from the GUI, then editing the file could be done by pressing ALT+F2 (this would open a “Run” window) and typing there gksu gedit /etc/modprobe.d/blacklist.conf

Please note: This applies to wireless card having rtl8188ce chipset. You can view that by typing lspci in a terminal and searching for the entries respective to Network Controller.

Ubuntu 11.04 on Lenovo E420

Update: 16 October 2011 – Ubuntu 11.10 works better. http://wp.me/p9bZ0-1Q

I recently got a Lenovo E420 laptop, and I just went ahead and installed Ubuntu 11.04 on it. Few are some of the things that may help those who’re facing issues with it. I got 4 GB RAM on Core i5. It’s 64bit processor, so I preferred 64bit Ubuntu instead of 32bit pae kernel.

Wireless

The machine has rtl8188ce chipset, and the Realtek drivers available from Realtek’s website don’t work well. You just need to blacklist acer_wmi module

Edit /etc/modprobe.d/blacklist.conf and add

blacklist acer_wmi

Save and reboot. This won’t work if you’ve compiled Realtek drivers and installed them. It’ll work only in the default install. Here’s more detailed link –Ā  http://askubuntu.com/questions/53625/wireless-on-thinkpad-edge-e420s

Random screen lockups

I am not sure why it occurred – due to the kernel or due to the compiz settings. I did both. Installed Kernel 2.6.39 from http://kernel.ubuntu.com/~kernel-ppa/mainline/v2.6.39-rc4-natty/

Also, I installed CompizConfig Settings Manager (ccsm) from Ubuntu Software Center, and then disabled this option

General -> OpenGL -> Sync to VBlank (uncheck this)

Reboot. The system may not hang. http://www.preshweb.co.uk/2011/05/ubuntu-11-04-x-freezing-after-screensaver-active-laptop-lid-closed/

Update 26 July 2011: There are still instances of system hanging šŸ˜¦ Unable to identify the cause as yet. However, this time the system just hangs with no mouse movement at all. This behavior I experienced in 32bit-pae kernel too and usually happens when system has gone through more than a few standbys. Will diagnose and update further.

Update 2 – 30 July 2011 : I updated the BIOS to v1.16 (earlier it was 1.10), but it didn’t do any good. The system still got hung. It is not due to standby also as I disabled the “Suspend” option from Power Management section and rebooted the computer and used it for around 3 hours after which I got a Kernel Panic. Realtek has put a new version of their drivers for rtl8188ce chipset – I’ve just installed those and rebooted and it seems to be working. Will update later if it has cured the hanging problem.

Update 3 – 31 July 2011 : After installing the realtek rtl8188ce drivers as mentioned in the post above, I’ve not rebooted the machine since more than 24 hours. Had suspended it more than a few times, and did various experiments which earlier eventually led to a freeze. But I’m happy to report that till now all has been good and it has not yet hung. I’ll keep working on it for next few days and see if there has been a proper resolution.

Indicator icons for unsupported apps

I installed gnome-do and I was unable to see the indicator icon for that. Installed dconf-editor from Ubuntu Software Center.

Got the name of the application from .xsession-errors file (TrayChild). Opened dconf-editor and added ‘Do’ in there. Logged out and logged back in and all is well.

http://askubuntu.com/questions/36898/how-can-i-see-a-list-of-all-the-systray-icons-that-are-not-whitelisted/39750#39750

Don’t set systray-whitelist to “all” as that may lead to the icons in indicator being unclickable.

To be honest, it was horrendous to use Ubuntu 11.04 due to severe productivity issues for the first week. I installed 32bit pae kernel so that the 4GB RAM could be supported. But I couldn’t upgrade it to 2.6.39 as no pae kernel was available for 2.6.39. I rather installed 64bit Ubuntu, and updated it immediately and rest did what I mentioned above. No more hangs till now, and life has been happy.

Making a WiFi Hotspot / Access Point using Linux & wifi lan card/USB adapter

If you have a wifi LAN card / USB adapter, then you can use it as an access point so that other machines can connect to the internet via your machine using Wifi. The process is fairly simple, but requires you to have a compatible set of drivers which allow a wifi lan card to come into “Master” mode.

It didn’t work well for

  • Linksys WUSB54GC v3 USB adapter. Till Ubuntu 10.04, there were no good drivers for use with hostapd (supporting mac80211 / nl80211). In Ubuntu 10.10, though the drivers were working, but the connection was highly unstable – in fact unusable. The drivers that I tried were rt2800usb (which allowed the adapter to come into Master mode), and rt2870sta which didn’t allow the adapter to come into “Master” mode. It always remained “Auto” or “Managed” (checked via iwconfig). Need to test in 11.04 when it arrives.

What worked pretty well

  • 02:00.0 Ethernet controller: Atheros Communications Inc. AR5001 Wireless Network Adapter (rev 01), using ath5k drivers. hostapd didn’t complain at all and all was smooth. This was in Ubuntu 10.04.

Concept

  1. There’s an application called hostapd which allows converting a wifi adapter into an access point and provide privileges such as WPA authentication and ssid name definition etc. I used it and it worked well.
  2. When a client connects to the access point, apart from authentication it’ll require IP addresses to be assigned. For that a DHCP server is used.
  3. You need to have 2 interfaces, one which accesses the net (e.g. eth0), and other which provides the access point services (e.g. wlan0).
  4. You start the wlan interface, assign it an IP address, start the dhcp server, setup firewall/nat and start hostapd. That’s all to it. Your devices would be able to use the wifi adapter as the access point.

Procedure

apt-get install dhcp3-server hostapd

Modify /etc/hostapd/hostapd.conf and put the following

interface=wlan0
driver=nl80211
ssid=MyAP
hw_mode=g
channel=11
wpa=1
wpa_passphrase=MyPasswordHere
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP CCMP
wpa_ptk_rekey=600

The dhcpd.conf section in /etc/dhcp3/dhcpd.conf would have something like the following

subnet 10.10.0.0 netmask 255.255.255.0 {
        range 10.10.0.25 10.10.0.50;
        option domain-name-servers 8.8.4.4, 208.67.222.222;
        option routers 10.10.0.1;
}

Modify /etc/default/dhcp3-server

INTERFACES="wlan0"

Check what name your adapter got via iwconfig. You can change the name also and make it persistent via /etc/udev/rules.d/70-persistent-net.rules so that it always gets a single type of name. In our example we’re assuming wlan0, but it could be changed. Make necessary changes in your configuration too.

Configure the new interface

ifconfig wlan0 10.10.0.1

The above could also be done in a better way via the /etc/network/interfaces file, but didn’t try it out. In any case if you shutdown hostapd, the network interface (wlan0) loses its address, so need to put a script which assigns it again before hostapd is started. An example could be

iface wlan0 inet static
 address 10.10.0.1
 netmask 255.255.255.0

Restart the dhcp3-server. It should now be ready to serve addresses and is also bound to the network interface too.

Allow ip masquerading

echo "1" > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

Now start hostapd and see the messages that it shows

hostapd -dd /etc/hostapd/hostapd.conf

Wait for a few seconds, it should show some probes being done by other wifi devices. If it shows, then probably you’re in good luck.

Now try to connect via your device to this access point. It should work.

To make this work on boot, can put the relevant config in /etc/default/hostapd

RUN_DAEMON="yes"
DAEMON_CONF="/etc/hostapd/hostapd.conf"
DAEMON_OPTS="-dd"

and also put the firewall rules in /etc/rc.local (make sure its executable).

Remember – if you shutdown your hostapd, the network card would lose its address. So you have to assign that again before starting hostapd. The usual practice would be

  • Stop hostapd
  • Stop dhcp server
  • Restart network (or rather ifupĀ wlan0 / ifconfigĀ wlan0Ā 10.10.0.1 would do)
  • Restart dhcp server
  • Start hostapd

Miscellaneous

  1. You can check the wifi interfaces via
    iwconfig
  2. To set a wifi adapter into master mode, try the following. If it doesn’t work and shows an error that it’s not possible or something, fret not – use hostapd as that’ll do that in any case.
    iwconfig wlan0 mode Master
  3. Network Manager could create issues, though in my test environment – instead of using an ethernet interface, I used two wlan interfaces, one being controlled by Network Manager for internet access, and other for making it an access point.
  4. modprobeĀ -rĀ ath5k / modprobeĀ -rĀ rt2800usb etc. is to be used for unloading the modules.
  5. If you wish to proceed without using authentication so that you can test it easy, then put the following in /etc/hostapd/hostapd.conf
    interface=wlan0
    driver=nl80211
    ssid=MyAP
    hw_mode=g
    channel=11

Asterisk Basics, and Load Balancing via DUNDi

IMPORTANT: The configurations, that is, the code sections underneath are not wrapped. However, if you want to copy paste them, you can just select them and despite they being not visible to you, they’ll get copied into the clipboard. Otherwise you may want to refer to the PDF version.

Prepared by : Vivek Kapoor http://exain.com
Prepared on : 01 July 2010
PDF Version : Asterisk_Basics_Load_Balancing_DUNDi_Vivek_Kapoor

Purpose of this document

Asterisk is an open source PBX. Which means, you can setup your own little telephone exchange in your home/office environment. On a much larger usage, you may look forward to setting up a redundant phone setup wherein multiple boxes are interconnected with each other and provide some sort of failover capability and easier management, which is possible through something called DUNDi. This document aims to provide such a solution with a possibility of horizontal scaling instead of vertical scaling. So, this may mean that by using low-end commodity hardware, you can setup a strong telephone infrastructure which can cater to thousands of users.

Read the document carefully. Read it fully before you start implementing it. It is intentionally detailed so that you know what you’re doing.

Acknowledgements

All credit of this document goes to JR Richardson. I’m afraid I’ve not been able to find a suitable link for him, but his whitepapers and presentations are the ones which helped me move forward. And of course, Mark Spencer – the guy behind Asterisk. Without him this document wouldn’t have existed.

The writings by JR Richardson

Continue reading

Booting Ubuntu without Monitor plugged in / switched off

There is a major issue with Ubuntu partly due to BulletproofX and the X window system, which requires the presence of a monitor for X window to start. If the monitor is switched off, or is not connected, then Ubuntu / X would not be able to detect it and thus would go into “low graphics mode”. So, basically your GDM would not start.


There are two scenarios in which the monitor is not connected / switched off

  1. You wish to save energy and thus switch off the monitor, and then remotely reboot the machine
  2. You have Ubuntu running as a Server and thus no dedicated monitor is connected to it and you remotely reboot the machine. Specially, if you have automatic login enabled along with Remote Desktop (vino/vnc) enabled, and rely on Network Manager to start your session (through Wifi perhaps). In this case, Ubuntu would go into low graphics mode, and your network manager would not be able to assign you an IP, and you have lost complete remote access to the machine. Isn’t it pathetic?


I am still not aware on how to take care of the first part, that is, monitor switched off intentionally by you.


However, if you are running Ubuntu as a server and have/need a GUI, then the solution is here. Thanks to nikgare / http://ubuntuforums.org/showpost.php?p=7681232&postcount=8 for the pointer.

  1. Modify /etc/X11/xorg.conf and remove all content and add the following

    Section "Device"
    Identifier "Configured Video Device"
    Driver "vesa"
    EndSection

    Section "Monitor"
    Identifier "Generic Monitor"
    HorizSync 58-62
    VertRefresh 75-117
    EndSection

    Section "Screen"
    Identifier "Default Screen"
    Device "Configured Video Device"
    Monitor "Generic Monitor"
    DefaultDepth 24
    SubSection "Display"
    Depth 24
    Modes "1024x768"
    EndSubSection
    EndSection

  2. You also may want to disable Bulletproof-X by modify /etc/gdm/gdm.conf and commenting out the line

    #FailsafeXServer=/etc/gdm/failsafeXServer


Now reboot, and X would start without monitor plugged in.

Auto shutdown KVM Virtual Machines on system shutdown

Update August 2010: It does not always work as expected. Though this method works well if the server is Ubuntu 8.04 or Ubuntu 9.04, but the shutdown script never get called in Debian Squeeze. Maybe a better init script would be required for newer versions.

Update February 2011: You should have a look at Sergey‘s comment below, where he mentions why it doesn’t work in Debian Squeeze. Thanks Sergey!


I have beenĀ  using KVM for virtualization for quite some time now, probably more than a year. Though the initial use was on the servers which were rarely shutdown, now I’ve started using it in my home envir0nment where frequent restarts or shutdowns are there. The challenge that I faced was to automatically shutdown the KVM virtual machines when the system was shutdown or restarted.

Thanks to Joern at linux-kvm.com, I was able to setup a script which does an auto shutdown of the Linux (basically any VM which has ssh available) machines. I am using it on Ubuntu 9.04 (Jaunty Jackalope) 64 Bit Desktop edition.

Steps

  1. Add the host file entries
  2. Make sure you are able to do ssh without entering any password from root into the VMs
  3. Put the script into the /etc/init.d directory.
  4. Test the script before rebooting the system
  5. Reboot the system to check if it worked

Continue reading

Storage Nirvana – Unlimited Storage using LVM, iSCSI and AoE

UPDATE: I don’t recommend this. See comment #4 – all you do is at your own risk.

If you want to have unlimited space like what google.com is doing with gmail, then here’s what you need to do. I used Ubuntu Feisty Fawn and Gutsy Gibbon to test out the solution.

  1. Setup and understand the usage of a LVM
  2. Setup iSCSI or AoE for network devices so that network storage can be used easily
  3. Setup RAID so that redundancy can be provided to LVM Physical Volumes

Important: Following steps may corrupt your data or partitions. Use them at your own risk. Also, I have listed down the steps as I went ahead doing them. They may not be accurate in your environment or all scenarios may not be covered. I would recommend going through the entire article before attempting anything.

Assumptions

  1. You are comfortable using Linux and fdisk
  2. You have backed up your data so that in case something goes wrong, nothing is lost
  3. You can connect to network and have access to more than 1 Linux machine to do the testing

This article is not complete and does not include the iSCSI and AoE related information as of now. I am working on it and will update it soon. However, you may continue on this page and learn about the LVM šŸ™‚

Continue reading