philipp's webloghttp://www.philipp-wagner.com/blog
whatever comes to a developer's mindWed, 05 Nov 2014 10:23:49 +0000en-UShourly1http://wordpress.org/?v=4.1Does /tmp have a split personality?http://www.philipp-wagner.com/blog/2014/04/does-tmp-have-a-split-personality/
http://www.philipp-wagner.com/blog/2014/04/does-tmp-have-a-split-personality/#commentsSat, 12 Apr 2014 10:55:09 +0000https://www.philipp-wagner.com/blog/?p=305Today I had my first real encounter with the new Linux world, with namespaces, cgroups and systemd. As it turns out, old wisdoms like “an absolute file path is an absolute file path” don’t hold any more :-)

But let’s start from the beginning. I just recently updated a machine to the latest openSUSE 13.1, which uses systemd unit files for a lot of services. I use this machine to develop a web application in PHP, and for debugging I wrote something to /tmp, like that:

<?php
file_put_contents('/tmp/some-file', 'some-content');
?>

The script always worked fine and it still does work fine. But not really the way I expected it to … The file /tmp/some-file does not exist after the script ran, even though I could read it back from PHP! Strange… the file simply seems to disappear!

After scratching my head for some time, I finally found out what’s going on:

I already highlighted the offending line in the unit file. What does it? Let’s have a look at the man page (man systemd.exec)

PrivateTmp=
Takes a boolean argument. If true, sets up a new file system namespace for the
executed processes and mounts private /tmp and /var/tmp directories inside it,
that are not shared by processes outside of the namespace. This is useful to
secure access to temporary files of the process, but makes sharing between
processes via /tmp or /var/tmp impossible. All temporary data created by service
will be removed after service is stopped. Defaults to false.

So yes, that’s the solution. Apache (and thus PHP, which runs as Apache module) sees a different /tmp as I do. The solution is easy obviously: either use a different directory for storing your files or disable PrivateTmp. The latter is quite easy as well, thanks to the configuration overrides in systemd (you may need to change the directory of the override, it’s the name of the unit + “.d”, see the announcement for details)

There is no such thing as a completely impartial review of technology, and you wouldn’t want someone who was completely impartial making technological decisions since it would indicate a disturbing lack of familiarity with the problem area.

]]>http://www.philipp-wagner.com/blog/2013/11/smime-und-egvp-unter-opensuse-12-3/feed/0A tiny update for Firefox OS on Raspberry Pihttp://www.philipp-wagner.com/blog/2013/09/a-tiny-update-for-firefox-os-on-raspberry-pi/
http://www.philipp-wagner.com/blog/2013/09/a-tiny-update-for-firefox-os-on-raspberry-pi/#commentsThu, 19 Sep 2013 22:56:44 +0000https://www.philipp-wagner.com/blog/?p=277Many of you have been waiting for updates on Firefox OS on the Raspberry Pi. Unfortunately my time is very limited at the moment, and a lot of things are to be done. To get you a bit better involved, I did two things. First, the patch repository with all necessary patches to get Firefox OS building on Raspberry Pi is online. And second, the meta-b2g layer has been changed so that it now can produce a SDK which can be used for compiling Firefox OS with, so that you don’t need work with all the OpenEmbedded/Yocto stuff any more.

Patch Repository

You can find the Mercurial patch repository containing all patches for the Mozilla source code necessary to build Firefox OS here:

https://www.philipp-wagner.com/hg/mc-b2g-patches/

To use it, checkout a mozilla-central source tree. Then go to the .hg folder inside your checkout, and checkout the patches repository:hg clone https://www.philipp-wagner.com/hg/mc-b2g-patches patches

Then go back to the root of your mozilla-central source tree, and update it to the version given in the .hg/patches/changeset file. Now apply all patches by running

hg qpush -a

SDK

Not everybody want’s to build a whole distribution only to hack on Firefox OS — but to compile it, a cross-compiler and various libraries for the target are necessary. To make cross-compiling easier, I’ve added a new target to the OpenEmbedded/Yocto meta-b2g layer. You can now run

bitbake meta-b2g-sdk

and it will create an installable SDK (after building you can find it in tmp/deploy/sdk in your OpenEmbedded build folder). I’ve also uploaded a precompiled version (155 MB).

Install it by simply running the shell script, choose an installation location, and after a couple of seconds you have everything setup to cross-compile Firefox.

Things left to do

A lot! I currently don’t get around to do new binary images, so you need to build from source to get support e.g. for newer/some Raspberry Pi models with different DDR memory on them (they require a newer firmware).

But I hope the SDK as well as the patch queue will help some people to do some changes themselves more easily.

]]>http://www.philipp-wagner.com/blog/2013/09/a-tiny-update-for-firefox-os-on-raspberry-pi/feed/0Thanks!http://www.philipp-wagner.com/blog/2013/05/thanks/
http://www.philipp-wagner.com/blog/2013/05/thanks/#commentsFri, 31 May 2013 15:13:52 +0000https://www.philipp-wagner.com/blog/?p=265After publishing the Firefox OS for Raspberry Pi post, Dietrich Ayalacommented that he liked it and that he’d send me something from my Amazon Wishlist. Today I went to the post office to pick up a parcel and look what I got:

And that’s what’s inside it:

That’s a lot of DVDs to watch. Thanks so much! Now I’m in a little quandary* on what to do on the weekend: work on Firefox OS or watch the DVDs? Maybe I can find time for both, the weather is bad enough to stay inside all day :-)

* That’s probably one of the nicest English words I know, so I had to use it here.

]]>http://www.philipp-wagner.com/blog/2013/05/thanks/feed/0Firefox OS for Raspberry Pi: Now Availablehttp://www.philipp-wagner.com/blog/2013/04/firefox-os-for-raspberry-pi-now-available/
http://www.philipp-wagner.com/blog/2013/04/firefox-os-for-raspberry-pi-now-available/#commentsSat, 13 Apr 2013 23:10:17 +0000https://www.philipp-wagner.com/blog/?p=251UPDATE: This was a project done in 2013, and since then I didn’t find enough time to continue it. Please look at the recent Mozilla effort to bring Firefox OS to RaspberryPi for a more usable and up-to-date solution.

It has been quite some time since my last post about Firefox OS running on a Raspberry Pi, but the questions didn’t stop to come in “when will it be released”? Well, I’m sorry that it took so long (sometimes finding time is not that easy), but finally, here we are: the sources and build instructions are available!

But before you start, please note the following limitations of this current release:

No input devices are supported. No mouse, no keyboard.

The screen resolution is hardcoded to 1280 x 1024 px.

The used Firefox/Gecko used is not up-to-date (it’s using revision 801ba75ac563 from 2013-01-03).

Quite some patches are required to get Gecko building, most of which were developed by Oleg Romashin. Unfortunately, they are not yet part of the official Mozilla source tree, and some of them are quite hacky. Progress to get this work upstream is tracked in bug 731498.All those patches are exported into the meta-b2g layer. A source repository for easier development will be made available soon together with instructions how to contribute to the Gecko development.

So what is all of this useful for at this point? I mainly leave this up to your imagination, but I’m using it as public info screen, displaying the weather forecast, room occupation, the next subway connections and today’s lunch menu. All data comes from publicly available web services or is scraped from Internet pages, all client-side with no web server or anything. Here’s how it looks:

Firefox OS for Raspberry Pi powering an infoscreen

I hope you find Firefox OS for Raspberry Pi as useful and exciting as I do, and please send me your comments, suggestions or (best) patches, to make it even greater!

]]>http://www.philipp-wagner.com/blog/2013/04/firefox-os-for-raspberry-pi-now-available/feed/42Firefox OS (Boot2Gecko) for Raspberry Pihttp://www.philipp-wagner.com/blog/2012/08/firefox-os-boot2gecko-for-raspberry-pi/
http://www.philipp-wagner.com/blog/2012/08/firefox-os-boot2gecko-for-raspberry-pi/#commentsFri, 17 Aug 2012 18:06:54 +0000https://www.philipp-wagner.com/blog/?p=229Two weeks ago my Raspberry Pi finally arrived. Immediately I started looking around for a way to get Firefox OS (formerly Boot2Gecko, B2G) running on it and found work-in-progress patches for Mozilla by the awesome Oleg “romaxa” Romashin. With those patches, Gecko renders directly into a OpenGL ES framebuffer without using an X Server. Nice! So the plan was to use those patches for the “Firefox” part of “Firefox OS” – now only the “OS” part was missing. I had two ideas for it: it should be as minimal as possible and for best performance it should be a hardfloat build. For this task PTXdist came handy. It’s a tool that allows you to build a complete Linux-based operating system (kernel and root file system) from source based on rule files. Again I wasn’t the first one using PTXdist on Raspberry PI and after some googling I found a GitHub repository from “fabricega” (I don’t know his full name unfortunately) that I could use as basis for my work.

So that was the idea: build Firefox OS for Raspberry Pi by combining Firefox with a PTXdist-built Linux.

