diff options
-rwxr-xr-x | bootstrap | 5 | ||||
-rwxr-xr-x | buildos | 42 | ||||
-rw-r--r-- | doc/manual.cli | 19 | ||||
-rwxr-xr-x | init | 6 |
4 files changed, 68 insertions, 4 deletions
@@ -155,6 +155,8 @@ if [ "$stage" -eq "1" ]; then pkgs+=",bzip2,xz-utils" pkgs+=",less,nano" + pkgs+=",qemu-kvm,socat" + pkgs+=",g++,pkg-config" sudo debootstrap \ @@ -293,6 +295,7 @@ set -x # addgroup --gid 2000 build adduser --uid 2000 --gid 2000 --home /build --gecos "" --disabled-password build +adduser build kvm echo "build ALL=(ALL) NOPASSWD:ALL" >/etc/sudoers.d/build chmod 0440 /etc/sudoers.d/build @@ -415,6 +418,8 @@ EOF subvol_snapshot -r "$root" "$root-5" fi +exit 0 + # Test. # if [ ! -e /tmp/buildos-state ]; then @@ -77,6 +77,14 @@ for v in "${cmdline[@]}"; do fi done +# Make sure /dev/kvm has correct permissions (while all the udev scripts seem +# to be there, it does not work for some reason). +# +if sudo test -c /dev/kvm; then + sudo chgrp kvm /dev/kvm + sudo chmod 0660 /dev/kvm +fi + hname="$(hostname)" # Get the build id. @@ -721,6 +729,7 @@ function bbot_start () # <toolchain-name> <toolchain-index> # start their bbot agents. # toolchain_boots=() +declare -A toolchain_cursors # Latest systemd journal cursor. # Monitoring loop. # @@ -844,7 +853,38 @@ EOF sudo systemctl reset-failed "bbot-agent@$tn" 2>&1 | \ tee -a "$tr/bbot-$count.log" 1>&2 else - continue # Nothing to do. + # See if there is any diagnostics in the systemd journal. We + # notify about warning and up. + # + # The old versions journalctl behavior is to not output anything + # (not even the cursor) if there are no new entries. The new + # versions output the old cursor. + # + c=(sudo journalctl --unit "bbot-agent@$tn") + + # Get the last cursor if any. + # + oc="${toolchain_cursors["$tn"]}" + if [ -n "$oc" ]; then + c+=("--after-cursor" "$oc") + fi + + nc="$("${c[@]}" --no-pager --quiet --priority 4 --show-cursor | \ +sed -n -re 's/^-- cursor: (.+)$/\1/p')" + + # If we have no new entries, then nothing to do. + # + if [ -n "$nc" -a "$nc" != "$oc" ]; then + s="bbot-agent@$tn service issued new diagnostics" + + info "$s" + email "$s" <<EOF +$tn.bbot_cmd: ssh build@$hname ${c[@]} +EOF + toolchain_cursors["$tn"]="$nc" + fi + + continue fi ;; 1) diff --git a/doc/manual.cli b/doc/manual.cli index b91f6ae..2d275aa 100644 --- a/doc/manual.cli +++ b/doc/manual.cli @@ -199,7 +199,7 @@ While any suitable filesystem can be used, \c{ext4} is a good choice, with journaling disabled if used on a flash drive/card. For example: \ -mkfs.ext4 -L buildos.machines -O ^has_journal /dev/sdX +mkfs.ext4 -L buildos.state -O ^has_journal /dev/sdX \ \h2#config-storage-machines|Machines| @@ -423,7 +423,7 @@ build$ cd /build/machines/default/linux-gcc_6 # Make user build the owner of the machine subvolume. # build$ sudo btrfs property set -ts linux-gcc_6-1.0 ro false -build$ sudo chown build:build linux-gcc_6-1.0 +build$ sudo chown build:build linux-gcc_6-1.0 linux-gcc_6-1.0/* build$ btrfs property set -ts linux-gcc_6-1.0 ro true # Make the subvolume the current machine. @@ -450,7 +450,7 @@ build$ cd /build/machines/default/linux-gcc_6 # Make user build the owner of the new machine subvolume. # build$ sudo btrfs property set -ts linux-gcc_6-1.1 ro false -build$ sudo chown build:build linux-gcc_6-1.1 +build$ sudo chown build:build linux-gcc_6-1.1 linux-gcc_6-1.1/* build$ btrfs property set -ts linux-gcc_6-1.1 ro true # Switch the current machine atomically. @@ -505,4 +505,17 @@ Note also that on reboot the Build OS monitor examines and cleans up machine directories of any stray subvolumes. As a result, an alternative approach would be to remove the current machine symlink and reboot the build host. + +\h#machines-login|Logging into a Machine| + +A running QEMU/KVM machine (that is, one being bootstrapped or used for +building) can be accessed with a VNC client. @@ TODO + +\ +echo cont | ssh build@build socat - UNIX-CONNECT:/tmp/<toolchain>-monitor +\ + +\ +ssh -f -L 5901:127.0.0.1:5901 build@build sleep 1 && vncviewer 127.0.0.1:5901 +\ " @@ -66,6 +66,12 @@ SYSTEMD_LOG_LEVEL=info /lib/systemd/systemd-udevd --daemon --resolve-names=never udevadm trigger --action=add udevadm settle || true +# Initialize KVM. +# +#if ! (modprobe kvm_intel || modprobe kvm_amd); then +# error "no virtualization support available (is it disabled in BIOS?)" +#fi + # Parse the kernel command line. This is complicated by the fact that the # values can be quoted, for example: # |