<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>nerdcenter &#187; linux</title>
	<atom:link href="http://nerdcenter.de/tag/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://nerdcenter.de</link>
	<description>IT-Kniffe eines Webentwicklers.</description>
	<lastBuildDate>Sun, 10 Apr 2011 16:55:03 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Debian Lenny: pam_mount, files and loop devices</title>
		<link>http://nerdcenter.de/debian-lenny-pam-mount-files-loop-devices/</link>
		<comments>http://nerdcenter.de/debian-lenny-pam-mount-files-loop-devices/#comments</comments>
		<pubDate>Thu, 17 Jun 2010 07:35:21 +0000</pubDate>
		<dc:creator>kcore</dc:creator>
				<category><![CDATA[Administration]]></category>
		<category><![CDATA[Linux / Unix]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[devices]]></category>
		<category><![CDATA[Lenny]]></category>
		<category><![CDATA[libpam-mount]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[loop]]></category>
		<category><![CDATA[pam_mount]]></category>

		<guid isPermaLink="false">http://nerdcenter.de/?p=77</guid>
		<description><![CDATA[

When I was trying to automatically mount an encrypted image at login using pam_mount, I encountered a strange problem:
I wasn&#8217;t able to find any errors in my configuration (at least none connected to this behaviour), but mount.crypt was unable to mount the image.
Enabling debugging in pam_mount.conf.xml (&#60;debug enable=&#34;1&#34; /&#62;) revealed the command used for mounting:
pam_mount(misc.c:272) [...]]]></description>
			<content:encoded><![CDATA[
<!-- google_ad_section_start -->
<p>When I was trying to automatically mount an encrypted image at login using pam_mount, I encountered a strange problem:<br />
I wasn&#8217;t able to find any errors in my configuration (at least none connected to this behaviour), but mount.crypt was unable to mount the image.<br />
Enabling debugging in pam_mount.conf.xml (&lt;debug enable=&quot;1&quot; /&gt;) revealed the command used for mounting:</p>
<p><b>pam_mount(misc.c:272) command: mount.crypt [-o loop] [/home/foobar/container] [/home/foobar/crypto]</b></p>
<p>In Debians libpam-mount 0.44-1+lenny3, /sbin/mount.crypt is a bash script that calls cryptsetup with parameters generated during its runtime.<br />
Debugging it (set -x), I stumpled upon the following command:</p>
<p><i>cryptsetup -c aes -h ripemd160 -s 256 create _home_foobar_container /home/foobar/container</i></p>
<p>&#8230;which returned the following error message:</p>
<p><b>Command failed: BLKROGET failed on device: Inappropriate ioctl for device</b></p>
<p>So mount.crypt has been passed the loop option but cryptsetup was told to mount the encrypted image instead of the associated loopback device (normally mount.crypt executes losetup to create this association in its function _losetup, but this apparently has never been called).</p>
<p>Long story short:<br />
There seems to be a bug in Debians libpam-mount 0.44-1+lenny3.<br />
The case statement at line 110 in /sbin/mount.crypt doesn&#8217;t work as expected because the variable $KEY used for option comparison has an ordinary space at its values beginning.<br />
To fix this, you can either change the way how passed options are saved in the OPTION variable (starting at line 60) or change line 110 to the following:</p>
<p><b>case ${KEY/ /} in</b></p>
<p>This will remove all spaces.</p>
<!-- google_ad_section_end -->
]]></content:encoded>
			<wfw:commentRss>http://nerdcenter.de/debian-lenny-pam-mount-files-loop-devices/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>pdftk statisch linken (kompilieren)</title>
		<link>http://nerdcenter.de/pdftk-statisch-linken-kompilieren/</link>
		<comments>http://nerdcenter.de/pdftk-statisch-linken-kompilieren/#comments</comments>
		<pubDate>Wed, 02 Apr 2008 22:16:10 +0000</pubDate>
		<dc:creator>kcore</dc:creator>
				<category><![CDATA[Linux / Unix]]></category>
		<category><![CDATA[Programmierung]]></category>
		<category><![CDATA[gcc]]></category>
		<category><![CDATA[lgcj]]></category>
		<category><![CDATA[libgcj]]></category>
		<category><![CDATA[linking]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[pdftk]]></category>
		<category><![CDATA[statically]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://www.nerdcenter.de/pdftk-statisch-linken-kompilieren/</guid>
		<description><![CDATA[

pdftk
pdftk ist eine Open Source Software, die es ermöglicht, PDF-Dateien per Kommandozeile zu bearbeiten. Zu den vielfältigen Features von pdftk gehört etwa die Möglichkeit PDFs übereinander zu legen.
pdftk statisch kompilieren
Einleitung
Möchte man pdftk statisch kompilieren, um es etwa auf einem Hetzner Managed Server betreiben zu können, müssen die mitgelieferten Java Bibliotheken statisch kompiliert werden. Um dies [...]]]></description>
			<content:encoded><![CDATA[
<!-- google_ad_section_start -->
<p><strong>pdftk</strong><br />
<a href="http://www.pdfhacks.com/pdftk/">pdftk</a> ist eine Open Source Software, die es ermöglicht, PDF-Dateien per Kommandozeile zu bearbeiten. Zu den vielfältigen Features von pdftk gehört etwa die Möglichkeit PDFs übereinander zu legen.</p>
<p><strong>pdftk statisch kompilieren</strong></p>
<p><b>Einleitung</b><br />
Möchte man pdftk statisch kompilieren, um es etwa auf einem Hetzner Managed Server betreiben zu können, müssen die mitgelieferten Java Bibliotheken statisch kompiliert werden. Um dies zu erreich genügt es sowohl bei pdftk 1.21 als auch bei pdftk 1.41, die Makefiles<br />
anzupassen &#8211; von Änderungen am Quelltext bleibt man verschont. Es ist übrigens durchaus sinnvoll, pdftk als 32bit Applikation zu kompilieren, denn nur so läuft es auf nahezu jedem Linuxsystem &#8211; ohne dass man sich auch noch mit Cross-Compiling herumschlagen muss.</p>
<p><strong>Makefiles anpassen</strong><br />
Nachdem man pdftk heruntergeladen hat, das Archiv entpackt hat und in das neue Verzeichnis gewechselt hat, gilt es die Dateien Makefile.Base und Makefile.DEINE-DISTRIBUTION bzw. Makefile.Generic anzupassen. Diese befinden sich im Unterverzeichnis pdftk.</p>
<p><strong>Makefile.Generic / Makefile.DEINE-DISTRIBUTION </strong><br />
In der Datei Makefile.Generic (bzw. in der Datei, die make mit dem Parameter -f übergeben wird, z.B. make -f Makefile.RedHat) werden die Flags für den Gnu Java Compiler GCJ gesetzt:</p>
<p><code># itext compiler flags<br />
export GCJFLAGS=</code></p>
<p>Um GCJ anzuweisen, die (mitgelieferten) Java Bibliotheken statisch zu kompilieren, müssen die GCJFLAGS wie folgt geändert werden:<br />
<code>export GCJFLAGS= -static</code></p>
<p>In diesem Makefile werden auch die Flags für den C++-Compiler g++ gesetzt.<br />
Default hat die Entsprechende Konstante in dem Makefile Makefile.RedHat folgenden Wert:<br />
<code>CXXFLAGS= -lrt -ldl -lgcj</code></p>
<p>Auch diese Flags müssen angepasst werden:<br />
<code>CXXFLAGS= -W1,-v -static -W1,-Bstatic -lgcj -lpthread -lm -lz -ldl -lrt -W1,-Bdynamic -lsupc++ -lstdc++ -lc</code></p>
<p>Die Flags, die mit &#8220;-W1,&#8221; beginnen, werden an den Linker ld übergeben. Abgesehen von libc, libsupc++ und libstdc++ werden alle Bibliotheken statisch gelinkt, um deren dynamische Versionen auf dem Zielsystem nicht erforderlich zu machen (auf den Managed Servern von<br />
Hetzner ist beispielsweise keine (dynamische) libgcj installiert).</p>
<p><strong>Makefile.Base</strong><br />
In der Datei Makefile.Base werden Konfigurationen vorgenommen, die weniger Distributionsabhängig sind, als jene in den anderen Makefiles. Der Entwickler von pdftk hielt sie offenbar sogar für komplett Distributionsabhängig, deshalb wird dieses Makefile von allen anderen<br />
eingebunden. Für das Vorhaben pdftk statisch zu kompilieren ist sie eigentlich uninteressant &#8211; es sei denn man erhält (wie bei mir während des Linkens von pdftk 1.41 passiert) eine Fehlermeldung im Stil von &#8220;multiple definition of `convert&#8217;&#8221;.<br />
pdftk liefert nämlich selbst alte Java Bibliotheken mit. Im Beispiel von Convert reicht es die betreffende Zeile im Makefile auszukommentieren, um das Problem zu beheben:</p>
<p><code>libgcj_local_libs = \<br />
$(java_libs_root)/java_local/security/security.a \<br />
$(java_libs_root)/gnu_local/java/security/provider/provider.a \<br />
$(java_libs_root)/gnu_local/java/security/security.a# \<br />
#$(java_libs_root)/gnu/gcj/convert/convert.a</code></p>
<p><strong>Tücken</strong><br />
<strong>GCC Versionen</strong><br />
Die aktuelle Version von pdftk stammt vom 28. November 2006 &#8211; anders ausgedrückt: pdftk wird nicht mehr aktualisiert. Da sich die GNU Compiler Collection jedoch mit jeder neuen Version ändert und beispielsweise strikter wird, was Syntax angeht, lassen sich pdftk Version 1.21 sowie pdftk 1.41 am besten mit alten Compilern kompilieren. Ich habe pdftk 1.21 erfolgreich mit GCC 3.4.5 kompiliert sowie pdftk 1.41 mit GCC 4.0.4. Statt sein System hierfür vollzumüllen<br />
kann ich die Installation von Fedora Core 2 in einer VM (z.B. der kostenlose VMWare Server) empfehlen.</p>
<p><strong>Statische Libraries mit &#8220;falschen&#8221; (unerwarteten) Dateinamen</strong><br />
Während des Kompilierens von pdftk werden u.a. die statischen Bibliotheken libgcj.a und libgcc_s.a erwartet. Sind die entsprechenden Pakete (meist libgcc-devel, libgcj-devel o.ä.) installiert, kann es trotzdem sein, dass die entsprechenden Dateien nicht vom Linker ld<br />
gefunden werden können. In meinem Fall hat sich libgcj.a unter dem Dateinamen libgcj_bc.so versteckt, libgcc_s.a hieß libgcc_s.so.1. Ein Symlink (ls -s) auf den richtigen Dateinamen behebt dieses Problem.<br />
Die GCC Bibliotheken befinden sich bei Linuxdistributionen standardmäßig im Verzeichnis /usr/lib/gcc/*/.</p>
<p><strong>GCC 4.0.4 auf Fedora Core 2 kompilieren</strong><br />
GCC 3.4 ist auf Fedora Core 2 bereits installiert. GCC 4.0.4 kann auf einem der zahlreichen GCC Mirrors heruntergeladen werden.</p>
<p>GCC 4.0.4 habe ich wie folgt konfiguriert / kompiliert / installiert:<br />
<code>tar jxf gcc*.tar.bz2<br />
cd gcc-*<br />
mkdir objdir &#038;&#038; cd objdir<br />
../configure --enable-languages=c,c++,java --prefix=/opt --enable-threads=posix &#038;&#038; make &#038;&#038; make -k check<br />
make install</code></p>
<!-- google_ad_section_end -->
]]></content:encoded>
			<wfw:commentRss>http://nerdcenter.de/pdftk-statisch-linken-kompilieren/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

