History log of /openbsd-current/libexec/reorder_kernel/reorder_kernel.sh
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.13 07-Nov-2022 kn

Use variable and shorter logic for NFS check

No need to hardcode a parent path if we can reuse an existing variable for
the specific path that is in being used.

Negate the file system type in df(1) so the `|| exit 1' can be dropped
in favour of the errexit option, as is done for everything else in there.

Clarify the comment how this is intentionally NOT logged, i.e. the test
happens before the error trap/syslog/logfile handling.

OK millert


# 1.12 07-Nov-2022 kn

Set up logger(1) traps earlier to catch logfile setup failures

If /usr is mounted read-only, kernel relinking fails silently without any
log trace:

# /usr/libexec/reorder_kernel
/usr/libexec/reorder_kernel[35]: cannot create /usr/share/relink/kernel/GENERIC.MP/relink.log: Read-only file system

This stderr line does not show up anywhere because init(8) redirects stdout
and stderr to /dev/null, executes rc(8) which inherits it and thus executes
reorder_kernel with both streams discarded.

So install the error handler first, then try to set up a log file.

Introduce ERRMSG to provide error messages to users, i.e. not say
"see .../relink.log" when creating this file is what failed:

# ksh ./reorder_kernel.sh
./reorder_kernel.sh[40]: cannot create /usr/share/relink/kernel/GENERIC.MP/relink.log: Read-only file system
# tail -n1 /var/log/message # or xconsole(1)
Nov 7 10:51:00 eru reorder_kernel.sh: failed

OK tb


Revision tags: OPENBSD_7_2_BASE
# 1.11 13-May-2022 sthen

If $KERNEL_DIR.tgz exists, reorder_kernel updates the destination for
logged stdout output, but forgot to handle stderr. Fix that so that
the error log includes stderr output in that case (otherwise the log
is usually empty). From Lauri Tirkkonen, plus comment adjusted. ok tb


Revision tags: OPENBSD_7_0_BASE OPENBSD_7_1_BASE
# 1.10 13-Sep-2021 robert

introduce /etc/bsd.re-config which can be used to configure the kernel
using config(8);

the contents of this configuration file will be fed to config(8) after
kernel relinking is done, so on the next boot the new kernel will have
all the configuration changes set by the user

this comes handy if you still want to use KARL while making changes
to the GENERIC kernel

diff from Paul de Weerd with input from several developers


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.9 28-Sep-2019 ajacoutot

Add where missing and harmonize PATH to be _PATH_DEFPATH (without local nor
X11R6).
Suggested by tb@

ok deraadt@ tb@ millert@


# 1.8 30-Jul-2019 deraadt

shorten the failure message, it should not wrap a line.


# 1.7 20-Jun-2019 deraadt

after installing new kernel, do a sync(8) to encourage lazy buffers to
make it to disk (discussion with tedu)


Revision tags: OPENBSD_6_5_BASE
# 1.6 10-Feb-2019 kn

Simplify NFS check

Instead of getting all filesystems with df(1), filter /usr/share/ and check
with mount(1) whether it's NFS, make df error out directly if the
filesystem type matches nfs.

OK sthen tb


Revision tags: OPENBSD_6_4_BASE
# 1.5 01-May-2018 rpe

Add an explanation to relink.log what a failed checksum of /bsd
means and show how to re-enable KARL.

Prodded by and OK deraadt
Feedback and OK tb


Revision tags: OPENBSD_6_3_BASE
# 1.4 05-Nov-2017 rpe

Consolidate lib.so.*.a, ld.so.a and the kernel relink kit into
one location under /usr/share/relink.

Be more specific in src/etc/rc reorder_libs() what filesystems
need r/w remount and ensure that their mount state is restored.

Idea and positive feedback from deraadt@
OK aja@ tb@


Revision tags: OPENBSD_6_2_BASE
# 1.3 25-Aug-2017 rpe

It's a standalone script now, so explicitly set a sane PATH.


# 1.2 25-Aug-2017 rpe

Fix detection whether /usr/share is on a nfs mounted filesystem.


# 1.1 21-Aug-2017 rpe

Move the kernel relinking code from /etc/rc into a seperate script
/usr/libexec/reorder_kernel. Requested by ajacoutot@ to be able to
relink the kernel from within syspatch(8).

OK deraadt@ tb@


# 1.11 13-May-2022 sthen

If $KERNEL_DIR.tgz exists, reorder_kernel updates the destination for
logged stdout output, but forgot to handle stderr. Fix that so that
the error log includes stderr output in that case (otherwise the log
is usually empty). From Lauri Tirkkonen, plus comment adjusted. ok tb


Revision tags: OPENBSD_7_0_BASE OPENBSD_7_1_BASE
# 1.10 13-Sep-2021 robert

introduce /etc/bsd.re-config which can be used to configure the kernel
using config(8);

the contents of this configuration file will be fed to config(8) after
kernel relinking is done, so on the next boot the new kernel will have
all the configuration changes set by the user

this comes handy if you still want to use KARL while making changes
to the GENERIC kernel

diff from Paul de Weerd with input from several developers


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.9 28-Sep-2019 ajacoutot

Add where missing and harmonize PATH to be _PATH_DEFPATH (without local nor
X11R6).
Suggested by tb@

ok deraadt@ tb@ millert@


# 1.8 30-Jul-2019 deraadt

shorten the failure message, it should not wrap a line.


# 1.7 20-Jun-2019 deraadt

after installing new kernel, do a sync(8) to encourage lazy buffers to
make it to disk (discussion with tedu)


Revision tags: OPENBSD_6_5_BASE
# 1.6 10-Feb-2019 kn

Simplify NFS check

Instead of getting all filesystems with df(1), filter /usr/share/ and check
with mount(1) whether it's NFS, make df error out directly if the
filesystem type matches nfs.

OK sthen tb


Revision tags: OPENBSD_6_4_BASE
# 1.5 01-May-2018 rpe

Add an explanation to relink.log what a failed checksum of /bsd
means and show how to re-enable KARL.

Prodded by and OK deraadt
Feedback and OK tb


Revision tags: OPENBSD_6_3_BASE
# 1.4 05-Nov-2017 rpe

Consolidate lib.so.*.a, ld.so.a and the kernel relink kit into
one location under /usr/share/relink.

Be more specific in src/etc/rc reorder_libs() what filesystems
need r/w remount and ensure that their mount state is restored.

Idea and positive feedback from deraadt@
OK aja@ tb@


Revision tags: OPENBSD_6_2_BASE
# 1.3 25-Aug-2017 rpe

It's a standalone script now, so explicitly set a sane PATH.


# 1.2 25-Aug-2017 rpe

Fix detection whether /usr/share is on a nfs mounted filesystem.


# 1.1 21-Aug-2017 rpe

Move the kernel relinking code from /etc/rc into a seperate script
/usr/libexec/reorder_kernel. Requested by ajacoutot@ to be able to
relink the kernel from within syspatch(8).

OK deraadt@ tb@


# 1.10 13-Sep-2021 robert

introduce /etc/bsd.re-config which can be used to configure the kernel
using config(8);

the contents of this configuration file will be fed to config(8) after
kernel relinking is done, so on the next boot the new kernel will have
all the configuration changes set by the user

this comes handy if you still want to use KARL while making changes
to the GENERIC kernel

diff from Paul de Weerd with input from several developers


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.9 28-Sep-2019 ajacoutot

Add where missing and harmonize PATH to be _PATH_DEFPATH (without local nor
X11R6).
Suggested by tb@

ok deraadt@ tb@ millert@


# 1.8 30-Jul-2019 deraadt

shorten the failure message, it should not wrap a line.


# 1.7 20-Jun-2019 deraadt

after installing new kernel, do a sync(8) to encourage lazy buffers to
make it to disk (discussion with tedu)


Revision tags: OPENBSD_6_5_BASE
# 1.6 10-Feb-2019 kn

Simplify NFS check

Instead of getting all filesystems with df(1), filter /usr/share/ and check
with mount(1) whether it's NFS, make df error out directly if the
filesystem type matches nfs.

OK sthen tb


Revision tags: OPENBSD_6_4_BASE
# 1.5 01-May-2018 rpe

Add an explanation to relink.log what a failed checksum of /bsd
means and show how to re-enable KARL.

Prodded by and OK deraadt
Feedback and OK tb


Revision tags: OPENBSD_6_3_BASE
# 1.4 05-Nov-2017 rpe

Consolidate lib.so.*.a, ld.so.a and the kernel relink kit into
one location under /usr/share/relink.

Be more specific in src/etc/rc reorder_libs() what filesystems
need r/w remount and ensure that their mount state is restored.

Idea and positive feedback from deraadt@
OK aja@ tb@


Revision tags: OPENBSD_6_2_BASE
# 1.3 25-Aug-2017 rpe

It's a standalone script now, so explicitly set a sane PATH.


# 1.2 25-Aug-2017 rpe

Fix detection whether /usr/share is on a nfs mounted filesystem.


# 1.1 21-Aug-2017 rpe

Move the kernel relinking code from /etc/rc into a seperate script
/usr/libexec/reorder_kernel. Requested by ajacoutot@ to be able to
relink the kernel from within syspatch(8).

OK deraadt@ tb@


# 1.9 28-Sep-2019 ajacoutot

Add where missing and harmonize PATH to be _PATH_DEFPATH (without local nor
X11R6).
Suggested by tb@

ok deraadt@ tb@ millert@


# 1.8 30-Jul-2019 deraadt

shorten the failure message, it should not wrap a line.


# 1.7 20-Jun-2019 deraadt

after installing new kernel, do a sync(8) to encourage lazy buffers to
make it to disk (discussion with tedu)


Revision tags: OPENBSD_6_5_BASE
# 1.6 10-Feb-2019 kn

Simplify NFS check

Instead of getting all filesystems with df(1), filter /usr/share/ and check
with mount(1) whether it's NFS, make df error out directly if the
filesystem type matches nfs.

OK sthen tb


Revision tags: OPENBSD_6_4_BASE
# 1.5 01-May-2018 rpe

Add an explanation to relink.log what a failed checksum of /bsd
means and show how to re-enable KARL.

Prodded by and OK deraadt
Feedback and OK tb


Revision tags: OPENBSD_6_3_BASE
# 1.4 05-Nov-2017 rpe

Consolidate lib.so.*.a, ld.so.a and the kernel relink kit into
one location under /usr/share/relink.

Be more specific in src/etc/rc reorder_libs() what filesystems
need r/w remount and ensure that their mount state is restored.

Idea and positive feedback from deraadt@
OK aja@ tb@


Revision tags: OPENBSD_6_2_BASE
# 1.3 25-Aug-2017 rpe

It's a standalone script now, so explicitly set a sane PATH.


# 1.2 25-Aug-2017 rpe

Fix detection whether /usr/share is on a nfs mounted filesystem.


# 1.1 21-Aug-2017 rpe

Move the kernel relinking code from /etc/rc into a seperate script
/usr/libexec/reorder_kernel. Requested by ajacoutot@ to be able to
relink the kernel from within syspatch(8).

OK deraadt@ tb@


# 1.8 30-Jul-2019 deraadt

shorten the failure message, it should not wrap a line.


# 1.7 20-Jun-2019 deraadt

after installing new kernel, do a sync(8) to encourage lazy buffers to
make it to disk (discussion with tedu)


Revision tags: OPENBSD_6_5_BASE
# 1.6 10-Feb-2019 kn

Simplify NFS check

Instead of getting all filesystems with df(1), filter /usr/share/ and check
with mount(1) whether it's NFS, make df error out directly if the
filesystem type matches nfs.

OK sthen tb


Revision tags: OPENBSD_6_4_BASE
# 1.5 01-May-2018 rpe

Add an explanation to relink.log what a failed checksum of /bsd
means and show how to re-enable KARL.

Prodded by and OK deraadt
Feedback and OK tb


Revision tags: OPENBSD_6_3_BASE
# 1.4 05-Nov-2017 rpe

Consolidate lib.so.*.a, ld.so.a and the kernel relink kit into
one location under /usr/share/relink.

Be more specific in src/etc/rc reorder_libs() what filesystems
need r/w remount and ensure that their mount state is restored.

Idea and positive feedback from deraadt@
OK aja@ tb@


Revision tags: OPENBSD_6_2_BASE
# 1.3 25-Aug-2017 rpe

It's a standalone script now, so explicitly set a sane PATH.


# 1.2 25-Aug-2017 rpe

Fix detection whether /usr/share is on a nfs mounted filesystem.


# 1.1 21-Aug-2017 rpe

Move the kernel relinking code from /etc/rc into a seperate script
/usr/libexec/reorder_kernel. Requested by ajacoutot@ to be able to
relink the kernel from within syspatch(8).

OK deraadt@ tb@


# 1.7 20-Jun-2019 deraadt

after installing new kernel, do a sync(8) to encourage lazy buffers to
make it to disk (discussion with tedu)


Revision tags: OPENBSD_6_5_BASE
# 1.6 10-Feb-2019 kn

Simplify NFS check

Instead of getting all filesystems with df(1), filter /usr/share/ and check
with mount(1) whether it's NFS, make df error out directly if the
filesystem type matches nfs.

OK sthen tb


Revision tags: OPENBSD_6_4_BASE
# 1.5 01-May-2018 rpe

Add an explanation to relink.log what a failed checksum of /bsd
means and show how to re-enable KARL.

Prodded by and OK deraadt
Feedback and OK tb


Revision tags: OPENBSD_6_3_BASE
# 1.4 05-Nov-2017 rpe

Consolidate lib.so.*.a, ld.so.a and the kernel relink kit into
one location under /usr/share/relink.

Be more specific in src/etc/rc reorder_libs() what filesystems
need r/w remount and ensure that their mount state is restored.

Idea and positive feedback from deraadt@
OK aja@ tb@


Revision tags: OPENBSD_6_2_BASE
# 1.3 25-Aug-2017 rpe

It's a standalone script now, so explicitly set a sane PATH.


# 1.2 25-Aug-2017 rpe

Fix detection whether /usr/share is on a nfs mounted filesystem.


# 1.1 21-Aug-2017 rpe

Move the kernel relinking code from /etc/rc into a seperate script
/usr/libexec/reorder_kernel. Requested by ajacoutot@ to be able to
relink the kernel from within syspatch(8).

OK deraadt@ tb@


# 1.6 10-Feb-2019 kn

Simplify NFS check

Instead of getting all filesystems with df(1), filter /usr/share/ and check
with mount(1) whether it's NFS, make df error out directly if the
filesystem type matches nfs.

OK sthen tb


Revision tags: OPENBSD_6_4_BASE
# 1.5 01-May-2018 rpe

Add an explanation to relink.log what a failed checksum of /bsd
means and show how to re-enable KARL.

Prodded by and OK deraadt
Feedback and OK tb


Revision tags: OPENBSD_6_3_BASE
# 1.4 05-Nov-2017 rpe

Consolidate lib.so.*.a, ld.so.a and the kernel relink kit into
one location under /usr/share/relink.

Be more specific in src/etc/rc reorder_libs() what filesystems
need r/w remount and ensure that their mount state is restored.

Idea and positive feedback from deraadt@
OK aja@ tb@


Revision tags: OPENBSD_6_2_BASE
# 1.3 25-Aug-2017 rpe

It's a standalone script now, so explicitly set a sane PATH.


# 1.2 25-Aug-2017 rpe

Fix detection whether /usr/share is on a nfs mounted filesystem.


# 1.1 21-Aug-2017 rpe

Move the kernel relinking code from /etc/rc into a seperate script
/usr/libexec/reorder_kernel. Requested by ajacoutot@ to be able to
relink the kernel from within syspatch(8).

OK deraadt@ tb@


# 1.5 01-May-2018 rpe

Add an explanation to relink.log what a failed checksum of /bsd
means and show how to re-enable KARL.

Prodded by and OK deraadt
Feedback and OK tb


Revision tags: OPENBSD_6_3_BASE
# 1.4 05-Nov-2017 rpe

Consolidate lib.so.*.a, ld.so.a and the kernel relink kit into
one location under /usr/share/relink.

Be more specific in src/etc/rc reorder_libs() what filesystems
need r/w remount and ensure that their mount state is restored.

Idea and positive feedback from deraadt@
OK aja@ tb@


Revision tags: OPENBSD_6_2_BASE
# 1.3 25-Aug-2017 rpe

It's a standalone script now, so explicitly set a sane PATH.


# 1.2 25-Aug-2017 rpe

Fix detection whether /usr/share is on a nfs mounted filesystem.


# 1.1 21-Aug-2017 rpe

Move the kernel relinking code from /etc/rc into a seperate script
/usr/libexec/reorder_kernel. Requested by ajacoutot@ to be able to
relink the kernel from within syspatch(8).

OK deraadt@ tb@


# 1.4 05-Nov-2017 rpe

Consolidate lib.so.*.a, ld.so.a and the kernel relink kit into
one location under /usr/share/relink.

Be more specific in src/etc/rc reorder_libs() what filesystems
need r/w remount and ensure that their mount state is restored.

Idea and positive feedback from deraadt@
OK aja@ tb@


Revision tags: OPENBSD_6_2_BASE
# 1.3 25-Aug-2017 rpe

It's a standalone script now, so explicitly set a sane PATH.


# 1.2 25-Aug-2017 rpe

Fix detection whether /usr/share is on a nfs mounted filesystem.


# 1.1 21-Aug-2017 rpe

Move the kernel relinking code from /etc/rc into a seperate script
/usr/libexec/reorder_kernel. Requested by ajacoutot@ to be able to
relink the kernel from within syspatch(8).

OK deraadt@ tb@