Why am I seeing “[ERROR] /usr/sbin/mysqld: Can’t open file: ‘./databasename/tablename.frm’ (errno: 24)”?

Problem: MySQL stops responding for a few minutes and during that time, the logs show messages like “Error in accept: Too many open files” and “Can’t open file”: Dec 2 07:14:34 www mysqld: 141202 7:14:34 [ERROR] Error in accept: Too many open files Dec 2 07:15:06 www mysqld: 141202 7:15:06 [ERROR] /usr/sbin/mysqld: Can’t open file: …

Continue reading ‘Why am I seeing “[ERROR] /usr/sbin/mysqld: Can’t open file: ‘./databasename/tablename.frm’ (errno: 24)”?’ »

How do I reconfigure MongoDB replication?

Problem How do I reconfigure MongoDB replication? Solution Load at the current configuration: appdata:SECONDARY> cfg = rs.conf() { “_id” : “appdata”, “version” : 3, “members” : [ { “_id” : 0, “host” : “appdata1.old.company.com:27017” }, { “_id” : 1, “host” : “appdata2.old.company.com:27017” }, { “_id” : 2, “host” : “appdata3.old.company.com:27017” } ] } appdata:SECONDARY> Change …

Continue reading ‘How do I reconfigure MongoDB replication?’ »

Why am I seeing “dpkg-source: not found” when I try to download source code on a Debian/Ubuntu server?

Problem I’m seeing “dpkg-source: not found” when I try to download source code on a Debian/Ubuntu server: $ apt-get source linux-headers-3.2.0-4-amd64 Reading package lists… Done Building dependency tree Reading state information… Done Picking ‘linux’ as source package instead of ‘linux-headers-3.2.0-4-amd64’ NOTICE: ‘linux’ packaging is maintained in the ‘Svn’ version control system at: svn://anonscm.debian.org/svn/kernel/dists/trunk/linux/ Need to …

Continue reading ‘Why am I seeing “dpkg-source: not found” when I try to download source code on a Debian/Ubuntu server?’ »

Why is the AWS CLI showing “A client error (PermanentRedirect) occurred” when trying to access S3?

Problem: When trying to access S3 via the AWS CLI tools, you’re able to get a list of buckets, but can’t do anything else without seeing a “PermanentRedirect” error: $ aws s3 ls 2011-06-22 16:25:23 bucket1 2011-07-26 21:34:43 testbucket 2012-08-20 17:05:32 mybucket $ $ aws s3 ls ‘s3://mybucket’ A client error (PermanentRedirect) occurred when calling …

Continue reading ‘Why is the AWS CLI showing “A client error (PermanentRedirect) occurred” when trying to access S3?’ »

How do I pin packages in APT?

You can tell APT to use a particular newer version of a package from the ‘testing’ Debian distribution (“jessie”) using APT package “pinning”. You’ll need to specify any dependent packages as well. For example, to run “graphite” from ‘testing’, create /etc/apt/preferences.d/graphite: Package: graphite-web python-django-tagging graphite-carbon python-whisper libc6 libc6-dev Pin: release n=jessie Pin-Priority: 900 Make sure …

Continue reading ‘How do I pin packages in APT?’ »

How do I setup a VPN connection to my EC2 VPC using pptpd?

How do I setup a VPN connection to EC2 using pptpd? Launch a new instance in the VPC, to serve as the “VPN concentrator” server. Install PPTPd: # apt-get install pptpd Edit /etc/pptpd.conf option /etc/ppp/pptpd-options logwtmp bcrelay eth0 localip 192.168.0.1 remoteip 192.168.0.2-101 Edit /etc/ppp/chap-secrets # Secrets for authentication using CHAP # client server secret IP …

Continue reading ‘How do I setup a VPN connection to my EC2 VPC using pptpd?’ »

How do I launch an EC2 instance in VPC from the command line?

Before launching the instance, we need to configure several parameters, and note their values: Look up the allocation ID of the new Elastic IP address. Look up the subnet-id of the subnet you want to use (subnet-xxxxxxxx): root@puppet:~# aws ec2 describe-subnets –output=text –filters=”Name=cidrBlock,Values=172.16.1.0/24″ SUBNETS us-west-2a 249 172.16.1.0/24 False False available subnet-00000000 vpc-00000000 TAGS Name 172.16.1.0 …

Continue reading ‘How do I launch an EC2 instance in VPC from the command line?’ »

How do I make a Debian package?

To make a .deb package for use with Debian / Ubuntu: $ sudo apt-get install devscripts debhelper Rename the source tarball following the syntax package name_1.x.orig.tar.gz: $ mv go1.3.src.tar.gz go_1.3.orig.tar.gz Extract the tarball: $ tar xf go_1.3.orig.tar.gz Go into the source directory and create a “debian” subdirectory under it: $ cd go $ mkdir debian …

Continue reading ‘How do I make a Debian package?’ »

Why am I seeing “Call to undefined function get_header() in index.php on line 1”?

Problem: Why am I seeing “PHP Fatal error:  Call to undefined function get_header() in /sites/xxxxx.com/htdocs/wp-content/themes/[THEME NAME]/index.php on line 1” in my Apache error logs?   Explanation: Some WordPress themes have an error in their header.php file that calls upon the main theme directory as the URL to load a stylesheet. Look for a line like …

Continue reading ‘Why am I seeing “Call to undefined function get_header() in index.php on line 1”?’ »