33 Commits

Author SHA1 Message Date
Michael Stapelberg a4a45a2014 go get all dependencies, re-enable KVM on GitHub Actions 2026-07-03 08:12:18 +02:00
Damiano Donati 6a14de363d add optional async argument to /reboot & /poweroff (#319) 2025-06-04 09:00:34 +02:00
Michael Stapelberg 4015d44102 website: re-generate for previous commit 2024-09-09 18:01:43 +02:00
Michael Stapelberg d2cd6b6f44 /reboot: implement optional ?kexec=off parameter
related to https://github.com/gokrazy/gokrazy/issues/243
2024-01-13 11:18:13 +01:00
Michael Stapelberg b2b842e326 fix reading Go module info for diverted services
related to https://github.com/gokrazy/gokrazy/issues/189
2023-04-03 09:03:21 +02:00
Michael Stapelberg bf4d6e1d20 unify signal delay default to 100s
see also https://utcc.utoronto.ca/~cks/space/blog/linux/ShutdownDelayProblem
2023-03-07 20:47:10 +01:00
oliverpool b85b03e5bd implement Poweroff (and refactor around killSupervisedServices) (#177) 2023-03-07 20:38:36 +01:00
Michael Stapelberg c4490d7822 /update/features: include EEPROM version in JSON requests
This handler (despite being named just /features) should supply all the
information that the updater package needs in a single request/response.
2023-02-15 18:28:26 +01:00
Mark Drayton 3142fec4b0 support passing command line flags to /divert (#166) 2023-02-06 19:09:53 +01:00
Anup Chenthamarakshan 87f82b194d supervise: wait for services to stop before reboot (#106)
Currently, rebooting/upgrading the instance sends a TERM signal to all
running services, waits 1 second and then reboots. Processes that take
longer to cleanly stop can't do so.

Instead, give each service up to 15s to do a clean shutdown. Reboot 15s
after the command is sent, or after all services are stopped, whichever
comes first.

To make it easier to kill entire process tree for a service, create a
per-service process group. Stopping the service can be done by sending a
single signal to the process group.
2022-01-12 21:52:51 +01:00
Anup Chenthamarakshan e42cbd86b3 update: support device-specific update handlers (#102)
Useful to update devices which expect blobs at fixed locations
2022-01-11 20:29:31 +01:00
Michael Stapelberg 3f026adfcb add SuperviseServices entry point, allow creating stopped services 2021-12-18 19:47:43 +01:00
Michael Stapelberg 0e70ad8c1d transparently add service when diverting an unknown service
This allows running “gok run” for prototyping, even for software you have not
included in the currently running gokrazy image.

fixes https://github.com/gokrazy/gokrazy/issues/88
2021-12-18 19:09:17 +01:00
Michael Stapelberg b07a22daa4 add /divert handler
This diverts existing services to their temporary counterparts, uploaded via the
/uploadtemp handler.

related to https://github.com/gokrazy/gokrazy/issues/88
2021-11-21 16:46:18 +01:00
Michael Stapelberg 95e14930ea add /uploadtemp/ handler
related to https://github.com/gokrazy/gokrazy/issues/88
2021-11-21 16:45:15 +01:00
Michael Stapelberg 1732a89ba9 update: list gpt feature when booted from GPT
related to https://github.com/gokrazy/gokrazy/issues/87
2021-06-22 08:37:43 +02:00
Michael Stapelberg 5f651d5dcc modifyCmdline: update systemd-boot config if present
related to https://github.com/gokrazy/gokrazy/issues/87
2021-06-22 08:22:42 +02:00
Michael Stapelberg e184e6545a update: implement /update/testboot handler
related to https://github.com/gokrazy/gokrazy/issues/75
2021-01-30 18:52:46 +01:00
Michael Stapelberg f16a76357f update: use crc32 for checksumming when the client requests it
This is significantly faster than sha256 on the Raspberry Pi 4:
update speeds increase from ≈12 MB/s to ≈55 MB/s.
2020-06-26 11:03:54 +02:00
Michael Stapelberg f3445e01a9 fix switchRootPartition on non-PARTUUID installations
The first update always worked, but a subsequent update would not.

To manually switch an installation to PARTUUID, mount its boot partition and
replace the root= kernel parameter in cmdline.txt, like so:

/tmp/breakglass669384965 # mkdir boot
/tmp/breakglass669384965 # mount /dev/mmcblk0p1 boot
/tmp/breakglass669384965 # cat boot/cmdline.txt
console=ttyAMA0,115200 root=/dev/mmcblk0p2 init=/gokrazy/init elevator=deadline rootwait
/tmp/breakglass669384965 # sed -i 's,root=/dev/mmcblk0p,root=PARTUUID=471cad93-0,g' boot/cmdline.txt
/tmp/breakglass669384965 # cat boot/cmdline.txt
console=ttyAMA0,115200 root=PARTUUID=471cad93-02 init=/gokrazy/init elevator=deadline rootwait
/tmp/breakglass669384965 # umount boot
/tmp/breakglass669384965 # reboot

The PARTUUID= for your installation is printed by gokr-packer:
[…]
2020/05/01 10:05:34 write.go:366: writing MBR (LBAs: vmlinuz=51789, cmdline.txt=119561, PARTUUID=471cad93)
[…]
2020-05-01 10:06:17 +02:00
Michael Stapelberg 057fc9dcb0 add /update/features handler for feature negotiation
related to https://github.com/gokrazy/gokrazy/issues/52
2020-04-07 09:52:12 +02:00
Michael Stapelberg ffc8928d2e update to new rootdev API
related to https://github.com/gokrazy/gokrazy/issues/52
2020-04-07 09:00:10 +02:00
Michael Stapelberg 99287f68e3 update rootRe for running in user-mode linux 2018-11-01 17:54:23 +01:00
Michael Stapelberg 9770d4408f move root device finding function to internal/rootdev 2018-07-14 23:37:12 +02:00
Michael Stapelberg d8206c507c /update/mbr: strip p suffix from mmcblk0p 2018-07-13 23:53:46 +02:00
Michael Stapelberg 24c8ad07b5 streamRequestTo: call f.Sync()
When calling reboot shortly after /update/*, the kernel should flush its cache,
but if you’re not calling reboot, it would be good to persist the data on disk
nevertheless.
2018-07-13 23:16:26 +02:00
Michael Stapelberg 0f8d40d7f6 add /update/mbr 2018-07-12 09:27:32 +02:00
Michael Stapelberg 4f0e427025 reboot: use kexec where possible
This doesn’t work on the Raspberry Pi yet (due to missing kexec_file_load), but
I tested it in qemu.
2018-06-17 09:29:29 +02:00
Michael Stapelberg 91da7026f8 reboot: send SIGTERM to processes, wait for 1s
This way, programs can flush state to permanent storage if they need to.
2018-06-17 08:53:19 +02:00
Michael Stapelberg 34f12d9ada update: find root device instead of hard-coding /dev/mmcblk0p*
This should allow using gokrazy from a USB drive.
2018-06-12 22:19:13 +02:00
Michael Stapelberg 6063608b2b update: introduce a /bootonly handler for bakery
Regular updates hit /boot, /root, then /switch.

bakery only updates /boot, so we need to take care of persisting the active root
partition across /boot updates.
2018-05-17 09:08:25 +02:00
Michael Stapelberg b96471c05d update FAT16B writer import path 2017-07-14 03:19:15 +02:00
Michael Stapelberg 38af7fd18d Initial commit 2017-03-04 11:22:48 +01:00