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

Allow unlimited restart attempts for autostart VMs #48

Closed
pshirshov opened this issue Jun 29, 2022 · 6 comments
Closed

Allow unlimited restart attempts for autostart VMs #48

pshirshov opened this issue Jun 29, 2022 · 6 comments

Comments

@pshirshov
Copy link

pshirshov commented Jun 29, 2022

Currently when the VMs initialize during system startup, they may fail because some bridges created by systemd-networkd may be not available yet:

Jun 29 13:44:30 vm systemd[1]: Starting MicroVM 'microvm-test'...
Jun 29 13:44:30 vm systemd[1]: Started MicroVM 'microvm-test'.
Jun 29 13:44:30 vm microvm@microvm-test[11347]: /run/wrappers/bin/qemu-bridge-helper: cannot run `/run/libvirt/nix-helpers/qemu-bridge-helper': No such file or directory
Jun 29 13:44:30 vm microvm@microvm-test[11339]: qemu-system-x86_64: -netdev bridge,id=eth0,br=br-untrusted,helper=/run/wrappers/bin/qemu-bridge-helper: bridge helper failed
Jun 29 13:44:30 vm systemd[1]: microvm@microvm-test.service: Main process exited, code=exited, status=1/FAILURE
Jun 29 13:44:30 vm systemd[1]: microvm@microvm-test.service: Failed with result 'exit-code'.
Jun 29 13:44:31 vm systemd[1]: microvm@microvm-test.service: Scheduled restart job, restart counter is at 5.
Jun 29 13:44:32 vm systemd[1]: Stopped MicroVM 'microvm-test'.
Jun 29 13:44:32 vm systemd[1]: Dependency failed for MicroVM 'microvm-test'.
Jun 29 13:44:32 vm systemd[1]: microvm@microvm-test.service: Job microvm@microvm-test.service/start failed with result 'dependency'.
Jun 29 16:25:23 vm systemd[1]: Starting MicroVM 'microvm-test'...
Jun 29 16:25:23 vm systemd[1]: Started MicroVM 'microvm-test'.

When I retry to launch the service manually in about 30s it launches perfectly.

It would be good to have an option for limitless boot retry attempts.

@astro
Copy link
Owner

astro commented Jun 29, 2022

The microvm@.service already includes Restart=always. Is that not sufficient?

You may also extend systemd.services."microvm@".after to solve the actual cause here though automatic restarts should work.

@pshirshov
Copy link
Author

pshirshov commented Jun 30, 2022

The microvm@.service already includes Restart=always. Is that not sufficient?

Seems like it's not, for some reason it makes 3 attempts then stops.

You may also extend systemd.services."microvm@".after to solve the actual cause here though automatic restarts should work.

Could you please give me an idea how? I'm not a nix expert yet :)

@pshirshov
Copy link
Author

I believe that's the explanation why just "restart=always" is not enough: https://unix.stackexchange.com/questions/289629/systemd-restart-always-is-not-honored

@pshirshov
Copy link
Author

pshirshov commented Jun 30, 2022

Maybe it's a good idea to allow custom properties in the generated unit files?

@astro
Copy link
Owner

astro commented Aug 15, 2022

The second answer in that link explains that it is just rate limit what you are seeing. systemd is going to continue starting/restarting all over again after a while.

@astro astro closed this as completed Aug 15, 2022
@pshirshov
Copy link
Author

pshirshov commented Aug 15, 2022

For some reason that "after a while" never happens. I've set up 3 vms, one failed to start and never re-attempted to start in a couple of weeks. Okay, sometimes systemd is a bit weird.

@astro astro reopened this Aug 15, 2022
@astro astro closed this as completed May 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants