Purge All dpkg Packages Marked As rc

Title says it all. Purges the packages and their configuration files. Watch out for “directory not empty” messages and manually delete those.

dpkg --list | grep "^rc" | cut -d " " -f 3 | xargs apt-get autoremove --purge -y

Original: http://linuxprograms.wordpress.com/2010/05/12/remove-packages-marked-rc/

Install A Particular Version of PHP – Debian Squeeze

Recently ran into an issue where I needed a specific version of PHP on a base Debian 6 install. The default is php 5.3.3 but what I wanted to install was php 5.3.8 for some testing.

Dotdeb maintains updated .deb packages for many LAMP applications. They also maintain older versions in their archives. This is what I had to do, which I think can be extrapolated to any other package you need.

Use wget to download all the .deb packages you need.

wget -r -l1 --no-parent -A ".deb" http://archives.dotdeb.org/dists/squeeze/php5/5.3.8/binary-amd64/

aptitude install libonig2 libqdbm14 libltdl7 libmcrypt4 libcurl3 #Some dependencies from the stable branch

dpkg -i php5-cli_5.3.8-1~dotdeb.2_amd64.deb php5-common_5.3.8-1~dotdeb.2_amd64.deb php5-gd_5.3.8-1~dotdeb.2_amd64.deb php5-mysql_5.3.8-1~dotdeb.2_amd64.deb php5-mcrypt_5.3.8-1~dotdeb.2_amd64.deb php5-mcrypt_5.3.8-1~dotdeb.2_amd64.deb libapache2-mod-php5_5.3.8-1~dotdeb.2_amd64.deb php5-curl_5.3.8-1~dotdeb.2_amd64.deb php5-common_5.3.8-1~dotdeb.2_amd64.deb

Debian Squeeze Problem Installing openjdk-6-jre-headless

This seems to be happening only on some machines. May be an apt-cacher bug? Still investigating.


root@sql:/opt# aptitude install openjdk-6-jre-headless
The following NEW packages will be installed:
  ca-certificates-java{a} dbus{a} java-common{a} libavahi-client3{a} libavahi-common-data{a} 
  libavahi-common3{a} libcups2{a} libdbus-1-3{a} liblcms1{a} libnspr4-0d{a} libnss3-1d{a} 
  openjdk-6-jre-headless openjdk-6-jre-lib{a} tzdata-java{ab} 
0 packages upgraded, 14 newly installed, 0 to remove and 0 not upgraded.
Need to get 33.9 MB of archives. After unpacking 93.6 MB will be used.
The following packages have unmet dependencies:
  tzdata-java: Depends: tzdata (= 2012c-0squeeze1) but 2012g-0squeeze1 is installed.
The following actions will resolve these dependencies:

     Keep the following packages at their current version:
1)     ca-certificates-java [Not Installed]               
2)     openjdk-6-jre-headless [Not Installed]             
3)     openjdk-6-jre-lib [Not Installed]                  
4)     tzdata-java [Not Installed]                        



Accept this solution? [Y/n/q/?] q
Abandoning all efforts to resolve these dependencies.
Abort.


root@sql:/opt# aptitude install tzdata-java
The following NEW packages will be installed:
  tzdata-java{b} 
0 packages upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 148 kB of archives. After unpacking 1,987 kB will be used.
The following packages have unmet dependencies:
  tzdata-java: Depends: tzdata (= 2012c-0squeeze1) but 2012g-0squeeze1 is installed.
The following actions will resolve these dependencies:

     Keep the following packages at their current version:
1)     tzdata-java [Not Installed]                        



Accept this solution? [Y/n/q/?] n
The following actions will resolve these dependencies:

     Downgrade the following packages:                           
1)     tzdata [2012g-0squeeze1 (now) -> 2012c-0squeeze1 (stable)]



Accept this solution? [Y/n/q/?] Y
The following packages will be DOWNGRADED:
  tzdata 
The following NEW packages will be installed:
  tzdata-java 
0 packages upgraded, 1 newly installed, 1 downgraded, 0 to remove and 0 not upgraded.
Need to get 884 kB of archives. After unpacking 2,281 kB will be used.
Do you want to continue? [Y/n/?] Y


root@sql:/opt# aptitude install openjdk-6-jre-headless
The following NEW packages will be installed:
  ca-certificates-java{a} dbus{a} java-common{a} libavahi-client3{a} libavahi-common-data{a} 
  libavahi-common3{a} libcups2{a} libdbus-1-3{a} liblcms1{a} libnspr4-0d{a} libnss3-1d{a} 
  openjdk-6-jre-headless openjdk-6-jre-lib{a} 
0 packages upgraded, 13 newly installed, 0 to remove and 0 not upgraded.
Need to get 33.8 MB of archives. After unpacking 91.6 MB will be used.
Do you want to continue? [Y/n/?] Y

Manually changing the package version for tzdata as suggested online in some places WILL break apt at some point. Not a bright idea.

Joomla! – Unexpected $end

I went through some trouble and spent some time on this issue before finally realizing that it was a super easy fix. To address a much bigger issue, I was moving a Joomla! 1.5.x(I know, old) site from Fedora 7 to Fedora 14. Just to make sure everything goes well with the upgrade I test everything in a stage environment.

  • Fedora 14 comes with php 5.3.8 by default.
  • Moved the site and db over. I start seeing a bunch of “Parse error: syntax error, unexpected $end…” httpd errors for a particular template file.
  • Checked the php file in question – no php syntax errors.
  • Some HTML in that file. Is the HTML malformed in some way? Nope.
  • May be its the PHP version.
    • yum downgrade php php-* (To version 5.3.3)
    • Bring the latest code from git and test.
    • This code works on our dev with php 5.3.3 and does not work on this Fedora 14 instance php 5.3.3.
    • So nope. Thats not the issue. Revert the changes made to php.
  • I installed php-suhosin for security. Is that causing an issue?
    • yum erase php-suhosin
    • Doesn’t solve anything. Re-install php-suhosin.
  • Is anything being dynamically added to the page from the database on load? Nope.
  • Check httpd configs – Not the issue.
  • Restarted apache a bunch of times and pulled my hair out.

At last I finally realized it has to be PHP settings – I don’t think anything changed drastically with the way people need to code in php from version 5.3.3 and 5.3.8. So I get the php.ini files from dev server and the Fedora 14 server, strip out all the comments and empty lines and do a side by side diff of the two files.

The culprit: short_open_tag=Off

Apparently this is set to off in the newer versions of php.ini file and for a good reason. These tags are notorious for conflicting with xml tags among other things and code containing short tags is generally considered not portable. Portable being the operating word in my situation since I’m jumping a few OS versions. Change this to “On” and restart httpd and I was good to go. Obviously this old version of Joomla! with a bunch of customizations has a lot of legacy code. I really wish I had started with comparing the php.ini files.

Apple Online Store Down – New iPad Launch.

apple_store_offline