Monthly Archives: December 2015

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

rsync

rsync – synchronizing two file trees
Use Rsync for Daily, Weekly and Full Monthly Backups
Rsync as a Backup Tool

$ rsync -a /boot/kernel{,-8.2}/
-a         = -rlptgoD

-r         = recurse into directories
-l         = copy symlinks as symlinks
-p         = Preserve permission
-t         = Preserve time
-g         = Preserve group
-o         = Preserve owner (user)
-D         = --devices --specials
--devices  = preserve device files (super-user only)
--specials = preserve special files

freebsd-update

FreeBSD Update
FreeBSD-Update (de)
FreeBSD Update (en)

Tech Stuff – FreeBSD Update Survival Guide

freebsd-update and custom kernels

Upgrades from one minor version of FreeBSD to another, like from FreeBSD 9.0 to FreeBSD 9.1, are called minor version upgrades. Major version upgrades occur when FreeBSD is upgraded from one major version to another, like from FreeBSD 9.X to FreeBSD 10.X. Both types of upgrades can be performed by providing freebsd-update with a release version target.

Upgrade to a new Patch-Level

FreeBSD 12.0-RELEASE-p9 GENERIC
$ freebsd-update fetch
$ freebsd-update install
$ reboot

FreeBSD 12.0-RELEASE-p10 GENERIC
$  freebsd-version -kru
-k   version and patch level of the installed kernel
-r   version and patch level of the running kernel
-u   version and patch level of the installed userland

12.0 to 12.2

# freebsd-update upgrade -r 12.2-RELEASE
src component not installed, skipped
Looking up update.FreeBSD.org mirrors... 2 mirrors found.
Fetching metadata signature for 12.0-RELEASE from update2.freebsd.org... done.
Fetching metadata index... done.
Fetching 2 metadata patches.. done.
Applying metadata patches... done.
Inspecting system... done.

The following components of FreeBSD seem to be installed:
kernel/generic kernel/generic-dbg world/base world/doc world/lib32

The following components of FreeBSD do not seem to be installed:
world/base-dbg world/lib32-dbg

Does this look reasonable (y/n)? y

Fetching metadata signature for 12.2-RELEASE from update2.freebsd.org... done.
Fetching metadata index... done.
Fetching 1 metadata patches. done.
Applying metadata patches... done.
Fetching 1 metadata files... done.
Inspecting system... done.
Fetching files from 12.0-RELEASE for merging... done.
Preparing to download files... done.
Fetching 10713 patches... [...]
Applying patches... done.
Fetching 11146 files... done.
Attempting to automatically merge changes in files... done.

The following changes, which occurred between FreeBSD 12.0-RELEASE and
FreeBSD 12.2-RELEASE have been merged into /etc/group:
[...]
Does this look reasonable (y/n)? y

The following changes, which occurred between FreeBSD 12.0-RELEASE and
FreeBSD 12.2-RELEASE have been merged into /etc/master.passwd:
[...]
Does this look reasonable (y/n)? y

The following changes, which occurred between FreeBSD 12.0-RELEASE and
FreeBSD 12.2-RELEASE have been merged into /etc/passwd:
[...]
Does this look reasonable (y/n)? y

The following changes, which occurred between FreeBSD 12.0-RELEASE and
FreeBSD 12.2-RELEASE have been merged into /etc/profile
[...]
Does this look reasonable (y/n)? y

The following files are affected by updates, but no changes have
been downloaded because the files have been modified locally:
[...]
The following files will be removed as part of updating to 12.2-RELEASE-p9:
[...]
The following files will be added as part of updating to 12.2-RELEASE-p9:
[...]
The following files will be updated as part of updating to 12.2-RELEASE-p9:
[...]
To install the downloaded upgrades, run "/usr/sbin/freebsd-update install".

Upgrade to a new Release Version

$ uname -a
FreeBSD gateway 10.0-RELEASE [...] GENERIC  amd64

$ freebsd-update upgrade -r 10.2-RELEASE
$ /usr/sbin/freebsd-update install
$ reboot
$ /usr/sbin/freebsd-update install
$ pkg upgrade -f
$ /usr/sbin/freebsd-update install
$ uname -a
FreeBSD ns2.te-clan.ch 10.1-RELEASE [...] NS2-BACHI-NET  amd64

$ df
Filesystem  1K-blocks    Used    Avail Capacity  Mounted on
/dev/ada0p2   2031132  969868   898776    52%    /      <== includes /boot
                                                            kernel uses ca. 450 MB
devfs               1       1        0   100%    /dev
/dev/ada0p3   8106716  452652  7005528     6%    /var
/dev/ada0p4   4053308   35020  3694024     1%    /tmp
/dev/ada0p6  64995324 7673760 52121940    13%    /usr
/dev/ada0p7  42651260   32836 39206324     0%    /web
/dev/ada0p8  26396824   32836 24252244     0%    /db
devfs               1       1        0   100%    /var/named/dev

$ cd /usr/src
$ make kernel __MAKE_CONF=/dev/null SRCCONF=/dev/null
/boot/kernel/kernel        <- GENERIC kernel
/boot/kernel.old/kernel    <- your kernel

$ rsync -a /boot/kernel /boot/GENERIC
$ rm /boot/kernel
$ mv /boot/kernel.old /boot/kernel

$ sysctl -n kern.bootfile
/boot/kernel.old/kernel

$ sysctl kern.bootfile=/boot/kernel/kernel
kern.bootfile: /boot/kernel.old/kernel -> /boot/kernel/kernel

$ sysctl -n kern.bootfile
/boot/kernel/kernel

$ freebsd-update upgrade -r 10.2-RELEASE
Looking up update.FreeBSD.org mirrors... none found.
Fetching public key from update.FreeBSD.org... done.
Fetching metadata signature for 10.1-RELEASE from update.FreeBSD.org... done.
Fetching metadata index... done.
Fetching 2 metadata files... done.
Inspecting system... done.

WARNING: This system is running a "ns2-bachi-net" kernel, which is not a
kernel configuration distributed as part of FreeBSD 10.1-RELEASE.
This kernel will not be updated: you MUST update the kernel manually
before running "/usr/sbin/freebsd-update install".

The following components of FreeBSD seem to be installed:
kernel/generic src/src world/base world/doc world/lib32

The following components of FreeBSD do not seem to be installed:
world/games

Does this look reasonable (y/n)? y

Fetching metadata signature for 10.2-RELEASE from update4.freebsd.org... done.
Fetching metadata index... done.
Fetching 1 metadata patches. done.
Applying metadata patches... done.
Fetching 1 metadata files... done.
Inspecting system... done.
Fetching files from 10.1-RELEASE for merging... done.
Preparing to download files... done.
Fetching 39913 patches.....10....20....30....40....50....60
[...]
Applying patches... done.
Fetching 6731 files... done.
Attempting to automatically merge changes in files... done.

The following file could not be merged automatically: /etc/dhclient.conf
Press Enter to edit this file in vi and resolve the conflicts
manually...

The following files are affected by updates, but no changes have
been downloaded because the files have been modified locally:
/.profile
/root/.profile

The following files will be removed as part of updating to 10.2-RELEASE-p8:
[...]
To install the downloaded upgrades, run "/usr/sbin/freebsd-update install".

$ /usr/sbin/freebsd-update install
Installing updates...
Kernel updates have been installed.  Please reboot and run
"/usr/sbin/freebsd-update install" again to finish installing updates.
$ sudo freebsd-update upgrade -r 9.1-RELEASE

[ warnings about custom kernel ]

$ sudo freebsd-update install

[ this is when the new generic kernel is installed if we weren't running a custom kernel ]

$ cd /usr 
$ mv src{,-8.2}
$ sudo svn co https://svn.freebsd.org/base/releng/9.1/
$ sudo cp src{-8.2,}/sys/i386/conf/PULP
$ cd src

$ sudo rsync -a /boot/kernel{,-8.2}/
$ sudo make kernel-toolchain
$ sudo make buildkernel KERNCONF=PULP
$ sudo make installkernel KERNCONF=PULP

$ sudo reboot

$ sudo freebsd-update install
$ sudo reboot

Custom kernel in loader.conf

How to keep freebsd-update from trashing custom kernel?
FreeBSD Boot Process

Just an idea, not tested: Leave the GENERIC kernel updated
by freebsd-update, and put your own kernel unter a different
name into /boot, for example:

	/boot/kernel/kernel		<- GENERIC kernel
	/boot/mykernel/kernel		<- your kernel

Then change /boot/loader.conf to contain:

	kernel="mykernel"
	bootfile="/boot/mykernel/kernel"

Create Ubuntu USB Stick

ISO-9660 / MBR / GPT

“CD-Rs normally use the ISO-9660 filesystem directly, without partitions.”
Do ISO’s contain partition tables as well as a backup of the data?
How to understand partition table on hybrid ISO image?
In Ubuntu ISO MBR, why does a GPT partition overlap the boot partition, and make MBR uneditable?

mkusb


dus – a revamped interface of mkusb and mkusb-nox
mkusb versions with GUI
mkusb – tool to create boot drives

$ sudo add-apt-repository ppa:mkusb/unstable
$ sudo apt-get update
$ sudo apt-get install mkusb

$ guidus

Zenity, erlaubt, GTK-Dialoge von der Kommandozeile oder von Shell-Skripten aus zu starten

Von Hand

How to create a bootable Ubuntu USB flash drive from terminal?

sudo umount /dev/sdb
sudo dd if=/path/to/ubuntu.iso of=/dev/sdb bs=1M

How do you monitor the progress of dd?

$ sudo dd if=/dev/urandom of=/dev/null status=progress
or
$ sudo apt-get install pv
$ dd if=/path/to/ubuntu.iso | pv | dd of=/dev/sdb
sudo mkdir /media/iso/
sudo mount -o loop /path/to/ubuntu.iso /media/iso

# add fat32 partition (with gparted)

cp -a /media/iso/. /media/xxx/

sudo apt-get install syslinux mtools
sudo syslinux -s /dev/sdd1

=== NOT FINISHED !!! ===

$ pkg install syslinux
New packages to be INSTALLED:
        syslinux: 6.03
        mtools: 4.0.10_4
[...]
[1/2] Installing mtools-4.0.10_4...
[1/2] Extracting mtools-4.0.10_4: 100%
[2/2] Installing syslinux-6.03...
[2/2] Extracting syslinux-6.03: 100%
Message from mtools-4.0.10_4:
************************************************************
Please verify /usr/local/etc/mtools.conf for your machine.
************************************************************

Delete MBR
$ dd if=/dev/zero of=/dev/da1 bs=2m count=1

Create MBR with one FAT32 partition
$ fdisk -i /dev/da0

Format the partition
$ newfs_msdos -F32 /dev/da1s1

Mount partition
$ mount_msdosfs /dev/da1s1 /mnt

Create a memory disk:
-a        = attach
-t vnode  = backing store "file"
-f <file> = filename to use
-u 0      = create /dev/md0
$ mdconfig -a -t vnode -f ubuntu-15.10-server-amd64.iso -u 0

Mount the memory disk
$  mount -t cd9660 /dev/md0 /media/iso

Copy files from ISO to USB Stick
$ cp -a /media/iso/. /mnt

$ find /mnt -name syslinux.cfg
/mnt/install/netboot/ubuntu-installer/amd64/boot-screens/syslinux.cfg

=== NOT FINISHED !!! ===

Format USB Stick with FAT32 on FreeBSD