Fast-forward two weeks. Welcome today! After many sleepless nights, a couple switches of the GCC and binutils versions (and full rebuilds of everything), different Linux kernels and some work on Oleg’s patches, I finally got it all working together! In the mean time Oleg posted a Youtube video of Firefox OS running on Raspberry Pi that made it to the homepage of raspberrypi.org. Many people seem to be excited by the idea of running Firefox OS on Raspberry Pi, which is great.

Firefox OS for Raspberry Pi combines two exciting projects, and I’m sure those two will have a great future together.

A lot of work remains to be done, and I’ll post patches and more documentation on how to build all of it in the coming days, but let’s get started with some images (and watch Oleg’s video if you didn’t do so yet!):

]]>http://www.philipp-wagner.com/blog/2012/08/firefox-os-boot2gecko-for-raspberry-pi/feed/19Contribute to openSUSE: Update a packagehttp://www.philipp-wagner.com/blog/2012/06/contribute-to-opensuse-update-a-package/
http://www.philipp-wagner.com/blog/2012/06/contribute-to-opensuse-update-a-package/#commentsMon, 25 Jun 2012 22:34:35 +0000https://www.philipp-wagner.com/blog/?p=212I’m sure many openSUSE users have already heard about the goodness of the openSUSE Build Service (OBS). But how many have already tried to use it as developer? I didn’t — until recently. A couple weeks ago I had found a wrong dependency in the calibre package, and today I was in the need for a newer version of hplip. I found that using OBS is much easier than I expected. Don’t believe me? Have a look how easy it can be to update a package. It all follows the popular github fork-and-pull-request development style. As an example I’ll use (a subset of) the changes I did today to the hplip package.

Step 0: Prepare your system to use OBS

Instead of duplicating existing documentation, just have a look at the OBS tutorial at the openSUSE wiki. You’ll only need to follow Step One. Basically, this means installing the required packages for OBS and creating a working directory.

If you’re done, switch to your working directory and you can follow the next steps*.

Instead of openSUSE12.1 you can use any target your might want to test (e.g. openSUSE_Factory etc.). This command is actually pure magic, it pulls all dependencies, installs them into a chroot build environment, and builds the package. Awesome!

You can now even install the resulting RPM package, the above command will tell you where to find it at the end of its output (probably somewhere in /var/tmp/build-root/home/abuild/rpmbuild/RPMS). You actually should do that and verify that everything works as expected.

Step 5: Finish it up

If you’re happy with your changes, and everything works as it should, we can get ready for submission.

First, add a changelog entry:

$> osc vc

will open an editor and allow you to add a changelog entry into the already prepared text template.

Now, check that you added/deleted all files by calling

$> osc status

If everything looks good, commit the package to OBS by using

$> osc commit

You can now go to the OBS web interface and watch your package build, or use

$> osc results

to see the results of the build process on the openSUSE servers. Note that building may take some time, depending on the OBS load and obviously your package.

Step 6: Submit the changes to the maintainer

Everything is great? The last step

$> osc sr

sends a “pull request” (in git language) to the package maintainer. You can see the status of this request in the web interface as well.

Now you only need to wait for the maintainer to accept your changes and then: Congratulations, you’ve made your possibly first contribution to openSUSE!

* Actually, the steps as written here will not result in a working package. The update of hplip required some other changes that I didn’t document here, but I hope the real-life examples will help to make the steps more understandable.

]]>http://www.philipp-wagner.com/blog/2012/06/contribute-to-opensuse-update-a-package/feed/1Using the the Sun/Oracle Multi-Schema XML Validator (MSV)http://www.philipp-wagner.com/blog/2012/04/using-the-the-sunoracle-multi-schema-xml-validator-msv/
http://www.philipp-wagner.com/blog/2012/04/using-the-the-sunoracle-multi-schema-xml-validator-msv/#commentsWed, 18 Apr 2012 18:45:38 +0000http://philipp.wagner.name/blog/?p=197I regularly work with more or less complex XML Schemas, and debugging those requires some tools with command lines I usually forget after a while. So I decided to write down some of my frequently used command lines for MSV, the Sun/Oracle Multi-Schema XML Validator. Maybe you find some of those helpful as well (since the MSV documentation is not exactly perfect).

Note: While I only use MSV for XML Schema validation, it can be used for RelaxNG and other schema languages as well.

Validate a XML document

Dump the post-schema-validation infoset (PSVI)

Often it is useful to see which type the XML Schema parser attached to a node in a document. To do this, get the post-schema-validation infoset (PSVI) from the schema validator. With MSV comes a sample application that can be used for this purpose.
$> cd msv-20090415/examples
$> java -cp .:../msv.jar psvi.PSVIDump schema.xsd document.xml