Apache 2.4 + PHP 5.6 + PHP-FPM on FreeBSD 10.2

Apache with PHP-FPM, chroots and per-vhost UIDs
Setting up Apache with PHP-FPM

A better way to run PHP-FPM
PHP-FPM Configuration 101 (php-fpm.conf, www.conf)

PHP-FPM not working as PHP handler in Apache
High-performance PHP on apache httpd 2.4.x using mod_proxy_fcgi and php-fpm
Apache 2.4 + PHP-FPM problem
Apache, PHP-FPM, MariaDB and FreeBSD
PHP method #3: PHP-FPM

What is the difference between fastcgi and fpm?
Differences and dis/advanages between: Fast-CGI, CGI, Mod-PHP, SuPHP, PHP-FPM
Showdown: HHVM vs. PHP5-fcgi vs. PHP5-FPM

First try

<VirtualHost www.example.com>
    ServerName      example.com
    ServerAlias     www.example.com
    ServerAdmin     info@example.com
    DocumentRoot    /web/example.com/www

    ErrorLog        /web/example.com/.logs/www-error.log
    CustomLog       /web/example.com/.logs/www-access.log common
    CustomLog       /web/example.com/.logs/www-referer.log referer
    CustomLog       /web/example.com/.logs/www-agent.log agent

    ProxyPassMatch  ^/(.*\.php(/.*)?)$ unix:/tmp/fpm_www_example_com.sock|fcgi://localhost/web/example.com/www
    DirectoryIndex  /index.php index.php
</VirtualHost>
[www_example_com]

user = www_example_com
group = www_example_com

listen = /tmp/fpm_www_example_com.sock

pm = ondemand
pm.max_children = 5
pm.process_idle_timeout = 120s;
pm.max_requests = 500
[Sat Dec 19 22:13:00.127794 2015] [proxy:error] [pid 82692] (13)Permission denied: AH02454: FCGI: attempt to connect to Unix domain socket /tmp/fpm_www_example_com.sock (localhost) failed
[Sat Dec 19 22:13:00.128004 2015] [proxy:error] [pid 82692] AH00959: ap_proxy_connect_backend disabling worker for (localhost) for 60s
[Sat Dec 19 22:13:00.128038 2015] [proxy_fcgi:error] [pid 82692] [client 84.74.50.9:65039] AH01079: failed to make connection to backend: httpd-UDS

[...]

[Sun Dec 20 11:39:18.535056 2015] [core:error] [pid 82705] (13)Permission denied: [client 84.74.50.9:56498] AH00035: access to /index.html denied (filesystem path '/web/example.com/www/index.html') because search permissions are missing on a component of the path

					

UBIFS / nandsim on Fedora 20

Memory Technology Devices – UBI
Memory Technology Devices – UBIFS
Memory Technology Devices – NAND

FreeBSD

NAND Flash Framework Introduction, experimental

Own try…

# file /tmp/nandimg_.JeCb7JOv/common.fs
/tmp/nandimg_.JeCb7JOv/common.fs: UBIfs image, sequence number 8, length 4096, CRC 0x151054e7

# mount -t ubifs /tmp/nandimg_.JeCb7JOv/common.fs /mnt/common
mount: unknown filesystem type 'ubifs'

Should work, but…

Where are the sources for mtd/nand/nandsim kernel module?
UBI / UBIFS on NANDSIM simulator
Simulate NAND MTD Device
Extract and rebuild a UBI image (on Ubuntu)

$ mkdir /mnt/ubi
$ modprobe mtdblock
$ modprobe ubi
$ modprobe nandsim \
first_id_byte=0x20 \
second_id_byte=0xaa \
third_id_byte=0x00 \
fourth_id_byte=0x15
$ cat /proc/mtddev
$ ls -l /dev/mtd*
$ dd if=ubi.img of=/dev/mtdblock[COLOR=red]0[/COLOR] bs=2048
$ ubiattach /dev/ubi_ctrl -m 0
$ ls -l /dev/ubi*
$ mount -t ubifs ubi0_0 /mnt/ubi
$ mkfs.ubifs -m 2048 -e 129024 -c 2047 -r /mnt/ubi ubifs.img
$ nano ubi.ini
[ubifs]mode=ubi
image=ubifs.img
vol_id=0
vol_size=200MiB
vol_type=dynamic
vol_name=rootfs
vol_flags=autoresize
$ ubinize -o ubi.img -p 131072 -m 2048 -s 512 ubi.ini

Compile kernel module

Fedore – Building Only Kernel Modules
How to: Compile Linux kernel modules
“FATAL: Module not found error” using modprobe
Building nandsim for Fedora

$ yum install mtd-utils
$ yum install kernel-devel
$ mkdir -p ~/src/nand
$ cd ~/src/nand
$ fetch <URL>/nandsim.c
$ vi Makefile <= (as in Fedora: Building Only Kernel Modules)
$ make
make -C /lib/modules/3.11.10-301.fc20.x86_64/build M=/home/andreas/src/nand modules
make[1]: Entering directory `/usr/src/kernels/3.11.10-301.fc20.x86_64'
  CC [M]  /home/andreas/src/nand/nandsim.o
/home/andreas/src/nand/nandsim.c: In function ‘alloc_device’:
/home/andreas/src/nand/nandsim.c:581:25: error: ‘FMODE_CAN_READ’ undeclared (first use in this function)
   if (!(cfile->f_mode & FMODE_CAN_READ)) {
                         ^
/home/andreas/src/nand/nandsim.c:581:25: note: each undeclared identifier is reported only once for each function it appears in
/home/andreas/src/nand/nandsim.c:586:25: error: ‘FMODE_CAN_WRITE’ undeclared (first use in this function)
   if (!(cfile->f_mode & FMODE_CAN_WRITE)) {
                         ^
make[2]: *** [/home/andreas/src/nand/nandsim.o] Error 1
make[1]: *** [_module_/home/andreas/src/nand] Error 2
make[1]: Leaving directory `/usr/src/kernels/3.11.10-301.fc20.x86_64'
make: *** [default] Error 2

$ uname -a
Linux nch-w-andreasb.advaoptical.com 3.11.10-301.fc20.x86_64 [...]

$ grep -r FMODE_CAN_READ /usr/src/kernels/3.11.10-301.fc20.x86_64/
<empty>

$ grep -r FMODE_CAN_READ /usr/src/kernels/3.19.8-100.fc20.x86_64
/usr/src/kernels/3.19.8-100.fc20.x86_64/include/linux/fs.h:#define FMODE_CAN_READ          ((__force fmode_t)0x20000)

$ rpm -qa kernel
kernel-3.19.8-100.fc20.x86_64
kernel-3.11.10-301.fc20.x86_64

$ grub2-mkconfig -o /boot/grub2/grub.cfg
$ grub2-install /dev/sda

<Reboot>

$ yum remove kernel-3.11.10-301.fc20.x86_64
$ yum remove kernel-devel-3.11.10-301.fc20.x86_64

FreeBSD bash Key Bindings

FreeBSD: Customize Home, Del, Insert keys for BASH shell
Creating the /etc/inputrc File
Readline and inputrc
How do I convert inputrc settings to bashrc ones?

The /etc/inputrc file deals with mapping the keyboard for specific situations. This file is the start-up file used by readline, the GNU command line editing library used by Bash, perl and most other open source programs.

# vi /etc/profile
export INPUTRC=/usr/local/etc/inputrc

# vi /usr/local/etc/inputrc
set meta-flag on
set input-meta on
set convert-meta off
set output-meta on
"\e[1~": beginning-of-line
"\e[4~": end-of-line
"\e[5~": beginning-of-history
"\e[6~": end-of-history
"\e[3~": delete-char
"\e[2~": quoted-insert
"\e[5C": forward-word
"\e[5D": backward-word

FreeBSD 10.2 Server

GeoIP-1.6.4                    Find the country that any IP address or hostname originates from
adns-1.5.0                     Easy to use asynchronous-capable DNS client library and utilities
bash-4.3.33                    The GNU Project's Bourne Again SHell
bind99-9.9.7                   BIND DNS suite with updated DNSSEC and DNS64
ca_root_nss-3.19.1_1           Root certificate bundle from the Mozilla Project
cairo-1.12.18_1,2              Vector graphics library with cross-device output support
cups-client-2.0.3_2            Common UNIX Printing System: Library cups
cups-image-2.0.3_2             Common UNIX Printing System: Library cupsimage
curl-7.42.1                    Non-interactive tool to get files from FTP, GOPHER, HTTP(S) servers
cvsps-2.1_1                    Create patchset information from CVS
db5-5.3.28_2                   The Oracle Berkeley DB, revision 5.3
dejavu-2.35                    Bitstream Vera Fonts clone with a wider range of characters
dialog4ports-0.1.5_2           Console Interface to configure ports
encodings-1.0.4_3,1            X.Org Encoding fonts
expat-2.1.0_2                  XML 1.0 parser written in C
font-bh-ttf-1.0.3_3            X.Org Bigelow & Holmes TTF font
font-misc-ethiopic-1.0.3_3     X.Org miscellaneous Ethiopic font
font-misc-meltho-1.0.3_3       X.Org miscellaneous Meltho font
font-util-1.3.1                Create an index of X font files in a directory
fontconfig-2.11.1,1            XML-based font configuration API for X Windows
freetype2-2.5.5                Free and portable TrueType font rendering engine
gdbm-1.11_2                    GNU database manager
gettext-runtime-0.19.4         GNU gettext runtime libraries and programs
gettext-tools-0.19.4           GNU gettext development and translation tools
ghostscript9-9.06_10           Ghostscript 9.x PostScript interpreter
git-2.4.2                      Distributed source code management tool
glib-2.42.1                    Some useful routines of C programming (current stable version)
gmake-4.1_1                    GNU version of 'make' utility
gmp-5.1.3_2                    Free library for arbitrary precision arithmetic
gnutls-3.3.15                  GNU Transport Layer Security library
graphite2-1.2.4                Rendering capabilities for complex non-Roman writing systems
graphviz-2.38.0_6              Graph Visualization Software from AT&T and Bell Labs
gsfonts-8.11_6                 Standard Fonts for Ghostscript
harfbuzz-0.9.40_1              OpenType text shaping engine
icu-55.1                       International Components for Unicode (from IBM)
idnkit-1.0_5                   Library to handle internationalized domain names
indexinfo-0.2.2                Utility to regenerate the GNU info page index
jbig2dec-0.11_4                Decoder implementation of the JBIG2 image compression format
jbigkit-2.1_1                  Lossless compression for bi-level images such as scanned pages, faxes
jpeg-8_6                       IJG's jpeg compression utilities
kbproto-1.0.6                  KB extension headers
lcms-1.19_5,1                  Light Color Management System -- a color management library
lcms2-2.7                      Accurate, fast, and small-footprint color management engine
libICE-1.0.9_1,1               Inter Client Exchange library for X11
libSM-1.2.2_3,1                Session Management library for X11
libX11-1.6.2_3,1               X11 library
libXScrnSaver-1.2.2_3          The XScrnSaver library
libXau-1.0.8_3                 Authentication Protocol library for X11
libXaw-1.0.12_3,2              X Athena Widgets library
libXdmcp-1.1.2                 X Display Manager Control Protocol library
libXext-1.3.3_1,1              X11 Extension library
libXft-2.3.2_1                 Client-sided font API for X applications
libXmu-1.1.2_3,1               X Miscellaneous Utilities libraries
libXp-1.0.3,1                  X print library
libXpm-3.5.11_3                X Pixmap library
libXrender-0.9.8_3             X Render extension library
libXt-1.1.4_3,1                X Toolkit library
libevent2-2.0.22_1             API for executing callback functions on events or timeouts
libffi-3.2.1                   Foreign Function Interface
libfontenc-1.1.2_3             The fontenc Library
libgcrypt-1.6.3                General purpose crypto library based on code used in GnuPG
libgd-2.1.0_6,1                Graphics library for fast creation of images
libgpg-error-1.19_1            Common error values for all GnuPG components
libiconv-1.14_6                Character set conversion library
libidn-1.29                    Internationalized Domain Names command line tool
libltdl-2.4.6                  System independent dlopen wrapper
libpaper-1.1.24.4              Library providing routines for paper size management
libpthread-stubs-0.3_6         This library provides weak aliases for pthread functions
libsmi-0.4.8_1                 Library to access SMI MIB information
libtasn1-4.5_1                 ASN.1 structure parser library
libxcb-1.11_1                  The X protocol C-language Binding (XCB) library
libxml2-2.9.2_2                XML parser library for GNOME
libxslt-1.1.28_6               The XSLT C library for GNOME
mDNSResponder-567              Bonjour (zero-configuration networking) by Apple
mkfontdir-1.0.7                Create an index of X font files in a directory
mkfontscale-1.1.2              Creates an index of scalable font files for X
nettle-2.7.1                   Low-level cryptographic library
node-0.12.4                    V8 JavaScript for client and server
npm-2.11.1                     Node package manager
openldap-client-2.4.40_1       Open source LDAP client implementation
p11-kit-0.23.1                 Library for loading and enumerating of PKCS#11 modules
p5-Authen-SASL-2.16_1          Perl5 module for SASL authentication
p5-Digest-HMAC-1.03_1          Perl5 interface to HMAC Message-Digest Algorithms
p5-Error-0.17024               Error/exception handling in object-oriented programming style
p5-GSSAPI-0.28_1               Perl extension providing access to the GSSAPIv2 library
p5-IO-Socket-IP-0.37           Drop-in replacement for IO::Socket::INET supporting IPv4 and IPv6
p5-IO-Socket-SSL-2.016         Perl5 interface to SSL sockets
p5-Mozilla-CA-20141217         Perl extension for Mozilla CA cert bundle in PEM format
p5-Net-SMTP-SSL-1.02           SSL support for Net::SMTP
p5-Net-SSLeay-1.69             Perl5 interface to SSL
p5-Socket-2.019                Networking constants and support functions
pango-1.36.8_1                 Open-source framework for the layout and rendering of i18n text
pcre-8.35_2                    Perl Compatible Regular Expressions library
perl5-5.20.2_4                 Practical Extraction and Report Language
pixman-0.32.6_1                Low-level pixel manipulation library
pkg-1.6.2                      Package manager
pkgconf-0.9.7_1                Utility to help to configure compiler and linker flags
png-1.6.17                     Library for manipulating PNG images
postgresql93-client-9.3.9      PostgreSQL database (client)
postgresql93-server-9.3.9      The most advanced open-source database available anywhere
printproto-1.0.5               Print extension headers
py27-Babel-1.3_2               Collection of tools for internationalizing Python applications
py27-MarkupSafe-0.23           Implements a XML/HTML/XHTML Markup safe string for Python
py27-asn1-0.1.7,1              ASN.1 toolkit for Python
py27-asn1-modules-0.0.5_1      Collection of ASN.1 data structures for py-asn1
py27-beaker-1.6.4_1            Session and Caching library with WSGI Middleware
py27-bsddb-2.7.9_5             Standard Python bindings to the Berkeley DB library
py27-chart-1.39_5              Create high quality Encapsulated Postscript, PDF, or PNG charts
py27-dateutil-2.3              Extensions to the standard Python datetime module
py27-gdbm-2.7.9_3              Python bindings to the GNU dbm library
py27-ldap2-2.4.19              LDAP module for python, for OpenLDAP2
py27-libxml2-2.9.2             Python interface for XML parser library for GNOME
py27-libxslt-1.1.28_6          Python interface for XSLT C library for GNOME
py27-lxml-3.4.1_1              Pythonic binding for the libxml2 and libxslt libraries
py27-mako-1.0.0                Super-fast templating language in Python
py27-mx-base-3.2.8             eGenix mx-Extension Series for Python
py27-parsing-2.0.3             General parsing module for Python
py27-pillow-2.6.0_1            Fork of the Python Imaging Library (PIL)
py27-pip-6.1.1                 Tool for installing and managing Python packages
py27-psycopg2-2.5.5            High performance Python adapter for PostgreSQL
py27-pydot-1.0.28              Python interface to the Graphviz Dot language
py27-pytz-2014.10,1            World Timezone Definitions for Python
py27-reportlab2-2.7_1          Library to create PDF documents using the Python language
py27-setuptools27-5.5.1_1      Python packages installer
py27-six-1.8.0                 Python 2 and 3 compatibility utilities
py27-sqlite3-2.7.9_6           Standard Python binding to the SQLite3 library
py27-tkinter-2.7.9_5           Python bindings to the Tk widget set
py27-xml-0.8.4_4               Python XML library enhancements
py27-yaml-3.11                 Python YAML parser
python2-2_3                    The "meta-port" for version 2 of the Python interpreter
python27-2.7.9                 Interpreted object-oriented programming language
renderproto-0.11.1             RenderProto protocol headers
rsync-3.1.1_4                  Network file distribution/synchronization utility
screen-4.2.1_5                 Multi-screen window manager
scrnsaverproto-1.2.2           ScrnSaver extension headers
sqlite3-3.8.8.2                SQL database engine in a C library
svgalib-1.4.3_7                Low level console graphics library
tcl86-8.6.4                    Tool Command Language
tiff-4.0.4.b_1                 Tools and library routines for working with TIFF images
tk86-8.6.4                     Graphical toolkit for Tcl
trousers-tddl-0.3.10_7         The open-source TCG Software Stack
tshark-1.12.3_1                Powerful network analyzer/capture tool
urwfonts-1.0_7                 Another font package for X
vim-lite-7.4.884               Improved version of the vi editor (lite package)
wget-1.16.2_1                  Retrieve files from the Net via HTTP(S) and FTP
xcb-util-0.4.0_1,1             Module with libxcb/libX11 extension/replacement libraries
xcb-util-renderutil-0.3.9_1    Convenience functions for the Render extension
xextproto-7.3.0                XExt extension headers
xorg-fonts-truetype-7.7_1      X.Org TrueType fonts
xproto-7.0.27                  X11 protocol headers

FreeBSD 10 & vim

FreeBSD bash Key Bindings

vim without X11 (pkgng)

Für vim will mir pkg ein komplettes X11 mit allem und Gummibärchen reindrücken
Why does Vim in pkgng depend on X11 and the GTK?

$ pkg install vim-lite

vim without X11 (portupgrade)

