Copy an Amazon EC2 instance to a new region

I thought this would be easier than it turned out to be. Documenting my steps here in case I need to do this again someday.

I had a running Amazon EC2 instance and I want to copy it for possible migration to a different Amazon region.

I created the snapshot of the boot drive, and copied that over to the desired destination region. Then I created an image from the snapshot and tried to launch that image with the default kernel option. The system starts running but fails 1/2 checks and is not reachable. I looked around and found some similar cases:

These posts clued me in to the kernel. I found which Amazon kernel image the source is running, but that kernel can’t be found in the destination region. At first I thought maybe it’s obsolete, or region-specific, but then I figured out how to find the correct kernel in the new region.

Look at the source instance in the source region, and find the AMI ID in the instance description. In my case it is
ubuntu-lucid-10.04-i386-server-20101020 (ami-8c0c5cc9)

Switch to the destination region and view the AMIs, switch to public AMIs and search based on the description (ubuntu-lucid-10.04-i386-server-20101020)
This brings up 2 results, I’m looking for the ‘ebs’ result.

Click on it and in the Details look for the Kernel ID, in my case it is aki-6603f70f

Now I can launch my snapshot-sourced AMI and choose this kernel ID under Advanced. My server comes up and passes 2/2 checks now, but I still can’t connect. I’m getting “Connection refused” even though the same security group allows me to connect to a neighboring instance.

This explained it for me:

I had to temporarily attach the volume to a different running instance in the same region & zone so that I could modify /etc/fstab to remove the defunct entries. After doing this, I re-attached the volume to the new instance as /dev/sda1 and then it booted with 2/2 checks passing and I am able to connect using SSH.

Posted in Uncategorized | Leave a comment

argument list too long – one possible solution

Sometimes when trying to do stuff with lots of files, I see the subject error. I’ve found that you can sometimes have better results if you are in the directory so that there is no path in your argument, i.e.

# mv /media/old_raw/back/* /media/raw/back/
bash: /bin/mv: Argument list too long

# cd /media/old_raw/back/
# mv * /media/raw/back/


Posted in Uncategorized | Leave a comment

rtorrent stopped uploading: “Could not lock session directory”

We noticed our torrents stopped uploading. When I try to run rtorrent via /etc/init.d it just seems like it restarts, but it’s still not listening on the designated port. I enter the command manually, something like

rtorrent -n -o bind=,port_range=44443-44443,directory=/home/user,session=/home/user/.rtorrent-session,peer_exchange=yes,scgi_port=

Then I get back the error:
rtorrent: Could not lock session directory: "/home/user/.rtorrent-session/", held by "xyzpdq".

Turns out there is a lock file that needs to be removed; apparently the previous run crashed without removing it, so,

rm /home/user/.rtorrent-session/rtorrent.lock

And now the rtorrent program starts normally from /etc/init.d

Posted in Uncategorized | Leave a comment

The end of (free) Dyn

Dyn is no longer offering their free dynamic dns service, as of a few days from now!

… with mixed emotions we are notifying you that in 30 days, we will be ending our free hostname program. This change in the business will allow us to invest in our customer support teams, Internet infrastructure, and platform security so that we can continue to strive to deliver an exceptional customer experience for our paying customers.

We would like to invite you to upgrade to VIP status for a 25% discounted rate …

Good thing there are several other alternatives.
I’m trying and and both seem to work quite well so far! Goodbye Dyn, and thanks for all the free DNS!

Posted in Uncategorized | Leave a comment

Omniweb Blocks All “.in” Email

Due to a steady stream of spam and a complete lack of legitimate Email from domains ending with “.in”, Omniweb, Inc. has made the decision to reject all Email ending with “.in”. We apologize to our legitimate users in the nation of India and request that you contact us using third party email systems such as yahoo or gmail. Thank you, come again.

Posted in Uncategorized | Leave a comment

And another one bites the dust…

Nothing like announcing the news (to my inbox, at least) at 4:50 PM on Friday.
Today I read that Imo will “start discontinuing” the fantastic free service I’ve come to rely on, on Monday.

To provide the best and most reliable service for our users, we need to focus on the areas we feel we can make the biggest impact.
We are now going to concentrate on building out our own communications platform to help people easily connect in their everyday lives.
Our goal is to create the fastest and most reliable messaging, voice and video call service in the world.

On March 3, 2014, we will start discontinuing support for all third-party instant messaging networks. We know change isn’t always easy, but we hope our users will trust that this will make imo an even better service.

Oh well, 2 days warning is better than none, thanks for the ride Imo.

Posted in Uncategorized | Leave a comment

Steps to fail over Mysql and maintain replication

1. on all replicating slaves issue:

2. on the slave that will be master there should be no binary logs floating around. issue:

3. change the ip address of the new master to that of the old (or not, and update your clients instead)

4. on the replicating slaves issue
CHANGE MASTER TO (with connection info but no log file or position)

Posted in Uncategorized | Leave a comment

ESXi 5.5 Error: vSphere Client could not connect

Can’t connect to one virtual host with vsphere, but the others are working from the same client.

vSphere Client could not connect to “″.
An unknown connection error occurred. (The client could not send a complete request to the server. (The underlying connection was closed: An unexpected error occurred on a send.))

The solution:
So, how do we get around this? Well, the best answer would be to upgrade to Vista or higher. Obviously, if you haven’t yet, there is a reason.
On 64bit version of XP and 2003, simply install this hotfix from Microsoft. If you are using a 32bit version, there is no hotfix, and we need to edit the vCenter server to allow older encryption methods.

Fortunately (if SSH is enabled), richardvm over on this post on the VMWare forums has instructions for handling it;

4. Re: Windows XP vSphere Client 5.5
For those that don’t have vCenter or want to connect to a stand alone ESXi 5.5 host via the vSphere Client, you’ll need to ssh into the ESXi host and modify the following file: /etc/vmware/rhttpproxy/config.xml

Insert the following xml line into the appropriate section:


After saving your changes restart the service:
/etc/init.d/rhttpproxy restart

Posted in Uncategorized | Leave a comment

Samba: session setup failed: NT_STATUS_LOGON_FAILURE

It’s been a while since I set up samba. I just put it on Ubuntu 12 and saw the subject error when testing with smbclient.
Turns out I just need to set the password with smbpasswd, then samba works. easy enough.

Posted in Uncategorized | Leave a comment

php_pdo_mysql_int.h:31:20: fatal error: mysql.h: No such file or directory

While trying to compile PHP 5.5 with pdo support on Ubuntu 12 with the intention of trying out this Medoo framework, I was seeing the subject error.

In the PHP installation folder, I edited the file ext/pdo_mysql/php_pdo_mysql_int.h and I changed line 31 from
# include <mysql.h>
# include </usr/include/mysql/mysql.h>

I don’t know why that was required, but after that configure ran… but make gives
/usr/local/src/php-5.5.8/ext/pdo_mysql/mysql_driver.c:35:26: fatal error: mysqld_error.h: No such file or directory

OK I changed the PHP configure command from having
to just

then PHP was able to compile and now ‘pdo_mysql’ is present in the phpinfo(), but Medoo is giving a new error… it doesn’t like that our db has old passwords, but I can’t update that now, so I will move on testing the next framework…

Posted in Uncategorized | 2 Comments