blog.plee.me About software, technology and random things

26Jun/090

Compiling Exim and MySQL on a (CentOS) 64 bit Environment

Hey there!

I was recently trying to compile Exim with MySQL support on a CentOS 5.x 64 bit system. However, I had my dear share of trouble when it came to adjust the Local/Makefile for the 64 bit architecture.

The following error was what I got stuck on:

...
gcc dkim-exim.c

awk '{ print ($1+1) }' cnumber.h > cnumber.temp
rm -f cnumber.h; mv cnumber.temp cnumber.h
gcc version.c
rm -f exim
gcc -o exim
/usr/bin/ld: cannot find -lmysqlclient
collect2: ld returned 1 exit status
make[1]: *** [exim] Error 1
make[1]: Leaving directory `/root/incoming/exim-4.69/build-Linux-x86_64'
make: *** [go] Error 2

Turns out it was easier to solve than I thought. The point was that it was looking for 32 bit libraries where it should have been looking for 64 bit ones. I adjusted the following lines in Local/Makefile:

LOOKUP_INCLUDE=-I /usr/include/mysql
LOOKUP_LIBS=-L/usr/lib/mysql -lmysqlclient -lz -lm

to say this:

LOOKUP_INCLUDE=-I /usr/include/mysql
LOOKUP_LIBS=-L/usr/lib64/mysql -lmysqlclient -lz -lm

And - hurray! - it works 🙂

Be careful though, it seems to need the /mysql after /usr/lib64.

15Jun/090

Firefox Lags + Sysinternals

Hey!

I've recently found out about a majorly annoying phenomenon that can be experienced if you launch a performance-hungry application through Firefox, mostly through downloading a file and opening it directly from Firefox.

Why?

Speaking in terms of process trees, firefox.exe is the root process (or parent process) of the child process, say for example Azureus / Vuze. Vuze is known to be rather performance demanding and when it needs resources, it will take them not only from the system itself, but also noticably from the parent process. I don't know if it's common behavior, but usually that shows in Firefox experiencing the occasional couple-of-seconds lags.

The solution? Close Firefox and restart it. That way, all its child processes are raised to the same level firefox.exe was on and you can now browse without any more lags disturbing your streaming videos or anything else 🙂

I realized this when I was running Process Explorer by Sysinternals (a company that creates awesome tools for Windows. In fact so awesome they ended up being bought by Microsoft :D). It's a great tool to see not only Process IDs, CPU usage, RAM usage and executable names, you can also see dependencies (parent/child processes), CPU time, threads, etc. As a very nice feature it can also show little diagrams of resource usage (CPU and I/O ops) as task icons in your task bar next to the system clock! So much better than the built-in task manager! 🙂

Also check out the other tools by Sysinternals. I use Process Explorer and Process Monitor.

10Jun/090

How To: Migrate an Existing Windows System to Another Hard Drive Using Acronis TrueImage

Hi!

Because of a new hard drive I bought a week ago I decided to transfer my existing system, running on a 250 GB hard drive, to my new 1 TB one. I was lucky enough to at least have made some experiences with migrating an existing system to a Virtual Machine in conjunction with Acronis TrueImage Home 2009 before, so that's what came in handy for me.

What you need

  • Backup software like Acronis TrueImage Home 2009
  • BartPE with Acronis TrueImage Plug-In / bootable version of your backup software
  • Windows installation disc (preferably the same Windows version as your current system)
  • New system hard drive which is either empty or ready to be re-formatted (backup your important data on it!)

Procedure

  1. Start Acronis TrueImage Home 2009 and make a backup of your system partition.
  2. Save the backup to a partition / hard drive that you will have access to later on while using the bootable backup restorer. This means: No (TrueCrypt-)encrypted partition. Ideally it would fit on a disc or USB stick (which my didn't with a size of 7 GB). Just make sure you will be able to access it later on. I know BartPE is able to access all hard drives (without encryption at least) and should give you access to a USB drive as well, as long as you have it connected while it's booting up. If you don't want to move it over to a USB drive or DVD or anything else, there is also a nice little trick at the end of this howto: (*).
  3. Shut down your computer and make sure your new system drive is connected as the first device to avoid improper device numbering. This means using the first connector for SATA/IDE or whatever. If you are using both SATA and IDE, I don't know how that's handled. I'm just assuming you somehow have figured it out 🙂
  4. Boot from your Windows installation disc.
  5. If you haven't done it previously under Windows, partition the new system drive properly. That means to have the partitions created in the correct order. If you haven't (or aren't sure any more), delete them and do it over again just to make it right. Maybe the order is not necessary, but I had a lot of trouble with that before, so I'm just playing safe.
  6. Install Windows as usual to the point when you've started up your brand new Windows installation for the first time and are watching the Start Menu in awe.
  7. Boot from your bootable backup software (or BartPE with the plugin) and fire it up.
  8. Restore the image. Don't select MBR / Track 0, however, because we just created a proper MBR (Master Boot Record) by installing Windows.
  9. That's it! You should be done. Now a reboot should provide you with your old system on a new hard drive. Congratulations 🙂

I don't guarantee anything, and I admit to having tried several methods for half a day till I got it right 🙂 This should work fine though, because it basically is what I did the time when it finally worked.

If you have partitions with programs on it that would be started on bootup, make sure you copy it (file by file) before you start your system on the new hard drive.

While you could do that by connecting your old system drive and booting from that, then copying the files over, you could also do it beforehand by using the Windows Disk Management tool to erase all partitions and partition it properly before the Windows installation. This allows you to format the specific partitions and copy the files over to it while you're still on your old system. (*) Also, you can add the backup image onto that partition, so you don't have to burn a DVD or move the image over to a USB stick or ... (you get the point). However, if you create and format the partitions on your old system, make sure to

  • (naturally) not touch them during the Windows installation progress or your data on them will be inaccessible
  • rename your partitions properly after booting up your new system because your old Windows already assigned them (probably different) drive letters. You can do that in the Windows Disk Management tool as well.

I hope I didn't forget anything. If I did, I'll be sure to add it later on 🙂

Thanks for reading and good luck!

8Jun/090

How To Migrate Your Live Windows System To VirtualBox

Hey!

Ever regret that Sun didn't include something like a migration assistant for your live Windows system in VirtualBox?

My method concentrates on these basic steps:

  • Create a backup of your whole system partition
  • Create a new VirtualBox Hard Disk
  • Install Windows onto the VirtualBox Hard Disk to create a function MBR (Master Boot Record)
  • Apply the backup onto your VirtualBox Hard Disk

Done!

What you need:

Process:

    1. Start Acronis TrueImage and create a backup of your whole system partition. For version 2009 doesn't mean System State but My Computer => Disk 1 => C:. Leave Back up sector-by-sector unchecked. Adjust the other settings to your liking and start the backup process.
    2. Go to Tools => Create Bootable Rescue Media and create the image as an ISO file.
    3. Use your File-to-ISO converter or burning software to convert your .tbi backup file to an ISO that you will be able to mount it as a CD/DVD later on. (Reason being that I had problems selecting the right partition to be replaced by the backup when I had two partitions mounted to the virtual machine - the other one included the backup file. Also you won't be able to install the Guest Additions, so you can't mount folders over the VirtualBox shared folders.)
    4. Start VirtualBox and create a new Machine. Choose your current OS and name it as you like.
    5. During the process create a new Boot Hard Disk and give it the same size as your current system partition (maybe less if you know the size will be enough).
    6. Adjust the settings of your new machine and start it.
    7. Mount the Windows installation disc and install Windows. This is so that a proper MBR (Master Boot Record) is created because we will need one in order to boot from the final system.
    8. After the Windows installation (as soon as you see the Windows Start Menu and stuff), mount the Acronis Bootable Rescue Media ISO as a CD/DVD and boot from it.
    9. Select Acronis True Image Home (Full Version) and you'll see the TrueImage program like you did in Windows.
    10. Dismount the current CD/DVD image.
    11. Mount your the ISO with your backup file.
    12. Click on Manage and Restore => Browse for backup... and open the CD/DVD Drive which should have the backup image file right there. If it doesn't, try unmounting and remounting it again.
    13. Right-click on the backup in the list and select Restore.
    14. Select the hard disk (partition) you just created and continue. Make sure that the Restore MBR (Master Boot Recover) / Track 0 checkbox is unchecked.
    15. Let it run through.
    16. Now reboot your machine.
    17. Congratulations! You should have a working copy of your live system in VirtualBox!

      I guess there are a couple of kinks here and there because I didn't actually do it like that (I installed Windows on the virtual machine before I attempted to restore via Acronis Bootable Rescue Media ... yeah, silly me 😀 ) and it was about 3 days ago, so I'm writing off the top of my head.

      Please give me feedback if it worked! (And also if it didn't!) 🙂

      In the case of Windows XP (and probably Vista and 7) because of the major change of hardware (actual drivers replaced by virtual drivers) you will be required to re-activate your Windows copy. XP gives you a maximum of 3 days for that.

      Just thought I'd mention it for clarity's sake 🙂

      Good luck and have fun!

      8Jun/090

      Compiling PHP 5 with IMAP support on SuSE / openSUSE Linux

      If you get the following configure error:

      configure: error: utf8_mime2text() has old signature, but U8T_CANONICAL
      is present. This should not happen. Check config.log for additional
      information.

      It's probably because you're missing either the libc-client-devel package or imap-lib and imap-devel. Fire up yast and install those. You should be good to go now 🙂

      (I have openSUSE 11.0 and it doesn't have the libc-client-devel package, but I read about it on another page and thought I'd add it, just to be safe 🙂 )

      8Jun/090

      Asus P5B and the broken JMicron SATA/PATA controller

      Hey there!

      Yesterday, while I was trying out my new hard drive, I noticed that it apparently took ages to defragment. Not only that, but it also took away a major amount of resources. Funnily enough, the CPU usage didn't show up at all in the task manager (I'm using Windows XP x64 Professional). However, the mouse cursor was lagging behind and whenever I played audio or video - be it a YouTube video or an actual video in VLC - it lagged there as well.

      So what could it be?

      (Skip to the bottom to see the conclusion 🙂 )

      My first guess was that there was a hardware failure. Probably with the new hard drive because my others all worked, right? Technically it was unlike for my new hard drive to be damaged though as I formatted it the day before (with TrueCrypt) and it showed around 90 MB/s of formatting speed.

      After a series of rebooting and benchmarking via HD Tune (also in Windows Safe Mode) I realized that at the start (basically the first time after a bootup) the hard drive worked fine with an average of about a 100 MB/s transfer rate. However, at around 60%+ it sunk drastically to a minimum of 1.4 and a maximum of 1.5 MB/s. It stayed there till the end of the benchmark and for every following one (until you rebooted).

      Next thing I did was to change the BIOS settings for the JMicron SATA/PATA Controller from Enabled / IDE to Enabled / AHCI. After the Windows bootup it recognized a new Primary IDE channel, Secondary IDE channel, Standard Dual Channel PCI IDE Controller and one of my two optical drives (why only one? Don't ask me :D). The hard drive didn't show up at all - neither in the Disk Management nor in the Device Manager. A change from Enabled / AHCI to Enabled / RAID (with "no raid" in the JMicron settings) did the same thing: recognition of new channels and no new hard drive.

      The first run with an HDD on the JMicron controller.

      Every other run following the first one with an HDD on the JMicron controller.

      For reference - this is what a healthy drive usually looks like:

      This is what a healthy HDD usually looks like in HD Tune.

      When I looked that the Device Manager I found that there were two SATA controllers in the IDE ATA/ATAPI controllers category. One was the Intel(R) ICH8 2 port Serial ATA Storage Controller - 2825 and the other one was the Intel(R) ICH8 4 port Serial ATA Storage Controller - 2820. My main / old hard drives are all hooked to the 4 SATA ports on the lower half of the P5B, some of them using an eSATA to SATA cable. So that had to be the 4 port SATA controller, which worked fine. Thus, the 2 port controller was the one controlling the eSATA port in the back pane - and making trouble.

      The moral of the story is that obviously the JMicron SATA/PATA Controller doesn't do his job on the ASUS P5B at all. So, in case you're looking for more SATA ports, you're going to have to buy a new SATA controller.

      I myself will be settling with SATA and eSATA for my biggest drives and using USB for my smallest one.

      Cheers 🙂

      4Jun/090

      The Start

      Welcome to this private blog.

      In here I will post several stuff (most of it probably tech-related) that goes through my mind and which I think of as useful.

      Have fun reading it and thank you for your visit 🙂

      Filed under: Blog No Comments
         
      %d bloggers like this: