Monday, August 3, 2015

How to upload vhd or file in Azure China

Step 1:

azure storage account connectionstring show --blob-endpoint mcops

Step 2:

azure storage blob upload -c '<step1 string>' -f /tmp/coreos_production_azure_image.vhd --container test --blobtype page

Step 3:

azure vm image create -f -u -f -v CoreOS-Latest --location "China North" --os Linux

azure vm image create myimage --blob-url --os linux

Step 4:

azure vm create <dnsname> <imagename> -u <vmusername> -p <vmpassword> -l <location>

Friday, July 10, 2015

Starting with Strace

What is strace?

Strace is a “system call trace” program. It attaches to a process and tracks system calls and signals made to and from it (and possibly it’s children). There are limitations to strace, some of which are detailed below. However, strace can be a very valuable tool for determining the root cause of many issues. This post only covers very basic usage of strace. The example used here can be done using jailshell.

What is a process?

For the purposes of this tutorial, a process is a unique instance of program being run, identified on the system by a unique process identifier (pid). For more information see and

What is a system call?

A system call is how a program requests that the operating system kernel perform a task for it. There are quite a few “normal” tasks that the operating system kernel does for programs regularly, including extremely common file operations like reading and writing. More information regarding system calls can be found at:

What information can strace capture? Not capture?

Strace can tell you
  • what files and network connections were opened, closed, or attempted
  • what was read from and written to from said files and connections
Strace cannot tell you what is happening inside the process. It is not a debugger and is not aware of the variables used inside the process.

What do I have to know before I can use strace?

Strace is a power tool in your troubleshooting bag. But it’s not the most basic tool. General troubleshooting (checking log files, researching error messages, etc) should be done before attempting to solve a problem with strace. Before using strace, you’ll need to be able to reliably reproduce the issue so that you can catch it with strace. You’ll also need to determine what process to strace (covered later).

When am I not able to use strace?

In addition to there being times when strace will not be helpful, there are a few scenarios when you can not use strace. While most normal processes can be attached to by strace, there are some exceptions.
You cannot attach to a process in these scenarios:
  • when a debugger or other tracing program is already attached
  • when you do not own the process, unless you are running the strace as root
  • when the system has special protections preventing strace from being used to gather information

Resource considerations

Output files created by strace files do get very big very quickly, but more importantly are the numerous writes that strace output produces. This i/o hit is not mitigated (and is frequently made worse) by outputting to the terminal instead of a file.

Before you start to strace

Ensuring strace is installed

You can determine if strace is installed by typing:
strace -V
If strace is installed, you’ll see something like: strace — version 4.5.19. If it’s not installed, you’ll see something like bash: strace: command not found. Install strace with:
yum install strace
This command does require root access, so if you do not have root, you will need to request that your web hosting provider install strace for you.

Tuesday, June 30, 2015

Trace zabbix server

objdump -DSswx zabbix_server | gzip -c > zabbix_server.objbump.gz

Monday, June 29, 2015

iOS code sign error - User interaction not allowed

Earlier today I was trying to build an iOS application over VPN, SSH or Bamboo (Jenkins), I was connected to my iMac at work. I was running a command line script that I had written in order to automate the build process and facilitate deployment to our network server. This involved a B2B application, so not something that would go into the App Store.

Anyway, I had built the application like this, it resulted in an .app file:
$> xcodebuild -target "$APP_NAME" -sdk iphoneos -configuration Release

Next I signed this .app and packaged it into an .ipa file:
$> xcrun -sdk iphoneos PackageApplication -v "$" -o "$APP_NAME.ipa" --sign "iPhone Distribution"

This resulted in an error:
$> build/Release-iphoneos/$ User interaction is not allowed

The key to solving this problem was unlocking the keychain access in order for the user to be able to sign applications. You can do this like this:
$> security unlock-keychain /Users/$USER/Library/Keychains/$KEYCHAIN.keychain

  1. replace $APP_NAME with the name of your application
  2. replace $USER with the name of your local user account, I used 'fred'
  3. replace $KEYCHAIN with the name of the target keychain, I used 'login'

Wednesday, December 31, 2014

use vmnet patch with vmware 10.0.4 and kernel 3.17

diff -ur vmnet-only.a/netif.c vmnet-only/netif.c
--- vmnet-only.a/netif.c    2014-10-10 03:23:08.585920012 +0300
+++ vmnet-only/netif.c  2014-10-10 03:23:09.245920008 +0300
@@ -149,7 +149,7 @@
    memcpy(deviceName, devName, sizeof deviceName);

-   dev = alloc_netdev(sizeof *netIf, deviceName, VNetNetIfSetup);
+   dev = alloc_netdev(sizeof *netIf, deviceName, NET_NAME_UNKNOWN, VNetNetIfSetup);
    if (!dev) {
       retval = -ENOMEM;
       goto out;

  1. tar xf /usr/lib/vmware/modules/source/vmnet.tar -C /tmp/vmware
  2. patch vmnet-only.a/netif.
  3. tar -cf vmnet.tar vmnet-only/ cp vmnet.tar /usr/lib/vmware/modules/source/
  4. # vmware-modconfig --console --install-all

Wednesday, July 16, 2014

Stop gvfsd-metadata Using 100% CPU and Disk High I/O

If your Linux system is slowly grinding to a halt, and you manage to pull up the System Monitor and see that gvfsd-metadata is using 100% of the CPU, here’s how to correct it. In a terminal run the following 2 commands:
rm -rf ~/.local/share/gvfs-metadata

pkill gvfsd-metadata
Your system should now be back to normal.

Friday, May 30, 2014

The best command to create raw datafile used by Oracle database

Oracle recommends creating new datafiles on devices with zero offset. The command "/usr/sbin/mklv -y LVname -T O -w n -s n -r n VGname NumPPs" can be used. Please contact Oracle customer support for more details.