knightly

Blog Archives

Ubuntu 11.10 issues after fresh install

Update: 13-11-2011

I decided to give Ubuntu another try. After downloading and burning a fresh image. I did a clean install. And this time the result was a lot better then the first time. Maybe i just had a bad disk.

Unity still caused me issues. Mainly because i am running a dual monitor setup. And i wan to use a TwinView setup. This just does not seem to work at the moment. So i install GNOME Shell. And that seems to work a lot smoother with two screens. Even my sound issues have been resolved magically. Maybe i should stick with Ubuntu a bit longer.

This weekend i decided to finally try to upgrade Ubuntu to the latest version (11.10). And since the upgrade process was not working out for me. I had no other choice but to do a clean install. No problem. It was time for a clean install anyway.

After fighting my way through a pile of bad rewritable DVDs i finally managed to write to disc that didn’t halt in the middle of the install process. And finished the install quite quickly. No problem there.

The Lightgdm greeting instead of the old GDM interface was nice. I logged in. And then it hit me. O shit they hooked Ubuntu up with the Unity interface. The last time i upgraded Ubuntu that was the first thing i disabled. But my second screen wasn’t activated. So i decided to install the Nvidia drivers first. And then did a reboot.

After the system came back up. The desktop environment didn’t load anymore. And if i waited long enough the whole system would crawl to a halt. Damn! At this point i was getting sleepy. And didn’t want to spend the whole night poking around the system trying to fix this. So a bit of Google magic later i found this. Some issues related to the current Nvidia driver. So i upgraded to the 285.05 version


$ sudo bash
$ add-apt-repository ppa:ubuntu-x-swat/x-updates
$ apt-get update && apt-get upgrade
$ reboot

And after a reboot the desktop was fine again. Nice!

World of Warcraft

After that i installed wine and copied back the old files i already had installed previously. But World of Warcraft didn’t want to start anymore. And although i planned not to play for a while. This got me poking around. And of course couldn’t find a solution. So i downloaded a new game client from battle.net. And started a fresh install. But when the launcher came up. It crashed just like before. Tried it a couple more times. When i noticed it was crashing starting the download. SO i started poking around in the download settings. And disabled peer-to peer. And voila! It started working for me again.

Options > Downloader Preferences
(uncheck ¨Enable peer-to-peer Transfer¨)

Lets remove Unity!

Although i kind alike the Unity interface. It wasn’t running smoothly. And i was having some serious CPU load issues. So i decided to remove it once again. This time. It wasn’t as easy though. I followed the steps in this post. Only to come to the realization that its Gnome 3 i´m dealing with and not Gnome2. O well lets give it a try.

So after messing with the themes a bit. I got the normal look back. Now the only thing annoying left is the bottom bar. That has to go. And preferably moved to the second screen. This was surprisingly easy for a change. Start up DConfig Editor from the Applications menu. And navigate to.


org > gnome > gnome-panel > layout > toplevels

(then change)

monitor : 1
orientation : top

And fix the freaking keyboard

Sound still makes a crackling noise!

But at least i have a desktop that looks reasonably the same as my old and trusted Gnome2 one did.

PHP slow on 32-bit Ubuntu

My last post was about the 32-bit integer issue i was having with PHP. And besides setting up a 64-bit server one of the solutions is to compile PHP with the CFLAGS mentioned in my previous post.

Intrigued by the fact that my 32-bit Ubuntu installation did not suffer from the same issue. I started to read the PHP5 changelog for Ubuntu.

CFLAGS=”-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64″ ./configure

But this has a negative side effect. Namely PHP running 50% slower then it should be. And to my surprise Ubuntu applies the CFLAGS above when compiling PHP5 for a 32-bit platform. So that would mean PHP on Ubuntu is always running 50% slower? Well according to this is should be the case.

I downloaded php-5.3.8 from php.net and compiled two versions. One with the CFLAGS set for large files. And one normal without any changes. After that i downloaded the benchmark script from php-benchmark-script.com. And did a couple of runs on each of the two installs. The results are stunning.

PHP-5.3.8 compiled with large file support:

test_math : 4.414 sec.
test_stringmanipulation : 4.968 sec.
test_loops : 3.529 sec.
test_ifelse : 2.344 sec.
————————————–
Total time: : 15.255 sec.

PHP-5.3.8 compiled without large file support:

test_math : 2.274 sec.
test_stringmanipulation : 2.286 sec.
test_loops : 1.619 sec.
test_ifelse : 1.228 sec.
————————————–
Total time: : 7.407 sec.

That’s pretty much a 50% speed decrease. One more thing i tried is adding the ‘AC_SYS_LARGEFILE’ macro to configure.in and rebuild the configure script. But this had no effect at all.

$ cd php-5.3.8
$ vi configure.in (add AC_SYS_LARGEFILE somewhere)
$ export PHP_AUTOCONF=/usr/share/autoconf2.59
$ ./buildconf –force

I then tried two things. First i build without the CFLAGS. But this didn’t seem to do much. Then i used the same configure script with the CFLAGS for large file support. But there was no speed increase measurable.

So why would Ubuntu have made the choice to compile PHP with the large file support on a 32-bit platform? Are there really that much developers that work on large files in web / cli applications written in PHP? Enough to sacrifice a 50% speed decrease?

I don’t really know the answer to that. But i will do my large file processing on 64-bit machines. And will compile PHP from scratch from now on. Until i have upgraded my aging hardware.

Extending my desktop

Although i am blessed with a nice double 22 inch monitor configuration. I have had this spare monitor sitting on my desk for a while Just asking to be added to the setup. Yesterday i gave it my first shot. It didn’t really go as planned but the result is fine for the moment.

Over the past years i have been a happy user of Compiz and the emerald theme manager. So these were two things i wanted to keep. Well that’s not going to happen. After playing around with xorg.conf for a couple of hours i just couldn’t manage to get the configuration i was looking for.

1. Single X Screen on the left
2. Two twinview screens on the right.

I managed to get Compiz to work with the 3 monitor setup. But this resulted in either having one large desktop extending the two 22 inch monitors. Or 3 screen using Compiz but with no possibility of sharing data between the screens. That just sucked. I have to admit this is one thing that just works better on Windows.

So the next was Xinerama. This meant switching Xinerama to “1″ in the config and restart X. Voila! Everything works. Well not everything. I have no Compiz effects and no emerald themes. So it’s slightly more ugly looking but it functions perfectly. So i will be keeping this config for now. Until i can either figure out how to get 3 monitors working using Compiz. Or get some effects / cool themes working while using Xinerama.

Zend Studio goes virtual

Zend Studio added a new great feature to there already impressive stack of features. The IDE just keeps growing in the right direction.

So the new 8 version which at the time of writing is in Beta added VMWare support. This is a feature i was looking forward to. And couldn’t wait to give this a try. So when i got a email that the new beta is out. I didn’t wait and downloaded the behemoth.

Adding VMWare support to the IDE seems like a logical thing to do. Specially since everything is virtualized now a days. I thought about this a while. But you can use it in different setups. For me it is an extra on my development environment. I’m a big Linux enthusiast. But at the office i work on windows. So now i can develop in my own virtual Linux environment. But it’s also a great solution for running Unit Test on a production VM. Or just to test on a production VM.

My first try was on my OS of choice which is Ubuntu. That however didn’t go to well. As soon as i started the “Run as VMWare application” my IDE would die on me. I quickly gave up on this mainly because i am running Maverick which is not considered stable. And VMWare already had some problems building the kernel modules. If anybody is interested in the crash logs. I still have some.

So back to windows. Windows 7 in particular. I always keep a Windows partition laying around. For games and stuff. So i downloaded the following files.

* Ubuntu-Server
* Zend Studio 8 Beta (trial)
* VMWare 7.1.2 (trial)

Installing VMWare and Zend Studio is a since. Nothing to make note off here. After that was done i installed Ubuntu 10.04 Server edition. And installed Zend Server inside of it. That should be all.. right? So let’s launch the IDE and give it a shot. Well it launched but i got back an error like below.

At first i had no clue what was going on. But i had the feeling there was something wrong with the VMWare client tools. After digging through the Zend Studio manual i found the answer The ‘hgfs’ was not mounted on teh client OS. And this was because the vmware tools did not have enough libraries to build everything. To build the complete VMWare tools on the client OS we need

* gcc
* make
* build-essential
* linux-headers-(current version)

When that’s done it necessary to attach the linux version of the VMWare tools to the virtual CDRom drive. So we can mount it inside the VM.

/usr/lib/vmware/isoimages/linux.iso

mount /dev/cdrom /mnt

Copy the file somewhere and unmount the /mnt or the build will fail. Unpack the VMWare tools and run the perl script inside to install. Once that’s done follow the VMWare instructions. Or reboot the VM.

Now we are all set. Now it’s just a matter of writing code. And running it on the VM. When running an application as a VMWare application the IDE syncs the files with the shared folder on the VM. After that the internal browser is launched to see the result.

The first time you will be asked for the VM to use. Just point it to the VM image created by VMWare.

When no VM is active when launching the application. Zend Studio will trigger VMWare to launch the VM.

Some output in Zend Studio

Move GNOME panels in Ubuntu 9.04

Some days ago i updated my Ubuntu Intrepid Ibex to the new Jaunty Jackalope. Besides some minor glitches everything works smoothly. One small issue however annoyed me.

I always work with a dual monitor setup. And i like to have a GNOME panel on every screen. So normally i would just create a new panel and drag it to the second screen. This doesn’t seem to work anymore. Or maybe it’s just a bug. After some playing around with the panel settings i found a small work around.

So to add an extra panel to the desktop. Just right click on the main panel and choose “New Panel”.

gnome_movepanel_1

This will create a new panel at the bottom of the screen. When you right click this panel and ask for the properties. You can change the way the panel behaves. The expand checkbox is selected by default. So just uncheck it. And the bottom panel shrinks. The bottom panel now has two dotted areas on the left and right sight of the panel. Clicking and holding down these areas makes it possible to drag the panel across screens.

gnome_movepanel_3

When the panel is at the right location. Just drop it and check the expand box again. Which results to the image below.

gnome_movepanel_5

Making PHP mail work on Ubuntu through Postfix

While writing a small mail application in PHP i noticed i couldn’t send mail from my local machine. Even with telnet i couldn’t send out emails. I quickly found out that postfix and sendmail on the same system is not a good idea. Seems it was a left over from some testing i did. So after wiping sendmail and postfix from the system. And reinstalling only postfix i got an error when starting Postfix

postfix: fatal: /etc/postfix/postfix-script: No such file or directory

So let’s try and completely remove the postfix package and purge all files.

$ sudo dpkg –remove postfix
$ sudo dpkg –purge postfix

And a clean install of postfix:

$ sudo apt-get -V install postfix

Now i can telnet in and try to send some mail. And this seemed to work. The mail got delivered.

$ telnet localhost 25

Trying 127.0.0.1…
Connected to localhost.
Escape character is ‘^]’.
220 0×0 ESMTP Postfix (Ubuntu)

helo test.nl
250 0×0
mail from: test@test.nl
250 2.1.0 Ok
rcpt to: some@working.address
250 2.1.5 Ok
data
354 End data with
testing
.
250 2.0.0 Ok: queued as ED97311C412F

So now let’s make sure it also works from PHP. I tested it through a CLI script and through apache2. With the most basic mail script you can imagine.

    mail('some@working.address', 'test', 'test message');

The mail however gets bounced.

Jan 7 22:31:48 0×0 postfix/pickup[10249]: 035BF11C4133: uid=1 from=
Jan 7 22:31:48 0×0 postfix/cleanup[11726]: 035BF11C4133: message-id=<20090107213148.035BF11C4133@0x0>
Jan 7 22:31:48 0×0 postfix/qmgr[10250]: 035BF11C4133: from=, size=303, nrcpt=1 (queue active)
Jan 7 22:31:48 0×0 postfix/smtp[11728]: 035BF11C4133: to=, relay=working.mail.server[xx.xxx.xx.xx]:25, delay=0.68, delays=0.02/0/0.48/0.18, dsn=5.0.0, status=bounced (host working.mail.server[xx.xxx.xx.xx] said: 553 sorry, your envelope sender domain must exist (#5.7.1) (in reply to MAIL FROM command))
Jan 7 22:31:48 0×0 postfix/cleanup[11726]: C5C2911C4134: message-id=<20090107213148.C5C2911C4134@0x0>
Jan 7 22:31:48 0×0 postfix/qmgr[10250]: C5C2911C4134: from=<>, size=2064, nrcpt=1 (queue active)
Jan 7 22:31:48 0×0 postfix/bounce[11729]: 035BF11C4133: sender non-delivery notification: C5C2911C4134
Jan 7 22:31:48 0×0 postfix/qmgr[10250]: 035BF11C4133: removed
Jan 7 22:31:49 0×0 postfix/smtp[11728]: C5C2911C4134: to=, relay=working.mail.server[xx.xxx.xx.xx]:25, delay=0.75, delays=0.01/0/0.41/0.34, dsn=2.0.0, status=sent (250 ok 1231363909 qp 10204)
Jan 7 22:31:49 0×0 postfix/qmgr[10250]: C5C2911C4134: removed

From looking at the log files i can tell it bounced because the from address is set to daemon@internal.name. And internal.name is not known by my mail server. Let’s try that again. But this time specifically set the FROM header.

    $headers .= 'To: Name ' . "\n";
    $headers .= 'From: test ' . "\n";
    mail('some@working.address', 'test', 'test message', $headers);

The result is the same. The FROM header didn’t change at all. So although it’s possible to set the from header. The message is always send by a system user.. So after doing some research on Google about this problem it seems possible to pass an extra parameter to the mail() function. This parameter can contain a string which will be passed to the postfix binary as an extra parameter. So adding -fsome@orking.address makes the problem go away.

Jan 7 22:36:58 0×0 postfix/pickup[10249]: 687CA11C4133: uid=1 from=
Jan 7 22:36:58 0×0 postfix/cleanup[11847]: 687CA11C4133: message-id=<20090107213658.687CA11C4133@0x0>
Jan 7 22:36:58 0×0 postfix/qmgr[10250]: 687CA11C4133: from=, size=276, nrcpt=1 (queue active)
Jan 7 22:36:59 0×0 postfix/smtp[11849]: 687CA11C4133: to=, relay=working.mail.server[xx.xxx.xx.xx]:25, delay=1.4, delays=0.02/0/0.59/0.76, dsn=2.0.0, status=sent (250 ok 1231364219 qp 10582)
Jan 7 22:36:59 0×0 postfix/qmgr[10250]: 687CA11C4133: removed

But this would mean that i always have to pass the extra parameter. And if i use a third party class or function. i may not be able to do so without hacking the code. So although it solves the problem it’s not the final solution. After i bit of browsing i found out that changing the myorigin parameter in /etc/postfix/main.cf to a known mail server. I could start the send out mail. So i changed it to the domain my mail server runs under.

myorigin = mail.server

And now sending mail from PHP works.

Making permanent changes to resolv.conf under Ubuntu.

At work we have a local dev box. This box is running Ubuntu 8.04 and some tools we need for developing. Nothing special. This box get’s it’s IP address from the DHCP server that runs on the router. And this caused some problems because we are running a local DNS server for the dev box. Mainly to use internal domains for testing.

To make this work we changed the resolv.conf to use the new local DNS server. This works fine wouldn’t it be for Ubuntu changing the file back to it’s original settings on every DHCP request. So every 900 sec the file gets overwritten. To solve this the first time i simply made the file read only. This however caused some problems with the DHCP client requesting an IP address over and over again. This caused the load on the dev box to rise….

Further inspection showed that it’s the dhclient-script the overwrites the resolv.conf file. I tried commenting out parts of the dhclient-script. But this just created more problems. So i did a search on the Ubuntu package list. And found a promising program called resolvconf. This program takes over from resolv.conf. And with this program installed it’s possible to make permanent changes without creating any problems.

After installing the package and doing a search for resolvconf. I found a directory in /etc which had a resolv.conf inside. This seemed to be the template used for overwriting the original resolv.conf. After changing this file all problems were resolved.

/etc/resolvconf/run/resolv.conf

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND — YOUR CHANGES WILL BE OVERWRITTEN
search example.com
domain example.com
nameserver xxx.xxx.x.xx

*Update

After googling some more. I think i found a better way to solve this problem. And probably the only way to solve this. No need to install any extra software. Just edit the dhclient config file.

change the following lines in /etc/dhcp3/dhclient.conf

supersede domain-name “example.com”
prepend domain-name-server xxx.xxx.xxx.1, xxx.xxx.xxx.2

Stop ACTA