Fix a problem that caused an "unable to set working directory: no such file
or directory (os error 2)" error before every login prompt.
The reason for this is that greetd starts agreety as the "greeter" user.
The working directory for the newly created process is, by default,
"/home/greeter", which does not exist (per our instructions).
* gnu/services/base.scm (greetd-accounts)[home-directory]: Set to /var/empty
[shell]: Set to /sbin/nologin.
Change-Id: I6d971968e8b6a7825c261d4695caf0dd70127e5d
Signed-off-by: Danny Milosavljevic <dannym@friendly-machines.com>
Use of ‘G_’ was added in 670d985cab but
it’s actually unbound.
* gnu/services/base.scm (network-set-up/linux): Remove uses of ‘G_’,
which is unbound.
Change-Id: I6e879688ceee2fcb738e5e213cd3d539c9d89e20
This factorizes out the remaining bashrc bits from /etc/skel/.bashrc to a the
template used for both /etc/bashrc on Guix System and ~/.bashrc for
home-bash-service-type.
Rationale: The use of /etc/skel introduce state: the file is only copied
originally when the user account is created, and never (automatically)
refreshed again.
* gnu/system.scm (operating-system-etc-service):
<profile>: Guard against souring /etc/bashrc in non-interactive, SSH case.
<bashrc>: Use %default-bashrc, having migrated the remaining definitions to...
* gnu/system/shadow.scm (%default-bashrc): ... here. Factorize aliases to...
* gnu/services.scm (%default-bash-aliases): ... here.
(%default-bashrc-d-aliases): New variable.
(%default-etc-bashrc-d-files): Include it in the default configuration.
* gnu/services/base.scm (%base-services): Register etc-bashrc-d-service-type.
* gnu/home/services/shells.scm (add-bash-configuration): Do not set PS1, now
part of %default-bashrc.
(home-bash-configuration) [guix-defaults?]: Update doc.
[aliases]: Set %default-bash-aliases as the default value. Update doc.
* doc/guix.texi (Shells Home Services): Update documentation.
(Service Reference): Update example.
Change-Id: I340c614983a78fd20a9c4a9705e7fc542ae9b513
This is a more correct fix to CDROM/DVDROM events/auto-mounting than was made
in the now-reverted commit 670724edcf ("gnu: eudev: Fix optical discs
detection/auto-mounting.")
This changes causes the 60-block.rules udev rules file shipped with eudev to
correctly set the default polling period to 2000 ms on block devices, which is
necessary for kernel events to be fired for CDROM drives for example. To
validate it is set:
# cat /sys/module/block/parameters/events_dfl_poll_msecs
2000
Before, it would return 0.
* gnu/services/base.scm (udev-shepherd-service): <#:start>: Add a 'udevadm
trigger --change=add --type=subsystems' invocation, so that it also creates
subsystem nodes, as done in Void Linux or LinuxFromScratch init scripts for
example.
* gnu/tests/base.scm (run-basic-test): Add test.
Fixes: <https://issues.guix.gnu.org/35584>
Change-Id: Idc0eb5640163b27e41b72cc0c1885412a60805c1
One possible solution for an issue when /etc/guix/acl file exists, but points
to a non-existent location. This can for example happen if one is
reinitializing the system, and remove only /gnu/store and /var/guix, keep the
rest okay. This is a major advantage of guix as compared to other distros that
usually need you to reinitialize the whole root partition. But this will leave
the user with acl file pointing to non-existent location. The file-exists?
procedure will return #f for broken symbolic links.
I think that another reason one would get this issue is, if one was booted in
a live iso, chrooted, fixing their system. They would switch generations to
one with different acl file, delete other generations gc rooting the original
acl file and then gc. One could do this approach for example when recovering
from file corruptions in the store, to get rid of the unsubstitutable paths
that can't be repaired with guix gc --verify.
This fixes the issue by looking for type of a file through lstat, instead of
relying on file-exists?. If the symlink is a broken symlink, it is
removed. Other than that the old behavior is kept:
- If regular file, back it up
- If symlink pointing to the store, remove it
- If symlink not pointing to the store, back it up
* gnu/services/base.scm (substitute-key-authorization): Check if acl file is a
possibly-dangling symbolic link.
Change-Id: I2f8170606b2f4afeea48f04acfd738b04cafc7cf
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Modified-by: Ludovic Courtès <ludo@gnu.org>
This re-introduces commit dd64f441d3, which had
been reverted due to previously causing a system hang when debug? was enabled,
a problem that appears to have been resolved within Shepherd.
* gnu/services/base.scm (<udev-configuration>): <debug?>: New field.
* gnu/services/base.scm (udev-shepherd-service): Use it to add '--debug' to
the command line, if applicable.
* doc/guix.texi (Base Services): Document it.
Change-Id: I88243fb4f321ff0876dd227e3c2b22082d37cfcf
* gnu/services/base.scm (run-with-writable-store)
(guix-ownership-change-program): New procedures.
(<guix-configuration>)[privileged?]: New field.
(guix-shepherd-service): Rename to…
(guix-shepherd-services): … this. Add the ‘guix-ownership’ service.
Change ‘guix-daemon’ service to depend on it; when unprivileged,
prefix ‘daemon-command’ by ‘run-with-writable-store’ and
omit ‘--build-users-group’; adjust socket activation endpoints.
(guix-accounts): When unprivileged, create the “guix-daemon” user and
group in addition to the others.
(guix-service-type)[extensions]: Adjust to name change.
* gnu/tests/base.scm (run-guix-daemon-test): Add ‘name’ parameter.
(%test-guix-daemon): Adjust accordingly.
(%test-guix-daemon-unprivileged): New test.
* doc/guix.texi (Base Services): Document ‘privileged?’.
(Migrating to the Unprivileged Daemon): Explain that this is automatic
on Guix System.
Reviewed-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Change-Id: I28a9a22e617416c551dccb24e43a253b544ba163
Prior to this change, only the udev rules installed to eudev's prefix were
consulted by tools such as udevadm, leading to problems such as when
configuring network interfaces, or attempting to override its default rules.
While our custom eudev patch adding support for the EUDEV_RULES_DIRECTORY
environment variable could have been refined to take precedence over the
package's configured udevrulesdir, this was not pursued for the following
reasons:
1. Due to eudev's using inotify to detect new rules, the EUDEV_RULES_DIRECTORY
is fixed in Guix System, per commit e9fa17eb98 ("services: udev: Use a fixed
location for the rules directory and config.")
2. Users would have had to set EUDEV_RULES_DIRECTORY to the fixed directory
themselves to have udevadm work as expected, which is inconvenient.
3. This simple solution is already implemented and tested in NixPkgs.
* gnu/packages/linux.scm (eudev) [source]: Remove custom patch.
[arguments] <#:make-flags>: New argument.
<#:phases>: Override install phase to alter installation make flags.
* gnu/services/base.scm (udev-shepherd-service): Do not set
EUDEV_RULES_DIRECTORY environment variable.
* gnu/packages/patches/eudev-rules-directory.patch: Delete file.
* gnu/local.mk (dist_patch_DATA): De-register it.
Fixes: https://issues.guix.gnu.org/63508
Reported-by: Felix Lechner <felix.lechner@lease-up.com>
Change-Id: Ib8698f4b452f6fd0951bcd71831705b1be85e6e0
This environment variable used to be honored by udevd, but that is no longer
the case (as shown by grepping its source).
* gnu/services/base.scm (udev-shepherd-service) <#:environment-variables>:
Remove UDEV_CONFIG_FILE.
Change-Id: I0828de76e8da429432bc0679903aa501c99625af
Reported by nigko on #guix:
https://logs.guix.gnu.org/guix/2025-04-05.log#201718
* gnu/services/base.scm (urandom-seed-shepherd-service): Return #f when
stopped.
Change-Id: I8212508e4a017270e4e9284b43170cd17999e8b4
* gnu/services/base.scm (guix-shepherd-service): Change ‘start’ to use
‘make-systemd-constructor’ in the default case. Remove now-redundant
code creating /var/guix/daemon-socket/. Adjust ‘stop’ method to use
‘make-systemd-destructor’ when appropriate.
Change-Id: I3572670c90f65509fbad01dcf13a60f772a86839
* gnu/services/base.scm (guix-shepherd-service): In ‘start’ method, use
‘fork+exec-command’ in the default case.
Change-Id: Id04d3d2651f89fbcdb2f17f027df91e132ff9ed1
* gnu/services/base.scm (guix-shepherd-service): In ‘start’ method,
move ‘fork+exec-command/container’ arguments to the new variables
‘daemon-command’ and ‘environment-variables’.
Change-Id: Ic04a1006849697e4e185ad94185bbdec8a91a05a
This reinstates c83bfc0415, which had been
reverted in 8c483c12e9 in response to
<https://issues.guix.gnu.org/76315>.
* gnu/services/base.scm (%base-services): Replace ‘syslog-service-type’
by ‘shepherd-system-log-service-type’.
* doc/guix.texi (Base Services): Update ‘syslog-service-type’
documentation.
(Shepherd Services): Mention that ‘system-log-service-type’ is in
‘%base-services’. Add anchor.
Reviewed-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Change-Id: I21082300f6a052865a6ab1bdff27fbe71f73d492
* gnu/services/base.scm (<udev-configuration>): <debug?>: New field.
* gnu/services/base.scm (udev-shepherd-service): Use it to add '--debug' to
the command line, if applicable.
* doc/guix.texi (Base Services): Document it.
Change-Id: I88243fb4f321ff0876dd227e3c2b22082d37cfcf
The parameter should take the values #t, #f or 'default.
In a container environment, 'default amounts to #f, otherwise it
amounts to #t.
* gnu/services/base.scm (guix-configuration)<chroot?>: New field.
(guix-shepherd-service): If chroot? is #f, add "--disable-chroot".
If it is #t or 'default, do nothing.
* gnu/system/linux-container.scm (containerized-operating-system):
If chroot? is 'default, replace it by #f.
* doc/guix.texi: Document the parameter.
Change-Id: I8b9c3f46ad8650fa6ed4acee947b4ae5d002d03d
This was erroneously renamed during the review of commit
ee0d1b144c ("services: greetd: Improve greeter configurations."). The field
*adds* to the intrinsic requirements of the service, so the 'extra-' prefixes
communicates this better.
* gnu/services/base.scm (<greetd-terminal-configuration>): Rename
shepherd-requirement field to extra-shepherd-requirement.
* doc/guix.texi (Base Services): Adjust doc accordingly.
Change-Id: I4b970bdd63864ed86d61fde9cad2487a293417ce
Fixes a bug introduced in ee0d1b144c where
reconfiguring a system with ‘greetd-service-type’ would fail with:
guix system: error: mkdir: File exists "/run/user".
* gnu/services/base.scm (greetd-run-user-activation): Replace mkdir with mkdir-p.
Change-Id: I030d1f57c3292c518b3f17061f75258e8a72141c
This improvement focuses on providing common user session scripts
for use by multiple greeters. Now user session entry point is
factored out into '<greetd-user-session>', which can be reused
as is with different greeters. By default it uses 'bash' as
first user process. Then user normally starts additional programs
with '.profile' or '.bashrc'. Using 'command', 'command-args' and
'extra-env' one can specify something else, which could be
'dbus-session' wrapped process, some desktop environment or else.
While the above is possible, one is still encouraged to use
'.bashrc', '.profile' or similar.
It also fixes incorrect use of 'XDG_RUNTIME_DIR' for 'wlgreet'.
'wlgreet' requires a compositor to run. We provide common sway based
greeter script, which can be shared by other graphical greeters.
* gnu/services/base.scm (<greetd-user-session>): Common user session
factored out, for shared use by multiple greeters.
(<greetd-agreety-session>): Switch to common user session.
(<greetd-wlgreet-configuration>): Refactor 'wlgreet' configuration.
(<greetd-wlgreet-sway-session>): Switch to common user session.
(<greetd-terminal-configuration>): Add 'extra-shepherd-requirement'
for establishing configurable Shepherd service dependency.
* gnu/tests/desktop.scm (%minimal-services): Reflect configuration
changes.
* doc/guix.texi (Base Services): Document refactoring changes.
Change-Id: I9d45a592b355eb9c438be5b1d4d15555ce4956fa
Modified-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Fixes <https://issues.guix.gnu.org/71173>.
* gnu/services/base.scm (network-set-up/linux): Define
‘max-set-up-duration’ and use it.
* gnu/tests/networking.scm (%static-networking-with-nonexistent-device):
New variable.
(run-static-networking-failure-test): New procedure.
(%test-static-networking-failure): New variable.
Change-Id: Idba9b36750aa8c6368c8f6d1bc1358066f7432e4
Running that code in PID 1 was fun but it’s not really beneficial and
somewhat risky: risk of blocking, file descriptor leak, inability to
reload Guile-Netlink in shepherd when it’s upgraded, and so on.
This change runs set-up and tear-down as separate processes, which, for
the price of one fork(1), buys us peace of mind.
* gnu/services/base.scm (network-set-up/hurd, network-tear-down/hurd)
(network-tear-down/linux): Use ‘program-file’ instead of ‘scheme-file’.
(network-set-up/linux): Likewise, and remove #:blocking? argument to
‘wait-for-link’.
Change-Id: Ia41479b50eab31ea40c67243fcb1cffe29ac874a
* gnu/services/base.scm (syslog-shepherd-service): Separate incorrectly
combined arguments which resulted in an argument like "-f
/etc/syslog.conf" being passed to syslogd, leading it to ignore the
argument and execute without a configuration file. Effects of this
included no log files being written, though the Shepherd service ran
successfully.
Ref: https://issues.guix.gnu.org/70677#4-lineno7
Change-Id: I3dbe00eabd4a10804e554c12e1466483c0b185b7
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* gnu/services/base.scm (syslog-shepherd-service): Change flag for designating
configuration file. The long option is not compatible with rsyslog while the
short is; switch to the short one.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
* gnu/services/base.scm (<syslog-configuration>): Add extra-options field.
(syslog-shepherd-service): Use it when running the service.
* doc/guix.texi: Document it.
Change-Id: I540d070b9a9678b45ec9fa28d6fdc761f9b3fd9a
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
For auto-login on systems with elogind, dbus-system needs to be started. This
commit adds ability to express that ordering.
* gnu/services/base.scm (<mingetty-configuration>): Add shepherd-requirement
field.
(mingetty-shepherd-service): Use it.
* doc/guix.texi (Base Services)<mingetty-configuration>: Document it.
Change-Id: Iedbdc4375180740379d561aa193d7c63350d2e7b
Modified-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Rename the accessors to ensure all start with `mingetty-configuration-'
prefix. Some were named just `mingetty-$FIELD', instead of
`mingetty-configuration-$FIELD'.
The renaming *is* backwards compatible, since in the define-module's #:export
argument the correct (`mingetty-configuration-$FIELD') were used already and
thus the accessors were not accessible.
* gnu/services/base.scm (<mingetty-configuration>): Rename accessors for
auto-login, login-program, login-pause?, clear-on-logout?.
Change-Id: I4557a82498805ade0b341feda9d33eccc305690f
Modified-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Not all aspects of mingetty were configurable, so this commit adds the
additional configuration fields to support that.
* gnu/services/base.scm (<mingetty-configuration>): Add delay, print-issue,
print-hostname, nice, working-directory, root-directory fields.
(mingetty-shepherd-service): Use the new fields.
(define-module)<#:export>: Export the new accessors.
* doc/guix.texi (Base Services)<mingetty-configuration>: Document the
additional field.
Change-Id: I4557a82498805ade0b341feda9d33eccc305690f
* gnu/services/base.scm (swap-service-type): Do not include 'udev' requirement
for the Hurd. Use system* with "swapon", "swapoff" for the Hurd.
* gnu/system.scm (hurd-default-essential-services): Add swap-services.
* gnu/services/base.scm (swap-service-type):
Change-Id: I1d4d445c614921752dc84aa0dd6ff42cdbf62aa8
Previously, when being stopped, the ‘user-file-systems’ service would
attempt to unmount / and /dev, which was bound to fail. This was
harmless, apart from a couple of lines in /var/log/messages, but it was
wrong.
* gnu/services/base.scm (file-system-shepherd-services)[user-unmount]:
Remove “/” and “/dev” from the list of file systems subject to
unmounting.
Change-Id: Ieb68fe46c114909a64d54f885c94a9d7cd61f5e0
Previously, the “running value” of the ‘host-name’ service would
be #<unspecified>. This change makes it more pleasing to the eye.
* gnu/services/base.scm (host-name-service-type): ‘start’ returns NAME.
Change-Id: I38b8320e43639b6623475871ca6fbad3a459eb59
In the absence of the /etc/guix/channels.scm file, %default-channels is used
anyway. If user manually (or by extra-special-file) created the file, we
should respect it. This commit therefore changes the default to #f, hopefully
having zero impact on people not actively using the `channels' field.
* gnu/services/base.scm (<guix-configuration>)[channels]: Set default to #f.
Change-Id: I516c1735a037a153fabbebfc337051aaf0be2155
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This is a followup to 7c27bd115b.
* gnu/services/base.scm (file-system-shepherd-service): Catch
'system-error from ‘umount’ call when FILE-SYSTEM is marked as
mount-may-fail.
Change-Id: I2234f8da320b43089f4ee058cad8608ce9c078f8
Add a mechanism to only require mounting a subset of file-system entries
during early Shepherd initialization. Any file-system with additional Shepherd
service requirements (e.g. networking) is not required to provision
'file-systems.
* gnu/services/base.scm (file-system-shepherd-service): Splice
file-system-requirements into the Shepherd service requirement list.
(file-system-shepherd-services): Provision 'file-system only when file system
services without additional Shepherd requirements are started.
* gnu/system/file-systems.scm (file-system): Add shepherd-requirements field
to the file-system record. This field is used for adding additional Shepherd
requirements to a file-system Shepherd service.
* doc/guix.texi: Add documentation for file-system shepherd-requirements.
Change-Id: If0392db03d48e8820aa53df1df482c12ec72e1a5
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This allows users to specify NSS plugins such as LDAP via the
‘name-services’ field of <nscd-configuration>. Failing that, user code
will dlopen whatever passwd/group plugins are listed in
/etc/nsswitch.conf, which is likely to fail, typically because those are
not in $LD_LIBRARY_PATH.
* gnu/services/base.scm (%nscd-default-caches): Add ‘passwd’ and ‘group’
caches.
Change-Id: I9c03346a1de2710685f7801eccd2e08007427f5d
The ‘action’ method was deprecated in Shepherd 0.10.0.
* gnu/services/base.scm (shepherd-set-http-proxy-action)
(shepherd-discover-action): Use ‘perform-service-action’ instead of the
now-deprecated ‘action’ method.
Change-Id: Ibe1c79a44148596292c2c8907011ec787f8a9ddd
It’s currently difficult to programmatically add a build-machine, because the
`service-extension' mechanism is the only facility which can do that. It
relies on the `guix-service-type', ala:
(service-extension guix-service-type
(guix-extension (build-machines (list ...))))
...but `guix-service-type' is already instantiated as part of
`%base-services', and replacing it may lose other configuration, like
substitute servers and authorized keys.
Additionally, a default value of `#f' for the build-machines field requires
guarding uses of the field with:
(or (guix-build-machines config) '())
Changing the default to be the empty list avoids that. One can now add
build-machines with code such as:
(modify-services %base-services
(guix-service-type
config =>
(guix-configuration
(inherit config)
(authorized-keys
(cons %build-machine-key
(guix-configuration-authorized-keys config)))
(build-machines (cons #~(build-machine ...)
(guix-configuration-build-machines config))))))
* gnu/services/base.scm (guix-configuration): Rename `guix-build-machines' to
`guix-configuration-build-machines' and export it. Change the default from
`#f' to the empty list.
* gnu/services/base.scm (guix-activation): Update the build-machines test and
reverse the conditions.
Change-Id: I6780c6a5579fd9d4b4f22ee2b2bf7ba7a0454407
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Previously, if /etc/guix/machines.scm was a dangling symlink, it would
be kept (because ‘file-exists?’ would return #f) and thus the following
‘symlink’ call would throw with EEXIST.
* gnu/services/base.scm (guix-machines-files-installation): Use ‘lstat’
rather than ‘file-exists?’.
Change-Id: I07c7eed842dacabbd19ae2a17ac3e59cf26e46b2