Warning: there may be occasional oddness due to css and blog edits. **KNOWN ISSUE: possible hidden text**

Monday, February 26, 2024

So many things to remember

I have been using FreeBSD for quite a long time but even with as often as some tasks occur, I still do not quickly remember where a config file belongs or which one I should edit.  I have kept a printout of my blog post about updating kernel and world so that I have a reference to the steps I use from time to time, usually about every 10-30 days.  I know that I could look in manpages or try the --help option for any executable but the solution I have chosen to do might be quicker or simpler in some way.

What I did is create a directory ~/Symbolic_links in my root directory, within this directory I have placed things like the following:

# ls -l
total 8
lrwxr-xr-x  1 root wheel 44 Sep 19 14:29 14amd64-blacklist -> /usr/local/etc/poudriere.d/14amd64-blacklist
lrwxr-xr-x  1 root wheel 44 Sep 19 14:28 14amd64-make.conf -> /usr/local/etc/poudriere.d/14amd64-make.conf
lrwxr-xr-x  1 root wheel 31 Feb  7  2022 app-defaults -> /usr/local/lib/X11/app-defaults
lrwxr-xr-x  1 root wheel 47 Sep 19 14:22 cache_14amd64 -> /usr/local/poudriere/data/cache/14amd64-default
lrwxr-xr-x  1 root wheel 35 Oct 19  2020 p-keg_ports -> /usr/local/poudriere/ports/default/
lrwxr-xr-x  1 root wheel 66 Sep 19 14:20 p-keg-logs_bulk_14amd64_latest-per-pkg -> /usr/local/poudriere/data/logs/bulk/14amd64-default/latest-per-pkg
lrwxr-xr-x  1 root wheel 35 Feb 26  2022 p-keg-logs_bulk_parent -> /usr/local/poudriere/data/logs/bulk
lrwxr-xr-x  1 root wheel 62 Sep 19 13:46 p-keg-ports_packages_all -> /usr/local/poudriere/data/packages/14amd64-default/.latest/All
lrwxr-xr-x  1 root wheel 24 Feb 13  2021 pkg_repo_conf_dir -> /usr/local/etc/pkg/repos
lrwxr-xr-x  1 root wheel 23 Feb 26 13:12 pkg.conf -> /usr/local/etc/pkg.conf
lrwxr-xr-x  1 root wheel 29 Nov 10  2020 poudriere.conf -> /usr/local/etc/poudriere.conf
lrwxr-xr-x  1 root wheel 26 Dec 18  2020 thePoudriereDir -> /usr/local/etc/poudriere.d
lrwxr-xr-x  1 root wheel 30 Jan 24  2022 xorg_configs -> /usr/local/etc/X11/xorg.conf.d
lrwxr-xr-x  1 root wheel 36 Sep 11 16:41 xorg-drivers-installed -> /usr/local/lib/xorg/modules/drivers/
lrwxr-xr-x  1 root wheel 31 Aug 28 17:34 Xterm_and_other_X_defaults_here -> /usr/local/lib/X11/app-defaults
lrwxr-xr-x  1 root wheel 37 Aug 28 17:33 xterm_app_defaults -> /usr/local/lib/X11/app-defaults/XTerm

Later, when I am wondering what I need to adjust or where that config file is that needs the adjustment, I can first look at these symbolic links and get to editing the file.

Another thing I've done which I am sure needs a bit of a cleanup and probably a revision, probably move the information to a different file, I've also thought about making the random notes one extensive alias to display it.  This is my .cshrc-personal file with all sorts of notes on various things I've run across in passing which come in handy or could someday.

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ROOT USER  .cshrc-personal
#______________________________________________

# sony exfat: mount.exfat-fuse /dev/da8s1 /mnt/usbstick

# If sound fails for firefox but works for other things, check if sndio is installed and remove that.
# Firefox from pkg also requires pango compiled with libthai option, pango pkg does not have this.
# mesa-dri should solve libGL error: failed to load driver: radeonsi

# rather oddly poudriere refused to update via the very brief incantation so instead the much more verbose and slower method seems to have worked:
# poudriere jail -m -v stable/14 -a amd64 -j 14amd64 -b -m src=/usr/src
# This may have been after /usr/src was already cleaned. Uncertain if the error from update via
# poudriere -u -j 14amd64
# was caused by a cleaned /usr/src or some other issue, also included a new symbolic link to /etc/src.conf in thepoudrieredir.
# Now there is the src-env.conf, src.conf, and make.conf used in there.

alias rekernconf	'ln -s /root/kernconf/ICHIGO /usr/src/sys/amd64/conf/ICHIGO ; ln -s /root/kernconf/RACK /usr/src/sys/amd64/conf/RACK'
alias kernconf		cp /root/kernconf/ICHIGO /usr/src/sys/amd64/conf/ICHIGO
alias remakeconf 	cp /etc/make.conf ~/Symbolic_Links/thePoudriereDir/13amd64-make.conf
alias sorta 		sort -d -u

alias portlint 		'echo;echo;\portlint'
alias plist		'echo "make makeplist > pkg-plist"'

alias fixnet		repairnet
alias fixtime		ntpdate -b 0.freebsd.pool.ntp.org
alias ezjail 		ezjail-admin
alias cmake-opts 	"cmake -L | awk '{if(f)print} /-- Cache values/{f=1}'"
alias autotools-opts	'./autogen.sh && ./configure --help=recursive'
alias myworldip		lynx -dump checkip.dyndns.org
alias nice 		/usr/bin/nice
alias redoGUI 		make-de-re-install-each GUI-fix-list
alias redogui 		make-de-re-install-each GUI-fix-list

alias eighty		'echo "1234567^1234567^1234567^1234567^1234567^1234567^1234567^1234567^1234567^1234567^"'
alias seventy		'echo "123456789^123456789^123456789^123456789^123456789^123456789^123456789^"'

alias zfs-df		'zfs list -o space'
alias pkeg-distclean	'poudriere distclean -a'

alias rust-crates	'echo "From the port directory: make cargo-crates > Makefile.crates"'

alias port_deps_help 'echo "dependencies for port: `make build-depends-list && make run-depends-list`"; echo "dependencies still needed to install for a port: `make missing`"'
unalias h
unalias j
unalias la
unalias lf
unalias ll

# A righteous umask
umask 22

set path = (/sbin /bin /usr/sbin /usr/bin /usr/local/sbin /usr/local/bin $HOME/scripts $HOME/bin)

setenv	EDITOR	vi
#setenv	PAGER	less
setenv	PAGER	more
setenv	BLOCKSIZE	K


if ($?prompt) then
	# An interactive shell -- set some stuff up
	set prompt = "%N@%m:%~ %# "
	set promptchars = "%#"

	set filec
	set history = 1000
	set savehist = (1000 merge)
	set autolist = ambiguous
	# Use history to aid expansion
	set autoexpand
	set autorehash
	set mail = (/var/mail/$USER)
	if ( $?tcsh ) then
		bindkey "^W" backward-delete-word
		bindkey -k up history-search-backward
		bindkey -k down history-search-forward
	endif

endif

alias today 	date "+%m/%d/%Y"

# -a When it receives a packet make audible beep - internal tower speaker
# -A When it misses a packet make audible beep - internal tower speaker
# And change the interval to every 63 secs
alias ping      ping -i 63 -A

alias recert    make -C  /usr/ports/security/ca_root_nss reinstall clean

alias installmedia 'echo "dd if=FreeBSD-10.2-RELEASE-amd64-memstick.img of=/dev/da0 bs=1M conv=sync status=progress"'

setenv autologout 30

setenv LSCOLORS Exfxcxdxbxegedabagacad
setenv CLICOLOR true

setenv LANGUAGE en_US.UTF-8
setenv LANG en_US.UTF-8
setenv LC_ALL en_US.UTF-8
setenv LC_CTYPE POSIX

setenv QT_QPA_PLATFORM xcb

# default is blank, qt5ct utility must have
#  setenv QT_QPA_PLATFORMTHEME qt5ct
setenv QT_QPA_PLATFORMTHEME qt5ct

#setenv QT_QPA_PLATFORMTHEME default

# Additions to fix qt5 scale issue in FVWM
# Boolean 0/1
setenv QT_AUTO_SCREEN_SCALE_FACTOR 1

# Numeric
#setenv QT_SCREEN_SCALE_FACTORS .35

# With radeon driver this seems right
#setenv QT_SCREEN_SCALE_FACTORS 1.1
# PCDM dpi is screwy & wrong! Use 96dpi only
#best below
#setenv QT_SCREEN_SCALE_FACTORS .5
#setenv QT_SCREEN_SCALE_FACTORS .495

# dependencies for port: `make build-depends-list && make run-depends-list`
#
# dependencies still needed to install for a port: `make missing`

# pkg prime-origins | sort -d -u | more
#
# pkg query -x '%o %n %v %R' 'mesa-|drm.*kmod|gpu-firmware*' | sort

# fc-list :scalable=true:spacing=mono: family > xterm_fonts_choices
# After an edit to the file, combine it with what is in use already:
#   xrdb -merge ~/.Xresources
#
# Use the file and override whatever is already used:
#   xrdb ~/.Xresources
#
# man build:
#	MAKEOBJDIRPREFIX Defines the prefix for directory
#	KERNCONFDIR Overrides the directory in which KERNCONF and any files included by KERNCONF should be found.
#
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# $FreeBSD: stable/12/bin/csh/dot.cshrc 338374 2018-08-29 16:59:19Z brd $
#
# .cshrc - csh resource script, read at beginning of execution by each shell
#
# see also csh(1), environ(7).
# more examples available at /usr/share/examples/csh/
#
# make -V LIB_DEPENDS
#
# Whois for IP, including AS number:
# whois -h whois.cymru.com " -v 165.231.253.20"
#
# If needing to install something and everything balks, use this on make install line
#FORCE_PKG_REGISTER
#
# What is your graphics hardware?
# pciconf -lv | grep -B4 -A1 VGA
#
# If the system is running with a custom kernel, use nextboot(8) to set the
# kernel for the next boot to the updated /boot/GENERIC:
#
# nextboot -k GENERIC
#
# The machine should now be restarted with the updated kernel:
#
# shutdown -r now
#
## possibly helpful pkg output for script
#pkg query %n:%v:%o
#
## this might be causing a window manager to act as "default"
#/usr/local/etc/X11/xsm/system.xsm
#
# xorg individual config files are in  /usr/local/etc/X11/xorg.conf.d/
#
# /var/log/dmesg.boot contains the boot messages. /var/log/messages contains the current errors.
#
###
# AMD (Phenom & Athlon for certain) cannot have this sysctl set non-zero:
# vm.pmap.pti=0
# If set, boot to loader prompt, set vm.pmap.pti=0 then boot.
###
#
# cert for ssl stuff in browser.
# security/ca_root_nss
#
# Someone forgot to configure the certificate chain in the webserver.
# review the webserver config and make sure that the certificate chain configuration is valid?
# In particular, one should be able to test this with
#   openssl s_client -connect forums.freenas.org:443
# and not get the "unable to verify the first certificate" error.
#
# ps auxdww piped to less can help quite a bit in that regard
# it gives you a snapshot of the full process table at any given point in time
#
# Where is the pkg repo config files stored?
# /etc/pkg/FreeBSD.conf
# /usr/local/etc/pkg/repos/00_synth.conf
#
# # pkg origin pkg
# ports-mgmt/pkg
#
# make build-depends-list should show you the dependencies
# make all-depends-list will recurse through all dependencies
#
# What kernel compile options built
# sysctl kern.conftxt
#
# Show what device an irq is bound to
# vmstat -i
#
# dd if=FreeBSD-10.2-RELEASE-amd64-memstick.img of=/dev/da0 bs=1M conv=sync
###
#fat32 thumbdrive usbstick
#If you need to create a FAT32 formatted USB thumb drive, find out its devicename
#running dmesg(8) after inserting it. Then create an MBR schema, a single slice and
#format it:
# gpart create -s MBR ${devicename}
# gpart add -t fat32 ${devicename}
# newfs_msdos -F 32 -L thumbdrive ${devicename}s1
###
# phone sd card
#gpart show
#=>       63  249737153  da8  MBR  (119G)
#         63  249737153    1  fat32  (119G)
# mount -t msdos -o ro /dev/da8s1 /mnt
# umount /dev/da8s1
# Troubles with efreet of enlightenment were solved by removing a file "0"
# ~/.ecore/efreetd/0
#
# For lots of buildworld and related info, targets, knobs
# man 7 build
#
# FYI qt5ct settings for added style is here /usr/local/share/qt5ct/qss
# /usr/local/etc/slim.conf edit to modify how it functions or theme
#
#  # pkg remove -f pkg
# Updating database digests format: 100%
# Checking integrity... done (0 conflicting)
# Deinstallation has been requested for the following 1 packages (of 0 packages in the universe):
#
# Installed packages to be REMOVED:
#         pkg-1.10.5_5
#
# Number of packages to be removed: 1
#
# The operation will free 13 MiB.
#
# Proceed with deinstalling packages? [y/N]: y
# [1/1] Deinstalling pkg-1.10.5_5...
# You may need to manually remove /usr/local/etc/pkg.conf if it is no longer needed.
# [1/1] Deleting files for pkg-1.10.5_5: 100%
#
#
# build world or kernel, settings here:  src-env.conf
#
#alias svn	svnlite
#alias fixnet	/etc/rc.d/netif restart lagg0
#
#alias pkg	pkg -N
#
### adjust this file for kernel/world build
# /etc/src-env.conf
#
### Initial /usr/src checkout:
# svn co https://svn0.us-east.freebsd.org/base/release/12.0.0 /usr/src
#
### If branch leaps such as Release to Stable, add 'ignore' switch
# svn  --ignore-ancestry switch ^/stable/12 /usr/src
#
### switch source branches easily! (was on stable-11)
# svn switch ^/stable/12 /usr/src
#
### when it times out without finishing add
# svn cleanup ;
#
#Audio capture desktop and firefox
# need virtual_oss from ports then:
# virtual_oss -Q 0 -C 2 -c 2 -r 48000 -b 16 -s 1024 -P /dev/dsp6 -R /dev/null -w vdsp.wav -l dsp
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# `procstat -k PID` shows the stack of all kernel threads associated with that process.
# That, with a tyro's grasp of kernels, makes it possible to work out where hangs etc.
# are coming from. Resource locks abound down there, and sometimes they break.
#
#`git clean -xdf` (removes all files not under version control)
#
# When pkg is seemingly stuck try to find out which command it is...
# ps auxwww | grep pkg
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# From /usr/local/share/doc/ccache/ccache-howto-freebsd.txt
# For csh/tcsh Add the following to /etc/csh.cshrc:
#
#  setenv PATH /usr/local/libexec/ccache:$PATH
#  setenv CCACHE_PATH /usr/bin:/usr/local/bin
#
# Ccache's default cache size is 1GB and this is larger than the default size of
# the root partition (/) on FreeBSD. To over come this you may specify a new
# cache location on a different partition with the following examples.
# For csh/tcsh Add the following to /etc/csh.cshrc:
#  setenv CCACHE_DIR "/usr/.ccache"
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# from https://forums.freebsd.org/threads/howto-freebsd-with-ccache.174/
# set ccache variables
#setenv PATH /usr/local/libexec/ccache:$PATH
#setenv CCACHE_PATH /usr/bin:/usr/local/bin
#setenv CCACHE_DIR /var/cache/ccache
#setenv CCACHE_LOGFILE /var/log/ccache.log
#
# set ccache temp size to 512MB (default 1GB)
#if ( -x /usr/local/bin/ccache ) then
#  /usr/local/bin/ccache -M 512M > /dev/null
#endif
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Tigersharke .cshrc
# $FreeBSD: stable/11/share/skel/dot.cshrc 278616 2015-02-12 05:35:00Z cperciva $
#
# .cshrc - csh resource script, read at beginning of execution by each shell
#
# see also csh(1), environ(7).
# more examples available at /usr/share/examples/csh/
#
# Spiffy progress for dd, add to commandline: status=progress
#
#########
# record 2 hours of Zenith -- must press record button in player that appears!
# vlc -vvv http://148.163.81.10:8006/stream --stop-time 7200 vlc://quit
#########
#
#########
# record without interaction, auto-quits as well, just need to use `at` to schedule it.
# cvlc -vvv http://stream.dbmedia.se/gk70tal96 --prefetch-buffer-size=0 --sout file/mp4:testfile.mp4 --stop-time 120 vlc://quit
#########
#
# Replace audio without recompressing. Use audacity to modify the audio first.
# ffmpeg.exe -i input_video.mp4 -i replacement_audio.m4a -vcodec copy -acodec copy -map 0:0 -map 1:0 output.mp4
#
# Fix aspect ratio: ffmpeg -i [INPUT] -aspect 720:540 -c copy [OUTPUT]
#
# location of desktop files: /usr/local/share/applications
#
#alias openoffice exec [ ! -e `ls -t /usr/local/bin | grep -m 1 openoffice`]||echo "Not installed"
#alias openoffice exec `ls -t /usr/local | grep -m 1 openoffice`
#
#alias today 	date "+%m/%d/%Y"
#
# When it receives a packet make audible beep - internal tower speaker
# And change the interval to every 10 secs
#alias ping      ping -i 10 -a
#alias recert    make -C  /usr/ports/security/ca_root_nss reinstall clean
#
# read(2) of directories may not be desirable by default, as this will provoke
# EISDIR errors from each directory encountered.
# alias grep    grep -d skip
#
#alias neovim	nvim
#alias neovim-qt nvim-qt
#alias amphetadesk AmphetaDesk
#alias freedroidrpg freedroidRPG
#alias xstart xinit ~/.xinitrc -- -dpi 75 -nolisten tcp
#
# These are normally set through /etc/login.conf.  You may override them here
# if wanted.
# set path = (/sbin /bin /usr/sbin /usr/bin /usr/local/sbin /usr/local/bin $HOME/bin)
# setenv	BLOCKSIZE	K
# A righteous umask
# umask 22
#
# when pkg is seemingly stuck try to find out which command it is...
# ps auxwww | grep pkg
#
# find all damned ports options!
# find * -maxdepth 2 -name Makefile -exec grep -Hn OPTIONS_DEFINE {} \; >> /root/options-list.txt
#
# Set default sound device in vlc: use any of /dev/dsp3.vp0 or similar,
# do `ls /dev | grep dsp` while vlc is running to see which audio devices exist, they only exist while in use.
# my fiberoptic is any of the dsp3, either dsp4.vp0 or dsp3.vp1
#
# # pkg set -o multimedia/vlc3:multimedia/vlc
#Change origin from multimedia/vlc3 to multimedia/vlc for vlc3-3.0.5,4? [y/N]: y
#
# Over quota? below will give you a sorted list of your directory sizes.
#  du -sh * | sort -h
#
# I find brace expansion useful for renaming files.
# This cmd expands to "mv Picture.jpg Picture-of-my-cat.jpg"
#   mv Picture{,-of-my-cat}.jpg
#
# /usr/ports/www/linux-flashplayer
# /usr/ports/www/nspluginwrapper/pkg-message
#
# When was the machine rebooted, shutdown, crashed?
# use the command: last
#
#setenv autologout 30
#
#setenv LSCOLORS Exfxcxdxbxegedabagacad
#setenv CLICOLOR true
#
#setenv LANGUAGE en_US.UTF-8
#setenv LANG en_US.UTF-8
#setenv LC_ALL en_US.UTF-8
#setenv LC_CTYPE POSIX
#
#setenv QT_QPA_PLATFORM xcb
################################################
## default is blank, qt5ct utility must have  ##
##  setenv QT_QPA_PLATFORMTHEME qt5ct	      ##
setenv QT_QPA_PLATFORMTHEME qt5ct
#setenv QT_QPA_PLATFORMTHEME default
################################################
## Additions to fix qt5 scale issue in FVWM   ##
## Boolean 0/1                                ##
#setenv QT_AUTO_SCREEN_SCALE_FACTOR 1
## Numeric                                    ##
#setenv QT_SCREEN_SCALE_FACTORS .35
# With radeon driver this seems right
#setenv QT_SCREEN_SCALE_FACTORS 1.1
# PCDM dpi is screwy & wrong! Use 96dpi only
#best below
#setenv QT_SCREEN_SCALE_FACTORS .5
#setenv QT_SCREEN_SCALE_FACTORS .495
################################################
#export LANGUAGE=en_US.UTF-8
#export LANG=en_US.UTF-8
#export LC_ALL=en_US.UTF-8
#export QT_QPA_PLATFORMTHEME=qt5ct
#setenv LANGUAGE en_US.UTF-8
#setenv LANG en_US.UTF-8
#setenv LC_ALL en_US.UTF-8
#setenv QT_QPA_PLATFORMTHEME qt5ct
#
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# just in case
# from https://forums.freebsd.org/threads/howto-freebsd-with-ccache.174/
# set ccache variables
#setenv PATH /usr/local/libexec/ccache:$PATH
#setenv CCACHE_PATH /usr/bin:/usr/local/bin
#setenv CCACHE_DIR /usr/.ccache
#setenv CCACHE_LOGFILE /var/log/ccache.log
#
## set ccache temp size to 512MB (default 1GB)
#if ( -x /usr/local/bin/ccache ) then
#  /usr/local/bin/ccache -M 512M > /dev/null
#endif
#
#
# If you experience issues when running OpenGL applications it is possible
# to force the use of DRI2 by setting the LIBGL_DRI3_DISABLE environment
# variable to 1 before starting any OpenGL application.  The easiest way to
# do this is by adding it to either your shell startup files or .xinitrc.
#setenv LIBGL_DRI3_DISABLE 1
#
#set path = ($path /media/sbin /media/bin /media/usr/sbin /media/usr/bin /media/usr/local/sbin /media/usr/local/bin /media$HOME/bin)
#
# Determine what requires llvm (3 lines output after)
# pkg info -rx llvm
#llvm10-10.0.1_5:
#        mesa-dri-20.2.3_1
#llvm11-11.0.1:
#
# /usr/ports/Mk for porting, and /usr/share/mk for software building.
#
#find what cmake options are available (from work/portbuild directory) from https://stackoverflow.com/questions/16851084/how-to-list-all-cmake-build-options-and-their-default-values
# cmake -LA | awk '{if(f)print} /-- Cache values/{f=1}'

