17. December 2013

Debian – upgrade from Apache 2.2 to 2.4 – Starting web server: apache2 failed!

Debian maintainers changed default Apache from version 2.2 to 2.4. Not a big deal?

I was just upgrading one package and it had dependency on whole new Apache. I said yes to upgrade, because I had no bigger issues with Apache upgrade in past.

Wohoo. This upgrade was very funny, because Apache 2.4 was not able to start due to conflicting configurations. The coolest part was that Subversion stopped working, but that’s different story.

The problematic part was that Apache failed to start with nice message:

[FAIL] Starting web server: apache2 failed!
[warn] The apache2 instance did not start within 20 seconds. Please read the log files to discover problems ... (warning)

I checked the log file /var/log/apache2/error.log, but there was no hint what went wrong.

Apache was working even though startup script reported error. 🙂

After a while I found that there were some important changes in /etc/apache2/apache2.conf. I compared this file with /etc/apache2/apache2.conf.dpkg.dist.

It was necessary to update following lines in apache2.conf:

Mutex file:${APACHE_LOCK_DIR} default
PidFile ${APACHE_PID_FILE}
#LockFile /var/lock/apache2/accept.lock - disable this, old value

Then it was possible to start Apache without problem:

[ ok ] Restarting web server: apache2.

22. September 2013

Deploy Spring application by Maven to Tomcat7 via HTTPS – PKIX problem

Simple scenario: deploy spring application to remote server which has https management interface.

Easy task. When you have properly configured project with pom.xml then you can use tomcat7 plugin for Maven.

Part of pom.xml

<plugin>
 <groupId>org.apache.tomcat.maven</groupId>
 <artifactId>tomcat7-maven-plugin</artifactId>
 <version>2.0-SNAPSHOT</version>
 <configuration>
  <path>/test</path>
  <!-- username and password must be set in ~/.m2/settings.xml -->
  <server>mytomcat</server>
  <!-- URL where Maven can find Tomcat 7 Manager -->
  <url>https://test.sinusgear.com:443/manager/text</url>
 </configuration>
</plugin>

Just run:

mvn tomcat7:deploy

Upload fails with error message:

PKIX path building failed

Ups. Not that easy? 🙂
The problem is that Java does not trust certificate of remote server.

Here is how to fix PKIX issue in Windows.

Open url of remote server by Firefox and save certificate to file.

Run PowerShell as administrator.

Go to directory with JDK cacets and import certificate. Default password is “changeit“.

cd C:\Program Files\Java\jdk1.7.0_40\jre\lib\security
keytool -import -alias test.sinusgear.com -keystore cacerts -file C:\Users\georgik\Documents\test.sinusgear.com

Done. Now you can start mvn tomcat7:deploy again.

1. June 2013

GitLab: Could not read from remote repository

When you try to push to GitLab you may end up with following error message:

fatal: Could not read from remote repository.
Please make sure you have the correct access rights
 and the repository exists.

It’s not very clear what’s real cause. You may check the permission, but it might not solve the problem.

One quick solution could be just restart of GitLab service. It still might not help.

Let’s learn some mechanics of GitLab.

You send data via ssh to GitLab server. When authentication by key is succesfull then server will invoke gitlab-shell. This will shell send request to web interface of GitLab. Yes, web interface. Then it will allow you to access git repository.

Schema:

git -> ssh -> sshd -> gitlab-shell -> gitlab web

The problem described in the beginning of this article is between gitlab-shell and gitlab-web. Most likely shell is not able to access gitlab web. URL is broken or host configuration is incorrect or port is not reachable.

Just go to gitlab-shell project and open file config.yml. You’ll see something like this:

gitlab_url: "http://localhost:80/"

Test this URL directly on server e.g. by links:

links http://localhost:80/

You may need to change hostname or port or add base directory to URL. Fix the URL so the gitlab-shell is able to access web interface. Restart gitlab service and try to push again.

Further discussion about this and similar problems is available at github.

12. May 2013

How to fix broken style in Plone

Some Products for Plone are little bit broken and uninstallation procedure does not work very well. When you install and then uninstall crappy product you might end up with messed layout of Plone portal.

That’s the time to pay a visit to plone_css folder in ZMI.