FreeBSD: HOWTO install vim from ports WITHOUT X-Windows.
Install vim on FreeBSD without X11

MAKE_ARGS = {
'editors/vim' => 'WITHOUT_X11=YES',
}

Tabs to Spaces

vi search and replace – how to replace all tabs with spaces

1,$s/\t/    /g

How to replace tabs with spaces?
Replace Tab with Spaces in VIM
Converting tabs to spaces

vim profile

FreeBSD Install VIM Editor Without X11 GUI + Setup profile

# cp /usr/local/share/vim/vim74/vimrc_example.vim /usr/local/share/vimrc
$ echo "alias vi='vim'" >> ~/.bashrc
set nocompatible
filetype on
filetype indent on
filetype plugin on
set laststatus=2
syntax on
[root@ns3 /home/andreas]# pkg install vim
Updating FreeBSD repository catalogue...
FreeBSD repository is up-to-date.
All repositories are up-to-date.
Checking integrity... done (0 conflicting)
The following 105 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
        vim: 7.4.884
        libXt: 1.1.4_3,1
        xproto: 7.0.27
        libSM: 1.2.2_3,1
        libICE: 1.0.9_1,1
        libX11: 1.6.2_3,1
        libXdmcp: 1.1.2
        libxcb: 1.11_1
        libpthread-stubs: 0.3_6
        libXau: 1.0.8_3
        kbproto: 1.0.6
        python27: 2.7.10_1
        libffi: 3.2.1
        pango: 1.36.8_2
        encodings: 1.0.4_3,1
        font-util: 1.3.1
        libXft: 2.3.2_1
        libXrender: 0.9.8_3
        renderproto: 0.11.1
        fontconfig: 2.11.1,1
        expat: 2.1.0_3
        freetype2: 2.6_1
        xorg-fonts-truetype: 7.7_1
        font-misc-meltho: 1.0.3_3
        mkfontdir: 1.0.7
        mkfontscale: 1.1.2
        libfontenc: 1.1.2_3
        font-bh-ttf: 1.0.3_3
        font-misc-ethiopic: 1.0.3_3
        dejavu: 2.35
        harfbuzz: 1.0.1
        cairo: 1.14.2,2
        libGL: 10.6.8
        libXfixes: 5.0.1_3
        fixesproto: 5.0
        dri2proto: 2.8
        libXdamage: 1.1.4_3
        damageproto: 1.2.1
        libdevq: 0.0.2_1
        libXxf86vm: 1.1.4_1
        xf86vidmodeproto: 2.3.1
        libXext: 1.3.3_1,1
        xextproto: 7.3.0
        libdrm: 2.4.60,1
        libpciaccess: 0.13.3
        pciids: 20150924
        libxshmfence: 1.2
        libglapi: 10.6.8
        libXvMC: 1.0.9
        libXv: 1.0.10_3,1
        videoproto: 2.3.2
        glproto: 1.4.17
        libEGL: 10.6.8
        gbm: 10.6.8
        llvm36: 3.6.2_2
        perl5: 5.20.3_8
        png: 1.6.20
        pixman: 0.32.6_1
        xcb-util-renderutil: 0.3.9_1
        xcb-util: 0.4.0_1,1
        glib: 2.44.1_1
        libiconv: 1.14_8
        pcre: 8.37_4
        libXpm: 3.5.11_4
        libXinerama: 1.1.3_3,1
        xineramaproto: 1.2.1
        icu: 55.1
        graphite2: 1.3.2
        cscope: 15.8b
        gtk2: 2.24.28_1
        hicolor-icon-theme: 0.15
        cups-client: 2.0.3_2
        libgcrypt: 1.6.3
        libgpg-error: 1.20
        gnutls: 3.3.17.1
        nettle: 2.7.1
        gmp: 5.1.3_2
        ca_root_nss: 3.20.1
        libtasn1: 4.7
        p11-kit: 0.23.1_1
        trousers-tddl: 0.3.10_7
        libidn: 1.31
        mDNSResponder: 567
        python2: 2_3
        gtk-update-icon-cache: 2.24.28
        libXcursor: 1.1.14_3
        libXcomposite: 0.4.4_3,1
        compositeproto: 0.4.2
        libXi: 1.7.4_1,1
        inputproto: 2.3.1
        atk: 2.16.0
        libXrandr: 1.4.2_3
        randrproto: 1.4.1
        gdk-pixbuf2: 2.32.1
        jasper: 1.900.1_15
        jpeg-turbo: 1.4.1
        tiff: 4.0.4
        jbigkit: 2.1_1
        shared-mime-info: 1.4
        python: 2.7_2,2
        lua52: 5.2.4
        ruby: 2.1.7,1
        libyaml: 0.1.6_2
        tcl86: 8.6.4
        ctags: 5.8

The process will require 532 MiB more space.

Proceed with this action? [y/N]: y
[1/105] Installing xproto-7.0.27...
[1/105] Extracting xproto-7.0.27: 100%
[2/105] Installing libXdmcp-1.1.2...
[2/105] Extracting libXdmcp-1.1.2: 100%
[3/105] Installing libpthread-stubs-0.3_6...
[3/105] Extracting libpthread-stubs-0.3_6: 100%
[4/105] Installing libXau-1.0.8_3...
[4/105] Extracting libXau-1.0.8_3: 100%
[5/105] Installing libxcb-1.11_1...
[5/105] Extracting libxcb-1.11_1: 100%
[6/105] Installing kbproto-1.0.6...
[6/105] Extracting kbproto-1.0.6: 100%
[7/105] Installing libX11-1.6.2_3,1...
[7/105] Extracting libX11-1.6.2_3,1: 100%
[8/105] Installing xextproto-7.3.0...
[8/105] Extracting xextproto-7.3.0: 100%
[9/105] Installing fixesproto-5.0...
[9/105] Extracting fixesproto-5.0: 100%
[10/105] Installing libXext-1.3.3_1,1...
[10/105] Extracting libXext-1.3.3_1,1: 100%
[11/105] Installing pciids-20150924...
[11/105] Extracting pciids-20150924: 100%
[12/105] Installing videoproto-2.3.2...
[12/105] Extracting videoproto-2.3.2: 100%
[13/105] Installing libXfixes-5.0.1_3...
[13/105] Extracting libXfixes-5.0.1_3: 100%
[14/105] Installing damageproto-1.2.1...
[14/105] Extracting damageproto-1.2.1: 100%
[15/105] Installing libpciaccess-0.13.3...
[15/105] Extracting libpciaccess-0.13.3: 100%
[16/105] Installing libXv-1.0.10_3,1...
[16/105] Extracting libXv-1.0.10_3,1: 100%
[17/105] Installing libffi-3.2.1...
[17/105] Extracting libffi-3.2.1: 100%
[18/105] Installing expat-2.1.0_3...
[18/105] Extracting expat-2.1.0_3: 100%
[19/105] Installing libXdamage-1.1.4_3...
[19/105] Extracting libXdamage-1.1.4_3: 100%
[20/105] Installing libdevq-0.0.2_1...
[20/105] Extracting libdevq-0.0.2_1: 100%
[21/105] Installing libdrm-2.4.60,1...
[21/105] Extracting libdrm-2.4.60,1: 100%
[22/105] Installing libxshmfence-1.2...
[22/105] Extracting libxshmfence-1.2: 100%
[23/105] Installing libXvMC-1.0.9...
[23/105] Extracting libXvMC-1.0.9: 100%
[24/105] Installing python27-2.7.10_1...
[24/105] Extracting python27-2.7.10_1: 100%
[25/105] Installing freetype2-2.6_1...
[25/105] Extracting freetype2-2.6_1: 100%
[26/105] Installing libfontenc-1.1.2_3...
[26/105] Extracting libfontenc-1.1.2_3: 100%
[27/105] Installing xf86vidmodeproto-2.3.1...
[27/105] Extracting xf86vidmodeproto-2.3.1: 100%
[28/105] Installing libglapi-10.6.8...
[28/105] Extracting libglapi-10.6.8: 100%
[29/105] Installing perl5-5.20.3_8...
[29/105] Extracting perl5-5.20.3_8: 100%
[30/105] Installing renderproto-0.11.1...
[30/105] Extracting renderproto-0.11.1: 100%
[31/105] Installing mkfontscale-1.1.2...
[31/105] Extracting mkfontscale-1.1.2: 100%
[32/105] Installing dri2proto-2.8...
[32/105] Extracting dri2proto-2.8: 100%
[33/105] Installing libXxf86vm-1.1.4_1...
[33/105] Extracting libXxf86vm-1.1.4_1: 100%
[34/105] Installing gbm-10.6.8...
[34/105] Extracting gbm-10.6.8: 100%
[35/105] Installing llvm36-3.6.2_2...
[35/105] Extracting llvm36-3.6.2_2: 100%
[36/105] Installing xcb-util-0.4.0_1,1...
[36/105] Extracting xcb-util-0.4.0_1,1: 100%
[37/105] Installing libiconv-1.14_8...
[37/105] Extracting libiconv-1.14_8: 100%
[38/105] Installing pcre-8.37_4...
[38/105] Extracting pcre-8.37_4: 100%
[39/105] Installing libICE-1.0.9_1,1...
[39/105] Extracting libICE-1.0.9_1,1: 100%
[40/105] Installing font-util-1.3.1...
[40/105] Extracting font-util-1.3.1: 100%
[41/105] Installing libXrender-0.9.8_3...
[41/105] Extracting libXrender-0.9.8_3: 100%
[42/105] Installing fontconfig-2.11.1,1...
[42/105] Extracting fontconfig-2.11.1,1: 100%
Running fc-cache to build fontconfig cache...
/usr/local/share/fonts: caching, new cache contents: 0 fonts, 5 dirs
/usr/local/share/fonts/OTF: caching, new cache contents: 23 fonts, 0 dirs
/usr/local/share/fonts/TTF: caching, new cache contents: 13 fonts, 0 dirs
/usr/local/share/fonts/dejavu: caching, new cache contents: 21 fonts, 0 dirs
/usr/local/share/fonts/encodings: caching, new cache contents: 0 fonts, 1 dirs
/usr/local/share/fonts/encodings/large: caching, new cache contents: 0 fonts, 0 dirs
/usr/local/share/fonts/util: caching, new cache contents: 0 fonts, 0 dirs
/usr/local/lib/X11/fonts: skipping, no such directory
/root/.local/share/fonts: skipping, no such directory
/root/.fonts: skipping, no such directory
Re-scanning /usr/local/share/fonts: caching, new cache contents: 0 fonts, 5 dirs
Re-scanning /usr/local/share/fonts/encodings: caching, new cache contents: 0 fonts, 1 dirs
/var/db/fontconfig: cleaning cache directory
/root/.cache/fontconfig: not cleaning non-existent cache directory
/root/.fontconfig: not cleaning non-existent cache directory
fc-cache: succeeded
[43/105] Installing mkfontdir-1.0.7...
[43/105] Extracting mkfontdir-1.0.7: 100%
[44/105] Installing libGL-10.6.8...
[44/105] Extracting libGL-10.6.8: 100%
[45/105] Installing glproto-1.4.17...
[45/105] Extracting glproto-1.4.17: 100%
[46/105] Installing libEGL-10.6.8...
[46/105] Extracting libEGL-10.6.8: 100%
[47/105] Installing png-1.6.20...
[47/105] Extracting png-1.6.20: 100%
[48/105] Installing pixman-0.32.6_1...
[48/105] Extracting pixman-0.32.6_1: 100%
[49/105] Installing xcb-util-renderutil-0.3.9_1...
[49/105] Extracting xcb-util-renderutil-0.3.9_1: 100%
[50/105] Installing glib-2.44.1_1...
[50/105] Extracting glib-2.44.1_1: 100%
No schema files found: doing nothing.
[51/105] Installing libSM-1.2.2_3,1...
[51/105] Extracting libSM-1.2.2_3,1: 100%
[52/105] Installing encodings-1.0.4_3,1...
[52/105] Extracting encodings-1.0.4_3,1: 100%
[53/105] Installing font-misc-meltho-1.0.3_3...
[53/105] Extracting font-misc-meltho-1.0.3_3: 100%
[54/105] Installing font-bh-ttf-1.0.3_3...
[54/105] Extracting font-bh-ttf-1.0.3_3: 100%
[55/105] Installing font-misc-ethiopic-1.0.3_3...
[55/105] Extracting font-misc-ethiopic-1.0.3_3: 100%
[56/105] Installing dejavu-2.35...
[56/105] Extracting dejavu-2.35: 100%
[57/105] Installing cairo-1.14.2,2...
[57/105] Extracting cairo-1.14.2,2: 100%
[58/105] Installing icu-55.1...
[58/105] Extracting icu-55.1: 100%
[59/105] Installing graphite2-1.3.2...
[59/105] Extracting graphite2-1.3.2: 100%
[60/105] Installing gmp-5.1.3_2...
[60/105] Extracting gmp-5.1.3_2: 100%
[61/105] Installing ca_root_nss-3.20.1...
[61/105] Extracting ca_root_nss-3.20.1: 100%
[62/105] Installing libtasn1-4.7...
[62/105] Extracting libtasn1-4.7: 100%
[63/105] Installing inputproto-2.3.1...
[63/105] Extracting inputproto-2.3.1: 100%
[64/105] Installing jpeg-turbo-1.4.1...
[64/105] Extracting jpeg-turbo-1.4.1: 100%
[65/105] Installing jbigkit-2.1_1...
[65/105] Extracting jbigkit-2.1_1: 100%
[66/105] Installing libXt-1.1.4_3,1...
[66/105] Extracting libXt-1.1.4_3,1: 100%
[67/105] Installing libXft-2.3.2_1...
[67/105] Extracting libXft-2.3.2_1: 100%
[68/105] Installing xorg-fonts-truetype-7.7_1...
[69/105] Installing harfbuzz-1.0.1...
[69/105] Extracting harfbuzz-1.0.1: 100%
[70/105] Installing xineramaproto-1.2.1...
[70/105] Extracting xineramaproto-1.2.1: 100%
[71/105] Installing libgpg-error-1.20...
[71/105] Extracting libgpg-error-1.20: 100%
[72/105] Installing nettle-2.7.1...
[72/105] Extracting nettle-2.7.1: 100%
[73/105] Installing p11-kit-0.23.1_1...
[73/105] Extracting p11-kit-0.23.1_1: 100%
[74/105] Installing trousers-tddl-0.3.10_7...
===> Creating users and/or groups.
Using existing group '_tss'.
Using existing user '_tss'.
[74/105] Extracting trousers-tddl-0.3.10_7: 100%
[75/105] Installing libidn-1.31...
[75/105] Extracting libidn-1.31: 100%
[76/105] Installing compositeproto-0.4.2...
[76/105] Extracting compositeproto-0.4.2: 100%
[77/105] Installing libXi-1.7.4_1,1...
[77/105] Extracting libXi-1.7.4_1,1: 100%
[78/105] Installing randrproto-1.4.1...
[78/105] Extracting randrproto-1.4.1: 100%
[79/105] Installing jasper-1.900.1_15...
[79/105] Extracting jasper-1.900.1_15: 100%
[80/105] Installing tiff-4.0.4...
[80/105] Extracting tiff-4.0.4: 100%
[81/105] Installing pango-1.36.8_2...
[81/105] Extracting pango-1.36.8_2: 100%
[82/105] Installing libXinerama-1.1.3_3,1...
[82/105] Extracting libXinerama-1.1.3_3,1: 100%
[83/105] Installing hicolor-icon-theme-0.15...
[83/105] Extracting hicolor-icon-theme-0.15: 100%
[84/105] Installing libgcrypt-1.6.3...
[84/105] Extracting libgcrypt-1.6.3: 100%
[85/105] Installing gnutls-3.3.17.1...
[85/105] Extracting gnutls-3.3.17.1: 100%
[86/105] Installing mDNSResponder-567...
[86/105] Extracting mDNSResponder-567: 100%
[87/105] Installing python2-2_3...
[87/105] Extracting python2-2_3: 100%
[88/105] Installing libXcursor-1.1.14_3...
[88/105] Extracting libXcursor-1.1.14_3: 100%
[89/105] Installing libXcomposite-0.4.4_3,1...
[89/105] Extracting libXcomposite-0.4.4_3,1: 100%
[90/105] Installing atk-2.16.0...
[90/105] Extracting atk-2.16.0: 100%
[91/105] Installing libXrandr-1.4.2_3...
[91/105] Extracting libXrandr-1.4.2_3: 100%
[92/105] Installing gdk-pixbuf2-2.32.1...
[92/105] Extracting gdk-pixbuf2-2.32.1: 100%
[93/105] Installing shared-mime-info-1.4...
[93/105] Extracting shared-mime-info-1.4: 100%
[94/105] Installing cups-client-2.0.3_2...
===> Creating users and/or groups.
Creating group 'cups' with gid '193'.
Creating user 'cups' with uid '193'.
[94/105] Extracting cups-client-2.0.3_2: 100%
[95/105] Installing gtk-update-icon-cache-2.24.28...
[95/105] Extracting gtk-update-icon-cache-2.24.28: 100%
[96/105] Installing python-2.7_2,2...
[96/105] Extracting python-2.7_2,2: 100%
[97/105] Installing libyaml-0.1.6_2...
[97/105] Extracting libyaml-0.1.6_2: 100%
[98/105] Installing libXpm-3.5.11_4...
[98/105] Extracting libXpm-3.5.11_4: 100%
[99/105] Installing cscope-15.8b...
[99/105] Extracting cscope-15.8b: 100%
[100/105] Installing gtk2-2.24.28_1...
[100/105] Extracting gtk2-2.24.28_1: 100%
[101/105] Installing lua52-5.2.4...
[101/105] Extracting lua52-5.2.4: 100%
[102/105] Installing ruby-2.1.7,1...
[102/105] Extracting ruby-2.1.7,1: 100%
[103/105] Installing tcl86-8.6.4...
[103/105] Extracting tcl86-8.6.4: 100%
[104/105] Installing ctags-5.8...
[104/105] Extracting ctags-5.8: 100%
[105/105] Installing vim-7.4.884...
[105/105] Extracting vim-7.4.884: 100%
Message from python27-2.7.10_1:
===========================================================================

