Nicolas314

All my geeky stuff ends up here. Mostly Unix-related

Posts Tagged ‘junior

Debian upgrades on Junior

leave a comment »

Junior runs Debian. Debian gets upgraded, so Junior gets upgraded.

Unfortunately this upgrade comes with a kernel upgrade, requiring re-compilation of all specific drivers: sis7019 for sound, ndiswrapper for WiFi and the webcam-specific drivers. I tried to install Debian packages from testing but could not get anything so I tried manual re-compilation. This failed miserably because the kernel headers have changed in some incompatible way. Time for me to Google my way out of this and I could finally get anything back to a usable state.

I am getting quite annoyed by the regular changes in kernel interfaces. There must be other ways of maintaining a kernel without requiring every driver writer to maintain their code for each new release, especially for a piece of software that is 15 years old now.

Written by nicolas314

Tuesday 29 January 2008 at 10:56 pm

Posted in junior

Tagged with , ,

Junior webcam support

leave a comment »

Just for fun: I have added a webcam to Junior. A USB webcam, the kind you can find for 20€ in any computer store out there. I bought one without checking for Linux support beforehand and was lucky enough to get one that is supported. For what it’s worth: the webcam is sold as Hercules Delux webcam. The package said it supports 1.3 Mpix images but that is a lie: the captor is 640×480, that is 300 kpix and they have software to interpolate (extrapolate) to larger images under Windows. Oh well… Next time I will check before going to the store.

Anyway: I needed to compile and install an extra driver to support this camera. The driver is called ov51x-jpeg and it can be found here:

http://www.rastageeks.org/ov51x-jpeg/index.php/Main_Page

Once the driver is loaded into the kernel, you get new devices corresponding to video and audio inputs (this webcam comes equipped with a microphone): /dev/video0 and /dev/dsp1. To check everything is working smoothly, I started up VLC (VideoLAN Client), chose “Open Capture Device” and provided these device names. Video is really smooth on this webcam and sound is working as expected.

Now I have video and sound acquisition capabilities on Junior, which finally enables me to implement a simple but powerful alarm system in my house. What I want is:

– A system running full-time when I am not home
– Keep acquiring images from the cam until some movement is detected
– As soon as something is detected, send the images to me by e-mail and send me an alert by SMS

I should also be able to log into Junior and listen to the audio flux remotely, and why not get the video flux too. I did not get to this last part yet but the rest is pretty easy.

You want to have a look at Motion, a pure command-line motion detector. This utility can be configured to take any kind of action upon detecting movement in a video feed, which is exactly what I want, and it is available from the Debian repositories. It took me a while to understand the configuration file and get it right but once put together it works really nice.

The last part I needed to solve was sending an alert over SMS. Un-surprisingly, there are still no SMS-brokers out there offering SMS sending services for free. You need to register and pay for these, and this is not cheap. I guess this is a good thing in the end to avoid spam on mobile phones in general. I checked out my phone subscription and found out that my provider also offers a Webmail that can be connected to my mobile phone: whenever I receive an e-mail at that address, they send an alert by SMS to my mobile phone containing the e-mail Subject line, and this is free of charge. There we are! The final algorithm can be summarized as:

– Run motion on Junior
– Whenever movement is detected, send the images by e-mail to me, and send an SMS alert to the e-mail account associated to my mobile subscription.

Since I do not want to be flooded with false SMS alarms, I limited the system to sending only one per day. This should be enough. Now I need to find a way to deactivate the alarm system when I come home, otherwise the alarm will trigger every day.

Yet another simple but nice project. Not sure it will ever be useful, I just wanted to know if it could be done!

Written by nicolas314

Sunday 12 August 2007 at 1:17 pm

Posted in junior

Tagged with , , ,

Junior as syslog archiver

with 2 comments

Idea

You have a Junior box or equivalent sitting at the heart of your home network and want to use it as a network syslog archiver for all of your machines.

Aim

All Unix machines on your network store their syslog messages locally and also send them to Junior through UDP packets, where they are stored in separate files for each machine.

Solution

install syslog-ng

The default Debian syslog has the capability to log network-based syslog messages coming from other machines on the same subnet (-r option). Unfortunately, syslog cannot be easily configured to store logs separately
for each machine, so everything ends up in the same files, mixing information from all hosts as well as local messages. This can get quite confusing.

Enters syslog-ng: this new generation brings a lot of useful features, among which the capability to do much better filtering on incoming messages and how to store them. The procedure to install it is as follows:


apt-get install syslog-ng

This will install syslog-ng and remove syslog.

For this example I assume we have a machine on the local network called ‘billy’ at address 192.168.1.10. Modify your /etc/syslog-ng/syslog-ng.conf configuration file as follows:

Add a UDP listener by un-commenting udp() in the source list:

source s_all {
# message generated by Syslog-NG
internal();
# standard Linux log source (this is the default place for the syslog()
# function to send logs to)
unix-stream("/dev/log");
# messages from the kernel
file("/proc/kmsg" log_prefix("kernel: "));
# use the following line if you want to receive remote UDP logging messages
# (this is equivalent to the "-r" syslogd flag)
udp();
};

Add another destination for log files generated by billy:

destination df_billy { file("/var/log/billy/messages.log"); };

Add a filter based on IP:

# all messages from billy
filter f_billy { netmask("192.168.1.10/32"); };

There are probably better ways to do filtering than providing a static IP address. Bear with me, I did not want to get any deeper into syslog-ng documentation since this fits the bill.

Add a rule to combine filter and output directory:

# Billy logs
log {
source(s_all);
filter(f_billy);
destination(df_billy);
};

On billy, make sure syslogd is started with option -R x.x.x.x where the latter is the IP address of your syslog archive box.

You should now get messages logged in /var/log/billy/messages.log.

Written by nicolas314

Tuesday 31 July 2007 at 1:31 pm

Posted in Uncategorized

Tagged with , , ,

Wake-on-LAN

with 5 comments

Looking through the BIOS for Junior, I could find no option to activate Wake-on-LAN. The way to achieve that is actually to configure the Ethernet chip directly. Under Debian, this is done with:
# ethtool -s eth0 wol g

The ‘g’ option for wake-on-lan (wol) actually specifies that you want to wake up on magic packets, but there are other interesting options if you want to wake up on other network events. Read the documentation for ethtool.

One important point: this setting only survives until the next boot. If you want to make it persistent, create a file called e.g. wol in /etc/network/if-up.d with the following contents:

#!/bin/bash
if [ "$IFACE" == "eth0" ]; then
ethtool -s eth0 wol g
fi

Make the file executable by chmod +x wol

I can now wake Junior from another Linux machine on the same subnet using tools like wakeonlan or etherwake. The former does not need root privileges to perform, which is safer.

Written by nicolas314

Sunday 1 July 2007 at 11:30 pm

Posted in junior

Tagged with , , , ,

Bricked… and back

leave a comment »

I bricked Junior by mistake.

The little box only has 128 MBytes of RAM which very soon become insufficient, even when running limited pure-network processes. Adding up swap on a Compact Flash is not a good idea, so I was desperately trying to squeeze the last Megs of RAM from the box. I did something stupid and disabled shared video memory in the BIOS. This bricked the box: no boot, no video, no response to keyboard inputs.

Do not disable shared video memory on these boxes!

To unbrick the box: remove the 4 bottom screws. Remove also the screws on the video plug on the back (one on each side), and the screw on the wireless antenna if you have one. Now you should be able to move the parts but be really gentle. Slide out the grey cover, starting from the back, and you should now also be able to remove the bottom part of the box. The upper part stays soldered to the CPU so do not even try to remove it by force.

If you examine carefully the top part you should see the battery. You will not be able to get to it, but you can see where it is soldered because there are two plugs coming out on the other side. Short-circuit these two plugs with a paper-clip, keep it for several seconds. Try booting the box again, just plugging in a screen and keyboard, and see if you got it back. If you did not, short-circuit the plugs again for more seconds.

Re-build the box when you are done.

I guess I will have to make do with 128 Megs. Re-compiling the kernel may not be such a bad idea after all…

Written by nicolas314

Sunday 1 July 2007 at 12:31 am

Posted in junior

Tagged with , ,

Junior working with WPA

leave a comment »

Junior is now working with WPA-based wireless. Hoping it might be useful to somebody else, this here retraces the steps I had to take to make it work.

There are basically two ways you can control the VT6655-based card provided with Norhtec Microclient Jr: through a native Linux driver, or through an encapsulation of Windows drivers achieved by a piece of software called ndiswrapper.

Browsing the VIA web site for drivers only provided a native driver for other versions of the kernel (mostly Fedora). Since the kernel API has changed in between, there is no way to make these work on a Debian Etch kernel (2.6.18-4-486). Going beyond that means pressuring VIA into either releasing the driver sources or releasing a binary version for this very kernel, an effort which would have to be repeated every time the kernel is upgraded to a non-compatible version (i.e. every new release). Forget it.

The other way proved to be the right one.

Through trial and failure, I found out that the default ndiswrapper version available on Debian corresponds to version 1.28, which is kind of late considering the latest version is 1.47. Many bugs corrections have happened in between and some of them are actually related to the VT6655 chip, so you definitely want to install it from the sources. As a side note, the Debian version is anyway only released through sources, you have to follow a non-obvious procedure to install it. A search on your favorite Search Engine for “debian install ndiswrapper” should yield results.

To install from sources: get the tar file from sourceforge. Untar it, cd into the directory you just decompressed and type make to build it. Change user to root and make install should install it all.

Now you have a kernel module that can encapsulate Windows drivers, but you still need to get the drivers. I cannot unfortunately host binary files on this site but you should be able to find them on Norhtec’s web site:

(URL soon published here)

Get the file, unzip it somewhere and cd into the directory. Now ask ndiswrapper to wrap it up with:

ndiswrapper -i VNWL.inf

Once the driver is available, type ndiswrapper -l to check it is actually there:

# ndiswrapper -l
vnwl : driver installed device (1106:3253) present

Now you can load the module into the kernel. Still as root:


# modprobe ndiswrapper

A quick look at kernel logs with dmesg should tell you about the driver being correctly loaded:


ndiswrapper version 1.47 loaded (smp=no)
ndiswrapper: driver vnwl (VNT,01/18/2005,1.30.00.0164) loaded
ndiswrapper: using IRQ 5wlan0: ethernet device xx:xx:xx:xx:xx:xx using NDIS driver:vnwl,
version: 0x1001e, NDIS version: 0x500, vendor:'VIA Networking Solomon Wireless LAN Adapter',
1106:3253.5.confwlan0: encryption modes supported: WEP; TKIPwith WPA, WPA2, WPA2PSK;
AES/CCMP with WPA, WPA2, WPA2PSK

Now you have a working wireless device in your box. You need to declare a new section in the /etc/network/interfaces file. First something like:


auto wlan0
iface wlan0 inet dhcp

Comment out the first line (auto wlan0) if you do not want the wireless interface to be brought up when you boot.

Now you can bring it up and scan wireless networks with:


# ifconfig wlan0 up
# iwlist wlan0 scanning
[...]

At that point you should be able to connect to your wireless network if it is unencrypted. Do not forget to put the correct settings on your access point for MAC address filtering if you use some, and temporarily deactivate encryption.

Now you want WPA, which is provided on Linux through wpa_supplicant. I juggled with a number of versions and compiling the beast from the sources is definitely not the easiest thing I have tried. Good news: the default Etch version works just fine (0.5.5-2). Install it:


# apt-get install wpasupplicant

An excellent point for the Debian package maintainer: wpa_supplicant has been integrated with the network scripts so that it can be controlled from the /etc/network/interfaces file. This is what my file looks like:


iface wlan0 inet dhcp
wpa-ssid MyAccessPoint
wpa-driver wext
wpa-psk 01234567890abcdef...
wpa-key-mgmt WPA-PSK
wpa-group TKIP

Several points:
– Replace MyAccessPoint by your access point’s name
IMPORTANT: specify wext for the driver to be used, not ndiswrapper.
– Replace the key by yours
– I used the most basic WPA settings here. Compare to the settings on your access point.
– You can also use anonymous access points, but I am not sure how they would be declared in this file.
– These settings are for a DHCP server. For static addresses, see the documentation.

All these options and more are described here:
README.modes

That should be all. If your interface is still up, bring it down (ifconfig wlan0 down) and up again:


