Skip to main content

Posts

Showing posts from April, 2013

Redirecting kernel messages (dmesg) out through your serial port

If you are into coding driver for Linux, you will know how precious those last few kernel messages are just before your module causes a system hang. So to alleviate that issue, we did to things:

First we started using virtualization. We use a Windows 7 PC (Linux can be used as well) to host Ubuntu as guest using VirtualBox. We use the "oh so awesome" SublimeText editor to edit the source code of the kernel module we are developing on the Windows PC. We shared the source code folder with the Ubuntu virtual machine (VM). This made life easier because it decreased the time to reboot Ubuntu in case of a hang. And whatever few seconds were involved in reboot could be used to look through the code on the unaffected source editor which ran outside the testing machine. This setup of course would only suit you if you aren't working on developing driver for devices connected to your system bus - you will need a real physical PC running Linux exclusively for that.

Secondly, we wan…

Disabling Avahi (mDNS Daemon) on Ubuntu

mDNS (multicast DNS) is the technology which allows you your computer, smart TV, smart phones to discover services on each other when they are connected to the same local network. Its part of the technology that enables you to play music/photos/videos on your TV from your smartphone over WiFi.

mDNS is one of the techniques for enabling Zero Configuration Networking


Apple's Zeroconf implementation is called Bonjour and uses mDNSUbuntu uses Avahi (wiki | home) as its mDNS daemonWindows uses SSDP to implement UPnP At times, while testing protocol stacks, you might want a quiet network - one without all the service discovery packets being sent every now and then. To achieve that, you will need to disable mDNS and service discovery daemons on all the computers connected to the network.
On Ubuntu 10.10 and up the following method seems to disable Avahi completely: Execute sudo gedit /etc/init/avahi-daemon.conf and change:
start on (filesystem
and started dbus)
to
start on (never
and filesystem

Serial Ports between Ubuntu Guests on a Windows Host using VirtualBox

Aim:
To establish a virtual serial connection between two Ubuntu virtual machines running on a Windows 7 host using VirtualBox. They should be able to exchange data over ttyS0 using a terminal emulation software like PuTTY. It like simulating two physical PCs both running Ubuntu, whose RS232 Ports are connected to each other using a null modem cable (TX to RX).

My setup:
Host OS: Windows 7 32 bit
Guest1 OS: Ubuntu 10.10 i386
Guest2 OS: Ubuntu 10.10 i386
VirtualBox: 4.1.16
(The following method should work on newer versions of VirtualBox and the Host and Guest OSes. Note that Ubuntu 10.10 is no longer supported, so it is better that you try this with a new version.)
Setup the environment:
Install VirtualBox on your Windows PC.Create a virtual machine on it for Ubuntu.Make sure to enable COM1 and COM2 for this machine under the serial ports option and leave them as disconnected before you install Ubuntu on it.Install the latest version of Ubuntu on it using the iso image available here: ht…

Disabling IPv6 on Ubuntu

There might be times when you might want to disable IPv6 support on your PC running an older version of Ubuntu (in my case 10.10) and you try out the following methods:

Method 1) Simply issuing the command: sudo sh -c "echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6" might not work on older versions of Ubuntu.
Method 2) Neither would the alternate method of editing /etc/sysctl.conf as shown here: How to disable IPv6 in Ubuntu 10.04 Lucid Lynx work on older versions of Ubuntu.
Method 3) To conclusively disable IPv6 (on Ubuntu 10.10 for example) you need to resort to editing the command line options passed to the kernel by the bootloader (grub) as shown here: How to disable IPv6 in Ubuntu 9.10 Karmic Koala It involves adding the line GRUB_CMDLINE_LINUX="ipv6.disable=1" to /etc/default/grub and running update-grub2
Don't go by the titles of the posts linked to above, editing the kernel command line arguments is still the best way to disable IPv6 on any version of …

Accessing Serial Console on iMX233-OLinuXino-MAXI

The default console for ArchLinux distribution for OLinuXino is directed to /dev/ttyAMA0.
To access this console, connect a FTDI Basic Breakout - 3.3V from SparkFun using Male to Female Jumper Wires like so:



Connect the FTDI board to your PC using a microUSB Cable and install the FTDI Vitual COM Port Drivers if required.
Then using PuTTY (dowload putty.exe from here) on (works on Windows as well as Linux) to create a serial session over the appropriate serial line (COM37 in my case) at 115200 speed :


On Windows, to look up your COM Port number, you have to usually open the Device Manager expand the Ports class and find it under there like so:

If you use Windows Vista or Windows 7, you can install the FTDI gadget which docks in one corner of your screen and displays the COM port numbers of all FT232RL based USB-Serial converters attached to your computer. This is a quicker way to know the COM number assigned to your FTDI Basic Breakout - 3.3V


kevent 2 may have been dropped

If you are using iMX233-OLinuXino-MAXI with Archlinux on it, it is highly likely that you might get the following kernel message when you connect your board to the network:
smsc95xx 1-1.1:1.0: eth0: kevent 2 may have been dropped Users of Raspberry Pi faced the same issue (it has the same network chip on it as the OLinuXuiono).
Here is how to fix it.

Access the console on OLiniXino's ttyAMA0 serial port using PuTTY from your Windows/Linux PC (instructions here).

Issue the following command and reboot the board:

sh -c "echo vm.min_free_kbytes = 8192 >> /etc/sysctl.conf"
sysctl -p
What this does is limit the system memory used by the network device - and so you won't see those annoying messages anymore.

Taken from the discussion on the forum here: Network and system hanging

Sharing folders between Ubuntu 12.04.1 Guest and Windows 7 Host when using VirtualBox

If you are running Ubuntu 12.04.1 i386 on your Windows 7 32-bit using VirtualBox, and found yourself wanting to share files between the two, here is how to get that done using the GUI:
Make sure to install the guest addition on your Guest OS (Ubuntu 12.04.1)
This will allow you to share clipboard (Copy/Paste) between Ubuntu and Windows and allow you to share folders between the two among other things.
The following screenshots provide hints at how to get that done.
Share folders
Share some folders between Windows and Ubuntu.
The following screenshots provide hints at how to get that done.
You will need to reboot the virtual machine every time you want to share a new folder.

Install "Users and Groups"
If you cd to the shared folders (eg /media/sf_GitHub in my case), you will note that you aren't allowed to do so. This is because the user account that you have logged in with does not yet have the permission to access those folders. What we need is a GUI program which will help you…