mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-04-02 05:23:14 +00:00
fix deadlock on install (#2667)
* fix deadlock on install * improve pruning script * bump tokio
This commit is contained in:
@@ -61,8 +61,8 @@ axum = { version = "0.7.3", features = ["ws"] }
|
||||
axum-server = "0.6.0"
|
||||
barrage = "0.2.3"
|
||||
backhand = "0.18.0"
|
||||
base32 = "0.4.0"
|
||||
base64 = "0.21.4"
|
||||
base32 = "0.5.0"
|
||||
base64 = "0.22.1"
|
||||
base64ct = "1.6.0"
|
||||
basic-cookies = "0.1.4"
|
||||
blake3 = { version = "1.5.0", features = ["mmap", "rayon"] }
|
||||
@@ -71,9 +71,9 @@ chrono = { version = "0.4.31", features = ["serde"] }
|
||||
clap = "4.4.12"
|
||||
color-eyre = "0.6.2"
|
||||
console = "0.15.7"
|
||||
console-subscriber = { version = "0.2", optional = true }
|
||||
console-subscriber = { version = "0.3.0", optional = true }
|
||||
cookie = "0.18.0"
|
||||
cookie_store = "0.20.0"
|
||||
cookie_store = "0.21.0"
|
||||
der = { version = "0.7.9", features = ["derive", "pem"] }
|
||||
digest = "0.10.7"
|
||||
divrem = "1.0.0"
|
||||
@@ -102,7 +102,7 @@ id-pool = { version = "0.2.2", default-features = false, features = [
|
||||
"serde",
|
||||
"u16",
|
||||
] }
|
||||
imbl = "2.0.2"
|
||||
imbl = "2.0.3"
|
||||
imbl-value = { git = "https://github.com/Start9Labs/imbl-value.git" }
|
||||
include_dir = { version = "0.7.3", features = ["metadata"] }
|
||||
indexmap = { version = "2.0.2", features = ["serde"] }
|
||||
@@ -111,7 +111,7 @@ integer-encoding = { version = "4.0.0", features = ["tokio_async"] }
|
||||
ipnet = { version = "2.8.0", features = ["serde"] }
|
||||
iprange = { version = "0.6.7", features = ["serde"] }
|
||||
isocountry = "0.3.2"
|
||||
itertools = "0.12.0"
|
||||
itertools = "0.13.0"
|
||||
jaq-core = "0.10.1"
|
||||
jaq-std = "0.10.0"
|
||||
josekit = "0.8.4"
|
||||
@@ -124,7 +124,7 @@ log = "0.4.20"
|
||||
mbrman = "0.5.2"
|
||||
models = { version = "*", path = "../models" }
|
||||
new_mime_guess = "4"
|
||||
nix = { version = "0.27.1", features = ["user", "process", "signal", "fs"] }
|
||||
nix = { version = "0.29.0", features = ["user", "process", "signal", "fs"] }
|
||||
nom = "7.1.3"
|
||||
num = "0.4.1"
|
||||
num_enum = "0.7.0"
|
||||
@@ -140,11 +140,11 @@ pin-project = "1.1.3"
|
||||
pkcs8 = { version = "0.10.2", features = ["std"] }
|
||||
prettytable-rs = "0.10.0"
|
||||
proptest = "1.3.1"
|
||||
proptest-derive = "0.4.0"
|
||||
proptest-derive = "0.5.0"
|
||||
rand = { version = "0.8.5", features = ["std"] }
|
||||
regex = "1.10.2"
|
||||
reqwest = { version = "0.12.4", features = ["stream", "json", "socks"] }
|
||||
reqwest_cookie_store = "0.7.0"
|
||||
reqwest_cookie_store = "0.8.0"
|
||||
rpassword = "7.2.0"
|
||||
rpc-toolkit = { git = "https://github.com/Start9Labs/rpc-toolkit.git", branch = "refactor/no-dyn-ctx" }
|
||||
rust-argon2 = "2.0.0"
|
||||
@@ -168,15 +168,14 @@ sqlx = { version = "0.7.2", features = [
|
||||
] }
|
||||
sscanf = "0.4.1"
|
||||
ssh-key = { version = "0.6.2", features = ["ed25519"] }
|
||||
stderrlog = "0.5.4"
|
||||
tar = "0.4.40"
|
||||
thiserror = "1.0.49"
|
||||
tokio = { version = "1.37", features = ["full"] }
|
||||
tokio-rustls = "0.25.0"
|
||||
tokio = { version = "1.38.0", features = ["full"] }
|
||||
tokio-rustls = "0.26.0"
|
||||
tokio-socks = "0.5.1"
|
||||
tokio-stream = { version = "0.1.14", features = ["io-util", "sync", "net"] }
|
||||
tokio-tar = { git = "https://github.com/dr-bonez/tokio-tar.git" }
|
||||
tokio-tungstenite = { version = "0.21.0", features = ["native-tls"] }
|
||||
tokio-tungstenite = { version = "0.23.1", features = ["native-tls", "url"] }
|
||||
tokio-util = { version = "0.7.9", features = ["io"] }
|
||||
torut = { git = "https://github.com/Start9Labs/torut.git", branch = "update/dependencies", features = [
|
||||
"serialize",
|
||||
|
||||
@@ -66,7 +66,7 @@ where
|
||||
let mut guid = format!(
|
||||
"STARTOS_{}",
|
||||
base32::encode(
|
||||
base32::Alphabet::RFC4648 { padding: false },
|
||||
base32::Alphabet::Rfc4648 { padding: false },
|
||||
&rand::random::<[u8; 20]>(),
|
||||
)
|
||||
);
|
||||
|
||||
@@ -65,7 +65,7 @@ impl<G: GenericMountGuard> BackupMountGuard<G> {
|
||||
unencrypted_metadata.wrapped_key.as_ref(),
|
||||
) {
|
||||
let wrapped_key =
|
||||
base32::decode(base32::Alphabet::RFC4648 { padding: true }, wrapped_key)
|
||||
base32::decode(base32::Alphabet::Rfc4648 { padding: true }, wrapped_key)
|
||||
.ok_or_else(|| {
|
||||
Error::new(
|
||||
eyre!("failed to decode wrapped key"),
|
||||
@@ -76,7 +76,7 @@ impl<G: GenericMountGuard> BackupMountGuard<G> {
|
||||
String::from_utf8(decrypt_slice(wrapped_key, password))?
|
||||
} else {
|
||||
base32::encode(
|
||||
base32::Alphabet::RFC4648 { padding: false },
|
||||
base32::Alphabet::Rfc4648 { padding: false },
|
||||
&rand::random::<[u8; 32]>()[..],
|
||||
)
|
||||
};
|
||||
@@ -93,7 +93,7 @@ impl<G: GenericMountGuard> BackupMountGuard<G> {
|
||||
}
|
||||
if unencrypted_metadata.wrapped_key.is_none() {
|
||||
unencrypted_metadata.wrapped_key = Some(base32::encode(
|
||||
base32::Alphabet::RFC4648 { padding: true },
|
||||
base32::Alphabet::Rfc4648 { padding: true },
|
||||
&encrypt_slice(&enc_key, password),
|
||||
));
|
||||
}
|
||||
@@ -141,7 +141,7 @@ impl<G: GenericMountGuard> BackupMountGuard<G> {
|
||||
.with_kind(crate::ErrorKind::PasswordHashGeneration)?,
|
||||
);
|
||||
self.unencrypted_metadata.wrapped_key = Some(base32::encode(
|
||||
base32::Alphabet::RFC4648 { padding: false },
|
||||
base32::Alphabet::Rfc4648 { padding: false },
|
||||
&encrypt_slice(&self.enc_key, new_password),
|
||||
));
|
||||
Ok(())
|
||||
|
||||
@@ -111,7 +111,7 @@ impl GenericMountGuard for MountGuard {
|
||||
|
||||
async fn tmp_mountpoint(source: &impl FileSystem) -> Result<PathBuf, Error> {
|
||||
Ok(Path::new(TMP_MOUNTPOINT).join(base32::encode(
|
||||
base32::Alphabet::RFC4648 { padding: false },
|
||||
base32::Alphabet::Rfc4648 { padding: false },
|
||||
&source.source_hash().await?[0..20],
|
||||
)))
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ use crate::progress::{
|
||||
FullProgress, FullProgressTracker, PhaseProgressTrackerHandle, PhasedProgressBar,
|
||||
};
|
||||
use crate::rpc_continuations::{Guid, RpcContinuation};
|
||||
use crate::s9pk::v2::pack::{CONTAINER_DATADIR, CONTAINER_TOOL};
|
||||
use crate::ssh::SSH_AUTHORIZED_KEYS_FILE;
|
||||
use crate::util::io::{create_file, IOHook};
|
||||
use crate::util::net::WebSocketExt;
|
||||
@@ -421,6 +422,10 @@ pub async fn init(
|
||||
tokio::fs::remove_dir_all(&tmp_var).await?;
|
||||
}
|
||||
crate::disk::mount::util::bind(&tmp_var, "/var/tmp", false).await?;
|
||||
let tmp_docker = cfg
|
||||
.datadir()
|
||||
.join(format!("package-data/tmp/{CONTAINER_TOOL}"));
|
||||
crate::disk::mount::util::bind(&tmp_docker, CONTAINER_DATADIR, false).await?;
|
||||
init_tmp.complete();
|
||||
|
||||
set_governor.start();
|
||||
|
||||
@@ -151,7 +151,7 @@ impl HashSessionToken {
|
||||
pub fn new() -> Self {
|
||||
Self::from_token(InternedString::intern(
|
||||
base32::encode(
|
||||
base32::Alphabet::RFC4648 { padding: false },
|
||||
base32::Alphabet::Rfc4648 { padding: false },
|
||||
&rand::random::<[u8; 16]>(),
|
||||
)
|
||||
.to_lowercase(),
|
||||
@@ -200,7 +200,7 @@ impl HashSessionToken {
|
||||
hasher.update(token.as_bytes());
|
||||
InternedString::intern(
|
||||
base32::encode(
|
||||
base32::Alphabet::RFC4648 { padding: false },
|
||||
base32::Alphabet::Rfc4648 { padding: false },
|
||||
hasher.finalize().as_slice(),
|
||||
)
|
||||
.to_lowercase(),
|
||||
|
||||
@@ -253,7 +253,7 @@ fn cert_send(cert: &X509, hostname: &Hostname) -> Result<Response, Error> {
|
||||
.header(
|
||||
http::header::ETAG,
|
||||
base32::encode(
|
||||
base32::Alphabet::RFC4648 { padding: false },
|
||||
base32::Alphabet::Rfc4648 { padding: false },
|
||||
&*cert.digest(MessageDigest::sha256())?,
|
||||
)
|
||||
.to_lowercase(),
|
||||
@@ -338,8 +338,7 @@ impl FileData {
|
||||
.any(|e| e == "gzip")
|
||||
.then_some("gzip");
|
||||
|
||||
let file = open_file(path)
|
||||
.await?;
|
||||
let file = open_file(path).await?;
|
||||
let metadata = file
|
||||
.metadata()
|
||||
.await
|
||||
@@ -439,6 +438,6 @@ fn e_tag(path: &Path, modified: impl AsRef<[u8]>) -> String {
|
||||
let res = hasher.finalize();
|
||||
format!(
|
||||
"\"{}\"",
|
||||
base32::encode(base32::Alphabet::RFC4648 { padding: false }, res.as_slice()).to_lowercase()
|
||||
base32::encode(base32::Alphabet::Rfc4648 { padding: false }, res.as_slice()).to_lowercase()
|
||||
)
|
||||
}
|
||||
|
||||
@@ -279,7 +279,7 @@ impl FullProgressTracker {
|
||||
.mutate(|v| {
|
||||
if let Some(p) = deref(v) {
|
||||
p.ser(&progress)?;
|
||||
Ok(false)
|
||||
Ok(progress.overall.is_complete())
|
||||
} else {
|
||||
Ok(true)
|
||||
}
|
||||
|
||||
@@ -206,7 +206,7 @@ impl<R: AsyncRead + AsyncSeek + Unpin + Send + Sync> S9pkReader<R> {
|
||||
(
|
||||
Some(hash),
|
||||
Some(base32::encode(
|
||||
base32::Alphabet::RFC4648 { padding: false },
|
||||
base32::Alphabet::Rfc4648 { padding: false },
|
||||
hash.as_slice(),
|
||||
)),
|
||||
)
|
||||
|
||||
@@ -32,10 +32,14 @@ use crate::util::Invoke;
|
||||
|
||||
#[cfg(not(feature = "docker"))]
|
||||
pub const CONTAINER_TOOL: &str = "podman";
|
||||
|
||||
#[cfg(feature = "docker")]
|
||||
pub const CONTAINER_TOOL: &str = "docker";
|
||||
|
||||
#[cfg(feature = "docker")]
|
||||
pub const CONTAINER_DATADIR: &str = "/var/lib/docker";
|
||||
#[cfg(not(feature = "docker"))]
|
||||
pub const CONTAINER_DATADIR: &str = "/var/lib/containers";
|
||||
|
||||
pub struct SqfsDir {
|
||||
path: PathBuf,
|
||||
tmpdir: Arc<TmpDir>,
|
||||
|
||||
@@ -374,9 +374,11 @@ impl Service {
|
||||
entry.as_icon_mut().ser(&icon)?;
|
||||
// TODO: marketplace url
|
||||
// TODO: dependency info
|
||||
|
||||
Ok(())
|
||||
})
|
||||
.await?;
|
||||
|
||||
Ok(service)
|
||||
}
|
||||
|
||||
|
||||
@@ -294,9 +294,12 @@ impl ServiceMap {
|
||||
.into(),
|
||||
);
|
||||
}
|
||||
drop(service);
|
||||
|
||||
sync_progress_task.await.map_err(|_| {
|
||||
Error::new(eyre!("progress sync task panicked"), ErrorKind::Unknown)
|
||||
})??;
|
||||
|
||||
Ok(())
|
||||
})
|
||||
.boxed())
|
||||
|
||||
@@ -20,7 +20,6 @@ impl Handler<Restart> for ServiceActor {
|
||||
.except::<DependencyConfig>()
|
||||
}
|
||||
async fn handle(&mut self, _: Guid, _: Restart, jobs: &BackgroundJobQueue) -> Self::Response {
|
||||
dbg!("here");
|
||||
// So Need a handle to just a single field in the state
|
||||
let temp = TempDesiredRestore::new(&self.0.persistent_container.state);
|
||||
let mut current = self.0.persistent_container.state.subscribe();
|
||||
@@ -77,7 +76,6 @@ impl Handler<Restart> for ServiceActor {
|
||||
impl Service {
|
||||
#[instrument(skip_all)]
|
||||
pub async fn restart(&self, id: Guid) -> Result<(), Error> {
|
||||
dbg!("here");
|
||||
self.actor.send(id, Restart).await
|
||||
}
|
||||
}
|
||||
|
||||
@@ -781,7 +781,7 @@ pub struct TmpDir {
|
||||
impl TmpDir {
|
||||
pub async fn new() -> Result<Self, Error> {
|
||||
let path = Path::new("/var/tmp/startos").join(base32::encode(
|
||||
base32::Alphabet::RFC4648 { padding: false },
|
||||
base32::Alphabet::Rfc4648 { padding: false },
|
||||
&rand::random::<[u8; 8]>(),
|
||||
));
|
||||
if tokio::fs::metadata(&path).await.is_ok() {
|
||||
|
||||
@@ -644,7 +644,7 @@ pub fn new_guid() -> InternedString {
|
||||
let mut buf = [0; 20];
|
||||
rand::thread_rng().fill_bytes(&mut buf);
|
||||
InternedString::intern(base32::encode(
|
||||
base32::Alphabet::RFC4648 { padding: false },
|
||||
base32::Alphabet::Rfc4648 { padding: false },
|
||||
&buf,
|
||||
))
|
||||
}
|
||||
|
||||
@@ -958,7 +958,7 @@ impl<T: AsRef<[u8]>> std::fmt::Display for Base16<T> {
|
||||
pub struct Base32<T>(pub T);
|
||||
impl<T: AsRef<[u8]>> std::fmt::Display for Base32<T> {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
base32::encode(base32::Alphabet::RFC4648 { padding: true }, self.0.as_ref()).fmt(f)
|
||||
base32::encode(base32::Alphabet::Rfc4648 { padding: true }, self.0.as_ref()).fmt(f)
|
||||
}
|
||||
}
|
||||
impl<'de, T: TryFrom<Vec<u8>>> Deserialize<'de> for Base32<T> {
|
||||
@@ -967,7 +967,7 @@ impl<'de, T: TryFrom<Vec<u8>>> Deserialize<'de> for Base32<T> {
|
||||
D: Deserializer<'de>,
|
||||
{
|
||||
let s = String::deserialize(deserializer)?;
|
||||
base32::decode(base32::Alphabet::RFC4648 { padding: true }, &s)
|
||||
base32::decode(base32::Alphabet::Rfc4648 { padding: true }, &s)
|
||||
.ok_or_else(|| {
|
||||
serde::de::Error::invalid_value(
|
||||
serde::de::Unexpected::Str(&s),
|
||||
|
||||
Reference in New Issue
Block a user