Category Archives: FreeBSD

Anything related to FreeBSD

Kernel panic due to memory corruption

This is what a kernel panic may look like when facing memory corruption.

kernel: panic: solaris assert: arc_buf_alloc_impl(hdr, private, compressed_read, 1, &buf) == 0 (0x5 == 0x0), file: /usr/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c, line: 5318
kernel: cpuid = 1
kernel: KDB: stack backtrace:
kernel: db_trace_self_wrapper() at 0xffffffff8046b52b = db_trace_self_wrapper+0x2b/frame 0xfffffe0122681380
kernel: vpanic() at 0xffffffff806c5ba6 = vpanic+0x186/frame 0xfffffe0122681400
kernel: panic() at 0xffffffff806c5a13 = panic+0x43/frame 0xfffffe0122681460
kernel: assfail3() at 0xffffffff8030987c = assfail3+0x2c/frame 0xfffffe0122681480
kernel: arc_read() at 0xffffffff80322ddc = arc_read+0x83c/frame 0xfffffe0122681510
kernel: dbuf_read() at 0xffffffff8032e918 = dbuf_read+0x678/frame 0xfffffe01226815c0
kernel: dmu_buf_hold_array_by_dnode() at 0xffffffff80338bf3 = dmu_buf_hold_array_by_dnode+0x203/frame 0xfffffe0122681630
kernel: dmu_read_uio_dnode() at 0xffffffff8033a167 = dmu_read_uio_dnode+0x37/frame 0xfffffe01226816a0
kernel: dmu_read_uio_dbuf() at 0xffffffff8033a10b = dmu_read_uio_dbuf+0x3b/frame 0xfffffe01226816d0
kernel: zfs_freebsd_read() at 0xffffffff803d7e80 = zfs_freebsd_read+0x660/frame 0xfffffe0122681780
kernel: VOP_READ_APV() at 0xffffffff80a7b77c = VOP_READ_APV+0x7c/frame 0xfffffe01226817b0
kernel: vn_read() at 0xffffffff807a0815 = vn_read+0x195/frame 0xfffffe0122681830
kernel: vn_io_fault1() at 0xffffffff8079e4e9 = vn_io_fault1+0x169/frame 0xfffffe0122681970
kernel: vn_io_fault() at 0xffffffff8079c6ac = vn_io_fault+0x18c/frame 0xfffffe01226819e0
kernel: dofileread() at 0xffffffff807291aa = dofileread+0xba/frame 0xfffffe0122681a20
kernel: kern_readv() at 0xffffffff80728db8 = kern_readv+0x68/frame 0xfffffe0122681a70
kernel: sys_read() at 0xffffffff80728d46 = sys_read+0x86/frame 0xfffffe0122681ac0
kernel: amd64_syscall() at 0xffffffff809d5f18 = amd64_syscall+0xa38/frame 0xfffffe0122681bf0
kernel: fast_syscall_common() at 

Joint Python ports in FreeBSD

I woke up this morning only to be greeted by:

# make -C /usr/ports fetchindex
/usr/ports/INDEX-11.bz2                       100% of 2150 kB  695 kBps 00m03s
# pkg version -ovIL=
devel/py27-setuptools              ?   orphaned: devel/py27-setuptools
devel/py36-setuptools              ?   orphaned: devel/py36-setuptools

As per /usr/ports/UPDATING, the solution is:

setenv FLAVOR py27
portupgrade -fpvo devel/py-setuptools devel/py27-setuptools
setenv FLAVOR py36
portupgrade -fpvo devel/py-setuptools devel/py36-setuptools
unsetenv FLAVOR

Take note of the North-American spelling.

Boot menu changes in base/head r325694

Update 2017-11-13
r325743 corrected the mistakes. The below no longer applies. Remove /boot/loader.rc.local if you created it.

/boot/loader.rc used to be copied from base/head/sys/boot/i386/loader/loader.rc on FreeBSD/amd64. With r325694 this changed to base/head/sys/boot/forth/loader.rc. Nothing was added to base/head/UPDATING, explaining this change.

As instructed in /boot/loader.rc, to regain our beloved boot menu, we must create and edit /boot/loader.rc.local, essentially redoing what was handled by the previous /boot/loader.rc.

include /boot/beastie.4th

Upgrading PHP from 7.0.22 to 7.1.9

I created a shell script which began its simple life as


# Use on first run

# Use on subsequent runs

portupgrade ${FLAGS} lang/php71 lang/php70 || exit

portupgrade ${FLAGS} textproc/php71-ctype      textproc/php70-ctype      || exit
portupgrade ${FLAGS} ftp/php71-curl            ftp/php70-curl            || exit
portupgrade ${FLAGS} textproc/php71-dom        textproc/php70-dom        || exit
portupgrade ${FLAGS} graphics/php71-gd         graphics/php70-gd         || exit
portupgrade ${FLAGS} devel/php71-gettext       devel/php70-gettext       || exit
portupgrade ${FLAGS} security/php71-hash       security/php70-hash       || exit
portupgrade ${FLAGS} converters/php71-iconv    converters/php70-iconv    || exit
portupgrade ${FLAGS} devel/php71-json          devel/php70-json          || exit
portupgrade ${FLAGS} net/php71-ldap            net/php70-ldap            || exit
portupgrade ${FLAGS} converters/php71-mbstring converters/php70-mbstring || exit
portupgrade ${FLAGS} security/php71-mcrypt     security/php70-mcrypt     || exit
portupgrade ${FLAGS} databases/php71-memcache  databases/php70-memcache  || exit
portupgrade ${FLAGS} www/php71-opcache         www/php70-opcache         || exit
portupgrade ${FLAGS} security/php71-openssl    security/php70-openssl    || exit
portupgrade ${FLAGS} databases/php71-pdo       databases/php70-pdo       || exit
portupgrade ${FLAGS} databases/php71-pdo_pgsql databases/php70-pdo_pgsql || exit
portupgrade ${FLAGS} databases/php71-pgsql     databases/php70-pgsql     || exit
portupgrade ${FLAGS} www/php71-session         www/php70-session         || exit
portupgrade ${FLAGS} textproc/php71-simplexml  textproc/php70-simplexml  || exit
portupgrade ${FLAGS} net/php71-soap            net/php70-soap            || exit
portupgrade ${FLAGS} net/php71-sockets         net/php70-sockets         || exit
portupgrade ${FLAGS} databases/php71-sqlite3   databases/php70-sqlite3   || exit
portupgrade ${FLAGS} textproc/php71-wddx       textproc/php70-wddx       || exit
portupgrade ${FLAGS} textproc/php71-xml        textproc/php70-xml        || exit
portupgrade ${FLAGS} archivers/php71-zlib      archivers/php70-zlib      || exit

portupgrade ${FLAGS} www/mod_php71 www/mod_php70 || exit

After running the script for a second time and a third time, etc, the script was successively changed to:


# Use on first run

# Use on subsequent runs

#portupgrade ${FLAGS} lang/php71 lang/php70 || exit

#portupgrade ${FLAGS} textproc/php71-ctype      textproc/php70-ctype      || exit
#portupgrade ${FLAGS} ftp/php71-curl            ftp/php70-curl            || exit
#portupgrade ${FLAGS} textproc/php71-dom        textproc/php70-dom        || exit
#portupgrade ${FLAGS} graphics/php71-gd         graphics/php70-gd         || exit
#portupgrade ${FLAGS} devel/php71-gettext       devel/php70-gettext       || exit
#portupgrade ${FLAGS} security/php71-hash       security/php70-hash       || exit
#portupgrade ${FLAGS} converters/php71-iconv    converters/php70-iconv    || exit
#portupgrade ${FLAGS} devel/php71-json          devel/php70-json          || exit
#portupgrade ${FLAGS} net/php71-ldap            net/php70-ldap            || exit
#portupgrade ${FLAGS} converters/php71-mbstring converters/php70-mbstring || exit
#portupgrade ${FLAGS} security/php71-mcrypt     security/php70-mcrypt     || exit

#portupgrade ${FLAGS} www/php71-session         www/php70-session         || exit
#portupgrade ${FLAGS} archivers/php71-zlib      archivers/php70-zlib      || exit
#portupgrade ${FLAGS} databases/php71-memcache  databases/php70-memcache  || exit

#portupgrade ${FLAGS} www/php71-opcache         www/php70-opcache         || exit
#portupgrade ${FLAGS} security/php71-openssl    security/php70-openssl    || exit
#portupgrade ${FLAGS} databases/php71-pdo       databases/php70-pdo       || exit
#portupgrade ${FLAGS} databases/php71-pdo_pgsql databases/php70-pdo_pgsql || exit
#portupgrade ${FLAGS} databases/php71-pgsql     databases/php70-pgsql     || exit
#portupgrade ${FLAGS} textproc/php71-simplexml  textproc/php70-simplexml  || exit
#portupgrade ${FLAGS} net/php71-soap            net/php70-soap            || exit
#portupgrade ${FLAGS} net/php71-sockets         net/php70-sockets         || exit
#portupgrade ${FLAGS} databases/php71-sqlite3   databases/php70-sqlite3   || exit

portupgrade ${FLAGS} textproc/php71-xml        textproc/php70-xml        || exit
portupgrade ${FLAGS} textproc/php71-wddx       textproc/php70-wddx       || exit

portupgrade ${FLAGS} www/mod_php71 www/mod_php70 || exit

Restart Apache using service apache24 restart.

In the end, PHP 7.0.22 got upgraded to PHP 7.1.9. All is well.