I still have general organizing to do, but for now I have the whole mess loaded, at the bottom of my .cshrc file I added

source /root/.cshrc-local
source /root/.cshrc-personal

Lastly, although you may have seen them in passing via that .cshrc-personal file root has, I will show you the various aliases I have for my root and user accounts.  This is one more way to keep track of things and make the information more quickly to hand.

# alias
amphetadesk     AmphetaDesk
autotools-opts  ./autogen.sh && ./configure --help=recursive
cmake-opts      cmake -L | awk '{if(f)print} /-- Cache values/{f=1}'
eighty  echo "1234567^1234567^1234567^1234567^1234567^1234567^1234567^1234567^1234567^1234567^"
ezjail  ezjail-admin
fixnet  repairnet
fixtime (ntpdate -b 0.freebsd.pool.ntp.org)
installmedia    echo "dd if=FreeBSD-10.2-RELEASE-amd64-memstick.img of=/dev/da0 bs=1M conv=sync status=progress"
kernconf        (cp /root/kernconf/ICHIGO /usr/src/sys/amd64/conf/ICHIGO)
less    (less --mouse)
myworldip       (lynx -dump checkip.dyndns.org)
neovim  nvim
neovim-qt       nvim-qt
nice    /usr/bin/nice
ping    (ping -i 63 -A)
pkeg-distclean  poudriere distclean -a
plist   echo "make makeplist > pkg-plist"
port_deps_help  echo "dependencies for port: `make build-depends-list && make run-depends-list`"; echo "dependencies still needed to install for a port: `make missing`"
portlint        echo;echo;\portlint
recert  (make -C /usr/ports/security/ca_root_nss reinstall clean)
redoGUI (make-de-re-install-each GUI-fix-list)
redogui (make-de-re-install-each GUI-fix-list)
rekernconf      ln -s /root/kernconf/ICHIGO /usr/src/sys/amd64/conf/ICHIGO ; ln -s /root/kernconf/RACK /usr/src/sys/amd64/conf/RACK
remakeconf      (cp /etc/make.conf /root/Symbolic_Links/thePoudriereDir/13amd64-make.conf)
rust-crates     echo "From the port directory: make cargo-crates > Makefile.crates"
seventy echo "123456789^123456789^123456789^123456789^123456789^123456789^123456789^"
sorta   (sort -d -u)
today   (date +%m/%d/%Y)
xstart  (xinit /root/.xinitrc -- -dpi 75 -nolisten tcp)
zfs-df  zfs list -o space
# exit

% alias
amphetadesk     AmphetaDesk
eighty  (echo 1234567^1234567^1234567^1234567^1234567^1234567^1234567^1234567^1234567^1234567^)
freedroidrpg    freedroidRPG
ircII   irc
ircii   irc
less    (less --mouse)
ls      (ls -a)
neovim  nvim
neovim-qt       nvim-qt
today   (date +%m/%d/%Y)
veloren veloren-voxygen
virtoss virtual_oss -Q 0 -C 2 -c 2 -r 48000 -b 16 -s 1024 -P /dev/dsp6 -R /dev/null -w vdsp.wav -l dsp
xstart  (xinit ~/.xinitrc -- -dpi 75 -nolisten tcp

While there may be a ton of things to remember on a FreeBSD system, there are numerous ways to make it easier to find the information and to do it in such a way as to have fewer extra places to look through to find it.  Symbolic links can become stale, but are easily replaced and the link itself can be more descriptive than the object of its link.  Aliases can cause custom output in the form of echoed text, or be named to assist with recall of its purpose, or sometimes a common name and its executable are different.

What ever method you use, along with the usual methods of searching through a manpage or forum post, or asking on IRC or any other social media platform (or even feedback to your favorite podcast like BSDNow or 2.5admins), you can be sure to succeed with any task that has you stuck.  The above is how I have made the struggle lighter for myself.

Wednesday, February 7, 2024

Zpool-upgrade loader.efi fail

I recently bought a Sony Walkman android device, which I hoped would permit me to use an app to control my Deco S4 wifi devices.  The wifi hardware was added in hopes of improving local wifi from a single Xfinity device and in a more secure way by connecting via my OPNsense box.  Once I solved the wifi device app issue, I still had the Sony Walkman for audio.

Perhaps foolishly, I wanted to use larger better quality flac files, and knowing I still had quite a large number of CDs to run through ripperX, I tried to change my vdev to better compression.  What seemed to me as being better compression algorithms were unavailable to me because my zfs needed an update.  I had done as many as two updates in the past, one which switched me to 'feature flags' and each time was warned about compatibility but never had an issue.

Without any further investigation, assuming that it would be just as easy a process as in the past, so I upgraded zfs and then changed the compression of the vdev for my music files.  Everything ran fine, no issues.  Later, I was playing minetest and after some time in the midst of what I was attempting on the minetest server, my display and mouse, and pc froze up.  There has been an issue with something somewhere which has caused me a panic and reboot, so all I had once more was the inconvenient interruption.  This time it didn't reboot itself, just seemed to remain frozen, so I rebooted.

This is when I discovered that something was wrong.  It started the boot but before it got very far I was greeted with errors including "ZFS: unsupported feature: com.klarasystems:vdev_zaps_v2" and mention that it couldn't find any bootable drives.  Luckily there was a specific term which I could search online for more information: klarasystems:vdev_zaps_v2.

One search result was FreeBSD forum post 14-0-release-zfs-features-gotcha.91085 but I also looked at the 14.0 release notes, and /usr/src/UPDATING:

20160708:
	The stable/11 branch has been created from head@r302406.

After branch N is created, entries older than the N-2 branch point are removed
from this file. After stable/14 is branched and current becomes FreeBSD 15,
entries older than stable/12 branch point will be removed from current's
UPDATING file.

COMMON ITEMS:

	General Notes
	-------------
	Sometimes, obscure build problems are the result of environment
	poisoning.  This can happen because the make utility reads its
	environment when searching for values for global variables.  To run
	your build attempts in an "environmental clean room", prefix all make
	commands with 'env -i '.  See the env(1) manual page for more details.
	Occasionally a build failure will occur with "make -j" due to a race
	condition.  If this happens try building again without -j, and please
	report a bug if it happens consistently.

	When upgrading from one major version to another it is generally best to
	upgrade to the latest code in the currently installed branch first, then
	do an upgrade to the new branch. This is the best-tested upgrade path,
	and has the highest probability of being successful.  Please try this
	approach if you encounter problems with a major version upgrade.  Since
	the stable 4.x branch point, one has generally been able to upgrade from
	anywhere in the most recent stable branch to head / current (or even the
	last couple of stable branches). See the top of this file when there's
	an exception.

	The update process will emit an error on an attempt to perform a build
	or install from a FreeBSD version below the earliest supported version.
	When updating from an older version the update should be performed one
	major release at a time, including running `make delete-old` at each
	step.

	When upgrading a live system, having a root shell around before
	installing anything can help undo problems. Not having a root shell
	around can lead to problems if pam has changed too much from your
	starting point to allow continued authentication after the upgrade.

	This file should be read as a log of events. When a later event changes
	information of a prior event, the prior event should not be deleted.
	Instead, a pointer to the entry with the new information should be
	placed in the old entry. Readers of this file should also sanity check
	older entries before relying on them blindly. Authors of new entries
	should write them with this in mind.

	ZFS notes
	---------
	When upgrading the boot ZFS pool to a new version (via zpool upgrade),
	always follow these three steps:

	1) recompile and reinstall the ZFS boot loader and boot block
	(this is part of "make buildworld" and "make installworld")

	2) update the ZFS boot block on your boot drive (only required when
	doing a zpool upgrade):

	When booting on x86 via BIOS, use the following to update the ZFS boot
	block on the freebsd-boot partition of a GPT partitioned drive ada0:
		gpart bootcode -p /boot/gptzfsboot -i $N ada0
	The value $N will typically be 1.  For EFI booting, see EFI notes.

	3) zpool upgrade the root pool. New bootblocks will work with old
	pools, but not vice versa, so they need to be updated before any
	zpool upgrade.

	Non-boot pools do not need these updates.

	EFI notes
	---------

	There are two locations the boot loader can be installed into. The
	current location (and the default) is \efi\freebsd\loader.efi and using
	efibootmgr(8) to configure it. The old location, that must be used on
	deficient systems that don't honor efibootmgr(8) protocols, is the
	fallback location of \EFI\BOOT\BOOTxxx.EFI. Generally, you will copy
	/boot/loader.efi to this location, but on systems installed a long time
	ago the ESP may be too small and /boot/boot1.efi may be needed unless
	the ESP has been expanded in the meantime.

	Recent systems will have the ESP mounted on /boot/efi, but older ones
	may not have it mounted at all, or mounted in a different
	location. Older arm SD images with MBR used /boot/msdos as the
	mountpoint. The ESP is a MSDOS filesystem.

	The EFI boot loader rarely needs to be updated. For ZFS booting,
	however, you must update loader.efi before you do 'zpool upgrade' the
	root zpool, otherwise the old loader.efi may reject the upgraded zpool
	since it does not automatically understand some new features.

	See loader.efi(8) and uefi(8) for more details.


