trap2 - loginhost
guest os: FreeBSD / amd64
cpu: 1
memory size 256 MB
storage: file - 4 GB
usage: loginhost / ssh server - replacement for the old trap.
tmux commands: ls - list session, attach - t
tmux keys: ctrl-B command key, ctrl-b i information, ctrl-b t time, ctrl-b d detach,
back to virtual machines page.
History
This machine was originally named bhyve_bvm4.
Work log
2024-02-18: vtbd0p2 - reboot, FreeBSD 13.2-release-p10 is in
root@trap2# freebsd-version -ku 13.2-RELEASE-p10 13.2-RELEASE-p10
kernel
root@trap2# uname -a FreeBSD trap2.kg4.no 13.2-RELEASE-p10 FreeBSD 13.2-RELEASE-p10 GENERIC amd64
2024-02-18: vtbd0p2 - freebsd-update fetch
root@trap2# freebsd-update fetch src component not installed, skipped [..] The following files will be updated as part of updating to 13.2-RELEASE-p10: /bin/freebsd-version /boot/kernel/kernel [..] /var/db/etcupdate/current/etc/defaults/rc.conf /var/db/etcupdate/current/etc/periodic/daily/480.leapfile-ntpd /var/db/mergemaster.mtree
install
root@trap2# freebsd-update install src component not installed, skipped Installing updates... Restarting sshd after upgrade Performing sanity check on sshd configuration. Stopping sshd. Performing sanity check on sshd configuration. Starting sshd. Scanning //usr/share/certs/blacklisted for certificates... Scanning //usr/share/certs/trusted for certificates... done.
2024-01-20: vtbd0p2 -I've noticed over the last couple of weeks that the machine use a small amount of swap now:
root@trap2# date;swapinfo -h;echo " ";tvlm;echo " ";tvls;echo " ";df -h;echo " ";uptime;service sshd status;service sshd status Sat Jan 20 10:52:50 CET 2024 Device Size Used Avail Capacity /dev/vtbd0p2 1.0G 544K 1.0G 0% [..]
As reported on the host
root@kg-vm3# vm info trap2 | grep memory memory: 256M memory-resident: 226750464 (216.246M)
Perhaps I should increase memory for the trap2 vm.
2024-01-13: c2 (FreeBSD workstation) - from c2, bootstrap ansible on this host
tingo@kg-core2:~/personal/projects/2020/ansible_fbsd/infrastructure_home $ ansible-playbook --become-method su --ask-become-pass -l trap fbsd-bootstrap.yml BECOME password: PLAY [all] ********************************************************************************************************************************** TASK [pkg bootstrap] ************************************************************************************************************************ changed: [trap] TASK [pkg update] *************************************************************************************************************************** changed: [trap] TASK [install python and sudo] ************************************************************************************************************** changed: [trap] TASK [set up wheel group to have passwordless sudo] ***************************************************************************************** changed: [trap] PLAY RECAP ********************************************************************************************************************************** trap : ok=4 changed=4 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
2024-01-13: trap2 - another reboot, yes FreeBSD 13.2-release-p9 is in
root@trap2# freebsd-version -ku 13.2-RELEASE-p8 13.2-RELEASE-p9
kernel
root@trap2# uname -a FreeBSD trap2.kg4.no 13.2-RELEASE-p8 FreeBSD 13.2-RELEASE-p8 GENERIC amd64
2024-01-13: trap2 - freebsd-update, try to upgrade directly to 13.2-RELEASE
root@trap2# freebsd-update -r 13.2-RELEASE upgrade src component not installed, skipped [..] The following components of FreeBSD seem to be installed: kernel/generic world/base The following components of FreeBSD do not seem to be installed: world/doc world/games world/lib32 Does this look reasonable (y/n)? y [..] The following files will be removed as part of updating to 13.2-RELEASE-p9: The following files will be added as part of updating to 13.2-RELEASE-p9: The following files will be updated as part of updating to 13.2-RELEASE-p9: [..] /var/db/ntp /var/empty /var/yp/Makefile.dist To install the downloaded upgrades, run "/usr/sbin/freebsd-update install".
install
root@trap2# freebsd-update install src component not installed, skipped Installing updates... Kernel updates have been installed. Please reboot and run "/usr/sbin/freebsd-update install" again to finish installing updates.
reboot, then
root@trap2# freebsd-update install src component not installed, skipped Installing updates... Completing this upgrade requires removing old shared object files. Please rebuild all installed 3rd party software (e.g., programs installed from the ports tree) and then run "/usr/sbin/freebsd-update install" again to finish installing updates.
well, nothing installed so
root@trap2# freebsd-update install src component not installed, skipped Installing updates...rmdir: ///var/db/etcupdate/current/usr/share/openssl/man/en.ISO8859-1: Directory not empty rmdir: ///var/db/etcupdate/current/usr/share/openssl/man: Directory not empty rmdir: ///var/db/etcupdate/current/usr/share/openssl: Directory not empty rmdir: ///var/db/etcupdate/current/usr/share/man/en.UTF-8: Directory not empty rmdir: ///var/db/etcupdate/current/usr/share/man/en.ISO8859-1: Directory not empty rmdir: ///var/db/etcupdate/current/usr/share/man: Directory not empty done.
2024-01-13: trap2 - reboot, yes that worked
root@trap2# freebsd-version -ku 10.4-RELEASE-p13 10.4-RELEASE-p13
kernel
root@trap2# uname -a FreeBSD trap2.kg4.no 10.4-RELEASE-p13 FreeBSD 10.4-RELEASE-p13 #0: Thu Sep 27 10:09:35 UTC 2018 root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC amd64
2024-01-13: trap2 (formerly bvm4) - try to run freebsd-update on it. fetch first
root@trap2# freebsd-update fetch src component not installed, skipped [..] The following files will be updated as part of updating to 10.4-RELEASE-p13: /usr/share/zoneinfo/zone.tab WARNING: FreeBSD 10.4-RELEASE HAS PASSED ITS END-OF-LIFE DATE. Any security issues discovered after Thu Nov 1 01:00:00 CET 2018 will not have been corrected.
ok, that worked at least. install
root@trap2# freebsd-update install src component not installed, skipped Installing updates... done.
2020-06-21: bvm4 - gets renamed to 'trap2' as part of the switch to vm-bhyve
root@kg-vm3# pwd /zs/vms root@kg-vm3# mv bvm4 trap2
add a config file
root@kg-vm3# more trap2/trap2.conf loader="bhyveload" cpu="1" memory="256M" network0_type="virtio-net" network0_switch="public" disk0_type="virtio-blk" disk0_name="guest-bvm4.img"
test it
root@kg-vm3# vm list NAME DATASTORE LOADER CPU MEMORY VNC AUTOSTART STATE trap2 default bhyveload 1 256M - No Running (10299) tv default bhyveload 2 1536M - No Running (9278) wiki default bhyveload 2 1024M - No Running (8672)
it works, and I can ssh into it
2019-11-27: vtbd0p3 - clock trouble
root@trap2# ntpq -p remote refid st t when poll reach delay offset jitter ============================================================================== kg-omni1.kg4.no 91.209.0.17 3 u 35 64 377 0.633 3592816 150966.
check
root@trap2# sysctl kern.timecounter.hardware kern.timecounter.hardware: TSC
change and verify
root@trap2# sysctl kern.timecounter.hardware=HPET kern.timecounter.hardware: TSC -> HPET root@trap2# sysctl kern.timecounter.hardware kern.timecounter.hardware: HPET
ok.
2019-11-25: powered on after power outage.
2019-08-27: bvm4 - this machine has clock trouble too:
root@trap2# date;ntpq -p Sun Aug 25 21:58:29 CEST 2019 remote refid st t when poll reach delay offset jitter ============================================================================== kg-omni1.kg4.no 194.58.205.148 2 u 42 64 377 0.452 1256607 112735.
and the culprit is
root@trap2# sysctl kern.timecounter.hardware kern.timecounter.hardware: TSC
change
root@trap2# sysctl kern.timecounter.hardware=HPET kern.timecounter.hardware: TSC -> HPET
fix time
root@trap2# service ntpd stop Stopping ntpd. root@trap2# ntpdate 10.1.10.1 27 Aug 08:55:53 ntpdate[27386]: step time server 10.1.10.1 offset 125700.424538 sec root@trap2# ntpdate 10.1.10.1 27 Aug 08:56:02 ntpdate[27387]: adjust time server 10.1.10.1 offset 0.000968 sec root@trap2# ntpdate 10.1.10.1 27 Aug 08:56:13 ntpdate[27388]: adjust time server 10.1.10.1 offset 0.000784 sec root@trap2# service ntpd start Starting ntpd.
and now?
root@trap2# date;ntpq -p Tue Aug 27 08:56:52 CEST 2019 remote refid st t when poll reach delay offset jitter ============================================================================== *kg-omni1.kg4.no 194.58.205.148 2 u 21 64 1 0.731 1.619 0.547
better.
2017-11-26: bvm4 - disk layout etc.
root@trap2# date;swapinfo -h;echo " ";tvlm;echo " ";tvls;echo " ";df -h;echo " ";uptime;service sshd status Sun Nov 26 20:42:25 CET 2017 Device 1K-blocks Used Avail Capacity /dev/vtbd0p2 1048576 0B 1.0G 0% Nov 26 21:26:15 trap2 kernel: random: unblocking device. Nov 26 21:26:15 trap2 kernel: Timecounter "TSC" frequency 1039821016 Hz quality 1000 Nov 26 21:26:15 trap2 kernel: Trying to mount root from ufs:/dev/vtbd0p3 [rw]... Nov 26 21:26:15 trap2 kernel: vtnet0: link state changed to UP Nov 26 21:26:16 trap2 ntpd[581]: ntpd 4.2.8p10-a (1): Starting Nov 26 21:35:24 trap2 su: tingo to root on /dev/pts/0 Nov 26 21:36:49 trap2 su: tingo to root on /dev/pts/1 Nov 26 21:37:34 trap2 sshd[756]: error: maximum authentication attempts exceeded for root from 2.235.53.130 port 54158 ssh2 [preauth] Nov 26 21:39:21 trap2 ntpd[773]: ntpd 4.2.8p10-a (1): Starting Nov 26 21:40:46 trap2 ntpd[794]: ntpd 4.2.8p10-a (1): Starting Nov 26 20:46:04 trap2 newsyslog[416]: logfile first created Filesystem Size Used Avail Capacity Mounted on /dev/vtbd0p3 2.9G 876M 1.8G 32% / devfs 1.0K 1.0K 0B 100% /dev 8:42PM up 16 mins, 1 user, load averages: 0.27, 0.28, 0.19 sshd is running as pid 615.
ok.
2017-11-26: bvm4 - I modified /etc/motd and a few other files:
root@trap2:~ # more /etc/ntp.conf server 10.1.10.1 iburst
and /etc/dhclient.conf
root@trap2# tail -1 /etc/dhclient.conf send dhcp-client-identifier "trap.kg4.no";
change sh for root
root@trap2:~ # chsh -s /bin/sh chsh: user information updated
I also fixed a few more files, mainly for convenience.
2017-11-26: vm3 - tmux - list (active sessions)
root@kg-vm3# tmux ls bhyve_bvm1: 1 windows (created Mon Oct 16 18:49:41 2017) [80x24] bhyve_bvm2: 1 windows (created Mon Oct 16 18:49:42 2017) [80x24] bhyve_bvm3: 1 windows (created Mon Oct 16 18:49:42 2017) [80x24] bhyve_bvm4: 1 windows (created Sun Nov 26 19:45:37 2017) [106x52]
connect to bvm4
root@kg-vm3# tmux attach -t bhyve_bvm4
(and the session starts)
2017-11-26: vm3 - bhyve - set up the new machine (1 cpu, 256M, 4 G, tap3)
create a directory for it
root@kg-vm3# cd /zs/vms root@kg-vm3# mkdir bvm4
make file for a virtual disk drive
root@kg-vm3# truncate -s 4G bvm4/guest-bvm4.img root@kg-vm3# ls -lh bvm4 total 96 -rw-r--r-- 1 root wheel 4.0G Nov 26 19:18 guest-bvm4.img
install the machine
root@kg-vm3# sh /usr/share/examples/bhyve/vmrun.sh -c 2 -t tap3 -d /zs/vms/bvm4/guest-bvm4.img -i -I /zs/tingo/dl/bsd/FreeBSD-10.4-RELEASE-amd64-disc1.iso bhyve_bvm4
this boot and starts the install. Selection and changes: xterm, Install, Norwegian ISO-8859-1 keymap, trap2.kg4.no, unselect games, lib32, ports, disk guided, entire disk, gpt, modify so I get 1G swap, 3G rootfs, net dhcp, services sshd, ntpd, dumpdev, set timezone. On exit, it reboots, just select "reboot" from the boot menu.
I add bvm4 to /etc/rc.conf.local:
root@kg-vm3# grep bvm4 /etc/rc.conf.local bhyve_profiles="bvm1 bvm2 bvm3 bvm4" bhyve_bvm4_tapdev="tap3" bhyve_bvm4_diskdev="/zs/vms/bvm4/guest-bvm4.img" bhyve_bvm4_ncpu="1" bhyve_bvm4_memsize="256"
check bhyve status
root@kg-vm3# service bhyve status ===> bhyve profile: bvm1 bhyve_bvm1 is running. ===> bhyve profile: bvm2 bhyve_bvm2 is running. ===> bhyve profile: bvm3 bhyve_bvm3 is running. ===> bhyve profile: bvm4 bhyve_bvm4 is not running.
start bvm4
root@kg-vm3# service bhyve start bvm4
Starting bhyve.
root@kg-vm3# service bhyve status ===> bhyve profile: bvm1 bhyve_bvm1 is running. ===> bhyve profile: bvm2 bhyve_bvm2 is running. ===> bhyve profile: bvm3 bhyve_bvm3 is running. ===> bhyve profile: bvm4 bhyve_bvm4 is running.
ok.
2017-11-26: setting up a new loginhost, so I can take vbox-trap offline. Trying to move everything off the VirtualBox host.