You are not logged in.
I'm running Timeshift and using grub-btrfsd to update grub automatically when new snapshots appear to allow bootable snapshots.
I'm trying to use a script to change the line that says
ExecStart=/usr/bin/grub-btrfsd --syslog /.snapshots
with
ExecStart=/usr/bin/grub-btrfsd -t
It's easy enough to do manually, but I want to use a script to change it so I can add it to my arch install script.
So I tried by doing this:
systemctl edit --stdin grub-btrfsd << EOF
[Service]
Type=simple
LogLevelMax=notice
# Set the possible paths for `grub-mkconfig`
Environment="PATH=/sbin:/bin:/usr/sbin:/usr/bin"
# Load environment variables from the configuration
EnvironmentFile=/etc/default/grub-btrfs/config
# Start the daemon, usage of it is:
# grub-btrfsd [-h, --help] [-t, --timeshift-auto] [-l, --log-file LOG_FILE] SNAPSHOTS_DIRS
# SNAPSHOTS_DIRS Snapshot directories to watch, without effect when --timeshift-a>
# Optional arguments:
# -t, --timeshift-auto Automatically detect Timeshifts snapshot directory
# -o, --timeshift-old Activate for timeshift versions <22.06
# -l, --log-file Specify a logfile to write to
# -v, --verbose Let the log of the daemon be more verbose
# -s, --syslog Write to syslog
ExecStart=/usr/bin/grub-btrfsd -t
EOF
Upon restarting the service it says:
Failed to restart grub-btrfsd.service: Unit grub-btrfsd.service has a bad unit file setting.
See system logs and 'systemctl status grub-btrfsd.service' for details.
So,
# systemctl status grub-btrfsd.service
● grub-btrfsd.service - Regenerate grub-btrfs.cfg
Loaded: bad-setting (Reason: Unit grub-btrfsd.service has a bad unit file setting.)
Drop-In: /etc/systemd/system/grub-btrfsd.service.d
└─override.conf
Active: active (running) since Wed 2025-03-05 08:40:44 EST; 2h 53min ago
Invocation: 141b1923c6b5453abb93dc8b01997bc6
Main PID: 563 (bash)
Tasks: 3 (limit: 9020)
Memory: 5.2M (peak: 6.1M)
CPU: 18ms
CGroup: /system.slice/grub-btrfsd.service
├─563 bash /usr/bin/grub-btrfsd -t
├─569 bash /usr/bin/grub-btrfsd -t
└─664 inotifywait -q -q -e create -e delete /run/timeshift
Mar 05 11:32:46 Arch-Linux systemd[1]: /etc/systemd/system/grub-btrfsd.service.d/override.conf:145: Missing '=', ignoring line.
Mar 05 11:32:46 Arch-Linux systemd[1]: /etc/systemd/system/grub-btrfsd.service.d/override.conf:146: Missing '=', ignoring line.
Mar 05 11:32:46 Arch-Linux systemd[1]: /etc/systemd/system/grub-btrfsd.service.d/override.conf:150: Missing '=', ignoring line.
Mar 05 11:32:46 Arch-Linux systemd[1]: /etc/systemd/system/grub-btrfsd.service.d/override.conf:151: Missing '=', ignoring line.
Mar 05 11:32:46 Arch-Linux systemd[1]: /etc/systemd/system/grub-btrfsd.service.d/override.conf:152: Missing '=', ignoring line.
Mar 05 11:32:46 Arch-Linux systemd[1]: /etc/systemd/system/grub-btrfsd.service.d/override.conf:153: Missing '=', ignoring line.
Mar 05 11:32:46 Arch-Linux systemd[1]: /etc/systemd/system/grub-btrfsd.service.d/override.conf:154: Missing '=', ignoring line.
Mar 05 11:32:46 Arch-Linux systemd[1]: /etc/systemd/system/grub-btrfsd.service.d/override.conf:155: Missing '=', ignoring line.
Mar 05 11:32:46 Arch-Linux systemd[1]: /etc/systemd/system/grub-btrfsd.service.d/override.conf:156: Missing '=', ignoring line.
Mar 05 11:32:46 Arch-Linux systemd[1]: grub-btrfsd.service: Service has more than one ExecStart= setting, which is only allowed for Type=oneshot services. Refusing.
Clearly there can't be more than one 'ExecStar=' setting as it says. So I'm wondering how I can edit this with an override file and make it work in a script without have to resort to manual internvention.
Last edited by bedtime (2025-03-05 20:39:23)
Offline
systemctl edit --stdin grub-btrfsd << EOF
"systemctl edit" does not what you think. Without `--full` option it edits drop-in snippet, not a full unit. See `edit` command description in man systemctl.
To override ExecStart option with drop-in you have to clear existing ExecStart list first, i.e.
[Service]
...
ExecStart=
ExecStart=new_command_here
EDIT: use `systemctl cat <unit>` to see actual settings.
Last edited by dimich (2025-03-05 17:34:56)
Offline
bedtime wrote:systemctl edit --stdin grub-btrfsd << EOF
"systemctl edit" does not what you think. Without `--full` option it edits drop-in snippet, not a full unit. See `edit` command description in man systemctl.
To override ExecStart option with drop-in you have to clear existing ExecStart list first, i.e.
[Service] ... ExecStart= ExecStart=new_command_here
EDIT: use `systemctl cat <unit>` to see actual settings.
Thank you so much. It all makes sense now. I was wondering why I was seeing this 'ExecStart=' around.
[SOLVED!]
Offline