Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate upgradability from historical PiRogue to new ViRogue #21

Open
CyrilBrulebois opened this issue Sep 7, 2024 · 3 comments
Open

Comments

@CyrilBrulebois
Copy link
Collaborator

Initially we mentioned we would not try and support upgrades from the historical, PiRogue-based approach to the new pirogue-admin/ViRogue-based approach.

That would probably mean using different repositories, having the risk of users still pointing to the old/current ones and never getting any upgrades.

It seems feasible to try and support that upgrade in best effort mode, with at least a couple of glitches spotted with a first attempt:

  1. pirogue-ap and pirogue-networking have files in common, a Conflicts is needed.
  2. A few things happened in the debian-12 branch that need to be merged/cherry-picked into the virogue one (e.g. in deb-packages, for the pirogue-archive-keyring addition).
  3. The --redeploy cannot work when existing packages (e.g. pirogue-dashboard, pirogue-eve-collector, pirogue-flow-inspector) get upgraded: the config file is very likely to be missing at this point.
  4. And pirogue-base.postinst only does autodetection on initial installation. It should also do it when upgrading from an “historical” version.

Quick comments/ideas:

  1. Is probably trivial.
  2. Will need to be seriously investigated when we get closer to a first release.
  3. Is probably easily addressed by turning the hard failure into a warning (I wanted to notice if things went KO, but making the upgrade smoother is a good reason to revisit this initial decision).
  4. Is probably easy as I decided to go for 1.2.* versions in the virogue branch while 1.1.* versions are used in the debian-12 branch. Version comparison will let us know if we're upgrading from an “historical, PiRogue-based” setup.
@CyrilBrulebois
Copy link
Collaborator Author

For the last point, we could probably try and read some settings (e.g. SSID, PSK, dashboard password) from the current configuration, and use a few sed call between running the autodetection and applying the configuration.

CyrilBrulebois added a commit that referenced this issue Sep 7, 2024
Let's help support upgrades on existing systems (without pirogue-admin
integration):
 - Tone down the logging from error to warning.
 - Exit with rc=0 instead of rc=1.

Link: #21
CyrilBrulebois added a commit to PiRogueToolSuite/deb-packages that referenced this issue Sep 7, 2024
That is a prerequisite to supporting upgrades on existing systems
(without pirogue-admin integration).

Link: PiRogueToolSuite/pirogue-admin#21
CyrilBrulebois added a commit to PiRogueToolSuite/deb-packages that referenced this issue Sep 7, 2024
Run the autodetection not only when performing a fresh install, but when
upgrading existing systems (without pirogue-admin integration) as well.
Use the old-version parameter of the postinst to determine when that
should happen.

[ Best viewed with -b due to indentation changes. ]

Link: PiRogueToolSuite/pirogue-admin#21
CyrilBrulebois added a commit to PiRogueToolSuite/debian-12-virogue that referenced this issue Sep 7, 2024
CyrilBrulebois added a commit to PiRogueToolSuite/debian-12-virogue that referenced this issue Sep 7, 2024
CyrilBrulebois added a commit to PiRogueToolSuite/debian-12-virogue that referenced this issue Sep 7, 2024
CyrilBrulebois added a commit to PiRogueToolSuite/debian-12-virogue that referenced this issue Sep 7, 2024
@CyrilBrulebois
Copy link
Collaborator Author

On a Pi 4, the following remains:

pi@pirogue:~$ cat /var/lib/pirogue/config/pirogue.env
WIFI_NETWORK_NAME=PiRogue1
WIFI_NETWORK_KEY=superlongkey
WIFI_COUNTRY_CODE=FR
WLAN_IFACE=wlan0
ETH_IFACE=eth0
DASHBOARD_PASSWORD=PiRogue

Interfaces we don't want, WIFI_* we probably could, and DASHBOARD_PASSWORD as well.

Cc @U039b: do we want to take the risk of adding a little more code in the upgrade path? (It's a bit of a pain to test as one needs to deploy a system the old way, then upgrade.) Or are we happy to have a tiny section “how to upgrade an historical PiRogue” that explains how to (re)configure?

@CyrilBrulebois
Copy link
Collaborator Author

Alright, another attempt with updated packages looks great.

I've tagged the PPA as virogue-5.

Keeping this issue open for the question asked in the previous comment.

For completeness, here's the upgrade transcript (that's on a Pi 5):

root@pirogue:~# apt-get dist-upgrade
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
The following package was automatically installed and is no longer required:
  linux-image-6.1.0-23-arm64
Use 'apt autoremove' to remove it.
The following packages will be REMOVED:
  pirogue-ap
The following NEW packages will be installed:
  libqrencode4 pirogue-admin pirogue-networking qrencode wireguard-tools
The following packages will be upgraded:
  pirogue-base pirogue-dashboard pirogue-eve-collector pirogue-flow-inspector