Remove any reference to broken style (whole box with style has yellow color) and click Save to reset Plone CSS caching system.

6. October 2011

Debian – dpkg problem – tar exists on unknown argument —warning=no-timestamp

I was upgrading Linux Debian. Everything went ok until upgrade of dpkg.

After upgrading dpkg package I was not able to install anything, because of error with tar command.

Tar was complaining that –warning=no-timestamp is unkwnown parameter and program terminated with error.

So I made small trick. I renamed /bin/tar to /bin/tar.original:

mv /bin/tar /bin/tar.original

Then I wrote simple script into /bin/tar file:

#!/bin/bash

tar.original xf -

Add permission:

chmod a+x /bin/tar

The last step is reinstallation of broken packages:

apt-get install --reinstall dpkg
apt-get install --reinstall tar

7. September 2011

Debian – apt-get install perl problem

I wanted to install new package on Debian. But what a funny message:

E: Could not perform immediate configuration on 'perl-modules'. 
Please see man 5 apt.conf under APT::Immediate-Configure for details. (2)

How to solve it?

Type:

apt-get install perl -o APT::Immediate-Configure=0

27. August 2011

Try to create aux.h file on Windows 7

Try it 🙂

I was playing with one package from Linux. I grab source code of package using Cygwin. This source code contained one funny file: aux.h.

Windows version of Vim refused to open this file with error message: Permission denied.

Even Notepad refused to open this file.

Finally Visual Studio gave me interesting hint about this aux.h file name:

 

I tried to zip this file by 7Zip and extract it back. Result was that 7Zip decompressed file as _aux.h.

Interesting issue. 🙂

5. March 2011

IE 6 Countdown

IE 6 is one of the biggest blocker of innovation in web technologies. IE 6 is eating hours and hours of developer’s time.

Some goverments stubbornly require support of this “ancient” application.

Christian Heilmann has been talking about this problem for several years.

Usage of IE 6 is falling. 12% in February. You can watch the departure of IE 6 from computer stage at: ie6countdown.com

31. January 2011

Amazon S3 – Authenticating REST – bug in documentation

Document Amazon S3 – Authenticating REST says that you should generate authentication signature using following code:

"Authorization: AWS " + AWSAccessKeyId + ":"
   + base64(hmac-sha1(VERB + "\n"
   + CONTENT-MD5 + "\n"
   + CONTENT-TYPE + "\n"
   + DATE + "\n"
   + CanonicalizedAmzHeaders + "\n"
   + CanonicalizedResource))

In documentation you can find following instructions:
The string to be signed is formed by appending the REST verb, content-md5 value, content-type value, date value, canonicalized x-amz headers, and the resource; all separated by newlines.

I followed instructions, but server always responded in the same stubborn fashion:

Code: SignatureDoesNotMatch
Message: The request signature we calculated does not match the signature you provided. Check your key and signing method.

The problem was that my request didn’t contain any AmzHeader and therefore CanonicalizedAmzHeaders was empty string followed by new line. That’s wrong.

If CanonizalizedAmzHeaders is empty string then there MUST NOT be new line!

Correct string for signing in case when AmzHeader is empty:

"Authorization: AWS " + AWSAccessKeyId + ":"
   + base64(hmac-sha1(VERB + "\n"
   + CONTENT-MD5 + "\n"
   + CONTENT-TYPE + "\n"
   + DATE + "\n"
   + CanonicalizedResource))

26. January 2011

IntelliJ Idea – Windows – Git – The remote end hung up

I was trying to clone git repository. I had brand new Windows with Cygwin version of git. Intellij Idea displayed nice helpful error message:

fatal: The remote end hung up unexpectedly

I found article at grublesmurf.org that pointed me to solution.

Problem was that Cygwin was using directory c:\cygwin\home\georgik\.ssh, but Intellij Idea was trying to read c:\Users\georgik\.ssh. I moved .ssh directory to c:\Users\georgik and set HOME variable to %USERPROFILE%.It is also worthy to modify /etc/passwd in cygwin to match that directory.

  • Where’s the fish?

  • Translations

  • Further info

  • Twitter

    Follow @jurajmichalek on twitter.

  • Comments

  • Tags

  • Topics