From nobody Sun Jun 14 20:17:58 2026 X-Original-To: hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4gdl1b1CPlz6hN0k for ; Sun, 14 Jun 2026 20:18:11 +0000 (UTC) (envelope-from vadimnuclight@gmail.com) Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gdl1Y6291z3CSm for ; Sun, 14 Jun 2026 20:18:09 +0000 (UTC) (envelope-from vadimnuclight@gmail.com) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20251104 header.b=lmsvNZL8; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of vadimnuclight@gmail.com designates 2a00:1450:4864:20::130 as permitted sender) smtp.mailfrom=vadimnuclight@gmail.com Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-5aa61e3d3f3so2068835e87.0 for ; Sun, 14 Jun 2026 13:18:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1781468283; x=1782073083; darn=freebsd.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=YBBeTwI4fpcm4aB/1Yks1CXnGZOfOWShX0Zjb/1NZzI=; b=lmsvNZL80l9irRz2dqQFpHofBqoSQLUlA9AEKBomLLMI4XPrickngh89gc+i09szpC btbNboMu+5UxOHXFYHFZmxcKtOZzy07N7dYgFw72V1cOz122OTFEO/ei2IrOY9fuuP7i iHx7q/kGx/8OfiukZAJ/nmXDZQd2ATY9Kd+gkj5vb/wT9WEAJKv8MqULyHe4aipU+KSK lznbJsjOipJKRAVjxoUC/1Yov3772NF+yIWjv9T0Fzs0fePYJCn8z/enKS0aR5RUnpgV YrY/7dS02ld3MCLXfUoXuxWPkwKngxpKi2OWQdFKWTsgZ0ZoWatZk4f/KzfxgI6yDZJR cf3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781468283; x=1782073083; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=YBBeTwI4fpcm4aB/1Yks1CXnGZOfOWShX0Zjb/1NZzI=; b=ebpT1wn1jEPzi9rxBh1maiPidaPQhZ4A0jUMqiO2+yoGKo+MBJ8sjraNE4BkYzOJml Rk5jJ75sZM5ySygNz5WRq9S0u4+lCAzxXXUE87KgkCqYqBDO5RnWwWqGS/mNxjmgnmIv gLpAMC0IaJ/4UtsaRjL6W4YDfYn49ke80fs4nUb4JQbficAmSQUZDKQjM0UmHjLH1S9P cMYkjBx5EYs9C6ym6q5dX0KELPuGx2dih5/b/rtUXSKeGZUp4qGtOehLNFtSCxMbLmla qNhUBfmDZrHKyHoFv8YuKkLWSnJR1AjDZLLUvE2sdcxsjEGkGKKfIFMlqP1IFzK8bDQ6 5zCw== X-Forwarded-Encrypted: i=1; AFNElJ/kk5ZL/UH5GiU7RhdMCaHkhzsvqIiHoFvTnBN2cnk6+hPMlFFiemll7YyAeTm8KabtXoBfcje1@freebsd.org X-Gm-Message-State: AOJu0YxMuArueKC7suQvgCy34phozKwQ5oBS9W5GQuCVbHQTpq613FZ/ r7eXsQOpNWHwnAMHNm9NmP/wDGptNdeE5ka8WtZrkDE25s+PKSnR65O+LVWvHA== X-Gm-Gg: Acq92OGhCCQErJbup3dIHGbherccXIC0XrJYOGDRda2ajgYAY9t2TlQTo1lWDrUgpsK GbbGdzHxcp6BrdOVUYSjisjQhGA0eE30wWZHaISR+yCJK3Z1natHEWplagpEa5YBqcwfE/HtFL0 hJHGAZ9lwo3x6JxEo0HWuraVf5PkBbH7ZEkOynWEUN0iVFJbTsn67H2fuzTfhFy7h9b9gZ3sfKK Y2dK1OddDENNGv7XkGvuMlsD0bDkRWIVfW8f+/FxoRyJq+JSVGVFqb7YAnNA/pCaOQ0xgz+grwU xydHldAIbbGeLqG8Bp0tcF4AC1gs69AG9BfocjVPnqUhwCtd7rd+d3UTFjevkY5AlXC3DH5+KsX fht589aaG+H2AyzyNL4KEsIKRszdLfvkFd4YAwEGfNv6bOUmbSPayyS+s92ssa9Lht7iCSzVhwD RNq7nPtgRGaG+wXhEwzxX7nZhbIRsQ9MrxZr5dydPL1lIIv+roSFJ5P2h9xtYDKBTk X-Received: by 2002:a05:6512:61af:b0:5aa:684d:3c75 with SMTP id 2adb3069b0e04-5ad2db1baa6mr2941582e87.10.1781468282805; Sun, 14 Jun 2026 13:18:02 -0700 (PDT) Received: from nuclight.lan (broadband-77-37-180-76.ip.moscow.rt.ru. [77.37.180.76]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5ad2e1b08d4sm2142772e87.66.2026.06.14.13.18.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jun 2026 13:18:02 -0700 (PDT) Date: Sun, 14 Jun 2026 23:17:58 +0300 From: Vadim Goncharov To: =?UTF-8?B?Q8OpbGVzdGU=?= Ornato Cc: Baptiste Daroussin , hackers@FreeBSD.org Subject: Re: rcd(8) - new service manager daemon Message-ID: <20260614231758.11402680@nuclight.lan> In-Reply-To: <86pl1sap93.fsf@gmail.com> References: <86pl1sap93.fsf@gmail.com> X-Mailer: Claws Mail 4.4.0 (GTK 3.24.52; amd64-portbld-freebsd13.5) List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-4.00 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-0.999]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20251104]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4864::/56]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; FREEMAIL_TO(0.00)[gmail.com]; ARC_NA(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; FREEMAIL_FROM(0.00)[gmail.com]; DKIM_TRACE(0.00)[gmail.com:+]; FROM_HAS_DN(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; PREVIOUSLY_DELIVERED(0.00)[hackers@freebsd.org]; TAGGED_RCPT(0.00)[]; MLMMJ_DEST(0.00)[hackers@freebsd.org]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::130:from] X-Spamd-Bar: --- X-Rspamd-Queue-Id: 4gdl1Y6291z3CSm On Sun, 14 Jun 2026 21:36:08 +0200 C=C3=A9leste Ornato wrote: > Hi, >=20 > This is honestly great! I must admit the long bootup times - while > *fine* - have always been kind of annoying, and having something > backwards-compatible that improves on that (and, I assume, is generally > more modern) is very appealing to me. I will be testing it ASAP. >=20 > Do you have an estimate as to how much time is saved from specifically > the parallelisation? Presumably not many. My patches for /bin/sh were eccepted in 2013 when I've used them to add `-p` flag to rcorder to give lists of scripts before barri= ers to be started parallel. I gave up on it when found it does not give much sp= eed up, probably because synchronization needed for barriers anyway. Later years where attempts from others to teach `rcorder` and that lead to nothing official, probably due to same reasons. What is interesting in this project is not that parallel boot but that it brings us *good* parts of systemd without it's *bad* parts (hopefully :) did not look at code but description looks promising and at least it avoids sys= temd error of being PID 1). For example, seems the many-years voices blaming of sshd(8) being dependent on LOGIN instead of started as early as possible to make remote server accessible (thus repairable!) if something goes bad late= r in boot process, now can just tweak dependency in configuration of units (inst= ead of patching hardcoded values which every OS update will rewrite). Using UCL is also much more better than systemd's ancient INI-shitstyle for= mat of units, pdfork/procctl/other FreeBSD-native interfaces much more better than ugly systemd's requirement for service to not fork and leave stderr fd pointing to daemon, and so on etc. =20 > Baptiste Daroussin writes: >=20 > > Hello everyone > > > > I have been working for the past years on rcd(8), a new service manager > > daemon for FreeBSD, some of you might recall a presentation in french 15 > > years ago or some discussion in BSDcam also that old! > > I would like to start a discussion about its integration into the tree. > > > > What is rcd? > > > > rcd(8) is a service manager daemon called by init(8) (in place of > > /etc/rc). It reads service definitions from UCL unit files > > (/etc/rcd.d/*.ucl), builds a dependency DAG, and starts services in > > parallel. After boot completes, it forks to background and stays > > running as a supervision daemon (automatically restarting failed > > services and accepting control commands via a UNIX socket). > > > > Key features: > > > > - Parallel boot via dependency DAG (no more serial rc.d execution) > > - Process tracking via pdfork(2) descriptors (no PID file races) > > - Subreaper via procctl(2) (no orphaned process escape) > > - Socket activation (pre-bound sockets passed via fd inheritance) > > - Resource control per service via rctl(2) > > - Service isolation via native jail(2) integration > > - OOM protection via procctl(2) PROC_SPROTECT > > - UCL-based unit files (JSON Schema validated) > > - Embedded Lua interpreter for inline service hooks > > - Template units for per-instance services (e.g., dhclient@em0) > > - Safe in-place binary upgrade (SIGUSR1: save state, re-exec) > > - Per-service access control on the control socket > > - Suspend/resume support > > > > User interface: rcctl(8) > > > > Service management is done via rcctl(8): > > > > rcctl start sshd > > rcctl enable sshd > > rcctl restart dhclient@em0 netif@em1 > > rcctl status > > rcctl show nginx > > > > 100% backward compatibility > > > > This is a hard requirement: rcd must work on existing FreeBSD systems > > without modifying any rc.d scripts or configuration files. Here is how > > this is achieved: > > > > 1) rcd scans /etc/rc.d/ and /usr/local/etc/rc.d/ for existing > > rc.d scripts, parses their PROVIDE/REQUIRE/BEFORE/KEYWORD headers > > (same format as rcorder(8)), reads rc.conf(5) to determine the > > enabled state, and wraps each script as a virtual "legacy" unit > > in the dependency graph. > > > > 2) Legacy scripts are auto-classified during loading: > > - Scripts with pidfile=3D or command=3D -> "legacy-forking" units, > > tracked by rcd-exec(8) sub-reaper without pidfiles. > > - Scripts with only comments/blank lines -> barrier units. > > - Scripts without rcvar=3D are always enabled. > > > > 3) All rcctl(8) commands are passed through to the script directly: > > rcctl reload sshd -> /bin/sh /etc/rc.d/sshd reload > > > > 4) Template instances preserve the traditional calling convention: > > rcctl restart netif@em0 netif@em1 =20 > > -> /bin/sh /etc/rc.d/netif restart em0 em1 =20 > > > > 5) rcd reads /etc/defaults/rc.conf, /etc/rc.conf and > > /etc/rc.conf.local to determine legacy service enablement. > > > > The result: you can install rcd on a running system, reboot, and > > everything works exactly as before -- except boot is faster because > > services start in parallel where the dependency graph allows. > > > > Current status and what I need > > > > I would like to commit this to main soon so that people can start > > testing it on their machines. The initial commit will include: > > > > - sbin/rcd/ -- the daemon, rcd-exec helper, unit tests > > - sbin/rcctl/ -- the control utility > > - Man pages: rcd.8, rcctl.8, rcd.conf.5, rcd.d.5, rcd-lua.3, > > rcd-exec.8 > > > > It will NOT change init(8) or /etc/rc yet. rcd will be built and > > installed but not activated by default. To test, you will be able to > > run it manually or configure via kenv(8) to replace /etc/rc. > > > > Migration path > > > > The plan for a smooth transition: > > > > - 1 (now): Commit rcd(8) and rcctl(8) to the tree. Build by > > default, but not activated. Early adopters can test. > > > > - 2 (later): Commit init(8) changes to call rcd when present (falling > > back to /etc/rc otherwise). Provide a /etc/rc wrapper that invokes > > rcd for systems that want to switch. > > > > - In the meantime: convert base system rc.d scripts to native > > UCL unit files adding the norcd keywords to the rc.d so that they > > are not read anymore by rcd(8). > > > > - Ultimately: rc.d -> unit files, at the pace each maintainer sees fit. > > There is no deadline; rc.d scripts are supported as long as needed. > > > > The code lives there: > > https://reviews.freebsd.org/D56835 > > > > Baptiste =20 >=20 --=20 WBR, @nuclight