ifup wlan0

You should see some messages about the DHCP request and finally a success message showing the address you got.

I cannot thank enough the Norhtec guys for their incredible support in my search of the working driver. Junior has just gone one step beyond in terms of capabilities!

Written by nicolas314

Monday 25 June 2007 at 11:28 pm

Posted in junior

Tagged with , , ,

Hunting for a VIA VT6655 driver

leave a comment »

I would like to get Junior to work with wireless, and unfortunately all I can do with the ndiswrapper driver is no crypto or WEP-only. This does not fit the bill: I need to connect to WPA-protected networks with this box.

There are two ways out of this: find a Windows driver that supports WPA correctly with ndiswrapper and wpa_supplicant, or push the guys at VIA to re-compile a driver for the kernel I use (Debian Etch). I asked on the dedicated VIA forums and got no reply so far. Check out the Linux Arena on the following page:

http://forums.viaarena.com/

There is no emergency since the box is currently wired to the network, but enhancing it to support wireless would boost even more its capabilities. I have a project to link to several of my neighbors over Wi-Fi in our own private network and junior would be perfect to take care of the link.

On a side note, I have hooked in a 40Gb USB drive to Junior and they match perfectly. Only USB 1.1 is supported, which makes data exchange a little slow but largely sufficient to serve files over a network. Now I can leave Junior awake at night to download 700-Mb blocks over the Net! With a little bit of scripting it should even be able to start downloads on its own.

Written by nicolas314

Sunday 24 June 2007 at 11:52 am

Posted in junior

Tagged with , ,

WEP Ok

with 3 comments

Junior now has some wireless working… Not exactly what I wanted but at least WEP is working Ok. Here is the path I followed:

I have been dissecting the Internet to find all possible links to a possible driver for Via VT6655, until I stumbled upon this page:

http://www.minipci.biz/support.html

From there I downloaded a large binary file containing lots of drivers, including some for Linux. Tried them all, nothing works but I finally got a version of the Windows drivers I had never encountered before. They load fine with ndiswrapper and judging from the output of dmesg, present a working interface to the kernel.

Unfortunately, it seems I cannot upload binary stuff to this blog so you will have to download them from the above site and get them from the directory “windows 98ME2000XP” in the ZIP archive. They also publish a tiny URL for this ZIP file: http://tinyurl.com/blop7.

For future reference, the files I got had these MD5 signatures:


891b23e6b475aebb26b8a07fef9d73eb VNWL5A.sys
17a711d4271db402dcfa59e8c4084ddb VNWL5B.sys
3918dc675b662e1c0434d53a8a450b86 VNWL.inf

The ndiswrapper version distributed with Debian Etch apparently has problems with this driver, so I un-installed the official version and compiled my own, which I got from ndiswrapper.sourceforge.net.
Once installed, change directory to where you downloaded the above files and get the driver in with:


ndiswrapper -i VNWL.inf

Then load the ndiswrapper module into the kernel:


modprobe ndiswrapper

If everything goes fine, you should see something like this with dmesg:


wlan0: ethernet device 00:xx:xx:xx:xx:xx using NDIS driver:vnwl,
version: 0x1001e, NDIS version: 0x500,
vendor:'VIA Networking Solomon Wireless LAN Adapter ',
1106:3253.5.conf
wlan0: encryption modes supported: WEP; TKIP with WPA,WPA2, WPA2PSK;
AES/CCMP with WPA, WPA2, WPA2PSK
usbcore: registered new driver ndiswrapper

Now configure your interface using the /etc/network/interfaces file:


iface wlan0 inet dhcp
wireless-essid MyAccessPoint
wireless-key 1234567890ABCDEF...

Activate your access point with the same ESSID and WEP key, and switch on the interface with: ifup wlan0. You should now be connected.

For WPA, Debian only needs a version of wpa_supplicant to be installed. With Etch, no need to worry about various configuration files for WPA, all you have to do is configure again /etc/network/interfaces with your WPA parameters, like this:


wpa-ssid MyAccessPoint
wpa-driver ndiswrapper
wpa-psk 1234567890ABCDEF...
wpa-key-mgmt WPA-PSK
wpa-group TKIP

All WPA-related options are documented in Debian. You can find a description e.g. here: README.modes

Unfortunately this stops here. wpa_supplicant reports being unable to associate to the driver but no further reason is given so your guess is as good as theirs.

Many possibilities there: I have seen Via distributes a patched version of wpa_supplicant with the latest version of their drivers, but was unable to compile it. It might simply be a bug or insufficient code in wpa_supplicant, I certainly hope it is not a bug in the Windows driver.

So WEP is now working, which proves if needed that the provided hardware is indeed functional. If you are not worried about your network security, I guess this should be enough to get the ball rolling. If you are living like me in an intensive wireless area, you do not want to use WEP at all. WEP is horribly broken, avoid it whenever possible.

Tough nut to crack, but I will get to the end of it!

Written by nicolas314

Tuesday 19 June 2007 at 10:21 pm

Posted in junior

Tagged with , , ,

Junior’s last news

leave a comment »

NorhTec’s Microclient Jr is sold under many other names.
Check out the following post for more pointers:

Puppy Linux Discussion Forum

Looking up the Net for more information might turn up more results with eBox-2300.

On another topic: I finally got Power Management to work. It was simply a matter of setting up the right flags in the BIOS… Yes, nothing more. Now the box shuts itself down completely when requested to halt. I also wanted the machine to launch /sbin/halt when I press the Power button. This was simply achieved by installing acpid, which comes with this single action by default on Debian Etch.

I also took care of disabling IPv6 in the kernel. Since the machine is staying 24/7 on the Net and my router forwards all IPv6 traffic I do not want to take any risk. It also uses less resources to get all unused modules out of the kernel, and supposedly reduces network latency a bit in the case of IPv6.

For the record: disabling IPv6 on Debian Etch is done by editing /etc/modprobe.d/aliases and replacing this line:

alias net-pf-10 ipv6

by this line:


alias net-pf-10 off

Since Junior is almost never connected to a real screen I do not need so many virtual consoles. Editing /etc/inittab and commenting out the last four consoles (tty) just did the trick:


1:2345:respawn:/sbin/getty 38400 tty1
2:23:respawn:/sbin/getty 38400 tty2
#3:23:respawn:/sbin/getty 38400 tty3
#4:23:respawn:/sbin/getty 38400 tty4
#5:23:respawn:/sbin/getty 38400 tty5
#6:23:respawn:/sbin/getty 38400 tty6

Now, if only I could get wireless to work…

Written by nicolas314

Friday 15 June 2007 at 10:25 pm

Posted in junior

Tagged with ,

Junior’s sound

leave a comment »

Instead of referring to my NorhTec-Microclient-Jr-box, I decided to call the little box Junior. Easier to type and blog about. So Junior was mute until I got help from the outside world, specifically from Axel:

Axel’s Microclient Jr (Seiten auf deutsch)

His pages offer lots of pictures of the box, if you are curious about size or form factor.

Axel writes there he got sound working by using a driver he found on the LTSP project (see links on his page). This means you have to download the relevant sources, install all necessary build tools (compiler, make, linux-headers, etc.), apply some patches manually to the distributed sources, and there you go: sound is working. A few caveats:

– Sound quality is good, but not that good. Do not expect very high quality stuff.
– Recompiling a driver may turn a little hard if you are not familiar with coding in C. You need to change a couple of lines to adapt it to a 2.6 kernel, compile and install. Definitely want a geek around for this.
– The driver is OSS-style, not ALSA. No need to install all ALSA-related stuff here. If you want to change sound levels (without GUI), you need to install ‘aumix’ or something similar.

For the record: the card is identified as SiS7019. You can find more about this card and the associated driver on the LTSP Wiki:


http://wiki.ltsp.org/twiki/bin/view/Ltsp/SoundCards#SiS_7019

We are almost there. Once I get wireless to work, all hardware would have been identified and handled by Debian Etch. More on that topic soon.

Written by nicolas314

Friday 15 June 2007 at 1:36 pm

Posted in junior

Tagged with , ,

NohrTec Microclient Jr

leave a comment »

Just got myself a new toy: a micro-PC initially aimed for embedded applications. This little marvel comes from Thailand, from a company called NorhTec based in Bangkok. You can find all specifications on their web site:

