system-manager
system-manager copied to clipboard
systemPackages not available after reboot
I'm using it in Fedora Silverblue. Fixed SELinux issues with fix in #51
Services are installed and systemPackages are available.
~~1- should those be available only for root? (I can run using the path, and add the path later to the user, but just want to confirm)~~ (EDIT: forgot zsh quirks)
The main problem is that the /run folder is cleaned on boot (and the systemPackages are left in /run/system-manager/sw/bin/) and the service that creates it (system-manager-path.service) is of type oneshot, so it's not persisting.
2- So, is it possible to configure it so it will be always run? (and/or changing where it saves that bin folder?)
The one-shot service should run when you reboot and recreate the needed symlinks in /run. I'm not sure why it's not working on fedora, but this is not a distro that I tested before, as explained in the readme.
If you want to investigate this further, the first step would be to check why the one-shot service is not being started.
So. I had to learn and understand a few things, and now I see that the question is a little bit weird, since type "oneshot" is not what I thought it was.
I'm using this installer btw: https://github.com/DeterminateSystems/nix-installer
Because of how silverblue works, it creates a nix.mount service to mount /var/home/nix to /nix.
The problem:
Inspecting the journal logs, it tries to parse all services and can't find the system-manager services because the symlinks chain to /nix that is not there yet.
This is basically the core problem when running it.
And anything made through system-manager will fall under the same problem.
I don't know if its possible to make those links point to /var/home/nix from some config.
And I'm not sure I want to mess with creating a post-switch script to "fix" the links in /etc/.system-manager-static/ rewriting them to point to the /var/home/nix/ path.
The hack I managed to was to create this:
sudo tee /etc/systemd/system/nix-ready.service <<EOF
[Unit]
Description=Restart system-manager after /nix is mounted
Requires=nix.mount
After=nix.mount
[Service]
Type=oneshot
ExecStart=/usr/bin/systemctl start system-manager.target
# if with 4/permission problems
#ExecStart=sh -c "/usr/bin/systemctl start system-manager.target"
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl enable --now nix-ready.service
This simply waits the mount to "manually" run the system-manager.target, which works for the foo.service.
From what I played around, you would need to add "system-manager.target" to wantedBy to any service you create, maybe add to the nix-ready.service any other services that are auto installed and not working.
I did try mounting /nix on /etc/fstab instead from the service, but then started getting other errors and couldn't make it work...