Note that some standard Python modules are provided as separate ports
as they require additional dependencies. They are available as:

bsddb           databases/py-bsddb
gdbm            databases/py-gdbm
sqlite3         databases/py-sqlite3
tkinter         x11-toolkits/py-tkinter

===========================================================================
Message from perl5-5.20.3_8:
The /usr/bin/perl symlink has been removed starting with Perl 5.20.
For shebangs, you should either use:

#!/usr/local/bin/perl

or

#!/usr/bin/env perl

The first one will only work if you have a /usr/local/bin/perl,
the second will work as long as perl is in PATH.
Message from dejavu-2.35:
Make sure that the freetype module is loaded.  If it is not, add the following
line to the "Modules" section of your X Windows configuration file:

        Load "freetype"

Add the following line to the "Files" section of X Windows configuration file:

        FontPath "/usr/local/share/fonts/dejavu/"

Note: your X Windows configuration file is typically /etc/X11/XF86Config
if you are using XFree86, and /etc/X11/xorg.conf if you are using X.Org.
Message from ca_root_nss-3.20.1:
********************************* WARNING *********************************

FreeBSD does not, and can not warrant that the certification authorities
whose certificates are included in this package have in any way been
audited for trustworthiness or RFC 3647 compliance.

Assessment and verification of trust is the complete responsibility of the
system administrator.