http://www.norhtec.com/products/mcjr/index.html

To get directly to the point, the box I got has:

– One 200-MHz CPU (Bogomips: 400)
– 128 Mb RAM
– Diskless, fanless
– 10/100 Mbit NIC
– Wireless support
– Sound in/out
– VGA out

I plan to use this unit as a jack-of-all-trades on my network: print server, web server, e-mail, web cache, VPN connection from the outside, ssh server, etc. No need for a Graphical User Interface. This box will run daemons 24 hours/day.

First impressions on the hardware: the box is really tiny. It fits in the palm of my hand and does not feel too heavy given its packed contents. The connectors are all packed on the front and the rear, there is no square millimeter left for anything else.

Careful about one point though: the unit was delivered with a power supply that supports 110-240V at 50-60Hz, which means you can basically plug it into any power system on the planet. But: the plug is American (two flat plugs) and does not fit European plugs. Even worse: the plug is not at the end of a cable so that you cannot take of the US plug and replace it with its European counterpart. You really have to buy an adapter. Now, I understand NorhTec is trying to make these beasts as cheap as possible but fitting the power supply with an adequate (European for European shippings, or simply replaceable) plug would have definitely been a bonus.

Installing an OS without using an optical or hard drive is most unusual but really simple. I chose to install the latest Debian at that time (Etch) from the USB port, in this case a USB key. Booting the machine for the first time, you have to get into the BIOS (press DEL) and select USB-something for your boot drive. Plug your USB key in, reboot and you should end up in the Debian installation menu.

How to configure a USB key to act as a boot device for the first time to install Debian? I simply followed the instructions from the Debian install page:

Debian Etch install instructions

For the record: preparing a USB key to install Debian was simply a matter of dropping these files on the key (a single DOS partition):

– vmlinux
– initrd.gz
– syslinux.cfg
– netinst.iso

And then make the key bootable using syslinux. This utility is available both for Windows or Linux. All these files are easily retrieved from a Debian mirror. You can actually choose any iso image you want from the Debian distrib, I chose netinst which gives me just the basics and then enough to get whatever else I might need over the Net.

To act as a hard drive, I purchased a 2Gb Compact Flash card for 20€. Not really expensive for a hard drive, and largely enough for what I intend to do with it. Once the unit had booted I just inserted the flash into its socket to have it recognized by the install procedure. Careful with this socket: there is no mechanism to help you take the card out once it has been inserted in. You can still do it with a knife or pliers but it would have been nice to get something a little more convenient. Oh well…

Debian Etch installation was a breeze. The PC is pretty slow compared to today’s standards, a basic installation took me about 45 minutes, after which I had a fully operational PC. During the next boot, I had to go through the BIOS again and re-declare boot devices. This time there was no option for USB boot, only floppy so I selected that one and the machine now boots correctly off the flash.

Once the PC was booted and on the network, I just changed the Debian repositories to the country I live in, applied the standard apt-get update, apt-get upgrade mantra and that was it!

First package I was missing was openssh-server, which will soon become my only link to this machine. Since I do not plan to leave it connected to screen and keyboard, the network ability is crucial. At that point I could take the box and install it in its definitive place. The only cables going to/from it are network and power. As soon as the ssh server is running, I am able to log into it from my PC and continue the configuration.

Next thing I did was differentiate the prompts on my PC and on the NorhTec box. To avoid doing something stupid on one machine while thinking I am on the other, I went to Bash documentation and found out how to convert my prompt to bright red on the NohrTex box. This seems really trivial but believe me it helps.

For what it is worth, here is my prompt on the tiny box:


export PS1='[e[1;31m]h(u)-W&[e[m] '

Now is time to start the usual hunt for non-working hardware. First issue is the wireless, second is sound. Since I did not get to make any of these work for now, I will leave that for further posts.

My first impressions of this machine are excellent. It is great to finally have a tiny box that remains powered on 24 hours a day without using too much power. It basically means I am able to log into my home network any time of day and from anywhere on the planet and from there, wake up other machines at home as needed. Sure, a WRT54G-based router would give me some of these functionalities but I plan to do so much more with this tiny box…

Written by nicolas314

Thursday 14 June 2007 at 5:31 pm

Posted in junior

Tagged with ,