[[PageOutline]] = Using a chroot as working environment = Although WebKit working environment and building system is quite self contained, some people like still to work in a `chroot` so they can move the complete environment from a computer to another or from a distribution to a different one without major problems and keeping their own production environment clean and totally independent from WebKit development. Working in a `chroot`, however, brings some drawbacks. Here you can find some tips, common problems and solutions. == Problems with shared memory == Different components and programs may need access to the shared memory and this may lead to some problems. === Running python based test with multiprocess support === For example, in WebKitGtkLayoutTests it is explained how to run WebKit tests. I'm running my development environment in a schroot with Ubuntu in an Ubuntu host. It hapenned to me the following error when trying to run the tests {{{ $ ./Tools/Scripts/run-webkit-tests --gtk --debug Using port 'gtk' Test configuration: <, x86, debug> Placing test results in /opt/webkit/WebKit.git/WebKitBuild/Debug/layout-test-results Baseline search path: gtk -> generic Using Debug build Pixel tests disabled Regular timeout: 12000, slow test timeout: 60000 Command line: /opt/webkit/WebKit.git/WebKitBuild/Debug/Programs/DumpRenderTree - Found 31495 tests; running 28693, skipping 2802. Running 4 DumpRenderTrees in parallel over 727 shards (1 locked). Releasing server lock ... OSError raised: [Errno 38] Function not implemented File "/opt/webkit/WebKit.git/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py", line 110, in run unexpected_result_count = manager.run(args) File "/opt/webkit/WebKit.git/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py", line 411, in run self._run_tests(self._test_names, result_summary, int(self._options.child_processes)) File "/opt/webkit/WebKit.git/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py", line 464, in _run_tests return self._runner.run_tests(test_inputs, self._expectations, result_summary, num_workers, needs_http, needs_websockets, self._retrying) File "/opt/webkit/WebKit.git/Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_runner.py", line 141, in run_tests with message_pool.get(self, self._worker_factory, num_workers, self._port.worker_startup_delay_secs(), self._port.host) as pool: File "/opt/webkit/WebKit.git/Tools/Scripts/webkitpy/common/message_pool.py", line 61, in get return _MessagePool(caller, worker_factory, num_workers, worker_startup_delay_secs, host) File "/opt/webkit/WebKit.git/Tools/Scripts/webkitpy/common/message_pool.py", line 79, in __init__ self._messages_to_worker = multiprocessing.Queue() File "/usr/lib/python2.7/multiprocessing/__init__.py", line 218, in Queue return Queue(maxsize) File "/usr/lib/python2.7/multiprocessing/queues.py", line 63, in __init__ self._rlock = Lock() File "/usr/lib/python2.7/multiprocessing/synchronize.py", line 147, in __init__ SemLock.__init__(self, SEMAPHORE, 1, 1) File "/usr/lib/python2.7/multiprocessing/synchronize.py", line 75, in __init__ sl = self._semlock = _multiprocessing.SemLock(kind, value, maxvalue) Failed to execute Tools/Scripts/new-run-webkit-tests at ./Tools/Scripts/run-webkit-tests line 126. }}} The reason is explained in this post http://www.boris.co/2012/02/server-ubuntu-11.html Python's ''_multithreading'' requires `/dev/shm` to work. === SHM Fix === ==== SHM Ubuntu ==== In Ubuntu `/dev/shm` points to `/run/shm` by default. One of the possible ways of fixing this is the one explained at http://www.boris.co/2012/02/server-ubuntu-11.html However, in order provide a solution that will also cover pulse audio's case a good solution would be to bind mount `/dev` into the chroot and also `/run/shm` == Pulse Audio == In order to have the audio output working correctly pulse audio working in the chroot is not strictly needed. GStreamer, through the `playbin2` element, tries to use `pulsesink` as audio sink but will fall to `alsasink` if `pulsesink` fails. In case the local pulse audio daemon is not making use of the audio device, alsa will work without problems in the chroot. In any case, having pulse audio working in the `chroot` would be nice. The complete information about this can be found at http://www.freedesktop.org/wiki/Software/PulseAudio/FAQ/#index36h3 === Pulse Fix === ==== Pulse Ubuntu ==== First, we have to make work `/dev/shm` following the instructions [wiki:WebKitGTK/Chroot#SHM_Ubuntu above]. We also need to mount bind `/var/lib/dbus` , `~/.pulse` and `/tmp`. For example, this is my working `fstab` file using `schroot`: {{{ #!sh $ cat /etc/schroot/webkit/fstab # fstab: static file system information for chroots. # Note that the mount point will be prefixed by the chroot path # (CHROOT_PATH) # # /proc /proc none rw,bind 0 0 /sys /sys none rw,bind 0 0 /dev /dev none rw,bind 0 0 /home /home none rw,bind 0 0 /tmp /tmp none rw,bind 0 0 # Added /var/lib/dbus /var/lib/dbus none rw,bind 0 0 /run/shm /run/shm none rw,bind 0 0 devpts /dev/pts devpts gid=5,mode=620 0 0 /opt/my-webkit-home /home/user none rw,bind 0 0 /home/user/.pulse /home/user/.pulse none rw,bind 0 0 }}}