*********************************** NOTE **********************************

This package installs symlinks to support root certificates discovery by
default for software that uses OpenSSL.

This enables SSL Certificate Verification by client software without manual
intervention.

If you prefer to do this manually, replace the following symlinks with
either an empty file or your site-local certificate bundle.

  * /etc/ssl/cert.pem
  * /usr/local/etc/ssl/cert.pem
  * /usr/local/openssl/cert.pem

***************************************************************************
Message from trousers-tddl-0.3.10_7:
To run tcsd automatically, add the following line to /etc/rc.conf

tcsd_enable="YES"

You might want to edit /usr/local/etc/tcsd.conf to reflect your setup.

To use TPM, add your_account to '_tss' group like following:

# pw groupadd _tss -m your_account
Message from ruby-2.1.7,1:
====
Some of the standard commands are provided as separate ports for ease
of upgrading:

        devel/ruby-gems:        gem - RubyGems package manager
        devel/rubygem-rake:     rake - Ruby Make

And some of the standard libraries are provided as separate ports
since they require extra dependencies:

        databases/ruby-gdbm:    GDBM module

Install them as occasion demands.
====
Message from ctags-5.8:
**************************************************************************
The executable for Exuberant CTAGS is installed as /usr/local/bin/exctags
**************************************************************************

FreeBSD 10 & BIND 9.9

Setup chroot for bind 9 in FreeBSD 10
DNS again: a clarification
FreeBSD 10: Unbound and LDNS replacing BIND

interface "xn0" {
    supersede domain-name-servers 127.0.0.1;
}
Message from bind99-9.9.8_1:
**********************************************************************
*            _  _____ _____ _____ _   _ _____ ___ ___  _   _         *
*           / \|_   _|_   _| ____| \ | |_   _|_ _/ _ \| \ | |        *
*          / _ \ | |   | | |  _| |  \| | | |  | | | | |  \| |        *
*         / ___ \| |   | | | |___| |\  | | |  | | |_| | |\  |        *
*        /_/   \_\_|   |_| |_____|_| \_| |_| |___\___/|_| \_|        *
*                                                                    *
*   BIND requires configuration of rndc, including a "secret" key.   *
*    The easiest, and most secure way to configure rndc is to run    *
*   'rndc-confgen -a' to generate the proper conf file, with a new   *
*            random key, and appropriate file permissions.           *
*                                                                    *
*     The /usr/local/etc/rc.d/named script will do that for you.     *
*                                                                    *
**********************************************************************
$ /usr/local/sbin/named -fg -t /var/named -u bind -c /usr/local/etc/namedb/named.conf

MOOC – Massive Open Online Course / Online University

Udacity
Udemy
Pluralsight | Unlimited Online Developer, IT and Cyber Security Training
edX (Education X ?!)

Coursera
Wikipedia: Coursera

Kiron University
Wikipedia: Kiron Open Higher Education

Kurse

Kiron University

Multivariable calculus – Derivatives of multivariable functions

Udemy

Solve 100 Python Exercises to Boost your Python Skills
Python Bootcamp: Vom Anfänger zum Profi, inkl. Data Science
Python für Data Science, Maschinelles Lernen & Visualization

Christian Heigele

Kommt halt drauf an was du suchst.

Udacity hat richtige Kurse mit richtigem Lerninhalt und druck, mit ein bisschen Glück werden dir die Zertifikate auch hier in Europa angerechnet, kosten aber auch echtes Geld. Also hundert Dollar pro Kurs oder entsprechend mehr für so Mini Studiengänge.

Pluralsight kann ich für aufbessern von Programmiertechniken, Pattern, Sprachdetails… Recht empfehlen. Ein Teil davon ist auch in einem MSDN Account dabei, kann sich lohnen.

Udemy ist eher so ein bisschen Hobby für Leute die neue Themen lernen wollen, aber nicht allzu in die Tiefe gehen wollen. Ist wirklich nett, und kostet in den Sales auch echt nicht viel. Ich hab mir da ein paar Kurse rausgelassen um mich während der Täglichen Pendelei durchlesen/hören.

ntpd / ntpq Internals

Documentation

Wikipedia: ntpd (de)
Wikipedia: ntpd (en)
The NTP FAQ and HOWTO, Understanding and using the Network Time Protocol (2006-11-21)
Network Time Synchronization Research Project (with PowerPoint/PDF presentations)
The Network Time Protocol (NTP) Distribution (31-Mar-2014 05:41)
The Network Time Protocol (NTP) Distribution (07-Nov-2009 20:43 UTC)
Performance Metrics for root distance statistic (root delay, root dispersion), 26.07.2015

support.ntp.org Wiki

The NTP Public Services Project
NTP Support Web
Configuring NTP
ntpd access restrictions

Timescale

