Rising from the ashes: NSLU2

Despite having a Synology Diskstation DS212+ for storing my data (photos, videos and PC/laptop backups), I also backup that data to an external disk connected to my faithful Linksys NSLU2 bought in 2005 using rsync from the Diskstation.

The NSLU2 is flashed ith the openSlug 5.3Beta firmware since 2009 (when it came out), with the operating system installed in a crappy 2GB SD card.

But this weekend due to a power failure, the NSLU2 failed to boot up. It kept the amber led blinking signalling that it couldn’t forward from the initial stages of booting up.

Using my desktop computer, I’ve FSCK’ed the external disk filesystem, that had some inconsistencies, nothing serious (most of the time it is dormant), and FSCK’ed the SD card, and, well, most of the /etc and /var directory where gone.

Due to having a backup of the SD card (these things die…), I’ve recovered the /etc directory, but still the NSLU2 didn’t boot.

Booting up without SD card, the NSLU2 did finish booting up, but it wouldn’t ping, neither the original IP address (192.168.1.77) neither the configured IP address. All I had on my Linux machine was incomplete at the arp table…

nslu2 (191.168.1.32) at <incomplete> [ether] on enp4s0f2

Not good….

I’ve flashed it again with the openSlug firmare, but still I was unable to ssh to it so I could initialize. Because I was able to flash it again with the upslug2 tool, it mean that the ethernet port was ok, and probably everything was ok, except the NVRAM settings that define the ip address where pretty much corrupted… Let’s hope that.

So the solution was to boot into RedBoot and erase the NVRAM (http://www.nslu2-linux.org/wiki/HowTo/ResetSysConf) with the following command: fis erase -f 0x50040000 -l 0x20000  (Attention to this command!!!! Don’t get it wrong)

And then upgrade from the RedBoot interface. The original Linksys firmware was flashed and after rebooting this firmware initialized the NVRAM with default settings: IP address 192.168.1.77, and bingo, ping works, and I can access the original Linksys Web Interface. On the web interface I’ve configured the old IP address, DNS, host name, and so on, and rebooted.

After reseting the NVRAM from redboot you must install the original Linksys firmware, because the openSlug doesn’t initialize the NVRAM.

Everything was fine, and the NSLU2 was working on the new IP. From this point on I’ve just flashed again the openSlug firmware, and formatted the SD Card (turnup with the memstick otion), and configured everything again (crontab, ntpclient and rsync daemon).

In no time I had the Diskstation again backing up to the NSLU2 external disk.

So, welcome again NSLU2 :)

Good Morning: Step in to Arduino….

So I’ve bought one of those cheap Arduino kits off eBay… In fact I’ve bought the cheapest one that I could find from a European seller… Bought it on Chinese shop with an UK warehouse, but the kit came from Sweden… Talk about globalization… After waiting around 10 days, I’ve got my kit, and in 5 minutes a LED was blinking in pure RGB glory (just red…).

The kit came with a UNO R3 clone, identical to the original, and several other components.

It depends what you want to do with your Arduino, but just to have an idea what came with my Kit:

- Some LED’s, push buttons, resistors, 7 segment (single and 4 side by side) and led matrix.

- One shift register 74hc595.

While the leds and the single segment can be driven by Arduino pins, for the led Matrix e the 4 7-segment display the shift register allows to drive them and use a minimal number of pins.

- An Infra red receiver and small remote. This is great because it allows to have multiple inputs (the remote switches) only using a single input.

- A 16×2 LCD display. I never used it directly, and just also bought an I2C driver for it, so I only need 2 pins to drive it and 2 pins for powering it.

- One servo SG-9 motor, and one stepper motor with a ULN2003 driver.
This allows to do some basic learning with these type of motors, but I think to do something useful, more motors are needed.

- An expansion shield with a mini bread board. Not used yet.

- A larger breadboard and some dupont cables. These last item are only enough for some basic experiments but for more advanced stuff there is the need to buy more…

- A 9V battery clip for providing standalone power

- An USB cable.

- Some assorted stuff. (On pot, flame sensor, LDR, tilt switch, etc…)

So, it is worth it to buy this kind of kit?

The short answer, yes, but for intermediate levels or more advanced levels, some more items are needed to be added to the kit, namely cables, and to allow the use of the 16×2 lcd while having pins available, at least an I2C driver/shield for the lcd. This is cheap out of ebay, works fine, and allows introducing to the I2C protocol

JVM Peer Gone in WebLogic T3 connection

So I have this exception when connecting to a FileNet P8 API from my Linux Machine:

com.filenet.api.exception.EngineRuntimeException: FNRCE0040E: E_NOT_AUTHENTICATED: The user is not authenticated. Message was: java.net.ConnectException: t3://1.2.3.4:9210: Bootstrap to 1.2.3.4/1.2.3.4:9210 failed. It is likely that the remote side declared peer gone on this JVM  at com.filenet.apiimpl.core.UserPasswordToken.getSubject(UserPasswordToken.java:121)
at com.filenet.api.util.UserContext.createSubject(UserContext.java:288)

This happens when connecting to a WebLogic Cluster and not into a single node (Well it might happen with a single node…).

The solution?

Easy: just add to the host files of the client machine the name and ip address of each weblogic cluster node.

SSH over HTTP Proxy

Using SSH to connecting to an host when an HTTP Proxy is between the client and the host, can not be done directly without some configuration.

On Linux based machines the solution is to install and run corkscrew, a program that can tunnel the SSH protocol through an HTTP Proxy.

So how to do the configuration?

1) First install the corkscrew program with your package manager. On Ubuntu family: apt-get install corkscrew

2) Then you need to configure SSH to use corkscrew when connecting to the host that has a http proxy between.

3) Goto to your home directory and change to the hidden directoy .ssh within a command shell window.

4) Create or edit a file named config. The name is just config. No extensions.

5) Add the following lines to the config file

Host <IP_of _remote_host>  
 ProxyCommand corkscrew <IP_of_HTTP_Proxy> <HTTP_Proxy_Port> %h %p <auth_file>

Where the <IP_of_remote_host> is the public ip address of the host where you wish to connect.

The <IP_of_HTTP_Proxy> and <HTTP_Proxy_Port>  are the IP address and Port of you local http proxy server that you wish to go through.

And finally, if your proxy server requires authentication, by username and password, just give a complete path to a file where Proxy credentials are stored, for example /home/primalcortex/.corkscrew_auth

This file content must be something like:

username:password

For example a complete config file example:

Host 78.0.1.3
    ProxyCommand 192.168.1.1 8080 %h %p /home/primalcortex/.corkscrew-auth

and the .corkscrew-auth file:

myproxyuser:rtwertjwe4

6) Just connect now:

ssh myremoteuser@78.0.1.3

or when not using the default ssh port:

ssh -p 12345 myremoteuser@78.0.1.3

7) Done!

So why we need this?

Well, first is of course, to access a remote machine, but ssh can forward local ports to remote ports, and this is important because, with this feature we can use Thunderbird to directly connect to a remote server by using the standard IMAP and SMTP protocols through an HTTP proxy.

MySQL on a Ubuntu VPS

Using the great site lowendbox.com I’ve “bought” a Ubuntu based VPS (Virtual Private Server) so that I can use for my testings…

Anyway, I needed to install MySQL database on this Ubuntu Server based VPS, which is simply done by running the following command:

apt-get update
apt-get install mysql-client mysql-server

During the installation process a password for the root user is required. Just make sure that it’s strong enough (Hint: use keypass password generator…)

After installing and running the MySQL server is available at port 3306 and normally only available at the loopback address. But anyway I’ve changed the local firewall rules to block all connections to port 3306 from outside the loopback adapter: Just edit the /etc/rc.local file and add the following lines before the exit 0 command

iptables -A INPUT -p all -s localhost -d localhost -j ACCEPT
iptables -A INPUT -p tcp --destination-port 3306 -j REJECT

Then as the root user just run the file: /etc/rc.local and make sure that the rules are active:

root@vpss:~# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     all  --  localhost.localdomain  localhost.localdomain 
ACCEPT     all  --  localhost.localdomain  localhost.localdomain 
ACCEPT     all  --  localhost.localdomain  localhost.localdomain 
ACCEPT     all  --  localhost.localdomain  localhost.localdomain 
REJECT     tcp  --  anywhere             anywhere             tcp dpt:mysql reject-with icmp-port-unreachable
ACCEPT     all  --  localhost.localdomain  localhost.localdomain 
ACCEPT     all  --  localhost.localdomain  localhost.localdomain 
ACCEPT     all  --  localhost.localdomain  localhost.localdomain 
ACCEPT     all  --  localhost.localdomain  localhost.localdomain 
REJECT     tcp  --  anywhere             anywhere             tcp dpt:mysql reject-with icmp-port-unreachable

And that’s it.

Now we need a backup policy so that anything goes wrong, at least we have some data to recover…

 

 

Execute a simple Java Console application

How to execute a simple java console program, with a main function?

Sometimes whe need to build a simple java program to test some concept/code/whatever.

So the code is something like (grabbed from stackoverflow for my quick reference):

Sun’s tutorial contains a complete demonstration, but here’s another one from scratch. You need two files:

Test.java:

public class Test {

   public static void main(String[] args){
      System.out.println("Hello world");
   }
}
Then create a Manifest.mf file with the following content:

Manifest-version: 1.0
Main-Class: Test

Then compile the Java source file and create the jar file:

javac Test.java
jar cfm test.jar Manifest.mf Test.class
java -jar test.jar

Output:

Hello world

Synology Mail Station with POP3 retrieval – Hibernation issues

After installing and enabling Synology Mail Station (RoundCube), I added a POP3 external account, so that account’s mail also was available at RoundCube’s interface on my Synology.

