Have a Question?

Mapping the Reset Button on VP Series Vaults

Print

TL;DR

If you want a VP Series Vault to reboot when the Reset button is held for at least one second:

  1. Save this file as /etc/systemd/system/reset-button.service
  2. Save this file as /usr/lib/protectli/vp2410-button.sh and chmod +x it
  3. Enable it with systemctl unmask reset-button && systemctl enable reset-button && systemctl start reset-button

Synopsis

The Reset button as seen on the face of the VP Series is not tied to any particular function by default. It could be used to reboot the machine, or any other action you’d like to perform in Linux. An idea for this could be to “factory-reset” the machine to a known good snapshot from the internal eMMC storage.

Prerequisites

The button state is visible through the ISA Bus, not GPIO or ACPI subsystems. In order to read the button state, the program isadump will let you probe the register space where the button exists. If the isadump tool is unavailable, it’s available in the following packages depending on your OS:

  • Ubuntu/Debian apt package lm-sensors. Install it with apt update && apt -y install lm-sensors

Reading the Button State from Linux

A simple script like so will allow for you to read the button state from the terminal. This script will poll the button state every half second and tell you when it is pressed. Simply put this script somewhere, chmod +x it to enable execution, and run it from the terminal with ./read-button.sh

#!/bin/sh

while true ; do
sleep 0.5 ;
STATE=`isadump -f -y 0xa00 16 | tail -n1 | awk '{print $2}'` ;
`echo -n date ` ;
[ "$STATE" = '04' ] && echo Button is not pressed || echo Button is pressed ;
done ;

Running the script with ./read-button.sh will output to terminal the status of the button. Example output is as follows, and you can see when the button is pressed.

# ./read-button.sh
Mon Aug 9 04:11:12 PM PDT 2021: Button is not pressed
Mon Aug 9 04:11:12 PM PDT 2021: Button is not pressed
Mon Aug 9 04:11:13 PM PDT 2021: Button is not pressed
Mon Aug 9 04:11:13 PM PDT 2021: Button is not pressed
Mon Aug 9 04:11:14 PM PDT 2021: Button is not pressed
Mon Aug 9 04:11:14 PM PDT 2021: Button is pressed
Mon Aug 9 04:11:15 PM PDT 2021: Button is pressed
Mon Aug 9 04:11:15 PM PDT 2021: Button is pressed
Mon Aug 9 04:11:16 PM PDT 2021: Button is pressed
Mon Aug 9 04:11:16 PM PDT 2021: Button is not pressed
Mon Aug 9 04:11:17 PM PDT 2021: Button is not pressed
Mon Aug 9 04:11:17 PM PDT 2021: Button is not pressed
Mon Aug 9 04:11:18 PM PDT 2021: Button is not pressed
^C

Make the Button Do Something

For this example, we’ll assume you’re using a Systemd-style init system. When the button is pressed, a script will force a reboot. The following steps will occur:

  1. Create a unit file to tell systemd to run a script that will always be active when the system is up.
  2. Create a script that does something when the button is pressed.
  3. Tell systemd to load the unit file.

Create a Systemd unit file

Create a new file in /etc/systemd/system/ called reset-button.service. Inside it, put the following configuration information. This tells systemd to run this script once the system boots.

[Unit]
Description=VP2410 Chassis Reset Button Listener
[Service]
Type=simple
Restart=always
RestartSec=1s
ExecStart=/usr/lib/protectli/vp2410-button.sh
[Install]
WantedBy=sysinit.target

Create the script that watches for the button to be pressed

We’ll create a path for our script in /usr/lib called protectli/. Perform mkdir -p /usr/lib/protectli and then create a file called usr/lib/protectli/vp2410-button.sh with executable privileges (chmod +x) with the following contents:

#!/bin/sh

while true ; do
sleep 1 ;
STATE=`isadump -f -y 0xa00 16 | tail -n1 | awk '{print $2}'` ;
if [ "$STATE" = '00' ] ; then
reboot now ;
fi ;
done ;

This script will check every second to see if the button is pressed, and if so, a reboot command is issued. So, you must hold the button for at least one second to trigger a reboot.

Enable the service in Systemd

To tell systemd to load the service, simply type into the terminal

systemctl unmask reset-button.service
systemctl enable reset-button.service
systemctl start reset-button.service

Caveats

Since the button state is monitored at the systemd level (essentially init), we’re as close to Ring 0 as possible without needing to do some BIOS- or kernel-level hacking. So, this script will theoretically work as long as your system hasn’t completely crashed. For example, if you experience a kernel panic and your system grinds to a halt, the aforementioned reboot script will not help you. However, by being loaded so early in the init system, even the worst out-of-memory system thrashing will still keep this unit file alive.

Table of Contents