Can’t locate File/Pid.pm in @INC

Sometimes when I move a script onto a new server, i see the subject error.
File::Pid is a handy little perl toolkit for keeping track of your own pid.
Every time I see the error I scramble around trying to find the fix. So here it is:
perl -MCPAN -e shell
> install File::Pid

Posted in Uncategorized | Leave a comment

OpenSSL Signing my own certificates Error Solved

this is on CentOS:
sudo openssl ca -in /opt/openssl/testCA/server/requests/testWEB.CSR -cert /opt/openssl/testCA/CA/testCA.CRT -keyfile /opt/openssl/testCA/CA/testCA.KEY -out /opt/openssl/testCA/server/certificates/testWEB.CRT
Using configuration from /etc/openssl.cnf
I am unable to access the /etc/openssl/testCA/certs directory

I tried creating the folders and files it wanted, what a mistake.
I finally found the proper thing to do is to find the install folder, such as /usr/share/src/openssl-1.0.0z
then copy the contents of apps/demoCA into wherever openssl is looking, eg for the example above,
cp -a /usr/share/src/openssl-1.0.0z/apps/demoCA/* /etc/openssl/testCA/certs/

Posted in Uncategorized | Leave a comment

Trouble with PDF::API2 paragraph function

We have some ancient code for printing documents that relied on the PDF::API2 module. When we upgraded our systems, this module has some different behavior and our program was throwing errors.
First, I commented out the “pdf->page->text->compress” function calls and that helped. But some text was not showing up. Turns out the “text->paragraph” function totally changed. Thankfully google led me to this page where I found the proper way to update my paragraph calls:

OLD
$text->paragraph("Hello, just a test."x10, -x => 300, -y => 600, -h => 600, -w => 200);

NEW
$text->translate( 300, 600 );
$overflow = $text->paragraph( "Hello, just a test. "x10, 200, 600 );

Scary note at the bottom, but applying the change above worked for me!
DEVELOPER METHOD means:
1. This method may not do anything useful.
2. This method may erase your hard disk(s).
3. This method may erase the hard disks on any machine your machine is connected to.
4. This method is subjected to change *without* notice.

Posted in Uncategorized | 3 Comments

How to Not overwrite files with Net FTP

I’m writing a batch program to transfer files with Net::FTP and since I only want to transfer files that don’t already exist, I was looking for a setting or flag in Net:FTP to prevent overwriting. Google, perlmonks, and Claudio to the rescue

I added this little check to my perl script:

if ( $ftp->rename( $dest, $dest ) ) {
  print "File $dest already exists in $path \n";
} else {
  print "Put $local -> $dest \n";
  $ftp->put($local, $dest)
  or die "put failed ", $ftp->message;
}
$ftp->quit;

It is indeed ingenious – thank you Claudio, whoever you are 🙂

Posted in Uncategorized | 2 Comments

Playstation3 Firmware 4.10 Problems

On February 8, 2012, Sony released a firmware update for the Playstation3 (version 4.10).
This update has introduced the following issues:

1. Playback of MP4 no longer natively supported. Prior to the update, a link to an MP4 file would launch the PS3 video player when clicked on in a browser. After the update, clicking a link to an MP4 brings up a download screen and there is no workaround to get the MP4 to stream as it formerly did.

2. High bitrates crash the PS3 update: MP4 files over 2GB crash the PS3. Not the browser, the whole box. When I attempt to load a 2.5mbps stream in a flashplayer, the video never loads and the PS3 becomes inoperable until rebooted.

My support inquiry:

with the new 4.1 software update I am not able to stream mp4 to browser, so I set up the flowplayer plugin to allow my content to stream to the new PS3 browser.
This solution works great for my streams under 1mbps but for my 2.5 mbps streams repeatedly crash the PS3 and the box needs to be rebooted.
Why is this happening? Is there any solution?

The reply from Sony Support:

Thank you for contacting Sony Computer Entertainment America LLC (SCEA). My name is Chad, and I am happy to help you today. I apologize if the web browser has caused you any frustration and I can certainly answer your questions today.

Please be aware, the PlayStation®3 (PS3™) system does have a limited web browser, in the interest of preserving the security of your system. There will be certain websites which may not always work fully as they would on a Personal Computer (PC). Features such as Flash Players, Java Script, and certain types of HTML are not compatible with the limited browser and some web pages will not work properly or even load if it has not been formatted for the PS3™.

Part of the reason for this is because the PS3™ will not install software that has not yet been officially tested or approved by SCEA. Certain websites that require special media players, software, or plug-ins (i.e., Quicktime, etc.) to view content will not display on the PlayStation®3 system’s Internet Browser. In addition, the PS3™ does not support any third party Internet Browsers (i.e., Internet Explorer, Firefox, etc.) at this time. I am very sorry again for any inconvenience this may have caused you today.

Each time an firmware update is released, we attempt at enhancing certain features of the PS3™, including the Internet Browser. If there is a website that once could be accessed is not currently available, it may no longer be compatible with the Limited Internet Browser.

I really appreciate your time and understanding with this matter and thank you for giving me the chance to assist you. Just to let you know, you may receive a brief survey regarding this correspondence. If you don’t mind, I would appreciate your feedback letting me know what I can do to better serve you in the future.

Sincerely,
Chad P.

Nice work Sony, NOT!!!

Posted in Uncategorized | 1 Comment

Start MySQL Replication on a slave

Had a problem with a slave database being a different (newer) version of MySQL than the master. After downgrading to the correct version of MySQL, the replicated data was no longer consistent with the master. ( For a good tool that can check the slave data’s consistency table by table, see here http://www.maatkit.org/doc/mk-table-checksum.html )

To fix this, the following steps were taken:
1) stop mysql on the broken slave.
2) on another good slave, in mysql prompt type ‘stop slave’, then (may want to remove some updatelogs first) tar up the /var/lib/mysql directory like so: ‘tar -cvpf good_slave.tar /var/lib/mysql’, then type ‘start slave’
3) Copy the tar to the broken slave with sftp or what have you
4) on the broken slave, move the /var/lib/mysql folder somewhere else for safekeeping such as ‘mv /var/lib/mysql /var/lib/broken_mysql’
5) untar the good_slave.tar file and make sure it goes in /var/lib/mysql
6) Edit relay-log.info file, change the hostname, see step 6 here: http://www.redips.net/mysql/add-new-slave/
# first line before change
./existing_slave_name-relay-bin.000076
# first line after change
./new_slave_name-relay-bin.000001

7) (not needed in this case since broken slave has it already, but for a new slave) Copy my.cnf and increment server-id – NOTE: edit the “relay-log” line with the new hostname!
‘8) start mysql on the broken slave. check ‘show slave status’ and hopefully seconds behind decreases to zero quickly!

Posted in Uncategorized | 4 Comments

Postfix Migration Error! SOLVED

I was moving some services to a different server and the postfix configuration wasn’t working right. The /var/log/mail.log had a bunch of repeated messages about

Jan 18 15:44:42 HOST postfix/trivial-rewrite[30797]: fatal: open database /etc/postfix/sender_maps.db: No such file or directory
Jan 18 15:44:43 HOST postfix/master[30461]: warning: process /usr/lib/postfix/trivial-rewrite pid 30797 exit status 1
Jan 18 15:44:43 HOST postfix/master[30461]: warning: /usr/lib/postfix/trivial-rewrite: bad command startup -- throttling

The /etc/postfix/sender_maps file existed so I just needed to enter this command:
postmap sender_maps
and then sender_maps.db was created and mail started going out!

Posted in Uncategorized | Leave a comment

install ec2 tools in ubuntu 10.04

this was harder than it should have been!
Tried to follow this https://help.ubuntu.com/community/EC2StartersGuide
But could not get apt-add-repository to work no matter what.
apt-add-repository: command not found
Just lot’s of ‘command not found’ errors, even after installing the python-software-properties.
Finally thanks to this post with clear instruction for manually updating /etc/apt/sources.list http://cpanelforums.net/install-amazon-ec2-api-tools-in-ubuntu/ looks like I got it!
Just in case that site ever goes away, here they are copied!


1) Enable multiverse by adding the following lines to end of the file /etc/apt/sources.list
deb http://us.archive.ubuntu.com/ubuntu/ lucid multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ lucid multiverse
deb http://us.archive.ubuntu.com/ubuntu/ lucid-updates multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ lucid-updates multiverse

2) Now run the following command to update the packages:
apt-get -y update

3) Now, install ec2 commandline tools.
apt-get install ec2-api-tools

Posted in Uncategorized | Leave a comment

Get Updates for Ubuntu 9

So we have a bunch of random aging servers doing various tasks. One of them needed to mount to a NAS unit with samba, but smbmount was not installed. Tried ‘apt-get install smbfs’ but got a bunch of errors about ‘Failed to fetch’ and ‘404 Not Found [IP: 91.189.88.40 80]’. Found the answer here.

Edit “/etc/apt/sources.list” (with root permissions) substituting all the links: “http://archive.ubuntu.com/…” (in my case us.archive) for “http://old-releases.ubuntu.com/.

Then ‘apt-get install smbfs’ worked perfectly and I was able to mount and move on with my work.

Posted in Uncategorized | Leave a comment

Install Open-E DSS on 3ware

I’m using Open-E DSS V6 for a NAS solution and tried to install on a brand new 3ware RAID configured to use 15 X 2TB drives in RAID6. It would not install no matter what I tried; the instructions weren’t very clear but I found this post through google and left a comment, the reply to which indicated I needed to recreate the RAID from scratch and set aside a boot partition.
When creating the 3ware RAID, there is an ‘Advanced’ option that allows the user to set a boot partition. After I set the boot partition (to 4G to be safe, even though only 2G are required) I was able to install Open E onto the RAID. Hooray.

Posted in Uncategorized | 2 Comments