and then to the manpage for loader.efi, specifically:

EXAMPLES
   Updating loader.efi on the ESP
       The  following  examples	 shows	how to install a new loader.efi	on the
       ESP.

       First, find the partition of type "efi":

	     # gpart list | grep -Ew '(Name|efi)'
	     1.	Name: nvd0p1
		type: efi
	     2.	Name: nvd0p2
	     3.	Name: nvd0p3
	     4.	Name: nvd0p4
	     1.	Name: nvd0

       The name	of the ESP on this system is nvd0p1.

       Second, let's mount the ESP, copy loader.efi to	the  special  location
       reserved	for FreeBSD EFI	loaders, and unmount once finished:

	     # mount_msdosfs /dev/nvd0p1 /boot/efi
	     # cp /boot/loader.efi /boot/efi/efi/freebsd/loader.efi
	     # umount /boot/efi

SEE ALSO
       loader(8), uefi(8)

Since I had experienced similar issues with my box which meant I had to adjust whatwas on the hard drive, I knew that I would need bootable media so that I could reach the hard drive.  This is what became a more significant and time-consuming problem, at least partly due to my own stubborn foolishness.  I had a number of micro sd cards and a usb reader.  Out of three which had the potential to function as I needed, only one had an old NomadBSD installed upon it.  My mistake was that I insisted upon upgrading it from 12.x to 14.0 which ran into storage constraints and then breaking it from its normal startup process and eventually unable to boot at all.