Major definitions of time

  • Atomic Time – or TAI
  • Universal Time – or UT0 and UT1
  • oordinated Universal Time – or UTC
  • Unix epoch = 1 January 1970
  • NTP epoch = 1 January 1900
  • constant 2,208,988,800 between 1900 and 1970
  • TAI seconds: seconds since 01.01.1970 00:00 without leap seconds
  • UTC seconds: seconds since 01.01.1970 00:00 with leap seconds (today 36 leap seconds) without daylight-saving time and time-zone information
  • NTP seconds: seconds since 01.01.1900 00:00 with leap seconds without daylight-saving time and time-zone information

Create ntp time stamp from gettimeofday
NTP Timestamp calculation

ntp_fraction
a

Time, Clock, and Calendar Programming In C
NTP, UTC, and Working with Time on Linux
The Unix leap second mess
The NTP Era and Era Numbering
NTP Timestamp Calculations

gettimeofday() should never be used to measure time
C/C++ tip: How to measure elapsed real time for benchmarking

stackoverflow

Create ntp time stamp from gettimeofday
Measure time in Linux – getrusage vs clock_gettime vs clock vs gettimeofday?
faster equivalent of gettimeofday
How do I get the unix timestamp in C as an int?

Manual Pages

Ubuntu Wily: man ntp.conf
FreeBSD 10.2: man ntp.conf

Reference Clock

Generic Reference Driver

IPv6

RFC: Reference ID for NTPv6
REFID Format
Updating the REFID format

HowTos

Ubuntuuser.de: Systemzeit
NTP Server – Stratum Levels Explained
The Raspberry Pi as a Stratum-1 NTP Server
How to build a stratum 1 NTP server with GPS time reference
Setting up a local stratum 2 NTP server
NTP-Deamon Konfiguration
Network Time Protocol

Root distance / dispersion

Root delay and Root dispersion values in NTP protocol?
NTPD not updating time date on CENTOS

FAQ

Question

powerpc-e300c3-linux-gnu-gcc -o ntpd ntp_config.o ntp_io.o \
ntp_parser.o ntp_scanner.o ntpd.o ntpd-opts.o \
-L. -lopts -lntp -lntpd -lrt -lcap -lm -lssl -lcrypto

ntpd.o: In function `ntpdmain':
./libntpd.a(ntp_control.o): In function `ctl_putadr':
src/ntpd/ntp_control.c:1678: undefined reference to `numtoa'
./libntpd.a(ntp_control.o): In function `ctl_putsys':
src/ntpd/ntp_control.c:2214: undefined reference to `k_st_flags'
./libntpd.a(ntp_control.o): In function `send_restrict_entry':
src/ntpd/ntp_control.c:4239: undefined reference to `res_match_flags'
src/ntpd/ntp_control.c:4240: undefined reference to `res_access_flags'
./libntpd.a(ntp_control.o): In function `write_variables':
src/ntpd/ntp_control.c:3283: undefined reference to `atoint'
./libntpd.a(ntp_control.o): In function `report_event':
src/ntpd/ntp_control.c:4773: undefined reference to `eventstr'
src/ntpd/ntp_control.c:4741: undefined reference to `eventstr'

Answer

Libraries order were not right

before:
-lopts -lntp -lntpd

after:
-lntpd -lntp -lopts

Is it possible to have circular dependencies?
Resolving circular dependencies by linking the same library twice?
Avoiding Linking Problems, Darryl Gove and Stephen Clamage, May 2011

-lfoo -lbar -lfoo
or
-Wl,--start-group -lfoo -lbar -Wl,--end-group

Question

How does asynchronouse / non-blocking sockets work?
non-blocking sockets + signal SIGALRM

Answer

SIGALRM, setitimer(), sleep(), select()
select() returns that socket is ready when SIGALRM
Unix signal handling example in C, SIGINT, SIGALRM, SIGHUP…

If any of these (as well as other) system calls is interrupted by a signal, such as SIGALRM or SIGIO, the call will return -1 and the variable errno will be
set to EINTR 2. The system call will be automatically restarted. It may be advisable to reset errno to zero.

Berkeley UNIX System Calls and Interprocess Communication
Unix connect() and interrupted system calls
c / interrupted system call / fork vs. thread
System call interrupted by a signal still has to be completed
EINTR and non-blocking calls
Apple: Avoiding Common Networking Mistakes
glibc: Waiting for Input or Output
select() usage examples
System call error handling

Question

How to listen only on specific interfaces?

Answer

How to prevent ntpd to listen on 0.0.0.0:123?
Does NTPd have to listen on an interface or address for updating the server time?

Question

No header files for simulation / standalone

[CC] src/ntpd/cmd_args.c
gcc -o obj/osa541x_sim/libntpd.a/ntpd/cmd_args.o -c src/ntpd/cmd_args.c -Iinclude/config/x86 -DHAVE_CONFIG_H -Iinclude -Wall -Wcast-align -Wcast-qual -Wmissing-prototypes -Wpointer-arith -Wshadow -Winit-self -Wstrict-overflow -Wno-strict-prototypes -g -O2 
In file included from include/ntp.h:14:0,
                 from include/ntpd.h:11,
                 from src/ntpd/cmd_args.c:8:
include/ntp_crypto.h:27:25: fatal error: openssl/evp.h: No such file or directory

Answer

Install header files

$ sudo apt-get install libssl-dev

Question

YACC not found

[CC] src/ntpd/ntp_io.c
gcc -o obj/osa541x_sim/advaNtpd/ntpd/ntp_io.o -c src/ntpd/ntp_io.c -Iinclude/config/x86 -DHAVE_CONFIG_H -Iinclude -Wall -Wcast-align -Wcast-qual -Wmissing-prototypes -Wpointer-arith -Wshadow -Winit-self -Wstrict-overflow -Wno-strict-prototypes -g -O2
src/ntpd/ntp_io.c: In function ‘io_setbclient’:
src/ntpd/ntp_io.c:2672:5: warning: assuming signed overflow does not occur when simplifying conditional to constant [-Wstrict-overflow]
  if (nif > 0) {
     ^
src/ntpd/ntp_io.c:2672:5: warning: assuming signed overflow does not occur when simplifying conditional to constant [-Wstrict-overflow]
yacc  src/ntpd/ntp_parser.y 
make: yacc: Command not found
<builtin>: recipe for target 'src/ntpd/ntp_parser.c' failed
make: *** [src/ntpd/ntp_parser.c] Error 127