4 upgraded, 5 newly installed, 1 to remove and 0 not upgraded.
Need to get 21.8 MB of archives.
After this operation, 664 kB of additional disk space will be used.
Do you want to continue? [Y/n] 
Get:1 http://deb.debian.org/debian bookworm/main arm64 libqrencode4 arm64 4.1.1-1 [39.4 kB]
Get:2 http://deb.debian.org/debian bookworm/main arm64 qrencode arm64 4.1.1-1 [41.9 kB]
Get:3 http://deb.debian.org/debian bookworm/main arm64 wireguard-tools arm64 1.0.20210914-1+b1 [89.3 kB]
Get:4 https://pts-project.org/debian-12-virogue/pirogue ./ pirogue-admin 1.4.2 [31.5 kB]   
Get:5 https://pts-project.org/debian-12-virogue/pirogue ./ pirogue-base 1.2.2 [2964 B]
Get:6 https://pts-project.org/debian-12-virogue/pirogue ./ pirogue-networking 1.3.4 [8548 B]
Get:7 https://pts-project.org/debian-12-virogue/pirogue ./ pirogue-dashboard 1.3.0 [20.3 kB]
Get:8 https://pts-project.org/debian-12-virogue/pirogue ./ pirogue-eve-collector 1.3.0 [23.0 kB]
Get:9 https://pts-project.org/debian-12-virogue/pirogue ./ pirogue-flow-inspector 1.3.0 [21.6 MB]
Fetched 21.8 MB in 2s (12.5 MB/s)            
Selecting previously unselected package libqrencode4:arm64.
(Reading database ... 87726 files and directories currently installed.)
Preparing to unpack .../libqrencode4_4.1.1-1_arm64.deb ...
Unpacking libqrencode4:arm64 (4.1.1-1) ...
Selecting previously unselected package qrencode.
Preparing to unpack .../qrencode_4.1.1-1_arm64.deb ...
Unpacking qrencode (4.1.1-1) ...
Selecting previously unselected package pirogue-admin.
Preparing to unpack .../pirogue-admin_1.4.2_all.deb ...
Unpacking pirogue-admin (1.4.2) ...
Selecting previously unselected package wireguard-tools.
Preparing to unpack .../wireguard-tools_1.0.20210914-1+b1_arm64.deb ...
Unpacking wireguard-tools (1.0.20210914-1+b1) ...
Preparing to unpack .../pirogue-base_1.2.2_all.deb ...
Unpacking pirogue-base (1.2.2) over (1.1.2) ...
(Reading database ... 87846 files and directories currently installed.)
Removing pirogue-ap (1.1.2) ...
Selecting previously unselected package pirogue-networking.
(Reading database ... 87836 files and directories currently installed.)
Preparing to unpack .../pirogue-networking_1.3.4_all.deb ...
Created symlink /etc/systemd/system/dnsmasq.service -> /dev/null.
Unpacking pirogue-networking (1.3.4) ...
Preparing to unpack .../pirogue-dashboard_1.3.0_all.deb ...
Unpacking pirogue-dashboard (1.3.0) over (1.1.1) ...
dpkg: warning: unable to delete old directory '/var/lib/grafana': Directory not empty
dpkg: warning: unable to delete old directory '/etc/grafana/provisioning/datasources': Directory not empty
dpkg: warning: unable to delete old directory '/etc/grafana/provisioning/dashboards': Directory not empty
dpkg: warning: unable to delete old directory '/etc/grafana/provisioning': Directory not empty
Preparing to unpack .../pirogue-eve-collector_1.3.0_all.deb ...
Unpacking pirogue-eve-collector (1.3.0) over (1.1.1) ...
Preparing to unpack .../pirogue-flow-inspector_1.3.0_all.deb ...
Unpacking pirogue-flow-inspector (1.3.0) over (1.1.0) ...
Setting up libqrencode4:arm64 (4.1.1-1) ...
Setting up qrencode (4.1.1-1) ...
Setting up wireguard-tools (1.0.20210914-1+b1) ...
wg-quick.target is a disabled or a static unit, not starting it.
Setting up pirogue-admin (1.4.2) ...
Setting up pirogue-dashboard (1.3.0) ...
WARNING:root:Cannot redeploy, no configuration file stored!
Setting up pirogue-flow-inspector (1.3.0) ...
Setting up pirogue-eve-collector (1.3.0) ...
WARNING:root:Cannot redeploy, no configuration file stored!
Setting up pirogue-networking (1.3.4) ...
Setting up pirogue-base (1.2.2) ...
INFO:root:external: eth0
INFO:root:isolated: wlan0
INFO:root:spotting network: 192.168.0.0/24
INFO:root:external networks: ['192.168.0.0/24']
INFO:root:isolated network picked: 10.8.0.0/24
INFO:root:isolated address picked: 10.8.0.1
ENABLE_DHCP: true
EXTERNAL_INTERFACE: eth0
EXTERNAL_NETWORKS: 192.168.0.0/24
ISOLATED_ADDRESS: 10.8.0.1
ISOLATED_INTERFACE: wlan0
ISOLATED_NETWORK: 10.8.0.0/24
SYSTEM_OPERATING_MODE: access point

