Monday, February 22, 2016

SmartOS first steps

Recently I was looking at SmartOS because I read an article on the net.
At first, I didn't quite understand what it was exactly. Then I decided to install it and see what it is.

So here is some information from a beginner point of view. What I will say is maybe not 100% accurate, but I will try my best. The goal of this post is to show you how to start playing with SmartOS. What I will show is just good for testing purposes!

Here is a quick explanation for someone who is used to work with VirtualBox:

SmartOS is like if VirtualBox is transformed into a OS.

And from Wikipedia:

SmartOS is a free and open-source SVR4 hypervisor, based on the UNIX operating system that combines OpenSolaris technology with Linux's KVM virtualization.

With SmartOS you can create virtual machines really easily. It is an operating system with the very minimum. The size of the ISO is around 155Mb.

In the setup described below, we will use VirtualBox to host a virtual machine using SmartOS called SmartOS Manager.

Here is a little schema:

So "SmartOS manager" is a guest (for VirtualBox) and it is also a host to manage SmartOS VMs.

How to setup something really basic

  • install VirtualBox
  • download the latest ISO file for SmartOS
  • open VirtualBox and create a new VM with these settings
    • Name: SmartOS manager
    • Type: Solaris 
    • Version: Oracle Solaris 11 (64-bit)
    • 2GB of ram
    • VDI disk of 16GB
Don't start the VM yet. Go to the settings of this VM and click on Network. Then select:
  • Attached to: Bridged Adapter
  • Adapter type: Intel PRO/1000 MT Desktop
  • Promiscuous Mode: Allow All
Now you can start the VM. It will ask you to select the installation disk. Just choose the ISO file downloaded earlier.

SmartOS will ask you some questions about your setup:
  • IP address
  • Default gateway
  • DNS
  • NTP server
  • Host
  • Default DNS search Domain
  • Password for root account
  • Data pool (where VM's will be installed), just type "y"
That's it! Now you should see that:
The system will now finish configuration and reboot. Please wait...
rebooting...
Great. Now let's see how to create a VM. By the way, in the world of SmartOS, a VM is called a zone.

Now, ssh to the VM and run the command to see all pre-configured zones:
$ imgadm avail
UUID                                  NAME     VERSION     OS       TYPE          PUB
f669428c-a939-11e2-a485-b790efc0f0c1  base     13.1.0      smartos  zone-dataset  2013-04-26
9eac5c0c-a941-11e2-a7dc-57a6b041988f  base64   13.1.0      smartos  zone-dataset  2013-04-26
...

As you can see there are a lot available. The one that we will use is (because it is the latest "base-64"):
96bcddda-beb7-11e5-af20-a3fb54c8ae29  base-64-lts  15.4.0  smartos  zone-dataset  2016-01-19

Import (download) the VM and wait a little bit:
$ imgadm import 96bcddda-beb7-11e5-af20-a3fb54c8ae29
Create a VM manifest file:
$ vi /root/web01.json
{
 "brand"              : "joyent",
 "image_uuid"         : "5c7d0d24-3475-11e5-8e67-27953a8b237e",
 "alias"              : "web01",
 "hostname"           : "web01",
 "max_physical_memory": 512,
 "quota"              : 7,
 "resolvers"          : ["8.8.8.8", "208.67.220.220"],
 "nics"               : [
                         {
                           "nic_tag": "admin",
                           "ip"     : "10.88.88.52",
                           "netmask": "255.255.255.0",
                           "gateway": "10.88.88.2"
                         }
                        ]
}

Resolvers: set the same DNS servers as you did for the SmartOS manager
IP: use an IP in the same network as the SmartOS manager
Gateway: same as the SmartOS manager

Create the VM:
$ vmadm create -f web01.json

Now you can list the existing VM;
$ vmadm list
UUID                                  TYPE  RAM      STATE             ALIAS
25ac9366-21ad-4942-a98d-f35373c3cf40  OS    512      running           web01

And to login:
$ zlogin 25ac9366-21ad-4942-a98d-f35373c3cf40

From there, you should be able to ping google:
$ ping google.com
google.com is alive

Now you can play with this VM. To install packages:
$ pkgin up
$ pkgin in vim
$ pkgin in gcc47
$ pkgin in gmake

As a sidenote, to install Java, you can download the archive from Oracle website. In my case, I used the Solaris x86 64-bit JDK.

To exit zlogin, press "~." (without double quotes).

Monday, February 8, 2016

How to delete a VirtualBox VM using command line

VirtualBox comes with a GUI that let you easily manage your virtual machines.
However, you may have no Desktop and have to manage your virtual machines via command line.

There is a great tools called vboxmanage that let you do anything you want. I will show you how to completely delete a virtual machine with vboxmanage.

First you should get the name of the VM you want to delete:
$ vboxmanage list vms
"MyVM" {bc0f9b2a-1c49-4771-8179-610a5bf10578}
"My second VM" {a2b9f0ea-3c48-4770-8179-610a5bf10578}
"My third VM" {9b2aae0f-6c48-4771-8179-610a5bf10578}

Identify the VM you want to delete and make sure you don't delete the wrong one, because once you execute the following command, there is no confirmation.

Here is what will do the following command:

  •     all hard disk image files, including differencing files, which are used by the machine and not shared with other machines;
  •     saved state files that the machine created, if any (one if the machine was in "saved" state and one for each online snapshot);
  •     the machine XML file and its backups;
  •     the machine log files, if any;
  •     the machine directory, if it is empty after having deleted all the above.


Ready to run the command to delete the VM? Here is the command:
$ vboxmanage unregistervm < name or uid > --delete

For example:
$ vboxmanage unregistervm MyVM --delete
$ vboxmanage unregistervm "My second VM" --delete
$ vboxmanage unregistervm 9b2aae0f-6c48-4771-8179-610a5bf10578 --delete

Remember there is no confirmation, as soon as you press enter the VM will be deleted.

Source: https://www.virtualbox.org/manual/ch08.html#vboxmanage-registervm

Tuesday, March 3, 2015

How to replace a disk in RAID6

On one of the server, a disk had some problems so it was time to change it.
Machine is Ubuntu 10.04 with 4 disks in RAID 6 and using LVM.

First, let's "remove" the failing disk (sdb2) from the RAID:
$ mdadm --manage /dev/md0 --fail /dev/sdb2
mdadm: set /dev/sdb2 faulty in /dev/md0

$ mdadm --manage /dev/md0 --remove /dev/sdb2
mdadm: hot removed /dev/sdb2 from /dev/md0

Now if you run lsblk you can see that the disk doesn't belong to the RAID.

-> shutdown the machine
-> replace the disk
-> start the machine

When the machine started, there was a problem with grub and grub rescue command prompt showed up.

To avoid to mess with grub, I decided to use Ubuntu Desktop live CD. I download it on a USB stick and boot the machine on it.

I had the following issue:
missing parameter in configuration file. keyword path
To fix it, simply type live and press enter.
Note: if you hit tab, you can see a list of options.

Perfect, it is working. Now let's install some packages:
$ sudo apt-get install mdadm lvm2

Let's create the partition of the new disk (didn't work for me):
$ parted -a optimal /dev/sdb
(parted) mklabel gpt
(parted) mkpart primary 1 2
(parted) set 1 bios_grub on
(parted) mkpart primary 2 -1
(parted) set 2 raid on
(parted) print

With this method, there was a small unallocated partition at the end... So I couldn't add the disk to the RAID because the size of sdb2 was too small.

Instead I used dd.
First you need to calculate the count parameter.
count = (128*N)+1024
Where N is the number of partitions you have. In this case I had 2, so the result is 1280.

The following commands will copy the partition table from /dev/sda to /dev/sdb. Make sure you type the second command correctly!

$ dd if=/dev/sda of=GPT_TABLE bs=1 count=1280
$ dd if=GPT_TABLE of=/dev/sdb bs=1 count=1280

Then I had to reboot the machine.

Finally add /dev/sdb2 to the RAID:
$ mdadm --manage /dev/md0 --add /dev/sdb2
mdadm: added /dev/sdb2

Then it will take time to repair everything. You can see the process using this command:
$ cat /proc/mdstat

My original disks are Seagate and I tried to add a Western Digital. Unfortunately the size was different by 1M, so I couldn't use the WD disk. I ordered a similar Seagate disk, and the size was OK.
The disk couldn't be added because the size was smaller... and by not much. For example(fdisk -l):
Seagate Barracuda /dev/sda 2,000,396,746,752 bytes
Western Digital   /dev/sdb 2,000,395,698,176 bytes

The best solution is : never us the full disk! Leave a 10 or 15M at the end. So disks with small differences in size can be added.

Monday, February 23, 2015

Add node to Puppet

In this post, I will explain how to add a node (computer) to Puppet.

I assume you have a Puppet master server running and it can ping the future node agent.

Puppet master server:
  • Debian 6.0
  • Name: master-puppet
  • Puppet version: 3.7.4

Future puppet node agent:
  • Ubuntu server 14.04 TLS
  • Name: new-node

NOTE: Puppet version 4.0 will be out soon, and the process may be different.

On the AGENT

Download puppet:
wget --no-check-certificate https://apt.puppetlabs.com/puppetlabs-release-trusty.deb
Note: if you use a different OS, please download the appropriate file

Install Puppet:
dpkg -i puppetlabs-release-trusty.deb
apt-get update
apt-get install puppet

Make Puppet to start on boot. Edit the file /etc/default/puppet:
START=yes

Run Puppet:
puppet agent --no-daemonize --onetime --test
Warning: Setting templatedir is deprecated. See http://links.puppetlabs.com/env-settings-deprecations
   (at /usr/lib/ruby/vendor_ruby/puppet/settings.rb:1139:in `issue_deprecation_warning')
Info: Creating a new SSL key for new-node
Info: Caching certificate for ca
Info: csr_attributes file loading from /etc/puppet/csr_attributes.yaml
Info: Creating a new SSL certificate request for new-node
Info: Certificate Request fingerprint (SHA256): 4A:...:04
Info: Caching certificate for ca
Exiting; no certificate found and waitforcert is disabled

On the MASTER

Sign the certificate created by the node agent:
puppet cert sign new-node
Notice: Signed certificate request for new-node
Notice: Removing file Puppet::SSL::CertificateRequest new-node at '/var/lib/puppet/ssl/ca/requests/new-node.pem'

Add the node info in the file site.pp of Puppet.

on the NODE

Run puppet:
puppet agent --no-daemonize --onetime --test

And that's it!

reducing the advertised EDNS UDP packet

I had to set up a PPPoE connection on my Ubuntu server. With the help of the command pppoeconf, it is kind of straigtforward.

However, when browsing some Websites I could see in the log file:
... after reducing the advertised EDNS UDP packet size to 512 octets
And even worse, some Websites were not showing up (ex: finance.yahoo.co.jp).

Solution

There were 2 problems:

1) Problem with IPv6
I had to disable IPv6 (probably a problem with my ISP?) with lines in /etc/sysctl.conf:

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1 

Then run:
sysctl -p /etc/sysctl.conf


2) Problem with packet size
A rule for iptables was automatically created in /etc/ppp/if-up.d/0clampmss. And later on I was flushing all the rules to set my own rules (set in another file). Because I was not re-running 0clampsmss then the rule was not added.
And this rule was for resizing the packet.
So in my own rules, I stopped flushing the table mangle.

And that's it.

Wednesday, February 18, 2015

How to mount a single disk that was part of RAID 1

I screwed up and deleted the folder /etc of our main computer (samba server, dhcp, router, etc.). Terrible mistake...

The positive thing is that it was an old Ubuntu 8.04 and we wanted to update it.
So here was the time to do it.

On the machine, there was 2 hard drives in RAID 1 (mirror). So we removed them and put 2 new drives. We installed Ubuntu 14.04 and all the necessary packages.

Then it was time to copy data from the old disks to the new ones.
I didn't want to lose any more data, so I wanted to connect only 1 hard drive.

The problem is that this hard drive was part of a RAID, it is not a normal hard drive that we can mount as usual.

If you try, you will get error like:

mount: unknown filesystem type 'linux_raid_member'
mount: /dev/sdc2 already mounted or /mnt/recovery busy

Solution


Here are the steps to do:

1)  create a mount point
mkdir /mnt/recovery

2) list the disk information
fdisk -l

Disk /dev/sdc: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000abbde

Device Boot      Start         End      Blocks   Id  System
/dev/sdc1   *          32    62500863    31250416   fd  Linux raid autodetect
/dev/sdc2      1937904885  1953520064     7807590   fd  Linux raid autodetect
/dev/sdc3        62500864  1937899519   937699328   fd  Linux raid autodetect

I want to mount /dev/sdc3. The important information that we need in the next step:
  • sectors: 512
  • start: 62500864

3) finally run these commands:
$ losetup --find --show --read-only --offset $((62500864*512)) /dev/sdc
/dev/loop3

$ fsck.ext3 -n -v /dev/loop3
e2fsck 1.42.9 (4-Feb-2014)
Warning: skipping journal recovery because doing a read-only filesystem check.

$ file -s /dev/loop3
/dev/loop2: Linux rev 1.0 ext3 filesystem data, UUID=dbf4-...-9a98a (needs journal recovery) (large files)

$ mount -t ext3 -o ro,noload /dev/loop3 /mnt/recovery
note: I'm using loop3, but it can be a different number in your case.

And that's it! you can now access your files.


If you have an error like:
mount: wrong fs type, bad option, bad superblock on ....
It probably means you have entered a wrong offset.

In case of error, use the following command to see the log:
dmesg | tail

Another solution on a computer without any RAID

On my desktop, I have no RAID disk, so I could run the following command:

mdadm --examine --scan

And that's it!


Here are 2 links that helped me a lot to find the solution!
http://digital-forensics.sans.org/blog/2011/06/14/digital-forensics-mounting-dirty-ext4-filesystems
http://unix.stackexchange.com/questions/72279/how-do-i-recover-files-from-a-single-degraded-mdadm-raid1-drive-not-enough-to

Wednesday, February 11, 2015

How to send an email after a push to gitolite


This is for the gitolite package on Debian.


# cat /etc/gitolite/VERSION
1.5.4-2+squeeze1 (Debian)

I assume gitolite is working correctly. You can commit, push and pull.

Log in as the gitolite user:
su - gitolite

In my case $HOME is /var/lib/gitolite

Go to the folder $HOME/.gitolite/hooks/common

If the file post-receive exists, then create a copy somewhere else.
cp post-receive /tmp/post-receive

Copy the hook to send an email and rename it:
cp /usr/share/gitolite/hooks/common/post-receive-email post-receive

Make sure privileges are OK:
chowm gitolite:gitolite post-receive
chmod 755 post-receive

Edit $HOME/.gitolite.rc

# edit this line:
$GL_GITCONFIG_KEYS = "";
# for this:
$GL_GITCONFIG_KEYS = ".*";

Then run this to apply the hook to all the repositories:
gl-setup

Now look at one of your repositories. In my case:
ls $HOME/repositories/my_repo.git/hooks

Then you should see the file post-receive.

Finally edit $HOME/.gitolite/conf/gitolite.conf
repo my_repo
    RW+  = user1
    config hooks.mailinglist = destination@test.com
    config hooks.emailprefix = "[my_repo] "
    config hooks.envelopesender = from@test.com
 
Now you can push something to my_repo and should receive an email. Make sure you have setup
an email server correctly.

if you see this message when you push something:
remote: sed: can't read ./description: No such file or directory

It is just a warning. You have successfully pushed your code, but in the email you received, you will see:
It was generated because a ref change was pushed to the repository containing
the project "".
See the empty double quote at the end?
If you want to fix this and the warning message, simply create a file:
vi $HOME/respositorirs/my_repo/description

And inside the file write something, for example:
my_repo
Then if everything is good, the email will look like:
It was generated because a ref change was pushed to the repository containing
the project "my_repo".

Wednesday, September 17, 2014

Raspberry Pi for beginner - Part 3a: Wifi firmware issue

We don't live in a perfect world.
The steps in Part 3 didn't work for me because of my WiFi dongle (Buffalo WLI-UC-GNM2). If it worked for you, then fine, you can skip this part.

What was the problem?

After completing Part 3, I inserted the micro SD card in the Pi and turned it on. After few seconds, I could see this message:
Wait 8 seconds for Network Interface to come up
And after that a message saying it was impossible to reach the server.

For some person, the solution was to change the power supply (USB cable) for a better one.
But in my case, the problem was the WiFi dongle!

How to solve it?


Here you have 2 cases, please choose:
1) You can't connect the Pi to your router with a cable
2) You can connect the Pi to your router with a cable

1) You can't connect the Pi to your router with a cable 
You can't use the installer. Instead, you have to download the Standalone image.
You also need to download usbit.

  • extract the files somewhere on your machine
  • insert your memory card in your computer
  • open usbit 
  • select your memory card
  • click on restore
  • select the image sd.img

Wait a little bit and that's it! You have a working copy of Raspbmc! But it's not end of our journey!

2) You can connect the Pi to your router with a cable
Same thing as in Part 3, except in the network management popup, don't select Wireless and set the correct values to connect to your router.

Either you chose 1 or 2, here is what you should do now.
Insert your micro SD card in the PI (be careful in which direction!) and plug your Pi!

After a while, you will see XBMC. First, we will disable CEC Adapter, otherwise we won't be able to run the terminal. CEC adapter controls your TV. If you keep it enable, when you exit Raspbmc, it will turn off your TV. And when you turn on your TV, it will restart your Pi. You can re-enable it later.
  • go to Settings 
  • go to System 
  • go to Input Devices 
  • go to Peripherals
  • open CEC Adapter 
  • uncheck the box Enabled 
  • click OK 
  • go back to the home screen (press Esc key)
  • click the standby icon at the bottom-left
  • select Exit 
  • at the blue splash screen which says Press ESC for command line, press the Esc key
Nice job! You are now ready to access the terminal! Let's continue. At the login prompt:
  • enter username pi
  • enter password raspberry
Only for the first time you use the command line you have to setup the locales and the timezone. Select the appropriate values. Then you should see:
All Set up now! Thanks for using Raspbmc

WiFi dongle setup

Now let's find out why we can't use our WiFi dongle.
Let's check which chipset the Buffalo WLI-UC-GNM2 is using. Type the command:
lsusb

And the result is:
Bus 001 Device 004: ID 0411:01ee BUFFALO INC. (formerly MelCo., Inc.) WLI-UC-GNM2 Wireless LAN Adapter [Ralink RT3070]  

Now open this page: WiFi
You can see a list of chipsets and if they are directly compatible with Raspbmc or not.

If you look at the WiFi page, you can see RT3070 is not compatible by default. You have to update the firmware. Fortunately there is a help page rt2800usb.

Here again there are 2 cases:
1) You can't connect the Pi to your router with a cable
2) You can connect the Pi to your router with a cable


1) You can't connect the Pi to your router with a cable
I think the best solution is to download on a USB stick the required package(s) using another computer.
Plug the stick in the Pi and install the packages.
I think it requires some time to achieve that. Please check on Google how to do that.

2) You can connect the Pi to your router with a cable
In case you haven't setup Internet yet. If you are familiar with Debian, you will think that you have to edit the file /etc/network/interfaces, but Raspbmc doesn't use this file!
Instead it is using this file:
/home/pi/.xbmc/userdata/addon_data/script.raspbmc.settings/settings.xml
So edit this file depending of your network. Also edit the value for your Wifi network (this will avoid you to have to modify this file a second time).
Restart your Pi (sudo reboot). Now you should be connected to Internet. It's the first time your Pi has access to Internet, so it will update some files!! So wait a little bit before continuing.

Exit XBMC to go to the terminal and execute the following command to update the firmware:
sudo apt-get install firmware-ralink
Installation is successful, good! Unplug the Ethernet cable and restart your Pi!

Finally the end! Now you should be connected using the WiFi dongle!

Friday, September 12, 2014

Raspberry Pi for beginner - Part 3: Installation


In this post, I'll show you how to prepare the memory card.

Warning: the steps described in this post don't work for the Wifi dongle (Buffalo WLI-UC-GNM2) that I bought. Here is what I had to do.

Which OS to install ?


The RaspberryPi is not limited to one OS. You can install different distributions of Linux.

The most popular one is Raspbian based on debian.


Raspbian is a free operating system based on Debian optimized for the Raspberry Pi hardware. An operating system is the set of basic programs and utilities that make your Raspberry Pi run. However, Raspbian provides more than a pure OS: it comes with over 35,000 packages, pre-compiled software bundled in a nice format for easy installation on your Raspberry Pi. 

Another popular OS is OpenElec.
Open Embedded Linux Entertainment Center (OpenELEC) is a small Linux distribution built from scratch as a platform to turn your computer into an XBMC media center. OpenELEC is designed to make your system boot fast, and the install is so easy that anyone can turn a blank PC into a media machine in less than 15 minutes.

The one I will use is Raspbmc (old name for OSMC)
Raspbmc is a minimal Linux distribution based on Debian that brings XBMC to your Raspberry Pi. This device has an excellent form factor and enough power to handle media playback, making it an ideal component in a low HTPC setup, yet delivering the same XBMC experience that can be enjoyed on much more costly platforms.

Why I choose Raspbmc?

  • I like the fact that it is based on Debian, that means a lot of packages are available.
  • it's the first one I heard about
  • looks like many people are using it, so you can find help on Internet more easily
  • based on the list of features (here), I think it can do many things
 It's really easy to install the OS, so in case I don't feel comfortable using Raspbmc, it will be easy to switch to another one.

How do I install Raspbmc ?


Prepare your micro SD card. Make sure there is no data in it, because it will be deleted. Just plug it in your computer.

Download the installer from the official Website. There is an installer for Windows and for Mac/Linux. In this post, I will use the installer for Windows. My machine is Windows 8.

  • extract the files (README.txt, setup.exe) somewhere on your Windows
  • double click on setup.exe
  • UAC (User Account Control) opens, click on YES
  • a small popup opens and click on Accept

  • on the main window, make sure in the list of device to select the micro SD card !
  • check I accept the license agreement
  • check Manually configure networking

  • a small window will appear, select Wireless
  • check Obtain an IP address automatically
  • enter your SSID (the name of your Wifi network)
  • choose the encryption (for me it's WPA/WPA2)
  • enter your wifi password

  • click on Save
  • back on the main window, click on Install
Wait 1 minute and then you will see this window


Donate money if you think it was easy and you feel happy :)


Next step, I will plug everything and start the Pi! I will explain how to setup the Pi.

Note: XBMC will change name soon! It will be called Kodi! And Raspbmc will also change name for OSMC! So don't get confused!

Wednesday, August 20, 2014

Raspberry Pi for beginner - Part 2: hardware

Here is the second part where I share my experience with Raspberry Pi.

I received everything ! I order the Raspberry Pi on Amazon Saturday, and I received it the next day ! Pleasantly surprised!
About the case, it took less than a week (shipped from the UK).

Here is the pictures of everything.



You will notice something that I didn't mention in the first part. I bought a USB switch. It's not that expensive and I think it is more friendly user and less risk to break the connector than unplugging the cable every time.

I was really surprised by the size of the Raspberry Pi. It's really small.

I will not create a post to explain how to plug the Raspberry Pi, because it's really easy. However, my next post will be about the setup of the micro SD card and how to install the OS.

Tuesday, August 19, 2014

Install Java on System Z Linux S390 Suse 10

Installing Java on System Z Linux is easy if you know which file to download.

More information about my machine:
# cat /etc/*release*
SUSE Linux Enterprise Server 10 (s390x)
VERSION = 10
PATCHLEVEL = 4
LSB_VERSION="core-2.0-noarch:core-3.0-noarch:core-2.0-s390x:core-3.0-s390x"
If you look at the Oracle Website to download Java for S390 system, you won't find anything.
After a quick search on Google, I could find this IBM website with all the files. But:
Before you can download, you will need an IBM Registration ID

I guess if you are using System Z, then you have an account.
Cool, so I download Java 7: 64-bit System z
And select the following file:
tgz package (InstallAnywhere)
ibm-java-sdk-7.1-1.1-s390x-archive.bin  (123 MB)

Then on the machine:
# chmod +x ibm-java-sdk-7.1-1.1-s390x-archive.bin
# ./ibm-java-sdk-7.1-1.1-s390x-archive.bin

Preparing to install...
Extracting the JRE from the installer archive...
Unpacking the JRE...
Extracting the installation resources from the installer archive...
Configuring the installer for this system's environment...

Launching installer...

Floating point exception

Ouch... it failed. I tried with the 32-bit version, but same result. And same result with the other file:
Installable package (InstallAnywhere)
ibm-java-s390x-sdk-7.1-1.1.bin (123 MB)

Ok, so let's try with Java 6: 32-bit System z
And select the following file:
tgz package (InstallAnywhere)
ibm-java-sdk-6.0-16.1-linux-s390.bin  (85 MB)

Then on the machine:
# chmod +x ibm-java-sdk-6.0-16.1-linux-s390.bin
# ./ibm-java-sdk-6.0-16.1-linux-s390.bin 

Choose Locale... 
Press  many times to skip the license agreement
DO YOU ACCEPT THE TERMS OF THIS LICENSE AGREEMENT? (Y/N): Y


Choose install folder:
 /opt/java/ibm-java-s390-60
 
Valid and wait for the installation to finish.
 
Installation Complete
---------------------

Congratulations. IBM 31-bit Linux SDK for Java v6 has been successfully
installed to:

  /opt/java/ibm-java-s390-60
Nice !
Now you can add Java to the path:
export JAVA_HOME=/opt/java/ibm-java-s390-60
export PATH=$JAVA_HOME/bin:$PATH

And finally:
java -version
java version "1.6.0"

Of course you can follow the same steps with Java 6 64-bit.
I'm wondering why Java 7 is not compatible. Maybe I'm missing a package? Maybe SUSE 10 is "old"?

Monday, August 11, 2014

Raspberry Pi - Amazon Japan error

Please be careful if you are using Amazon Japan and want to buy a Raspberry Pi !

Have a look at the following screenshot
Don't you see anything wrong?
Hint: memory card

The Raspberry Pi B+ is using a micro SD card !Don't do the mistake to buy a regular size SD card.
Only older models of the Raspberry Pi are using a regular size SD card.

I guess some customers were disappointed when they received their package.
Don't always trust Amazon suggestion ;)

I check on Amazon US and Amazon France, and the suggestions are different, so there is no problem.

Sunday, August 10, 2014

Raspberry Pi for beginner - Part 1: buy

Here I will talk about my project to setup a Raspberry pi.
I'm myself a beginner, and I hope these posts about my project will help other people.

My goal

  • use Raspberry Pi as a media center
  • control XBMC with my Android phone or Android tablet

 What is a Raspberry Pi?

The Raspberry Pi is an index card-sized single-board computer developed in the UK by the Raspberry Pi Foundation with the intention of promoting the teaching of basic computer science in schools. (Wikipedia)

What do I need?

  • raspberry Pi B+
  • power supply
  • micro SD card
  • case
  • wifi dongle
  • HDMI cable 
  • external hard drive

How to get everything?

  • raspberry Pi
After a quick search on the forum, many people recommend Amazon.  And yes, I could find one on Amazon Japan for 5400yen.
  • power supply
I don't need to buy one now, I will use my Nexus 5 USB cable. It delivers 5V, 1.2A, and that should be enough.
Please take the time to read this FAQ to know how much power you need.
  • micro SD card
For 1140yen, there is one on Amazon Japan. I choose 16GB, which is kind of big, because I will use a external hard drive. The price is not so high anymore, so why not. If you read this thread, someone said that "the Pi is always in non-UHS mode".
  • case
I saw some nice case here: http://shop.pimoroni.com/products/b-ninja-pibow
On Amazon Japan they cost 4600yen! Original price is 12.95GBP -> 2200yen.
I can get it ship for 6GBP. So total is 18.95GBP -> 3200yen.
  • wifi dongle
From Buffalo WLI-UC-GNM2. On Amazon as well for 922yen. I saw on the Web, a Japanese guy using this one for his Raspberry Pi.
For a complete list, have a look here.
  • HDMI cable
I already have a spare one.
  • external hard drive
I already have one LaCie 3TB with its own power supply.

Total

The total for all of that is around 10,600yen excluding the cost of an external hard drive, power supply and hdmi cable.

 In part 2, I will show the pictures once I receive everything !


Wednesday, August 6, 2014

Upgrading to Windows 8.1

On my Dell machine at work, I had no choice to use Windows 8. My plan was to remove Windows and use Ubuntu. And install Windows as a virtual machine. Thanks to Dell, it's not possible...
So I dual boot using grub.

Anyway, because Windows 8 was crashing once a week (especially when the computer was idle), I decided to try Windows 8.1.

The process to upgrade to Windows 8.1 is easy, but you should know that after all files are downloaded, you have 15min max before the computer restart!
Then it takes around 30 - 40min to install everything.

No problem during installation, Windows starts ... and I was not really satisfied...
First thing I noticed is that the language is in Japanese and I can't switch to English... Ok, I will set it to English again, as I did before. Oh surprise! There is no option to download the language pack... Fortunately I could find this thread on the Social Technet forum:
Language Pack not usable message in Windows 8.1

Here is what you should do (in case the link is broken):
Download the new 8.1 MUI:
EN-GB
32Bit: http://fg.v4.download.windowsupdate.com/d/msdownload/update/software/updt/2013/09/lp_43e709fc9932e26431ff87e163daaaeae15677eb.cab
64Bit: http://fg.v4.download.windowsupdate.com/d/msdownload/update/software/updt/2013/09/lp_55c5ff4da1d83ae6f4ebd1f8c020cb80ceda7da8.cab
EN-US
32Bit: http://fg.v4.download.windowsupdate.com/d/msdownload/update/software/updt/2013/09/lp_45b0cfb6b0bfd5984faa3cd64b7b8f2b2a72465e.cab
64Bit: http://fg.v4.download.windowsupdate.com/d/msdownload/update/software/updt/2013/09/lp_8fa033dd9ab61a528192eaa696088d582f112e68.cab
Rename the file to LP.mlc and double click it to install it.



I'm glad it worked!

Good, I can start working, let's connect to the VPN... boom error. I have to re-install OpenVPN.
Ok done. Now let's start VirtaulBox... boom error. I have to re-install VirtualBox.

After 90min, I could start working... (and I didn't fix grub yet...)
Not as smooth as I expected. After 2 days, my PC didn't crash. I hope it will continue to work correctly.

Tuesday, August 5, 2014

Cross-compile GDB for ARM (ARMEL & ARMHF)

Let's say you have:
Machine A: x86, cross-compile for armhf
Machine B: armhf

On Machine A, you create a program. Then you copy the program to Machine B.
On Machine B, you execute the program and boom fatal error, a core is generated.

The question is: on which machine should I use GDB to read the core file?
Answer: Machine A! But you need to install GDB for ARMHF!

Here are the steps (on Machine A):

Download GDB
wget http://ftp.gnu.org/gnu/gdb/gdb-7.8.tar.gz
Extract
gunzip gdb-7.8.tar.gz
tar -xf gdb-7.8.tar
Go to the folder
cd gdb-7.8/
Build GDB 
#ARMHF
./configure --target=arm-linux-gnueabihf --prefix=/usr/arm-linux-gnueabihf CXX="arm-linux-gnueabi-g++"
#ARMEL
./configure --target=arm-linux-gnueabi --prefix=/usr/arm-linux-gnueabi CXX="arm-linux-gnueabi-g++"
make
make install
And that's it.
From Machine B, copy the core file in Machine A, and run this command:
/usr/arm-linux-gnueabihf/arm-linux-gnueabihf-gdb myProgram core

And that's it.


Note: I'm not sure if you really need to specify CXX when building GDB.

Saturday, August 2, 2014

Steps to develop Android applications

So I think the way to setup everything and to be able to develop and run an app are not friendly user at all.

Just last week, I met a guy who is interested in Android. He downloaded the ADT plugin with eclipse. Everything looks good, he created a new application based on the "blank activity". Then he hit run and boom error... How to demotive new people to start coding app for Android...
I think I had a similar problem with a "fullscreen activity".


Anyway, here are the list of steps that I should remember when changing VM:

- if it's a 64-bit VM, don't forget that Android architecture is ARM 32-bits, so you should install 32-bits libraries!
sudo apt-get install libc6:i386 libstdc++6:i386
sudo apt-get install lib32z1

- you will need Java:
sudo apt-get install openjdk-7-jdk

- Setting up a Device for Development
http://developer.android.com/tools/device.html
sudo vi /etc/udev/rules.d/51-android.rules
#Samsung 
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", MODE="0666", GROUP="plugdev"
#Google
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666", GROUP="plugdev"
#ASUS
SUBSYSTEM=="usb", ATTR{idVendor}=="0b05", MODE="0666", GROUP="plugdev"
#LG
SUBSYSTEM=="usb", ATTR{idVendor}=="1104", MODE="0666", GROUP="plugdev"

sudo chmod a+r /etc/udev/rules.d/51-android.rules

For VirtualBox:
- install the Guest Additions
- add a shared folder so it's easy to copy from file between host and guest
- add your user to the group vboxsf to be able to access the share folder:
sudo usermod -a -G vboxsf alex
- in the VB settings of the VM, go to USB and add your device! So the VM will capture the device.
- install GIT
sudo apt-get install git

You can install Eclipse IDE with built-in ADT
http://developer.android.com/sdk/index.html
And go to: Window-> Preferences -> Android -> DDMS -> ADB Connection Timeout (ms)
And set it to 10000 (if you leave it to 5000, you  may see some timeout)

Friday, August 1, 2014

Debian hangs at “Select and Install Software”

Recently, I wanted to use Debian 5.0.3 Lenny (for work).

The first step was to find the ISO.
I couldn't find it on the Debian website. Fortunately I could find it on these both sites: http://www.debiantutorials.com/download-debian-iso/
 http://cdimage.debian.org/mirror/cdimage/archive/5.0.3/i386/iso-cd/

After downloading the file debian-503-i386-netinst.iso (~150Mo), I'm ready to create a VM using VirtualBox.

The installation is easy but it freezes at the screen "Select and Install Software".

The way to solve this is the following:
  • start a new installation 
  • just before 'Select and install software.' I could see a popup about a warning. Press alt+F2 
  • press enter to activate the console 
  • run the command to place you into the system you are installing
    chroot /target
  • run the command to install the keyring
    aptitude install debian-archive-keyring
  • run the command
    aptitude update
  • run the 3 following commands
    gpg --keyserver pgp.mit.edu --recv-keys 6070D3A1
    gpg --armor --export 6070D3A1 | apt-key add -
    apt-get update
    
  • press alt+F1 to go back to the installer 
  • continue the installation as normal to the end 

And that's it !


Here is a quick link in case you want to cross compile:
http://wiki.micromint.com/index.php/Debian_ARM_Cross-compile

source: http://forums.debian.net/viewtopic.php?t=12259

Wednesday, July 30, 2014

cross-compile ncurses for ARM: ARMEL & ARMHF

First, make sure you have installed these packages:

# ARMHF
sudo apt-get install gcc-arm-linux-gnueabihf
sudo apt-get install g++-arm-linux-gnueabihf
# ARMEL
sudo apt-get install gcc-arm-linux-gnueabi
sudo apt-get install g++-arm-linux-gnueabi
Make sure you did the following command and that "gcc" is in your path
sudo apt-get install build-essential

Download ncurses:
wget http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.9.tar.gz

Extract ncurses:
tar -xzf ncurses-5.9.tar.gz

Go to the folder:
cd ncurses-5.9

And build ncurses:
#ARMEL
./configure --host=arm-linux-gnueabi --prefix=/usr/arm-linux-gnueabi CXX="arm-linux-gnueabi-g++"
#ARMHF
./configure --host=arm-linux-gnueabihf --prefix=/usr/arm-linux-gnueabihf CXX="arm-linux-gnueabihf-g++"
make
sudo make install

 Done!

Then you should see libncurses.a with this command:
ls /usr/arm-linux-gnueabi/lib
ls /usr/arm-linux-gnueabihf/lib

Saturday, September 14, 2013

VirtualBox is slow !

So my host OS is Windows 8 and I wanted to separate my everyday stuff from my projects (coding) stuff.
I created a virtual machine, guest OS is Linux Mint.
My PC is: intel i3570K, 8GB DDR3, 64SSD + 128SSD, Asus Z77. Not a bad one!

Problem

So when I was in Mint, it was kind of slow.

 In settings > System > Processor, I had only 1 processor and when I selected 2 processors, I could see a warning message saying something like "this is not the most efficient setup". I ignore this message and in settings > System > Accelation, I checked "Enable VT-x/AMD-v".
When I start my virtual machine, I add an error message and the machine didn't start at all.

Solution

After searching on the Web, I found out that I had to go to the bios and activate a feature.
I don't remember exactly the name of the feature (and I guess it depends of the motherboard), but it was in the CPU section, and the feature was like "activate virtualization something".

After activating it, I could select 2 CPU and now my virtual machine is not slow anymore!

And that's it!

Thursday, May 30, 2013

imageMagick on mac os

Recently, I'm working on a mac os, creating a website using Rails.
I want the user to be able to upload a picture as an avatar. I found excellent
information on Internet. The most popular library is probably Paperclip (https://github.com/thoughtbot/paperclip).
Paperclip is intended as an easy file attachment library for Active Record.


After installing Paperclip and  ImageMagick (with brew), I added the code in my model :
attr_accessible :avatar, :name
has_attached_file :avatar, :styles => { :medium=>"300x300>", :thumb => "100x100>"},
  :url  => "/assets/restaurants/:id/:style/:basename.:extension",
  :path => ":rails_root/public/assets/restaurants/:id/:style/:basename.:extension"

It's exactly like in the wiki page of Paperclip (nothing fancy).

Problem :
But when I tried to upload an image, I had this error :
 ... is not recognized by the 'identify' command.

On Internet, many people said to do:
which identify
#/usr/local/bin/identify
And then add in config/environment.rb:
Paperclip.options[:command_path] = "/usr/local/bin"

But this didn't work for me.
If I just tried the command "identify", I could see this error :
dyld: Library not loaded: /usr/local/lib/libtiff.3.dylib
  Referenced from: /usr/local/bin/identify
  Reason: image not found
Trace/BPT trap: 5

So I was thinking there is a problem with the file "libtiff.3.dylib".

Solution :
I copied the file libtigg.3.dylib :
from : /opt/local/lib/libtiff.3.dylib
to : /usr/local/lib/libtiff.3.dylib

I restarted my rails server, and now it's working !
It's probably not the best solution, but at least it's working so far.
I think ImageMagick is looking for the file libtiff.3.dylib in a wrong folder.
Maybe if I could modify ImageMagick config file and change to the good folder, this
would be a better solution.

And that's it !