From 4f9282ce133fb25fff319773f5d79ba1031ed227 Mon Sep 17 00:00:00 2001 From: Ian Kelling Date: Mon, 16 Feb 2026 02:17:38 -0500 Subject: [PATCH] new host related fixes --- brc2 | 31 ++++++++ brc3 | 12 --- distro-end | 119 ++++++++++------------------- filesystem/usr/local/bin/btrbk-run | 5 +- mail-setup | 2 +- system-status | 11 +-- 6 files changed, 82 insertions(+), 98 deletions(-) diff --git a/brc2 b/brc2 index c37bcd9..2b90ce3 100644 --- a/brc2 +++ b/brc2 @@ -356,6 +356,37 @@ EOF } +# Removes leftover schroot sessions, including bind mounts. dunno yet why +# this happens. Based on +# http://logan.tw/posts/2018/02/24/manage-chroot-environments-with-schroot/#list-all-schroot-sessions +schroot-cleanup() { + local session sessions + sessions=$(schroot -l --all-sessions | sed 's/session://') + for session in $sessions; do + schroot -e -c $session + done +} + +# usage: $0 SCHROOT_NAME_TO_RM +schroot-rm() { + local conf dir n="$1" + conf="/etc/schroot/chroot.d/$n.conf" + schroot-cleanup + if [[ -s $conf ]]; then + dir=$(grep ^directory= "$conf" | sed 's/^directory=//' | head -n1) + m s rm -f "$conf" + else + dir="/nocow/schroot/$n" + fi + if [[ $dir == /?* && -d $dir ]]; then m s rm -rf "$dir"; fi +} + +crypttab-open() { + for f in $(awk '{print $1}' /etc/crypttab | grep -v '#'); do + m cryptdisks_start $f + done + } + # note: this is incomplete and untested. # https://wiki.archlinux.org/index.php/Install_Arch_Linux_from_existing_Linux#Creating_a_chroot mkarchchroot() { diff --git a/brc3 b/brc3 index d6ba3c6..f492dac 100644 --- a/brc3 +++ b/brc3 @@ -110,18 +110,6 @@ ecne-basefile() { echo "WARNING: remove leftover /t/mmchroot" } -# cleans up bind mounts that got leftover by an schroot. dunno yet why -# this happens. Based on -# http://logan.tw/posts/2018/02/24/manage-chroot-environments-with-schroot/#list-all-schroot-sessions - -schroot-cleanup() { - local session sessions - sessions=$(schroot -l --all-sessions | sed 's/session://') - for session in $sessions; do - schroot -e -c $session - done -} - # misc bash tip. If we have a set of lines we want to know if one is a specific string, we can use =~ with: # regex="("$'\n'"|^)$string("$'\n'"|$)" diff --git a/distro-end b/distro-end index 3390e0f..6ebed62 100755 --- a/distro-end +++ b/distro-end @@ -1311,14 +1311,14 @@ sgo schrootupdate.timer # for testing firefox specific issues case $distro in trisquel|ubuntu) - bookworm + name=bookworm m mkschroot -s /a/bin/fai/fai/config/files/etc/apt/sources.list.d/bookworm.list/BOOKWORM_FREE \ - bookworm bookworm chromium fonts-noto-color-emoji fonts-recommended locales - sd /nocow/schroot/$schroot_name/etc/locale.gen <<'EOF' + $name $name chromium fonts-noto-color-emoji fonts-recommended locales + sd /nocow/schroot/$name/etc/locale.gen <<'EOF' en_US.UTF-8 UTF-8 EOF - s schroot -c $schroot_name locale-gen - s schroot -c $schroot_name update-locale LANG=en_US.UTF-8 + s schroot -c $name locale-gen + s schroot -c $name update-locale LANG=en_US.UTF-8 ;; debian) @@ -1496,10 +1496,10 @@ EOF fi fi } -tr-config-daemon case $HOSTNAME in $d_host) + tr-config-daemon sgo transmission-daemon-nn ;; esac @@ -1729,6 +1729,21 @@ rm -fv /home/iank/.mpv/watch_later rm -rf /home/iank/.mpv +# run appimages without manually extracting. +# https://github.com/AppImage/AppImageKit/wiki/FUSE +case $(debian-codename) in + aramo) + pi libfuse2 + ;; + # assume this is newer than aramo + *) + pi libfuse2t64 + ;; +esac + +##### begin beets ##### + + ## note: begin u24 message upon pip install # If you wish to install a non-Debian-packaged Python package, # create a virtual environment using python3 -m venv path/to/venv. @@ -1743,10 +1758,6 @@ rm -rf /home/iank/.mpv ## end ## in ubuntu, you can install python3-venv - -# if [[ ! -e ~/.local/bin/pip ]]; then -# tmp=$(mktemp) -# wget -O$tmp https://bootstrap.pypa.io/get-pip.py # ### begin msg from below without # # error: externally-managed-environment @@ -1774,8 +1785,11 @@ rm -rf /home/iank/.mpv # # tried using --break-system-packages, but then trying to use pipx # # failed with something like: no module ensurepath, and again # # complained that I should install system packages, but this time -# # there was no alternative. So, fuck it, just getting the system -# # package from ubuntu for now. +# # there was no alternative. bleh +# if [[ ! -e ~/.local/bin/pip ]]; then +# tmp=$(mktemp) +# wget -O$tmp https://bootstrap.pypa.io/get-pip.py + # python3 $tmp --user # hash -r # python3 -m pip install --user pipx --break-system-packages @@ -1783,76 +1797,23 @@ rm -rf /home/iank/.mpv # # Upgrade pipx with python3 -m pip install --user --upgrade pipx # fi -pi pipx - -# run appimages without manually extracting. -# https://github.com/AppImage/AppImageKit/wiki/FUSE -case $(debian-codename) in - aramo) - pi libfuse2 - ;; - # assume this is newer than aramo - *) - pi libfuse2t64 - ;; -esac - -##### begin beets ##### - -# ## apt install method, disabled because it is 2025 & packaged version is 2021. -# # apt install beets fails due to wanting a pip package, -# # we find out why it wants this through -# # apt-cache depends --recurse --no-recommends --no-suggests --no-conflicts --no-breaks --no-replaces --no-enhances beets | less -# # python-mediafile requires tox, which requires virtualenv, which requires pip. -# # but, python-mediafile doesn't really require tox, it is specified in -# # ./usr/lib/python3/dist-packages/mediafile-0.9.0.dist-info/METADATA -# # as being required only for testing, but the debian package -# # included it anyways, due to a mistake or bad tooling or something. -# # I don't plan to use tox, so, according to https://serverfault.com/a/251091, -# # we can create and install a dummy package by: -# # -# # "equivs-control , edit the file produced to provide the right -# # dependency and have a nice name, then run equivs-build and -# # finally dpkg -i the resulting .deb file" -# # as of 2023-02, the tox dependency was removed in debian unstable, so -# # this hack will probably go away in t12. - -# case $(debian-codename) in -# aramo) -# if pcheck tox; then -# tmpdir="$(mktemp -d)" -# cd "$tmpdir" -# # edited from output of equivs-control tox -# cat >tox <<'EOF' -# Section: python -# Priority: optional -# Standards-Version: 3.9.2 -# Package: tox -# Description: tox-dummy -# EOF -# equivs-build tox -# sudo dpkg -i tox_1.0_all.deb -# rm -rf ./tox* -# cd -# rm -r "$tmpdir" -# fi -# ;; -# esac -# pi beets beets-doc -# # get rid of annoying message -# s sed -ri "s/^([[:space:]]*ui.print_\('Playing)/#\1/" /usr/share/beets/beetsplug/play.py -# I ran this initially to make sure things were working, but don't need it again. -#pipx ensurepath -v -# -# in brackets are nondefault plugins -pipx install 'beets[lyrics,discogs,mbsync]' +if [[ ! -d ~/.pyenv/.git ]]; then + git clone https://github.com/pyenv/pyenv.git ~/.pyenv + . /b/ds/brc2 + mypyenvinit + pyenv install 3.13 + pyenv global 3.13 + # from pipx install instructions + python3 -m pip install --user pipx + python3 -m pipx ensurepath + # from beets install instructions. + # in brackets are nondefault plugins + pipx install 'beets[lyrics,discogs,mbsync]' +fi -# note: when i first setup beets, i found installing some plugins -# useful, but now it is bundled with enough good ones that i found no -# urgent need. ##### end beets ##### @@ -2159,7 +2120,7 @@ case $HOSTNAME in if [[ ! -e /etc/apt/sources.list.d/pgdg.sources ]]; then pi postgresql-common sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -y noble - pi postgresql-18 + pi postgresql-17 sudo -u postgres createuser -d iank sudo usermod -a -G postgres iank fi diff --git a/filesystem/usr/local/bin/btrbk-run b/filesystem/usr/local/bin/btrbk-run index 65fd56a..f2341fc 100755 --- a/filesystem/usr/local/bin/btrbk-run +++ b/filesystem/usr/local/bin/btrbk-run @@ -685,6 +685,9 @@ if [[ ! -v targets && ! $source ]]; then if [[ $HOSTNAME != frodo ]]; then targets+=(frodo.b8.nz) fi + if [[ $HOSTNAME != kd ]]; then + targets+=(kd.b8.nz) + fi wireless_home_hosts=( sy so @@ -940,7 +943,7 @@ df --output=size,pcent / | tail -n1" fi # we may be booted into a bootstrap fs or something - min_root_kb=$(( 1024 * 1024 * 200 )) # 200 gb + min_root_kb=$(( 1024 * 1024 * 70 )) # 70 gb tmp=$(( root_size < min_root_kb )) if (( tmp )); then e "warning: $h: root_size=$root_size < 200gb, perhaps it is booted to bootstrap vol. skipping for now" diff --git a/mail-setup b/mail-setup index fb1548d..4eb119e 100755 --- a/mail-setup +++ b/mail-setup @@ -4830,7 +4830,7 @@ fi # optimization, this only needs to be run once if [[ ! -e /var/lib/prometheus/node-exporter/exim_paniclog.prom ]]; then sysd-prom-fail-install epanicclean - sre epanicclean + son epanicclean fi case $HOSTNAME in diff --git a/system-status b/system-status index ce733ab..f99346a 100755 --- a/system-status +++ b/system-status @@ -97,7 +97,7 @@ write-status() { esac case $HOSTNAME in - kd) + frodo) services=( prometheus-node-exporter prometheus-alertmanager @@ -139,10 +139,6 @@ write-status() { chars+=(EXIM) fi - if ! pgrep -fc '^/bin/bash /usr/local/bin/prof-tail$' &>/dev/null; then - chars+=(PROF) - fi - if [[ -e /a/bin/bash_unpublished/source-state ]]; then # /a gets remounted due to btrbk, ignore error code for file doesnt exist source /a/bin/bash_unpublished/source-state || [[ $? == 1 ]] @@ -194,6 +190,11 @@ write-status() { if [[ $MAIL_HOST == "$HOSTNAME" ]]; then + if ! pgrep -fc '^/bin/bash /usr/local/bin/prof-tail$' &>/dev/null; then + chars+=(PROF) + fi + + bouncemsg= glob=(/m/md/bounces/new/*) if [[ -e ${glob[0]} ]]; then -- 2.30.2