Skip to content

Commit 75c8eb5

Browse files
fix(site-router): drop the pki config-version entry, and make the appliance say why a config was rejected
Two things, and the second exists because of how the first was found. The version entry goes. site-router's config.boot declared `pki@1` alongside the component versions copied verbatim from the image, which did not carry a pki entry at all. A config declaring a component version the system does not have is the shape VyOS rejects, and remote site B is the control: its config has no pki entry and no pki block, and it loads on the same image while A does not. The entry bought nothing either way, since pki's only migration returns immediately without `pki ca`. That is a hypothesis, not a measurement, which is the problem. A rejected config.boot reaches the console as one line, "Configuration error", and the reason stays in /var/log/vyatta/vyos-config.log inside a guest with no SSH service, a locked login and now a password-protected bootloader. The bring-up emitter cannot cover it either: cron installs it from the configuration that just failed to load, so the diagnostics need the thing that broke. So the appliance now prints the tail of that log to the console after vyos-router has run, whatever the outcome. A few lines on a good boot, the whole answer on a bad one, collected by logSerialConsole and the e2e report like everything else on that console. Had it been there, this round would have named the offending line instead of narrowing to it. An earlier reading of the boot output claimed the migration had succeeded and the commit had failed, on the strength of the progress line "migrate system configure". That does not follow: vyos-router runs migrate_bootfile with `|| overall_status=1` and carries on regardless, and the word "system" comes from the subinit loop rather than from system_activate. The migration step is back in scope, which is what put the version entry back under suspicion. Assisted-By: LLM Signed-off-by: Myasnikov Daniil <[email protected]>
1 parent 3b5a0d6 commit 75c8eb5

4 files changed

Lines changed: 58 additions & 1 deletion

File tree

‎packages/apps/site-router/templates/_helpers.tpl‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,6 @@ system {
561561

562562

563563
// Warning: Do not remove the following line.
564-
// vyos-config-version: "bgp@6:cluster@2:config-management@1:conntrack@6:conntrack-sync@2:container@3:dhcp-relay@2:dhcp-server@11:dhcpv6-server@6:dns-dynamic@4:dns-forwarding@4:firewall@20:flow-accounting@3:https@7:ids@2:interfaces@34:ipoe-server@4:ipsec@14:isis@3:l2tp@9:lldp@3:monitoring@2:nat@8:nat66@3:nhrp@1:ntp@3:openconnect@3:openvpn@5:ospf@2:pim@1:pki@1:policy@8:pppoe-server@12:pptp@5:qos@2:quagga@12:reverse-proxy@3:rip@1:rpki@2:salt@1:snmp@3:ssh@3:sstp@6:system@31:vpp@6:vrf@4:vrrp@4:wanloadbalance@4:webproxy@2"
564+
// vyos-config-version: "bgp@6:cluster@2:config-management@1:conntrack@6:conntrack-sync@2:container@3:dhcp-relay@2:dhcp-server@11:dhcpv6-server@6:dns-dynamic@4:dns-forwarding@4:firewall@20:flow-accounting@3:https@7:ids@2:interfaces@34:ipoe-server@4:ipsec@14:isis@3:l2tp@9:lldp@3:monitoring@2:nat@8:nat66@3:nhrp@1:ntp@3:openconnect@3:openvpn@5:ospf@2:pim@1:policy@8:pppoe-server@12:pptp@5:qos@2:quagga@12:reverse-proxy@3:rip@1:rpki@2:salt@1:snmp@3:ssh@3:sstp@6:system@31:vpp@6:vrf@4:vrrp@4:wanloadbalance@4:webproxy@2"
565565
// Release version: 2026.03
566566
{{- end -}}

‎packages/system/vyos-router-image/hack/inject-appliance.sh‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,16 @@ install -d "${MERGED}/etc/systemd/system/vyos.target.wants"
7878
ln -sf /etc/systemd/system/vyos-appliance-seed.service \
7979
"${MERGED}/etc/systemd/system/vyos.target.wants/vyos-appliance-seed.service"
8080

81+
# The other half of the seed: say what vyos-router made of the configuration.
82+
# A rejected config.boot reaches the console as the single line "Configuration
83+
# error" and the reason stays in a log inside a guest with no SSH, a locked login
84+
# and a password-protected bootloader. The bring-up emitter cannot cover it
85+
# either, because cron installs it from the configuration that just failed.
86+
install -m 0755 "${OVERLAY_DIR}/vyos-appliance-config-report.sh" "${MERGED}/usr/local/sbin/vyos-appliance-config-report.sh"
87+
install -m 0644 "${OVERLAY_DIR}/vyos-appliance-config-report.service" "${MERGED}/etc/systemd/system/vyos-appliance-config-report.service"
88+
ln -sf /etc/systemd/system/vyos-appliance-config-report.service \
89+
"${MERGED}/etc/systemd/system/vyos.target.wants/vyos-appliance-config-report.service"
90+
8191
install -d "${MERGED}/usr/share/vyos"
8292
install -m 0644 "${OVERLAY_DIR}/config.boot.default" "${MERGED}/usr/share/vyos/config.boot.default"
8393

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[Unit]
2+
Description=Report the VyOS configuration load result to the console
3+
# After, not Before: the point is to read what vyos-router left behind. It runs
4+
# whether that succeeded or failed, because "which line did it object to" is only
5+
# answerable from the log and the console is the only way off this appliance.
6+
After=vyos-router.service
7+
Wants=vyos-router.service
8+
9+
[Service]
10+
Type=oneshot
11+
RemainAfterExit=yes
12+
ExecStart=/usr/local/sbin/vyos-appliance-config-report.sh
13+
14+
[Install]
15+
WantedBy=vyos.target
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/sh
2+
# Print why the configuration failed, to the console, after vyos-router has tried
3+
# to load it.
4+
#
5+
# vyos-router reports a rejected config.boot as the single line "Configuration
6+
# error" and puts the reason in /var/log/vyatta/vyos-config.log inside the guest.
7+
# On this appliance nothing can go and read that: there is no SSH service, the
8+
# `vyos` login is locked, and the bootloader is password-protected, so the
9+
# console is the only channel and it carries the one useless line. The bring-up
10+
# emitter does not help either, because it is installed by the configuration that
11+
# just failed to load.
12+
#
13+
# So this runs after vyos-router regardless of outcome and puts the tail on the
14+
# console, where logSerialConsole and the e2e collector already pick it up. It is
15+
# a few lines on a successful boot and the whole answer on a failed one.
16+
set -u
17+
18+
LOG=/var/log/vyatta/vyos-config.log
19+
MAX=25
20+
21+
log() { echo "vyos-appliance-config-report: $*" > /dev/console 2>&1; }
22+
23+
if [ ! -s "$LOG" ]; then
24+
log "no $LOG; vyos-router either did not run or wrote nothing"
25+
exit 0
26+
fi
27+
28+
log "last $MAX lines of $LOG:"
29+
tail -n "$MAX" "$LOG" 2>/dev/null | while IFS= read -r line; do
30+
log "| $line"
31+
done
32+
exit 0

0 commit comments

Comments
 (0)