Joomla: 500 internal server error on administrator panel.

The solution is rather simple.
You need to set the right permissions for log , cache, tmp and administrator/cache.
So goto your joomla root dir and

chmod 755 log cache tmp administrator/cache

Also make sure the file ownerships are correct.

chown -R myuser myjoomladir

And last to get rid of “500 – An error has occurred” while logging to the admin read the error_log which should be like this

[16-Nov-2013 10:00:37 Europe/Athens] PHP Warning:  fopen(/home/myuser/www/logs/error.php) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: Permission denied in /home/myuser/www/libraries/joomla/log/loggers/formattedtext.php on line 248

Meaning you have to

chmod 777 /home/myuser/www/logs/error.php

Also one last thing to keep in mind is you need to have the correct path for log and tmp at your configuration.php file. Something like that.

 public $log_path = '/home/myuser/public_html/logs';
 public $tmp_path = '/home/myuser/public_html/tmp';

All set!

Otenet outgoing smtp server blacklisted (mailgate.otenet.gr) and how to fix it.

If you use an email client for sending emails the default outgoing smtp server for otenet is mailgate.otenet.gr according to this.

From what i’ve figured out this acts as a gate that sends you to one of the smtp servers of Otenet.
The thing here is that Otenet smtp servers tend to get blacklisted every now and then and there is nothing you can do about it. The mails would bounce back from the server following this error.

This is the mail system at host medusa.otenet.gr.
I’m sorry to have to inform you that your message could not
be delivered to one or more recipients. It’s attached below.
For further assistance, please send mail to postmaster.
If you do so, please include this problem report. You can
delete your own text from the attached returned message.
The mail system

<some@client.gr>: host
mx.some.provider.gr [1.1.1.1]
said: 554 5.7.1 Service unavailable; Client host [83.235.69.31] blocked
using bl.spamcop.net; Blocked – see
http://www.spamcop.net/bl.shtml?83.235.69.31 (in reply to RCPT TO command)

What this informative yet unhelpfull error message says is that 83.235.69.31 which resolves to smtp-out31.otenet.gr is blacklisted by spamcop. What you can do is tell spamcop that this is not a smap through their page but even if you do you still have to wait for them to approve etc which in best case takes some hours.

So the alternative is to use directly one of the smtp servers of Otenet and not going through the mailgate.
To do so you can use any of these 4 ips making sure that they are not blacklisted.

83.235.69.31 smtp-out31.otenet.gr
83.235.69.32 smtp-out32.otenet.gr
83.235.69.33 smtp-out33.otenet.gr
83.235.69.33 smtp-out34.otenet.gr

You can check their blacklist status here http://mxtoolbox.com/blacklists.aspx .

Joomla: Increase max upload size limit

Joomla uses it’s own php.ini for the administration panel. So although we had change our values in the root php.ini the upload_max_filesize remained at 8M.

To increase that we need to edit the php.ini located under the administrator dir and add those two lines

upload_max_filesize = 50M
post_max_size = 50M

Also have a look at your Media Manager Component configuration and increase the limit accordingly.
All done.

#file-limit, #joomla-2, #max-upload-size, #php-ini

Migrating VMware ESXi

Hello.
Recently one of our VMware ESXi servers started acting up weird.
Situation was that we had no means of accessing ESXi through SSH ( user/pass got refused although it was the right one) and the console was also unaccesible for each VM.
After invastigating a bit through the Vsphere Client it appearead that the system couldn’t find the necessary pam modules and thus no authentication for us.
Hopefully at least we had access through the VSphere Client and also to the Web-Based datastore Browser.
Anyway to make long story short we had to find a way of getting our VMs from there and moving them to another machine.
Typically and afaik we would simply login on our ESXi console and scp our files through the servers. In our case that was no option since we had no ssh access at all. So we came up with two solutions.

General Prerequisites 

  1. Power off your VM while transferring.
  2. Make sure there are no snapshots.
  3. If you got snapshots  take care of them and delete. You can’t move snapshots and you have to have only “the current working branch” .

Transferring (Having a shell access)

  1. scp [[user@]from-host:]source-file [[user@]to-host:][destination-file]  
  2. Example: scp root@myno1.esx.com:/vmfs/volumes/datastore1/linux/linux.vmdk root@myno2.esx.com:/vmfs/volumes/datastore1/linux

Transferring (Alternative way, no ssh required)

    1. I’ve found this very handy little script http://blogs.vmware.com/vsphere/2010/01/scripting-datastore-access.html . What it does is accessing your datastore through the web interface and downloads to local .
    2. So to make things faster we can have this script download the files on a remote box and then transfer from there to our new ESXi server.
#!/bin/bash

CURL_ARGS="--insecure"
# Change if you want to use an alternate user
# (you'll be prompted for the password each time)
USER=root
if ! $(which curl > /dev/null); then
echo "ERROR: curl not found in your path" >&2
echo "" >&2
echo "You'll need to install curl on your system for this script to work." >&2
exit 1
fi
usage() {
echo "USAGE: $0 <get|put> <hostname> <ds> <ds path> <local_path> [thread_count]" >&2
echo "" >&2
echo "one of source or target must be a datastore path" >&2
echo "Example: $0 put hostname datastore /file.iso ./file.iso'" >&2
echo "" >&2
echo "If you set the thread_count then this script will" >&2
echo "use that many parallel threads when downloading the file." >&2
echo "Warning: you'll need ~2x the file size in available space locally for this approach" >&2
}
urlescape() {
TMP=$(echo $1 | sed \
-e ' {
s/%/%25/g
s/ /%20/g
s/</%3C/g
s/>/%3E/g
s/#/%23/g
s/{/%7B/g
s/}/%7D/g
s/|/%7C/g
s/\\/%5C/g
s/\^/%5E/g
s/~/%7E/g
s/\[/%5B/g
s/\]/%5D/g
s/`/%60/g
s/;/%3B/g
s|/|%2F|g
s/?/%3F/g
s/:/%3A/g
s/@/%40/g
s/=/%3D/g
s/&/%26/g
s/\$/%24/g
}' )
echo ${TMP}
}
if [ $# -lt 5 ] ; then
usage
exit 1
fi
OPERATION=$1
HOSTNAME=$2
DATASTORE=$(urlescape "$3")
REMOTE_PATH=$(urlescape "$4")
LOCAL_PATH=$5
if [ $# == 6 ] ; then
THREADS=$6
else
# Default to 4 threads for better performance
THREADS=4
fi
URL="https://${HOSTNAME}/folder/${REMOTE_PATH}?dcPath=ha-datacenter&dsName=${DATASTORE}"
if [ "${OPERATION}" == "get" ]; then
if [ ${THREADS} -gt 1 ] ; then
echo -n "Enter password for ${USER}@${HOSTNAME}: "
stty -echo
read PASSWORD
stty echo
echo ""
# Note: This is somewhat insecure as the password will show up on the
#    command line. Consider switching to use netrc or SSPI
#	   see the curl man page for more details.
#
#    This first curl invocation grabs just the header to get the size
LENGTH=$(curl ${CURL_ARGS} -s -u "${USER}:${PASSWORD}" "$URL" -I | awk '/Content-Length:/ { print $2 }'|sed -e "s/\r//g")
CHUNK=$((LENGTH / THREADS + 1))
START=0
echo "Starting download (${THREADS} parallel threads)..."
COUNT=1
while [ ${COUNT} -le ${THREADS} ] ; do
END=$((START + CHUNK - 1))
# Progress reporting with multiple threads gets jumbled up, so be silent
curl -s ${CURL_ARGS} -u "${USER}:${PASSWORD}" --create-dirs --range ${START}-${END} "$URL" -o "${LOCAL_PATH}.${COUNT}" &
COUNT=$((COUNT + 1))
START=$((END + 1))
done
wait
# Merge the files back together
rm -f "${LOCAL_PATH}"
touch "${LOCAL_PATH}"
COUNT=1
while [ ${COUNT} -le ${THREADS} ] ; do
cat "${LOCAL_PATH}.${COUNT}" >> "${LOCAL_PATH}"
rm -f "${LOCAL_PATH}.${COUNT}"
COUNT=$((COUNT + 1))
done
echo "Done"
else
curl ${CURL_ARGS} -u ${USER} --create-dirs "$URL" -o "${LOCAL_PATH}"
fi
elif [ "${OPERATION}" == "put" ]; then
if [ ! -f ${LOCAL_PATH} ] ; then
echo "ERROR: ${LOCAL_PATH} does not exist" >&2
echo "" >&2
usage
exit 1
fi
curl ${CURL_ARGS} -u ${USER} -T "${LOCAL_PATH}" "$URL"
else
usage
exit 1
fi

Configuration of the VM to the new ESXi

  1. After having transfer all our files ( *-flat.vmdk *.vmdk *.vmx) we now have to create a new VM on the new server.
  2. Create a new VM using the exact same options as on the old ESXi.
  3. Choose Advanced options and select an existing hard disk.
  4. Finsh and boot.

Final Configuration

  1. Since you are now propably on a new network you need to reconfigure your network and your VMAC address.
  2. Create a VMAC address from your host panel.
  3. On CentOS goto /etc/udev/rules.d/70-persistent-net.rules and edit making sure eth0 uses the newly created VMAC.
  4. Goto /etc/sysconfig/network-scripts and edit ifcfg-eth0 accordingly with your new ip, gateway and hwaddr.
  5. Edit /etc/sysconfig/network-scripts/route-eth0 and configure your gateway.

 

Et voila! You have now succesfully migrated ! 🙂

Suggestions or alternative methods are really appreciated 🙂

#centos, #datastore, #esxi, #esxi4, #esxi5, #migration, #moving, #vmware-2

Building Android on Gentoo

Ok, it is generally best practice to use Ubuntu  for building android but if you are a Gentoo fan and don’t want to mess with a vm you’ll have to bypass some bumps first.

So let’s start. Firstly you need sun-jdk6. icedtea-jdk won’t do the trick. So let’s get sun-jdk6 firstly. I’m going to just pass the commands you need and it should be self explanatory if you know what you are doing.

Download java and put it at /usr/portage/distfiles/

su-
cd /usr/portage/distfiles
wget http://uni-smr.ac.ru/archive/dev/java/SDKs/sun/j2se/6/jdk-6u45-linux-x64.bin

Then copy paste the exact same lines as below to auto-accept all licenses.


cat >> /etc/make.conf <<END
ACCEPT_LICENSE="*"
EMERGE_DEFAULT_OPTS="${EMERGE_DEFAULT_OPTS} --autounmask=n"
END

Then let’s unmask sun-jdk. It’s masked for security reason but we really need this. So edit  package.unmask with your favorite editor ( vi /etc/portage/package.unmask ) and add at the bottom


=dev-java/sun-jdk-1.6.0.45

Ok we’re ready let’s emerge


emerge dev-java/sun-jdk

After you’ve done select the appropriate package by issuing


java-config --set-system-vm sun-jdk-1.6

Afterwards let’s emerge all the packages we need to compile android.


emerge git app-crypt/gnupg flex bison gperf libsdl wxGTK squashfs-tools curl ncurses zlib schedtool perl-Switch zip unzip emul-linux-x86-baselibs emul-linux-x86-compat emul-linux-x86-cpplibs

You should be all done expect one last thing. repo sync etc. and before you start your build goto core/config.mk and comment out the following lines.


+#ifeq ($(wildcard $(HOST_JDK_TOOLS_JAR)),)
+#$(error Error: could not find jdk tools.jar, please install JDK6, \
+#    which you can download from <a href="http://java.sun.com" target="_blank">java.sun.com</a>)
+#endif

You are good to go! Happy android building!

#android, #building, #endif, #gentoo, #ifeq, #requires_openjdk, #sun-jdk

Android Studio Installation: Error, “failed to find java version for ‘C:\windows\system32\java.exe”

So this is quite simple to solve.

Goto http://www.oracle.com/technetwork/java/javase/downloads/index.html and download the latest jdk for your architecture x32 or x64.

Install as usual and then goto Control Panel -> “Advanced System Settings”

Click on the “Enviroment Variables” and under “System Variables” click “New..”

Then create a new entry with Variable Name: “JAVA_HOME” and Variable Value: “C:\Program Files\Java\jdk1.7.0_21” (this differs according to the version and system).

Save and restart android studio installation and it should identify the correct pat.

#android, #android-studio, #development, #error, #failed, #java

Git: Cherry-picking from another repository

Quite often when working with an android kernel there would be some nifty commits you’d wish to add to your local repo. So here is the way to do it.

In my case i am working on the Huawei kernel for G300 which involves the msm7627a chipset. So let’s patch it a bit with some commits from Code Aurora Forum (CAF).

Firstly let’s fetch our project locally

git clone https://github.com/ezeteze/android_kernel_huawei_u8815 g300-kernel

Okey now let’s add our remote branch and fetch.

git remote add msm  git://codeaurora.org/kernel/msm.git

git fetch

Cool! Now git branch -a should show your branches and all the remote tracking branches. You are now ready! You can either cherry-pick your commits or if you are brave enough do a full merge, which will probably result in ^n conflicts!

Let’s try out a cherry-pick

akis@localhost:~/kernel/huawei/u8815$ git cherry-pick 4e17bc5b7846448344c262c89ce769f756864b62
[detached HEAD 7ce9f8c] msm: qdsp6v2: Reduce the step size of soft volume and soft pause.
Author: Deepa Madiregama <dmadireg@codeaurora.org>
2 files changed, 8 insertions(+), 2 deletions(-)

Success! Happy cherry-picking! 🙂

#android, #cherry-pick, #cherry-picking, #code-aurora-forum, #github, #kernel, #msm