INFO:root:Applying: {'ENABLE_DHCP': True, 'EXTERNAL_INTERFACE': 'eth0', 'EXTERNAL_NETWORKS': '192.168.0.0/24', 'ISOLATED_ADDRESS': '10.8.0.1', 'ISOLATED_INTERFACE': 'wlan0', 'ISOLATED_NETWORK': '10.8.0.0/24', 'SYSTEM_OPERATING_MODE': 'access point'}
INFO:root:Loading current config (from scratch): empty
INFO:root:applying system configuration for pirogue-admin
INFO:root:configuring the isolated interface
Error: ipv4: Address already assigned.
INFO:root:applying configuration for pirogue-dashboard
INFO:root:/var/lib/grafana/dashboards/pirogue-dashboard.json=changed, scheduling associated actions
INFO:root:/var/lib/grafana/dashboards/pirogue-flow-details-dashboard.json=changed, scheduling associated actions
INFO:root:running ['systemctl', 'enable', 'grafana-server']
Synchronizing state of grafana-server.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable grafana-server
INFO:root:running ['systemctl', 'enable', 'grafana-server']: done.
INFO:root:running ['systemctl', 'restart', 'grafana-server']
INFO:root:running ['systemctl', 'restart', 'grafana-server']: done.
INFO:root:skipping systemctl enable grafana-server, already done
INFO:root:skipping systemctl restart grafana-server, already done
INFO:root:applying configuration for pirogue-eve-collector
INFO:root:applying configuration for pirogue-flow-inspector
INFO:root:/usr/local/sbin/reconfigure-pirogue-flow-inspector=changed, scheduling associated actions
INFO:root:running ['chmod', '+x', '/usr/local/sbin/reconfigure-pirogue-flow-inspector']
INFO:root:running ['chmod', '+x', '/usr/local/sbin/reconfigure-pirogue-flow-inspector']: done.
INFO:root:running ['/usr/local/sbin/reconfigure-pirogue-flow-inspector']
Removed "/etc/systemd/system/default.target.wants/[email protected]".
Created symlink /etc/systemd/system/default.target.wants/[email protected] -> /lib/systemd/system/[email protected].
INFO:root:running ['/usr/local/sbin/reconfigure-pirogue-flow-inspector']: done.
INFO:root:applying configuration for pirogue-networking
INFO:root:/etc/sysctl.d/10-pirogue-networking.conf=changed, scheduling associated actions
INFO:root:/etc/systemd/system/dnsmasq.service.d/pirogue.conf=changed, scheduling associated actions
INFO:root:/etc/dnsmasq.d/pirogue.conf=changed, scheduling associated actions
INFO:root:/etc/iptables/rules.v4=condition failed, scheduling associated actions_else
INFO:root:/etc/iptables/rules.v6=condition failed, scheduling associated actions_else
INFO:root:/etc/systemd/system/nftables.service.d/pirogue.conf=changed, scheduling associated actions
INFO:root:/etc/nftables-pirogue.conf=changed, scheduling associated actions
INFO:root:running ['systemctl', 'restart', 'systemd-sysctl']
INFO:root:running ['systemctl', 'restart', 'systemd-sysctl']: done.
INFO:root:running ['systemctl', 'daemon-reload']
INFO:root:running ['systemctl', 'daemon-reload']: done.
INFO:root:running ['systemctl', 'unmask', 'dnsmasq']
Removed "/etc/systemd/system/dnsmasq.service".
INFO:root:running ['systemctl', 'unmask', 'dnsmasq']: done.
INFO:root:running ['systemctl', 'enable', 'dnsmasq']
Synchronizing state of dnsmasq.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable dnsmasq
INFO:root:running ['systemctl', 'enable', 'dnsmasq']: done.
INFO:root:running ['systemctl', 'restart', 'dnsmasq']
INFO:root:running ['systemctl', 'restart', 'dnsmasq']: done.
INFO:root:skipping systemctl daemon-reload, already done
INFO:root:running ['systemctl', 'enable', 'nftables']
INFO:root:running ['systemctl', 'enable', 'nftables']: done.
INFO:root:running ['systemctl', 'restart', 'nftables']
INFO:root:running ['systemctl', 'restart', 'nftables']: done.
Writing configuration file to: /var/lib/pirogue/admin/config.yaml
INFO:root:Applied!
Processing triggers for libc-bin (2.36-9+deb12u8) ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant