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

A better solution to the Void Linux shutdown problem #408

Open
amak79 opened this issue Oct 22, 2021 · 10 comments
Open

A better solution to the Void Linux shutdown problem #408

amak79 opened this issue Oct 22, 2021 · 10 comments
Labels
Bug Confirmed to be a bug Easy Good for new contributors

Comments

@amak79
Copy link

amak79 commented Oct 22, 2021

PR #183 attempts to fix the Void Linux shutdown problem, but any changes to /etc/runit/1 won't survive an update to the runit-void package.

A better solution is the change the permissions of /etc/runit/stopit in /etc/rc.local, which is sourced during runit stage 2 and can be used to specify configuration to be done prior to login.

I've added the following line to /etc/rc.local to set the permissions for /etc/runit/stopit.

chmod 100 /run/runit/stopit
@dontlaugh
Copy link

Perhaps this can be handled by configuring lxc stop to send a different signal.

Please see this solution: https://github.com/lxc/lxd/issues/5592#issuecomment-1339984790

I tested it. It stopped the container right away. I need to confirm that it was truly a graceful shutdown, but given that the halt signal is how graceful shutdowns should be requested, it seems promising.

@amak79
Copy link
Author

amak79 commented Mar 9, 2023

From the runit-init man page:

       init 6 tells the Unix process no 1 to shutdown and reboot the system.
              To signal runit(8) the system reboot request, runit-init sets
              the execute by owner permission of the files /etc/runit/reboot
              and /etc/runit/stopit (chmod 100). Then a CONT signal is sent to
              runit(8).

Sending SIGCONT requires changing the permissions for /etc/runit/stopit to 100. I have lxc.signal.halt=SIGCONT plus chmod 100 /run/runit/stopit in /etc/rc.local and it has worked for me.

@stgraber
Copy link
Member

So a proper fix would be an init script (not rc.local) which if a container is detected goes on to chmod /run/runit/stopit as 100?

Can someone familiar with voidlinux send a PR that does that? (needs an update to voidlinux.yaml)

@stgraber stgraber added Bug Confirmed to be a bug Easy Good for new contributors labels Oct 17, 2023
@sbromberger
Copy link

In newer images, /etc/runit/1 has been changed to include

install -m100 /dev/null /run/runit/stopit

In older images, it is

install -m000 /dev/null /run/runit/stopit

I don't know when that change was made but the current official void repo still has it as 000: https://github.com/void-linux/void-runit/blob/32893ea380f756534c919d2b4d2c47cd9242eaa0/1#L27

@sbromberger
Copy link

Here's the fundamental problem with the yaml right now: The modification in

sed -ri 's#install -m000 /dev/null /run/runit/stopit#install -m100 /dev/null /run/runit/stopit#' /etc/runit/1
will be overwritten whenever the runit-void package gets updated. The recommendation from the void folks is to put this in /etc/rc.local.

@sbromberger
Copy link

I have proposed void-linux/void-runit#113 as a step towards a solution here. Once that PR is merged, we will need to make the necessary changes to the void YAML here to create a local core service that will change the permissions on /run/runit/stopit.

@duskmoss
Copy link

Adding a note for voidlinux/musl

looks like adding chmod 100 /run/runit/stopit and incus config set test raw.lxc="lxc.signal.halt=SIGCONT" works as described for voidlinux images, SIGINT also semi works as sbromberger described in void-runit/pull/50

however neither work at all voidlinux/musl images, stop requests just hang. I might investigate farther later, but thought I should note for anyone else trying that here.

@dontlaugh
Copy link

New related PR upstream void-linux/void-runit#122

@Vaelatern
Copy link

Vaelatern commented Sep 6, 2024

Thank you @sbromberger the work is merged. EDIT: upstream, not any local lxc changes that are also needed

@dontlaugh
Copy link

stopping void containers still seems to take a long time, eventually timing out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Confirmed to be a bug Easy Good for new contributors
Development

No branches or pull requests

6 participants