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

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.