The issue is that after that change/configuration the NAS didn’t hibernate any more.

I thought that the issue was related to the pooling interval to the POP3 account, and I was right, it was set to 5 minutes by default. I’ve changed to 4 hour’s (240 minutes), but checking the logs I could see that the pooling was still at 5 minutes… and still the NAS wouldn’t hibernate.

So a quick check I’ve found out that the fetchmail process that fetchs the mail from the external POP3 accounts reads it’s configuration files from /var/packages/MailStation/target/roundcubemail/ext

In my case the POP3 account was defined on the admin accounts, and so there is an admin_fetch file, which might be different if other users are using the POP3 external accounts feature.

Editing this file there is a line

#### .fetchmailrc
set daemon 300

Which means pooling every 5 minutes (300 seconds)

I’ve changed the value to 21600 (4 hours), and waited for the next NAS restart.

After that pooling was set to every 4 hours and the NAS does hibernate now.

Didn’t bother to much to see how to restart the fetchmail process without rebooting the NAS, but probably restarting the Mail Station packages will suffice.

How to check Apache Httpd version

This is a quick post regarding the how to check the Apache httpd version.

The simple way is just to run the following command: httpd -v

But on Linux, an error might crop up, namely: ./httpd: error while loading shared libraries: libexpat.so.0: cannot open shared object file: No such file or directory

So solve this issue, just run first the following command on the sbin httpd instalation directory:  source envvars and then the httpd -v command should work ok.

 

[K]Ubuntu on the Asus N73SV video issues – i915, Nouveau, Nvidia and Bumblebee

Well, after a month on using this Asus Laptop N73SV there are some issues with it.

The first one, and I’m not sure if it’s a driver issue or just a plain hardware issue is that the external connected monitor was working fine, and then started to have a blue tint and now it has a green tint. So first I wonder if the VGA cable or the monitor itself was bad, but replacing it by another same monitor brand and model  and different VGA cable, it has shown the same issues. So Ok, it’s a laptop issue that some HP owners are also having… Just search for HP an video tint… Removing the battery and power, waiting some time, and booting up with the external monitor, even the ASUS logo is tinted… So it’s not a K/Ubuntu issue. Solution? None so far. I have to try with a different monitor/and cable namely HDMI.

The second part of this post related with the video issues that I have is due to the fact that this N73SV has dual cards: an Intel i915 and NVidia GT540M. While trying to debug the above issue, I ended up with no desktop effects on KDE KDM by messing around with the desktop effects options… Whatever I did to enable them I was also greeted with the message that Effects couldn’t be enabled. So issue was related to the fact that the GLX libraries couldn’t be found/loaded… When running glxgears this error appear:

name of display: :0.0
Xlib: extension “GLX” missing on display “:0.0″.
Xlib: extension “GLX” missing on display “:0.0″.

The solution:
I’ve removed bumblebee and nvidia, which cleared the issue:

apt-get purge bumblebee
sudo apt-get purge nvidia*
apt-get install –reinstall xserver-xorg-video-intel libgl1-mesa-glx libgl1-mesa-dri xserver-xorg-core
dpkg-reconfigure xserver-xorg
reboot

And after this I could enable  again Desktop effects but I was using the default Intel driver and the Nouveau driver.

Finally, I’ve installed again MrMee/Bumblebee, which by itself installed again the Nvidia drivers, and after that I could only boot into Recovery Mode, because a normal start wouldn’t give me the Kubuntu boot logo and at final boot stage I just had a black screen with an hanged computer…

This issue is due to the fact that the nouveau driver is/was enabled, and I had to disable it. I found no complete instructions for doing that, but these do work:

The nouveau driver needs to be disabled, by editing two files:

/etc/modprobe.d/blacklist.conf

Add at the end of this file the following line: blacklist nouveau

And then, the other file to edit it depends of your grub version. For Grub2 , there is the need to add the following to the file /etc/default/grub

GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash pci=nomsi nouveau.blacklist=1

And then run the command: update-grub2

On Grub1, just edit the menu.lst file and add the nouveau.blacklist=1 to yur booting kernel options, keeping in mind that after a kernel upgrade you need to blacklist the module again.

Booting up now with the Intel Driver and the Nvidia driver installed by Bumblebee should work.

Portuguese Steam Engine train at the Douro

One of my favourite shows at the Travel Channel is the one named “The Great Scenic Railways Journeys”. North America has a lot of private and volunteer steam engines trains that are a tourist attraction, and at the same time, keep it’s pre-industrial and industrial history. And this on two countries that have at most 250 years of “modern” history.

Portugal despite it’s huge 1000 year history and contribution to the global world history is famous for  forgetting and letting rot it’s assets…

So it’s good to see, again this year, an old steam engine train on one of the more beautiful rail-roads in Europe and across the OPorto wine region is back in action:

If your in Oporto area this year, don’t miss it: Every Saturday until the 1st of October.