atuinsh / atuin

✨ Magical shell history
https://atuin.sh
MIT License
20.84k stars 562 forks source link

Systemd file not working #2280

Open sascha-wi opened 4 months ago

sascha-wi commented 4 months ago

What did you expect to happen?

Easy to set up atuin self-hosted server

What happened?

When starting the server it gives gibberish error: (atuin)[38065]: atuin-server.service: Failed at step NAMESPACE spawning atuin: No such file or directory (atuin)[545]: atuin-server.service: Failed to set up mount namespacing: /run/systemd/unit-root/etc/atuin: No such file or directory

cat /etc/systemd/system/atuin-server.service
[Unit]
Description=Start the Atuin server syncing service
After=network-online.target
Wants=network-online.target systemd-networkd-wait-online.service

[Service]
ExecStart=atuin server start
Restart=on-failure
User=atuin
Group=atuin

Environment=ATUIN_CONFIG_DIR=/etc/atuin
ReadWritePaths=/etc/atuin

# Hardening options
CapabilityBoundingSet=
AmbientCapabilities=
NoNewPrivileges=true
ProtectHome=true
ProtectSystem=strict
ProtectKernelTunables=true
ProtectKernelModules=true
ProtectControlGroups=true
PrivateTmp=true
PrivateDevices=true
LockPersonality=true

[Install]
WantedBy=multi-user.target

Atuin doctor output

Atuin Doctor
Checking for diagnostics

Please include the output below with any bug reports or issues

{
  "atuin": {
    "version": "18.3.0",
    "sync": null,
    "sqlite_version": "3.44.0"
  },
  "shell": {
    "name": "bash",
    "default": "bash",
    "plugins": [
      "atuin",
      "bash-preexec"
    ],
    "preexec": "bash-preexec"
  },
  "system": {
    "os": "Debian GNU/Linux",
    "arch": "x86_64",
    "version": "12",
    "disks": [
      {
        "name": "/dev/vda1",
        "filesystem": "ext4"
      }
    ]
  }
}

Code of Conduct

sascha-wi commented 3 months ago

I assume the error lies somewhere here: Environment=ATUIN_CONFIG_DIR=/etc/atuin ReadWritePaths=/etc/atuin

What do I need to set these variables to when I install atuin through cargo? Can you please update your self-hosting documentation?

ghostheory commented 3 months ago

@sascha-wi I got this working, but it was a bit of a mess.

I installed atuin using the install script with my normal user (on a ubuntu headless server in my homelab) which dropped the atuin binary into the ~/.atuin/bin directory, which is not at all helpful for getting the server going.

So, I was getting the same error you are seeing above. To get this thing to run I had to:

Basically, the documentation needs to be updated to outline the process here (or something that at least alerts users to the nuances of running your own sync server as a systemd service).

I can do that if the admins want me to (I don't remember if this is FOSS/licensed for contributors, but I am guessing that it is).

sascha-wi commented 3 months ago

Wow what a hassle, I got i working with your instructions. Would be really nice if somebody can edit the documentation.

ghostheory commented 3 months ago

Glad to hear you got it running. If I find time this month I might sniff around and see if I can bother to do this.