-
Notifications
You must be signed in to change notification settings - Fork 61
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
ostree planner does not understand --no-start-daemon/$NIX_INSTALLER_START_DAEMON=false #1297
Comments
Have you tried with What do you mean when you say "I cannot stop the installer from erroring out when it does not see a running systemd" -- do you have those errors handy? |
Some minimal reproducers, you don't need anything but podman (i suspect docker works too). Using the linux planner does not succeed because of missing directories, either way the /nix directory will be wiped out. bareFROM ghcr.io/ublue-os/base-main:41
ADD https://github.com/DeterminateSystems/nix-installer/releases/download/v0.28.0/nix-installer-x86_64-linux /tmp/nix
RUN chmod +x /tmp/nix && \
/tmp/nix install && \
rm /tmp/nix && \
ostree container commit
|
Ah, OK, that's my bad -- I completely skipped over the fact this was a containerized environment, sorry! Right now, the I can easily add the I can't think of a way to get this working, but if you feel like poking around, here's the diff that adds diff --git a/src/planner/ostree.rs b/src/planner/ostree.rs
index f92d7d9..8654b0d 100644
--- a/src/planner/ostree.rs
+++ b/src/planner/ostree.rs
@@ -1,3 +1,6 @@
+#[cfg(feature = "cli")]
+use clap::ArgAction;
+
use crate::{
action::{
base::{CreateDirectory, CreateFile, RemoveDirectory},
@@ -33,6 +36,19 @@ pub struct Ostree {
/// Where `/nix` will be bind mounted to.
#[cfg_attr(feature = "cli", clap(long, default_value = "/var/home/nix"))]
persistence: PathBuf,
+ /// Start the daemon (if not `--init none`)
+ #[cfg_attr(
+ feature = "cli",
+ clap(
+ value_parser,
+ action(ArgAction::SetFalse),
+ env = "NIX_INSTALLER_START_DAEMON",
+ default_value_t = true,
+ long = "no-start-daemon"
+ )
+ )]
+ pub start_daemon: bool,
+
#[cfg_attr(feature = "cli", clap(flatten))]
pub settings: CommonSettings,
}
@@ -44,6 +60,7 @@ impl Planner for Ostree {
Ok(Self {
persistence: PathBuf::from("/var/home/nix"),
settings: CommonSettings::default().await?,
+ start_daemon: true,
})
}
@@ -232,7 +249,7 @@ impl Planner for Ostree {
);
plan.push(
- ConfigureUpstreamInitService::plan(InitSystem::Systemd, true)
+ ConfigureUpstreamInitService::plan(InitSystem::Systemd, self.start_daemon)
.await
.map_err(PlannerError::Action)?
.boxed(),
@@ -263,6 +280,7 @@ impl Planner for Ostree {
let Self {
persistence,
settings,
+ start_daemon,
} = self;
let mut map = HashMap::default();
@@ -271,6 +289,10 @@ impl Planner for Ostree {
"persistence".to_string(),
serde_json::to_value(persistence)?,
);
+ map.insert(
+ "start_daemon".to_string(),
+ serde_json::to_value(start_daemon)?,
+ );
Ok(map)
} |
That makes sense, either way it works fine having run the installer on the live system. It would still be nice to have this working to have nix appear automatically on a fresh install, especially to replace Linuxbrew.
I might have a looksie and see what might be adapted in the planner to split between what can be done in the build environment and what should be done on the live system when the image is booted. But at that point i feel like the better option may be to just add the installer itself to the image and run it as a oneshot systemd service on first boot.
…On Tue, 19 Nov 2024, at 16:48, Cole Helbling wrote:
Ah, OK, that's my bad -- I completely skipped over the fact this was a containerized environment, sorry!
Right now, the `ostree` planner only supports systems with a running systemd (it does all the setup necessary for the ostree environment via systemd units).
I can easily add the `no-start-daemon` argument, but that won't help in this case, as systemd isn't running at all in the container, so all the tasks that rely on systemd being available would still fail...
I can't think of a way to get this working, but if you feel like poking around, here's the diff that adds `--no-start-daemon` to the `ostree` planner:
diff --git a/src/planner/ostree.rs b/src/planner/ostree.rs
index f92d7d9..8654b0d 100644
--- a/src/planner/ostree.rs
+++ b/src/planner/ostree.rs
@@ -1,3 +1,6 @@
+#[cfg(feature = "cli")]
+use clap::ArgAction;
+
use crate::{
action::{
base::{CreateDirectory, CreateFile, RemoveDirectory},
@@ -33,6 +36,19 @@ pub struct Ostree {
/// Where `/nix` will be bind mounted to.
#[cfg_attr(feature = "cli", clap(long, default_value = "/var/home/nix"))]
persistence: PathBuf,
+ /// Start the daemon (if not `--init none`)
+ #[cfg_attr(
+ feature = "cli",
+ clap(
+ value_parser,
+ action(ArgAction::SetFalse),
+ env = "NIX_INSTALLER_START_DAEMON",
+ default_value_t = true,
+ long = "no-start-daemon"
+ )
+ )]
+ pub start_daemon: bool,
+
#[cfg_attr(feature = "cli", clap(flatten))]
pub settings: CommonSettings,
}
@@ -44,6 +60,7 @@ impl Planner for Ostree {
Ok(Self {
persistence: PathBuf::from("/var/home/nix"),
settings: CommonSettings::default().await?,
+ start_daemon: true,
})
}
@@ -232,7 +249,7 @@ impl Planner for Ostree {
);
plan.push(
- ConfigureUpstreamInitService::plan(InitSystem::Systemd, true)
+ ConfigureUpstreamInitService::plan(InitSystem::Systemd, self.start_daemon)
.await
.map_err(PlannerError::Action)?
.boxed(),
@@ -263,6 +280,7 @@ impl Planner for Ostree {
let Self {
persistence,
settings,
+ start_daemon,
} = self;
let mut map = HashMap::default();
@@ -271,6 +289,10 @@ impl Planner for Ostree {
"persistence".to_string(),
serde_json::to_value(persistence)?,
);
+ map.insert(
+ "start_daemon".to_string(),
+ serde_json::to_value(start_daemon)?,
+ );
Ok(map)
}
—
Reply to this email directly, view it on GitHub <#1297 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AIYEFFQ5BDLWUNWD3VDRFGL2BNTXPAVCNFSM6AAAAABR7ZS27GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIOBWGIZTOMJQGU>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
I am attempting to add Nix to a universal blue image (https://github.com/ublue-os/image-template), but I cannot stop the installer from erroring out when it does not see a running systemd. Installing on a live system works fine. No combination of
--no-start-daemon
or$NIX_INSTALLER_START_DAEMON=false
will get it to start installing.The text was updated successfully, but these errors were encountered: