Author Archive
For a lack of LSOF
by sudo on Aug.28, 2012, under Linux
When you have to deal with system that lacks lsof and cannot be easily installed, you can run the following to show information regarding currently open file handlers.
ls -l `ls -l /proc/*/fd/ 2>/dev/null | grep ">" | cut -d ">" -f 2 | grep "/" | sort | uniq`
If the culprit of disk space usage has already been deleted, you’ll find the following in your output.
ls: /var/log/openvswitch/ovs-vswitchd.log.1: No such file or directory
ls: (deleted): No such file or directory
———
Teran came up with the following.
for file in `ls -l /proc/*/fd/* | grep deleted | awk '{print $9}'`; do echo -n "$file "; ls -l $file | awk '{print $11}' | tr -d '\n'; stat -L $file | grep Size; done
Error accessing XVP java console
by sudo on Aug.04, 2012, under Linux
If you see
Network Error: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilder
when attempting to connect to an XVP console, update your SSL crt/key, restart (apache|nginx) and stunnel.
More information can be found here.
XVP troubleshooting guide
Unable to connect to Xen Console
by sudo on Mar.29, 2011, under Linux
If you encounter the following error when trying to connect to an instance with Xen, xenconsoled is not running.
xenconsole: Could not read tty from store: No such file or directory
To rectify, start /usr/sbin/xenconsoled.
Display configuration options for an RPM
by sudo on Mar.31, 2010, under Linux
rpm -q --queryformat="%{NAME}: %{OPTFLAGS}\n" packagename
Fast large file finder
by sudo on Jan.20, 2010, under Linux
The following will display all files over 100MB in size on the server except for those in /proc.
find / -path /proc -prune -o -type f -size +102400k -printf "%s %h/%f\n" | sort -rn -k1 | head -n 50 | awk '{ print $1/1048576 "MB" " " $2}'
For a specific case, multiple paths.
find / -path /images -prune -o -path /var/run/sr-mount -prune -o -path /proc -prune -o -type f -size +102400k -printf "%s %h/%f\n" | sort -rn -k1 | head -n 50 | awk '{ print $1/1048576 "MB" " " $2}'
Install PHP Modules via PECL
by sudo on Jan.13, 2010, under Apache, PHP
First, mount the /tmp partition with exec permissions.
mount -o remount,exec /tmp
To install a package via pecl, run the following.
pecl install ssh2
(If the package is in a state other than stable, append the state after the package name ‘pecl install ssh2-beta’)
Last few lines of the module install will list the location of the library, usually /usr/lib/php/modules. Create a ini file with the module name within /etc/php.d/ with the extension directive.
# cat /etc/php.d/gd.ini
; Enable gd extension module
extension=gd.so
At this point, run the mount command to reestablish noexec for the /tmp partition.
mount -o remount,noexec /tmp
Gracefully restart apache and you are done.
Reset mySQL root password
by sudo on Jan.12, 2010, under mySQL
First, insert the init-file directive into the mySQL configuration under the [mysqld] section.
init-file=/var/lib/mysql/mysql-init
Create /var/lib/mysql/mysql-init with the following line. Replace ‘Changeme’ with a password of your choosing.
SET PASSWORD FOR ‘root’@’localhost’=password(‘Changeme’);
Restart the mySQL service and login as root with the password used above. Remember to remove the init-file directive and the init file you created once complete.
Urchin : Unable to retrieve local file listing / Permission denied
by sudo on Dec.10, 2009, under Apache, Linux
A common issue with occurs when apache is updated. Red Hat Enterprise Linux will revert /var/log/httpd to 0755 with root:root as ownership resulting in the following error.
WARNING: (****-****-****) Unable to retrieve local file listing
DETAIL: /var/log/httpd/access_log : Permission denied
A temporary fix until the next apache update, which are few and far between, is to ‘chmod 0755 /var/log/httpd’. Then ensure the current access logs are readable to the urchin user, 0644 should work. A permanent work around is to specify a log directory that will not be touched by the httpd rpm and give urchin sufficient permissions to access it.
Remove default domain from IP in Plesk
by sudo on Dec.01, 2009, under Plesk
Of all the things Plesk does well, this which would seem like common sense to include within the interface, cannot be done. To rectify this issue, you must update the default_domain field within psa.IP_Addresses.
mysql -uadmin -p`cat etc/psa/.psa.shadow` -Dpsa -e "UPDATE IP_Addresses SET default_domain_id = 0 WHERE ip_address = 'IPGOESHERE';"
Remove the WHERE statement if you wish to do a blanket default domain removal.
mysql -uadmin -p`cat etc/psa/.psa.shadow` -Dpsa -e "UPDATE IP_Addresses SET default_domain_id = 0;"
Display Physical Memory in Server
by sudo on Nov.13, 2009, under Linux, Server
The following is useful in the event that the wrong version (32 vs 64bit) of linux or non-SMP/PAE kernel is installed and you’d like to verify how much RAM physically is in the server.
dmidecode | awk '/\tSize: [0-9]+ MB/ {SUM=SUM+$2} END {print SUM}'