You are not logged in.
Hi Altoid. Thanks for the suggestion.
I had considered apparmor as a possible cause as I've previously had to modify apparmor profiles that were too restrictive in the past.
However I had checked the list of loaded apparmor profiles and they didn't include one for evolution. I also found the github firejail discussion, but again I wasn't using firejail to confine evolution (albeit the firejail profile is loaded).
What I hadn't done is actually stop apparmor to check if that was the cause of the problem.
Unfortunately the problem persists even when I stop apparmor.
Does anyone have evolution working in Chimaera and it reading their local mbox files OK?
As it did work in evolution in Beowulf (3.30.5-1.1) and it doesn't now in Chimaera ( 3.38.3-1) I wonder if it could be a regression in this version of evolution.
I'm aware there is another problem with this version (syncing with google contact/calendar) that is allegedly fixed in the version in Debian testing ( 3.43.2-2).
The problem with mutt is now solved. The problem with evolution isn't.
When displaying or composing emails the most recent version of mutt need to store temporary files in /var/tmp. It used to store them in /tmp, and that is what it still tells you if you look at the man page. On my PC, but not on my mail server the file permissions for /var/tmp were wrong (40755 not 41777). Correcting this solved the problem with mutt.
I still have no solution as to why my evolution mail user agent is unable to open my local mbox mail file (/var/mail/[myusername]), reporting a locking error instead.
I've just upgraded my desktop PC and my mail server from Beowulf to Chimaera following the Devuan guide on how to do this and having checked the Release Notes first.
Both upgrades largely went well. The mail server, that was updated over ssh continued running through the update. One omission from the Guide is what to do if you need contrib and non-free as well an main: I did the upgrade with the sources list as described in the guide then repeated with the augmented sources.
I did have some small problems with apache php, where 7.4 was installed by the upgrade but 7.3, which wasn't, was the one enabled. This temporarily borked my web server. Also an issue with directory ownership for chrony, where I needed to identify an apparmor config. change that I had missed as I had stayed with my (amended) old Beowulf apparmor config. instead.
Unattended upgrades inherits a Debian config, which I needed to correct so that it will install devuan-security upgrades instead.
Anyway the problem I still have is with reading my local mail (var/mail/marjorie) on my desktop PC. I use local mail to check any root messages from anacron, unattended upgrades, apt-listchanges, etc.
On my mail server I can log in via ssh and then use mutt. Everything works OK, as before.
On my desktop PVC I have one of my evolution mail accounts set up to read local mail . This worked fine on Beowulf. On Chimaera I can read the headers but when I try and open a message it complains
Unable to retrieve message. Could not lock “/var/mail/marjorie”
I get a similar error message when it tries to refresh the folder.
If I start mutt then I can see the headers but if I try and open a message it complains
Could not create temporary file!
I can't see any differences between the relevant directory or file ownership or permissions between the two computers.
I'm using postfix as my local mta.
Any help in sorting this would be appreciated.
As HOAS says UFW still accesses the nftables back-end (which uses the nftables kernel module) through an iptables translation layer.
If you want to run nftables commands natively you need to do as HOAS suggest.
If you have Chimaera (or above) then use the nftables init script provided by orphan-sysvinit-scripts.
If you have Beowulf or earlier then there is no orphan-sysvinit-scripts. Having installed nftables and put the commands you want run in the config file you need to copy the example file /usr/share/doc/nftables/examples/sysvinit/nftables.init to /etc/init.d/nftables, change the Default-Start and Default-Stop lines (lines 6 and 7) and then make the init file executable by root.
Change the lines:
# Default-Start:
# Default-Stop: 0 1 2 3 4 5 6
to:
# Default-Start: S
# Default-Stop: 0 6
Then run
update-rc.d nftables defaults
as described by HOAS.
This will then read the config file and start nftables at boot.
The update to Firefox-esr_91.5.0esr-1~deb10u1_amd64 finally seems to have hit the Beowulf (oldstable) repositories.
You report that your problem is intermittent, which if true makes it hard to solve.
For myself I use the pm-utils package to suspend or hibernate and resume.
My wifi card uses the ath9k kernel module, however I found that it wasn't powering down when I suspended so I configured pm-utils to unload and reload the relevant module(s). This solved my problem.
One issues was that for my wifi card there are actually several interdependent modules, not just the primary one, and I needed to load/unload all of them. In my case these were ath9k ath9k_common ath9k_hw ath.
The instruction I had to use to specify which modules to load/unload were in the file /etc/pm/config.d/defaults, the relevant lines being:
# If you need to unload any modules to suspend/resume, add them here.
SUSPEND_MODULES="ath9k ath9k_common ath9k_hw ath"
you can check what is actually happening by viewing the log file /var/log/pm-suspend.log, where, on my system I find:
[on suspend]
Running hook /usr/lib/pm-utils/sleep.d/75modules suspend suspend:
Unloading kernel module ath9k...Done.
Unloading kernel module ath9k_common...Done.
Unloading kernel module ath9k_hw...Done.
Unloading kernel module ath...Done.
/usr/lib/pm-utils/sleep.d/75modules suspend suspend: success.
[on resume]
Running hook /usr/lib/pm-utils/sleep.d/75modules resume suspend:
Reloaded unloaded modules.
/usr/lib/pm-utils/sleep.d/75modules resume suspend: success.
Running hook /usr/lib/pm-utils/sleep.d/60_wpa_supplicant resume suspend:
Failed to connect to non-global ctrl_ifname: (nil) error: No such file or directory
/usr/lib/pm-utils/sleep.d/60_wpa_supplicant resume suspend: success.
The log also captures module interdependencies, and this is where you can find if you've loaded/unload all the relevant modules. in my case it shows (in additions to all the other modules/dependencies:
Linux grendel 4.19.0-18-amd64 #1 SMP Debian 4.19.208-1 (2021-09-29) x86_64 GNU/Linux
Module Size Used by
ath9k 139264 0
ath9k_common 20480 1 ath9k
ath9k_hw 483328 2 ath9k_common,ath9k
ath 36864 3 ath9k_common,ath9k,ath9k_hw
Which is where I got my list of related wifi card modules from.
For me suspend/hibernate and resume works and the networking restarts.
The update to Firefox-91.4.1esr now seems to have trickled down to Debian Bullseye (oldoldstable-security).
The update for Debian Buster has still not arrived.
https://tracker.debian.org/pkg/firefox-esr
In my Cinnamon (3.8.8) on Beowulf the window buttons settings are in Menu>System Settings (Control Centre)>Windows>Titlebar tab or alternatively Menu>Preferences>Windows>Titlebar tab.
Normally you decide which buttons (Max,Min,Close,Menu,Close,Sticky,Shade) go on the left or right but it would be possible to blank them all.
Hi zzzzzz,
It seems the .deb in the repositories no longer include the files and postinst scripts to install on a sysvinit system. Very lazy on the part of debian/upsteam.
As I never wrote the init that I use myself I assume that I originally installed it from a .deb that did.
I was mistakenly assuming that that your question related to how you set up the configuration as I thought it would still install the init correctly.
To install on a sysvinit OS you need an init file.
The init file (/etc/init.d/dnscrypt-proxy) I'm using is this:
#!/bin/sh
### BEGIN INIT INFO
# Provides: dnscrypt-proxy
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: DNSCrypt client proxy
# Description: Encrypted/authenticated DNS proxy
### END INIT INFO
cmd="/usr/sbin/dnscrypt-proxy -config /etc/dnscrypt-proxy/dnscrypt-proxy.toml"
name=$(basename $(readlink -f $0))
pid_file="/var/run/$name.pid"
stdout_log="/var/log/$name.log"
stderr_log="/var/log/$name.err"
get_pid() {
cat "$pid_file"
}
is_running() {
[ -f "$pid_file" ] && ps $(get_pid) > /dev/null 2>&1
}
case "$1" in
start)
if is_running; then
echo "Already started"
else
echo "Starting $name"
if [ ! -d /var/cache/dnscrypt-proxy/ ]; then
mkdir /var/cache/dnscrypt-proxy
fi
cd '/root'
$cmd >> "$stdout_log" 2>> "$stderr_log" &
echo $! > "$pid_file"
if ! is_running; then
echo "Unable to start, see $stdout_log and $stderr_log"
exit 1
fi
fi
;;
stop)
if is_running; then
echo -n "Stopping $name.."
kill $(get_pid)
for i in $(seq 1 10)
do
if ! is_running; then
break
fi
echo -n "."
sleep 1
done
echo
if is_running; then
echo "Not stopped; may still be shutting down or shutdown may have failed"
exit 1
else
echo "Stopped"
if [ -f "$pid_file" ]; then
rm "$pid_file"
fi
fi
else
echo "Not running"
fi
;;
force-reload|restart)
$0 stop
if is_running; then
echo "Unable to stop, will not attempt to start"
exit 1
fi
$0 start
;;
status)
if is_running; then
echo "Running"
else
echo "Stopped"
exit 1
fi
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
;;
esac
exit 0
In the above code the cmd= line points to where my executable (/usr/sbin/dnscrypt-proxy) and configuration file (/etc/dnscrypt-proxy/dnscrypt-proxy.toml) are installed.
Create a file named /etc/init.d/dnscrypt-proxy and with this content and make it executable:
sudo chmod +x /etc/init.d/dnscrypt-proxy
and
sudo chown root:root /etc/init.d/dnscrypt-proxy
In order to get this to work you'll also need to run:
sudo update-rc.d dnscrypt-proxy defaults
to create the symbolic links to this file from /etc/rc02..rc06.
And to start the program:
sudo service dnscrypt-proxy start
This will first download a default list of upstream doh and dnscrypt servers (public.resolvers.md), which you can then, for example, filter (I only use unfiltered, non-logging DNSSEC servers) using the control parameters in the config file.
Which server is chosen from the filtered list at any one time can be controlled but the default is that you get the nearest.
To update the list (servers do come and go) force a restart.
sudo service dnscrypt-proxy restart
There are a number of other (optional) .txt files that are referenced but commented out in the default config file, such as blocking and allow lists. If you enable these I suggest you keep these in /etc/dnscrypt-proxy, however I put my log files in the usual place var/log/dnscrypt-proxy.log.
There are a few example .txt files in the .deb that are placed in /usr/share/dnscrypt-proxy/examples/.
You can check the program runs without using it for live dns lookups, so long as your resolv.conf doesn't point to it.
My resolv.conf is:
# Not from Network Manager
#
# bypass nameserver, uncomment to bypass dnscrypt-proxy
# nameserver 1.1.1.1
#
# dnscrypt-proxy nameserver
nameserver 127.0.0.1
options edns0
My solution to Network Manager trying to overwrite this is to make /etc/resolv.conf a symbolic link to /etc/dnscrypt-proxy/resolv.conf.
Hoping this is helpful.
Have you had a look at
https://github.com/DNSCrypt/dnscrypt-pr … and-Ubuntu?
There's more information about installation and configuration in the wiki (see right panel on that page)
The versions in the devuan repositories are reasonably up to date (2.0.19 in Beowulf) but you can update to the latest version from Github as long you also get the latest configuration to use the additional features.
If you need more information I run dnscrypt-proxy myself (my version is 2.0.44).
This seems to be a reasonable summary of the current debian dilemma. A real clusterf**k.
Not quite sure why some of us are rushing to update firefox-Esr, and looking for round-about, and perhaps dangerous, ways to do so.
The whole point of firefox-esr is that it is stable.
Although firefox-esr 91.0 was released on 8 August Mozilla continue to provide 3 months of monthly point security updates of the previous Firefox-esr.
Debian/Devuan have always used this delayed release and only then made the new version avaialble as a security upgrade, which has then had three security patches under the belt.
Firefox-esr 91.3 is due for release 2 November, at the same time as Firefox 94.
I expect to receive it shortly thereafter in a normal unattended secruity update, replacing the last version of Firefox-esr 78 - 78.15.
This is what happened last year.
Did you do this as root / using sudo (which depends on whether you have set up a root password) or as yourself as user?
grub-mkconfig won't be found is you run /usr/sbin/update-grub as a regular user. This in on my machine (I use sudo):
marjorie@grendel:~$ which grub-mkconfig
marjorie@grendel:~$ sudo which grub-mkconfig
[sudo] password for marjorie:
/usr/sbin/grub-mkconfig
Your issue seems to relate to runing scripts that capture the lid open/closing event and running an appropriate command.
This has to happen before you call your suspend/hibernate/resume command and therefore related to acpi/acpid and acpi scripts not pm-utils and its scripts which obviously only run once suspend/resume have been called.
I don't have a laptop myself so I have no personal experience of how to do this.
However there is some discussion (and further links) here that might be able to help:
https://askubuntu.com/questions/517683/ … ect=1&lq=1
Ubuntu 14 was the last sysvinit version of Ubuntu before they went over to the systemd darkside.
Just to add.
In order to get hibernation resume to work you'll need to tell the OS where the swap partition is that you will use to store/restore your resume image on.
Edit /etc/default'grub/ to add or amend the line:
GRUB_CMDLINE_LINUX_DEFAULT="quiet resume=UUID=1e9fb381-0966-401f-b649-7958a6df7307"
to name the actual UUID of your swap partition. Obviously the swap partition will have to be large enough to store your ram image.
Then run (as root/sudo) update-grub to update /boot/grub/grub.cfg and reboot.
Yes, if you are using sysvinit then I'd anticipate that you can use pm-utils to suspend and hibernate . Which is what I use.
Installing the pm-utils package installs both binaries and the scripts that are run when you put your machine to sleep/wake it up again.
As root/sudo you can run pm-suspend, pm-hibernate or pm-suspend-hybrid.
I've added the names of the first two of these to my sudoers file so that I can run them from a power menu button on my cinnamon desktop.
The pm-utils configuration scripts are in /etc/pm/ and /usr/lib/pm-utils.
In the former you will have the /etc/pm/config.d/defaults script that (inter-alia) sets the hibernate mode.
This is mine:
##########################################################
# DO NOT EDIT THE FILE in /usr/lib/pm-utils/ #
# #
# Edit this in /etc/pm/config.d/ instead! #
##########################################################
# Default method to power down the system when hibernating.
# If commented out, the system will use the kernel default as a
# default value.
#
# Check /sys/power/disk for valid values. The default value
# will be surrounded by [square brackets].
HIBERNATE_MODE="platform"
# Whether we need to post the video card when resuming from
# hibernate. You should not normally need to set this.
# In the future pm-utils will get this setting from HAL.
#
# Valid values are "no" and "yes"
# HIBERNATE_RESUME_POST_VIDEO="no"
# The default sleep/wake system to use. Valid values are:
# kernel The built-in kernel suspend/resume support.
# Use this if nothing else is supported on your system.
# uswsusp If your system has support for the userspace
# suspend programs (s2ram/s2disk/s2both), then use this.
# tuxonice If your system has support for tuxonice, use this.
#
# The system defaults to "kernel" if this is commented out.
SLEEP_MODULE="kernel"
# These variables will be handled specially when we load files in
# /etc/pm/config.d.
# Multiple declarations of these environment variables will result in
# their contents being concatenated instead of being overwritten.
# If you need to unload any modules to suspend/resume, add them here.
SUSPEND_MODULES="ath9k ath9k_common ath9k_hw ath"
# If you want to keep hooks from running, add their names here.
# HOOK_BLACKLIST=""
# If you want to unconditionally add parameters to the commandline,
# add them here.
# ADD_PARAMETERS=""
# If you want to ignore commandline parameters, add them here.
# DROP_PARAMETERS=""
# If you need to synchronize the system clock across a suspend/resume or
# hibernate/thaw cycle, set this variable.
# NEED_CLOCK_SYNC="true"
My atheros network card refuses to go to sleep so I unload the relevant modules and reload then on waking, hence the SUSPEND_MODULES= line.
I aso have supplementary scripts:
etc/pm/sleep.d/10_unattended-upgrades-hibernate that stops hibernation until unattended upgrades has finished.
and
etc/pm/sleep.d/password-protect-waking that calls a locked screensaver on waking.
In the latter you will find the default scripts that are run when you put your computer to sleep and are then run in reverse when you wake it up. You can also add your own.
I have an additional script /usr/lib/pm-utils/sleep.d/95anacron that start and stops anacron when I sleep the computer. The purpose of this is to defer scripts run by anacron until the computer is awake (regular cron scripts simply don't run if the computer is asleep).
#!/bin/sh
# This script makes anacron jobs stop/start when a workstation
# enters/exits a suspended/hibernated state.
#
case $1 in
resume|thaw)
/usr/sbin/invoke-rc.d anacron start >/dev/null
;;
suspend|hibernate)
/usr/sbin/invoke-rc.d anacron stop >/dev/null
;;
esac
and /usr/lib/pm-utils/sleep.d/wpa-supplicant that notifies wpa-supplicant of pm actions.
#!/bin/sh
# /etc/pm/sleep.d/60_wpa_supplicant
# Action script to notify wpa_supplicant of pm-action events.
PATH=/sbin:/usr/sbin:/bin:/usr/bin
WPACLI=wpa_cli
case "$1" in
suspend|hibernate)
$WPACLI suspend
;;
resume|thaw)
$WPACLI resume
;;
esac
exit 0
I'm a bit puzzled here, at least in respect of dnscrypt-proxy.
Certainly the deb for Beowulf Stable ( dnscrypt-proxy 2.0.19+ds1-2+devuan4) has a working init script (/etc/init.d/dnscrypt-proxy). I know, I use it.
Of course this init version may have been provided by the Devuan developers, not by Debian.
#!/bin/sh
### BEGIN INIT INFO
# Provides: dnscrypt-proxy
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: DNSCrypt client proxy
# Description: Encrypted/authenticated DNS proxy
### END INIT INFO
cmd="/usr/sbin/dnscrypt-proxy -config /etc/dnscrypt-proxy/dnscrypt-proxy.toml"
name=$(basename $(readlink -f $0))
pid_file="/var/run/$name.pid"
stdout_log="/var/log/$name.log"
stderr_log="/var/log/$name.err"
get_pid() {
cat "$pid_file"
}
is_running() {
[ -f "$pid_file" ] && ps $(get_pid) > /dev/null 2>&1
}
case "$1" in
start)
if is_running; then
echo "Already started"
else
echo "Starting $name"
if [ ! -d /var/cache/dnscrypt-proxy/ ]; then
mkdir /var/cache/dnscrypt-proxy
fi
cd '/root'
$cmd >> "$stdout_log" 2>> "$stderr_log" &
echo $! > "$pid_file"
if ! is_running; then
echo "Unable to start, see $stdout_log and $stderr_log"
exit 1
fi
fi
;;
stop)
if is_running; then
echo -n "Stopping $name.."
kill $(get_pid)
for i in $(seq 1 10)
do
if ! is_running; then
break
fi
echo -n "."
sleep 1
done
echo
if is_running; then
echo "Not stopped; may still be shutting down or shutdown may have failed"
exit 1
else
echo "Stopped"
if [ -f "$pid_file" ]; then
rm "$pid_file"
fi
fi
else
echo "Not running"
fi
;;
force-reload|restart)
$0 stop
if is_running; then
echo "Unable to stop, will not attempt to start"
exit 1
fi
$0 start
;;
status)
if is_running; then
echo "Running"
else
echo "Stopped"
exit 1
fi
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
;;
esac
exit 0
Just to report that my system has reverted to normal behaviour, with automatic screen blanking and then suspend after a pre-determined delay.
I've not done anything I'm aware of to achieve this, it has just happened. Not sure exactly when either as I normally invoke suspend manually.
I can't find any relevant reverted package updates.
My suspicion is that it may be have been triggered by minor kernel updates: I upgraded to 4.19.0.16 on 16 March and 4.19.0.17 on 18 July.
Im not sure what controls screen blanking with cinnamon but im fairly certain you can use xset to fix it.
what does xset -q say in a terminal?
marjorie@grendel:~$ xset -q
Keyboard Control:
auto repeat: on key click percent: 0 LED mask: 00000002
XKB indicators:
00: Caps Lock: off 01: Num Lock: on 02: Scroll Lock: off
03: Compose: off 04: Kana: off 05: Sleep: off
06: Suspend: off 07: Mute: off 08: Misc: off
09: Mail: off 10: Charging: off 11: Shift Lock: off
12: Group 2: off 13: Mouse Keys: off
auto repeat delay: 500 repeat rate: 33
auto repeating keys: 00ffffffdffffbbf
fadfffefffedffff
9fffffffffffffff
fff7ffffffffffff
bell percent: 50 bell pitch: 400 bell duration: 100
Pointer Control:
acceleration: 2/1 threshold: 4
Screen Saver:
prefer blanking: yes allow exposures: yes
timeout: 0 cycle: 0
Colors:
default colormap: 0x20 BlackPixel: 0x0 WhitePixel: 0xffffff
Font Path:
/usr/share/fonts/X11/misc,/usr/share/fonts/X11/100dpi/:unscaled,/usr/share/fonts/X11/75dpi/:unscaled,/usr/share/fonts/X11/Type1,/usr/share/fonts/X11/100dpi,/usr/share/fonts/X11/75dpi,built-ins
DPMS (Energy Star):
Standby: 0 Suspend: 0 Off: 0
DPMS is Enabled
Monitor is On
I use Cinnamon (3.8.8) as my DE on Beowulf. I'm running a mains-powered desktop PC not a laptop with battery.
I've previously used my particular setup unchanged, apart from a few tweaks on both Mint (pre-systemd) and ASCII and for some time now Beowulf and it 'just worked'.
However I now find that the timer that automatically blanks the screen and then suspends my computer, and is controlled by the Power Management menu option (cinnamon-settings power) no longer works. Invoking suspend directly does work.
Cinnamon-screensaver also doesn't start automatically if you set a delay, though again it can be started directly.
Anyone with any suggestions as to what has broken previous behaviour? The only changes I've made in recent weeks are regular upgrades.
I note that cinnamon-settings-daemon 3.8.4.2 shows a dependency on libsystemd0 and I don't have libsystemd0 installed. However the Debian changelog shows the deb dates from 2018.
Devuan GNU/Linux 3 (beowulf) x86_64
Kernel: 4.9.0-17-amd64
Shell: bash 5.0.3
DE: Cinnamon
WM: Mutter
Terminal: gnome-terminal
Apparmor: 2:13.2-10
Man working fine:
marjorie@grendel:~$ man ls
LS(1) User Commands LS(1)
NAME
ls - list directory contents
SYNOPSIS
ls [OPTION]... [FILE]...
..etc.
Altoid wrote:Is this right?
ie: linux-headers-amd64 -> Linux devuan 5.10.0-0.bpo.3-amd64 does no need it?Yes, that's right. The kernel does not have the headers listed as a dependency. The headers are only needed for building custom kernel modules so most users don't need them.
I think you do still need the current kernel headers to recompile the kernel module for NVidia if you are using NVidia's own driver.
I've now updated my earlier reply. It works with lightdm and hence with display managers that use lightdm. I think it was also present as a gludge in gdm. If you use something else (slim?) it may not work.
I have this working in Beowulf with lightdm and Cinnamon.
I have a GRUB_CMDLINE_LINUX="text" in /etc/default/grub.
I assume that you ran update-grub to change /boot/grub/grub.cfg?
This should have put a 'text' parameter in the linux /vmlinux.. line of your grub.cfg's menuentry.
This will start you in text mode, not sure if this will then permit you to successfully run startx - it is implemented as a simple trap in the lightdm init script (/etc/init.d/lightdm):
case "$1" in
start)
CONFIGURED_DAEMON=$(basename "$(cat $DEFAULT_DISPLAY_MANAGER_FILE 2> /dev/null)")
if grep -wqs text /proc/cmdline; then
log_warning_msg "Not starting Light Display Manager (lightdm); found 'text' in kernel commandline."
elif [ -e "$DEFAULT_DISPLAY_MANAGER_FILE" ] && \
[ "$HEED_DEFAULT_DISPLAY_MANAGER" = "true" ] && \
[ "$CONFIGURED_DAEMON" != lightdm ] ; then
log_action_msg "Not starting Light Display Manager; it is not the default display manager"
else
log_daemon_msg "Starting Light Display Manager" "lightdm"
start-stop-daemon --start --quiet --pidfile /var/run/lightdm.pid --name lightdm --exec $DAEMON -b|| echo -n " already running"
log_end_msg $?
fi
;;
In my case this is on my mail server and I just run it headless and ssh -X into it from my desktop PC. Graphics mode (Cinnamon desktop) is installed as I used it when configuring the server and it's there if I were to need to work on the server with a keyboard and screen plugged in on my desk.
Isn't there a tool that does this switching sort of automagically if configured accordingly? Or do I have to re-invent the wheel? Is any of the network managers of any use in this case?
I use Network Manager and in Cinnamon the Network applet would allow you to enable whichever of ethernet or wireless is enabled.
You can still confuse it by choosing both if both are enabled.
With a laptop you'd usually choose ethernet if you were sitting at a desk that was wired. Elsewhere you'd probably try and use Wireless.