Later I noticed an old Kingston Digital DataTraveler SE9 64GB USB 2.0 which I discovered has FreeNAS installed.  I could boot it and get to shell which allowed me to get the img file.  It was good enough for some attempts to create a bootable micro sd card but it eventually would fail too quickly during an ftp transfer or dd write, so that I had to find another option.  I was pretty sure that I had some cdroms or dvds which have some kind of FreeBSD, so once I found my cache, I decided to use a PC-BSD 8.2rc2 dvd.

This is when I was finally tired of the whole process and possibly more rested or something, so I actually, after a chunk of two days of attempts, finally made progress.  I booted the PC-BSD disc and after some tries for the GUI, I realized I only truly needed a shell.  From the shell, I was able to mount my target micro sd card which I used to store the downloaded (via ftp -a download.freebsd.org) img file.  I could also format an SSD which I bought more than 5 years ago in a group of four for adding zfs cache devices to my box (obviously still not accomplished).  I shifted the img file to the SSD so I could dd it to the micro sd card.  Once I had the FreeBSD 14.0 installer on the micro sd card, I booted it and began the process of the repair.

My initial plan was to first test the process by an update of the loader.efi on the micro sd card but got stymied.  I followed the steps above (in the loader.efi manpage example).  I discovered that the appropriate partition was ada2p1, which I mounted to /boot/efi and then found that there was no /boot/efi/efi/freebsd path.  What I had was /boot/efi/EFI/BOOT/BOOTxxx.EFI which I left alone.  Instead I created the needed freebsd directory in /boot/efi/EFI.  Once the path was setup, I could copy the loader.efi into the correct location.

This was my very first ever experience with this sort of repair or upgrade, so I was not sure of success until my reboot.  At some point during or shortly after this repair, I decided to properly install FreeBSD 14.0 onto the SSD as a failsafe against future similar problems, I kept the micro sd card as the FreeBSD 14.0 installer.  I used the SSD using the presently unavailable cables2go version of Generic-Adapter-Converter-Optical-External.  Aside from all of the above, I was able to connect to my local network with my Sony Walkman to look for answers and help.  If I can keep my Walkman able to use for such emergencies, this may be an easier method than keeping an entire network and FreeBSD installed on a box functioning, all I will likely need is wifi and access.  I have no plan to ever modify the Walkman away from its functional install.

Definite relief after I was able to properly boot up my box and use it on my last of a series of three days off from work.  I hope that you update your loader.efi BEFORE you upgrade zfs so that you can avoid the excitement of doing the repair above.

Frequently viewed this week