Alix.2D + Voyage Linux = a DIY home NAS

This is my 3th attempt to build a DIY home nas.
The first attempt with a Raspberry PI was a disaster: the well-known “USB POWER BUG” makes my NAS (with 2 USB DISK) pretty unstable.
The second attempt with an ALIX board + voyage linux crashes without any reason, but I admit that the initial setup was a mess…

The goal is:

  • An home NAS with 2 external USB: a little one EXT-4 for my mac TimeMachine (using Netatalk) and a bigger one NTFS as a generic storage (using Samba)
  • TrasmissionDaemon with WEB interface, as thin torrent client

Now is up and running. But if it will die again I think that I will buy a QNAP šŸ™‚

Install VOYAGE LINUX

Read the Voyage Linux README

Install VIM
# apt-get install vim
Fix sudo
# chown -R root:root /usr/bin/sudo
# chmod u+s /usr/bin/sudo
# chown root:root /usr/lib/sudo/sudoers.so
# chown root:root /etc/sudoers
# chown root:root /etc/sudoers.d/
# chown root:root /etc/sudoers.d/README
# chown root:root /var/lib/sudo

visudo --- add user
Add new user
# useradd -m -s /bin/bash sarbyn
# passwd sarbyn
Install NTFS-3G
# apt-get install ntfs-3g
Fstab and volumes
# mkdir /mnt/TimeMachine
# mkdir /mnt/MUSIC
# chown sarbyn:sarbyn /mnt/MUSIC
# chown sarbyn:sarbyn /mnt/TimeMachine

UUID=206606FF6606D606 /mnt/MUSIC ntfs-3g   rw,defaults     0       0
UUID=03c90579-88f0-4478-ae8d-adc64972a07d /mnt/TimeMachine ext4 defaults 0 0
Enable swap file
# mkswap /mnt/MUSIC/swapfile
# swapon /mnt/MUSIC/swapfile
Samba
# apt-get install sambaĀ samba-common-bin
# service samba stop
# mv /var/lib/samba /var/tmp/samba
# ln -s /var/tmp/samba /var/lib/samba
# smbpasswd -a sarbyn
[mnt]
path = /mnt
read only = Yes
guest only = Yes
guest ok = Yes

[mnt_RW]
path = /mnt
read only = No
valid user =Ā sarbyn
browseable = yes
writable = yes

Next add these directories to the file etc/default/voyage-util so it now contains the line:
VOYAGE_SYNC_DIRS=”/var/cache”

SSH
$ mkdir .ssh
$ chmod 0700 .ssh/
$ cd .ssh
$ ls
$ vim authorized_keys
$ chmod 600 authorized_keys

Disable root login and plaintext login in /etc/ssh/sshd_config file

Transmission
# apt-get install transmission-daemon
# service transmission-daemon stop
# cp settings.json /etc/transmission-daemon/
# service transmission-daemon start

Next add transmission directories to the file etc/default/voyage-util so it now contains the line:
VOYAGE_SYNC_DIRS=”/var/cache /var/lib/transmission-daemon”

FIX cracklib config
# apt-get install cracklib-runtime
# create-cracklib-dict /usr/share/dict/*

Before
root@voyage:/var/cache/cracklib# ls -la
-rw-r--r-- 1 root root 1024 Oct 4 13:28 cracklib_dict.hwm
-rw-r--r-- 1 root root 16 Oct 4 13:28 cracklib_dict.pwd
-rw-r--r-- 1 root root 16 Oct 4 13:28 cracklib_dict.pwi
-rw-r--r-- 1 root root 65 Oct 4 13:17 src-dicts

AFTER
root@voyage:/var/cache/cracklib# ls -la
-rw-r--r-- 1 root root 1024 Oct 7 22:46 cracklib_dict.hwm
-rw-r--r-- 1 root root 412696 Oct 7 22:46 cracklib_dict.pwd
-rw-r--r-- 1 root root 22968 Oct 7 22:46 cracklib_dict.pwi
-rw-r--r-- 1 root root 65 Oct 4 13:17 src-dicts
# cd /usr/lib/
# root@voyage:/usr/lib# ln -s  /var/cache/cracklib/cracklib_dict.hwm
# root@voyage:/usr/lib# ln -s  /var/cache/cracklib/cracklib_dict.pwd
# root@voyage:/usr/lib# ln -s  /var/cache/cracklib/cracklib_dict.pwi
Netatalk

*DON’T USE NETATALK FROM DEBIAN REPOS*
The older version of netatalk are VERY…VERY unstable. Download the sources from Netatalk site and follow —>Ā this tutorialĀ <—

# apt-get install build-essential libssl-dev libgcrypt11-dev libkrb5-dev libpam0g-dev libwrap0-dev libdb-dev libmysqlclient-dev libavahi-client-dev libacl1-dev libldap2-dev libcrack2-dev systemtap-sdt-dev libdbus-1-dev libdbus-glib-1-dev libglib2.0-dev tracker libtracker-sparql-0.14-dev libtracker-miner-0.14-dev

Next add /usr/local/var/netatalk to the file etc/default/voyage-util so it now contains the line:
VOYAGE_SYNC_DIRS=”/var/cache /var/lib/transmission-daemon /usr/local/var/netatalk”

# apt-get install avahi-daemon

# insserv avahi-daemon
# insserv netatalk
# /etc/init.d/avahi-daemon start
# /etc/init.d/netatalk start

Edit “/usr/local/etc/afp.conf”.

[Global]
; Global server settings
uam list = uams_dhx.so,uams_dhx2.so
set password = yes

[MusicAFP]
    path = /mnt/MUSIC

[TimeMachineAFP]
    path = /mnt/TimeMachine
    time machine = yes

Add user to Netatalk (using the SHORT password)

# afppasswd -an sarbyn
FIX BOOT

The NTFS volume does not mount at boot, so add some lines on /etc/rc.local

# vim /etc/rc.local

service transmission-daemon stop
mount -a
swapon /mnt/MUSIC/swapfile
service transmission-daemon start

# chmod +x /etc/rc.local
Fix timezone
# ln -sf /usr/share/zoneinfo/Europe/Amsterdam /etc/localtime
NOIP client
# wget http://www.no-ip.com/client/linux/noip-duc-linux.tar.gz
# tar xzf noip-duc-linux.tar.gz
# cd no-ip-2.1.9
# make
# make install

Next add /usr/local/etc/ to the file etc/default/voyage-util so it now contains the line:
VOYAGE_SYNC_DIRS=”/var/cache /var/lib/transmission-daemon /usr/local/var/netatalk /usr/local/etc”

PUT APT cache on external disk
# remountrw
# cd /var/cache
# rm apt
# ln -s /mnt/MUSIC/APT_CACHE/ apt
# remountro
Clear APT cache
# apt-get clean
Final step – do a CompactFlash backup

Now is all setted up but it’s better to do a CompatFlash backup using dd

# dd if=DISK of=voyage-backup.img bs=1m
EXTRA – Mount image done with DD
# apt-get install kpartx
# kpartx -a MUSIC/backup_voyage_2014_10_09.iso
# mount /dev/mapper/loop0p1 /mnt/cf -o loop,ro
 

HOWTO – Debug an AOSP – CM java application

Just a little reminder for the future

Run DDMS and select the process that you want to debug (for example, com.android.calendar).

Now, in eclipse, you can attach to the emulator or device:

  1. Run > Open Debug Dialog…
  2. Right-click “Remote Java Application”, select “New”.
  3. Pick a name, i.e. “android-debug” or anything you like.
  4. Set the “Project” to your project name.
  5. Keep the Host set to “localhost”, but change Port to 8700.
  6. Click the “Debug” button and you should be all set.

Note that port 8700 is attached to whatever process is currently selected in the DDMS console, so you need to sure that DDMS has selected the process you want to debug

 

Bluetooth HC-06 + Arduino + RX1 and TX1

Yes…I’m alive.
It’s about 1 year that I didn’t post something on this wonderful blog but I’ve been quite busy.

But some days ago I bought a bluetooth module (HC-06, the cheapest module for Arduino) in order to integrate wireless capability in my HomeTemp project, and I want to share a simple thing about its configuration:

DO NOT WIRE THE MODULE TO RX1 (pin 0) AND TX1 (pin 1).

I tried theĀ easiest way to connect the module to an Arduino UNO board, using the standard RX1 and TX1 pin, but the behavior was a little confusing:

  • The module sends correctly data via bluetooth
  • The module does not receive any data via bluetooth

I didn’tĀ understand why…maybe a “conflict” with the standard Serial USB communication. But after some experiments Ā I found a post somewhere that suggests to use the “SoftwareSerial” Arduino Library and use two others PIN (10 and 11). With this simple configuration the following example works like a charm šŸ™‚ Not all pins support change interrupts, check the SoftwareSerial page and check which pins should work.

Pair the device with your PC (the default pairing PIN is 1234) and then open a serial console (on Mac OSX I use “screen /dev/tty.XXXYYZZZ). You are now able to read and send data.

I hope it could be helpful to someone.


#include <SoftwareSerial.h>
#define LED_PIN 12

SoftwareSerial bluetoothSerial(10, 11);

void setup() {
  pinMode(LED_PIN, OUTPUT);  

  
  Serial.begin(57600);

  bluetoothSerial.begin(9600);
  bluetoothSerial.println("I'm ready");
  
  digitalWrite(LED_PIN, LOW);
  delay(300);
  digitalWrite(LED_PIN, HIGH);
  delay(300);
  digitalWrite(LED_PIN, LOW);
  delay(300);
  digitalWrite(LED_PIN, HIGH);
  delay(300);
  digitalWrite(LED_PIN, LOW);
  
  Serial.print("Ready to go");  

}

void loop() {

  if (bluetoothSerial.available() > 0) {
    char inChar = bluetoothSerial.read();
    if (inChar == '1') {
        digitalWrite(LED_PIN, HIGH);
        bluetoothSerial.print("ON");
    }
    else if (inChar == '0'){
        digitalWrite(LED_PIN, LOW);
        bluetoothSerial.print("OFF");
    }
  } 

}
 

A new toy for me

This is NERD time. But today IĀ bought an “old” Lego Mindstorm NTX 2.0 set on Ebay

box_NXT2

I’m so happy šŸ™‚

 

CanonTimer Version 1

Welcome to my first Arduino DIY project. I need a intervalometer in order to do some time-lapse video. On amazon or ebay you can find a standard timer for less than 40ā‚¬ but I want to build it by myself šŸ™‚

A lot of DIY timer can be discovered using Google, but this is too simple. So I bought an Arduino Uno, some electronics parts, and now I can share my CanonTimer project with the first version!

SchemaYou can found the Arduino code and schematics on my Bitbuchet GIT repository.

In this first version the user interface is very simple: Ā there are nine hardcoded delays assigned to nine different programs

  • 5 seconds – Program 0
  • 10 secondsĀ – Program 1
  • 15 secondsĀ – Program 2
  • 30 secondsĀ – Program 3
  • 45 secondsĀ – Program 4
  • 60 secondsĀ – Program 5
  • 90 secondsĀ – Program 6
  • 120 secondsĀ – Program 7
  • 180 secondsĀ – Program 8
  • 300 secondsĀ – Program 9

You can select the time delay using the right button. Once the program is selected, you can start the timer using the left button. Every XX seconds the led will blink.

Yes…the led…in this first version there isn’t a real connection to a Canon Camera. In the upcoming releases I will introduce some other improvements:

  • Wired connection to the Canon Camera šŸ™‚
  • A more complete user interface, without hardcoded time delays but with a 4 digit 7-segment display and (+) and (-) buttons in order to specify a custom delay

 

 

Welcome back, and happy new year!

I’m back…and I’m back with a lot of news šŸ™‚

  • First of all, I changed the website hosting. After some years of (free) web hosting I had to search for another solution for this site and for another two blogs that I manage. (www.asvirtus.it and www.bandacastanoprimo.it). Ā My choice was the Shared Hosting by DreamHost.com. Cheap, no limits, fast setup, easy control panel….so perfect to me!
  • After four months waiting for the 9$ Arduino BoardĀ (my shipment is lost, I think) I decided to buy an Arduino Uno on Ebay for a new small project…more news coming soon šŸ™‚Schema
  • I published a new little Android software on Google Play, “Webcam Valle d’Aosta”: a very simple application that shows the main webcam of Italian Alps (no english translation, only italian)
  • The last news is…my new Laptop. Ā After 5 years I said “GoodBye” to my old Sony Vaio and I’ve joined the “Apple” side with a beautiful and powerful MacĀ©Ā®ā„¢ Book Pro Retina 13”. Yes….I’ve always been an Apple enemy and a great fanboy of OpenSource and Linux. But now I’m old…and bored of spending my time configuring my laptop at every “apt-get upgrade”. A new laptop with Windows 8 is the worst thing, so I chose a “working and easy to use” version of Linux: MacĀ®ā„¢Ā© OS-X. I can do everything with it: coding and programming (arduino, android, cyanogenMod), photo editing, playing with my favorites games (Diablo III for example works like a charm on my RetinaĀ©ā„¢Ā® display) etc etc etc…Yes…the MBP-Retina is a little bit expensive (with expanded RAM – 16GB ), but this little boy is, simple, perfect.

So…happy new year and stay tuned for the next news šŸ™‚

 

Merged

image

Tonight my changes goes in main CyanogenMod 11.0 branch. After years of using open source software this is my first contribution to a project.
I hope that more will come šŸ™‚

 

Finally….a feedback from CyanogenMod creator

Yeah! A little bit proud of it šŸ˜‰
image

 

One small step for man…

…one giant leap for mankind.

gerrit_review

 

Waiting for feedback šŸ™‚

 

Fixed .classpath file for Motorola Jordan

I think that I am the last CyanogenMod Motorola Defy developer in the whole world. But if you plan to develop something for the old Motorola defy (aka jordan aka mb526) and your eclipse classpath is completely messed up, you can find a fixed “.classpath” in my GitHub repo. Simply download the “ide/eclipse/.classpath” file and put it in your project folder. It fixes all the FM Radio releated classes and libraries (fmradio, com.stericsson … etc etc): with this .classpath file you can use Eclipse in order to debug (on device) your mods.