Hi Ask Fedora Community,
I’m trying to layer local packages using an rpm-ostree install command similar to this Adding OS extensions to the host system :: Fedora Docs . The only difference is for my exec I’m using rpm-ostree install --apply-live --cache-only --allow-inactive --idempotent /var/tmp/$localfile.rpm.
However sadly when I run this I get the following error that I haven’t been able to find anywhere online:
rpm-ostree[2166]: error: Preparing D-Bus arguments: No such file or directory (os error 2).
I can run the command on the command line no problem. I need this to run as a one shot on first boot though to get my wifi tools installed to enable unattended setup.
My systemd unit file:
[Unit]
Description=Layer wifi rpm-ostree
# We run before `zincati.service` to avoid conflicting rpm-ostree
# transactions.
Wants=network-online.target
After=network-online.target
Before=zincati.service
ConditionPathExists=!/var/lib/%N.stamp
[Service]
Type=oneshot
RemainAfterExit=yes
# `--allow-inactive` ensures that rpm-ostree does not return an error
# if the package is already installed. This is useful if the package is
# added to the root image in a future Fedora CoreOS release as it will
# prevent the service from failing.
ExecStart=/usr/bin/rpm-ostree install --apply-live --cache-only --allow-inactive /var/tmp/*.rpm
ExecStart=/bin/touch /var/lib/%N.stamp
I’ve tried chaing exec start to hard code the timestamp name.
I’ve tried editing the rpm-ostree install command to contain a specific file in /var/tmp (which does exist).
I’ve tried with and without the “before zincatai” line
I’ve tried running by rebooting
I’ve tried running using systemctl start $service and the errors are the same when i do that
This is in the docs for layering but I can’t figure out why it doesn’t work for me unless I run the exec there on the cli.
Just a thought.
From the command line you may be running bash, and probably have $localfile.rpm defined.
That error says that there is ‘no such file or directory’.
The install is likely running sh or python
the install environment may not have $localfile.rpm defined
Either of those could easily prevent the use of variables without being very careful when and how they are defined & instantiated.
To clairfy I’m not actually using variables accept %N and I tried without that as well. $localfile was an example sorry for the confusion. You can see in the unit I’m using *.rpm (also tried with just NetworkManager-wifi-1.36.4-1.fc36.aarch64.rpm)
It does bring up a good point that perhaps its somehow not able to follow the path /var/tmp though i’m not sure how that could be.
Just going to the basics, it seems the starting point is that this unit doesn’t run when you try to start it via systemctl. You’ve probably already tried to look for guides on “debugging systemd unit files”, but How to debug systemd unit ExecStart - Server Fault may provide some ideas. You probably want to know whether the problem is your unit file specification, or is that the command can’t run at that point in time because it needs some infrastructure to be ready that isn’t yet. The “wrapper” approach might be the most useful. And of course the debugging process involves looking at some of the logs, but systemctl status ... is useful too.
Personally I suspect your systemd unit file is not structured properly, but I don’t think you pasted in the most recent version.
Most recent version. I should also note this unit file doesn’t work after the system is fully booted either. I can run the command in ExecStart no problem though. I also noted above that the errors are always from rpm-ostree nothing to do with errors in any other part of the unit file. Literally the only thing in the logs is that rpm-ostree error above and then a failed to start service message:
variant: fcos
version: 1.3.0
systemd:
units:
# Installing vim as a layered package with rpm-ostree
- name: rpm-ostree-install-wifi.service
enabled: true
contents: |
[Unit]
Description=Layer wifi rpm-ostree
# We run before `zincati.service` to avoid conflicting rpm-ostree
# transactions.
Wants=network-online.target
After=network-online.target
Before=zincati.service
After=dbus-broker.service
ConditionPathExists=!/var/lib/%N.stamp
[Service]
Type=oneshot
RemainAfterExit=yes
# `--allow-inactive` ensures that rpm-ostree does not return an error
# if the package is already installed. This is useful if the package is
# added to the root image in a future Fedora CoreOS release as it will
# prevent the service from failing.
ExecStart=/usr/bin/rpm-ostree install --apply-live --cache-only --allow-inactive --idempotent /var/tmp/*.rpm
ExecStart=/bin/touch /var/lib/%N.stamp
[Install]
WantedBy=multi-user.target
You have two ‘After’ specifications … the documentation calls for multiple service dependencies to be put on the same line, space separated. I haven’t found in my reading so far what happens when you have two Afters but often it seems the later one is taken over the earlier. Something to try unless you know the impact of specifying twice.
Thanks to all who gave me suggestions here. I’m guessing that in my testing I made a typo somewhere because it turns out this issue was caused by the blob expansion in the unit file. I’m sure I tested it with just one specific RPM but alas I must have failed to see another issue at the time.
Special thanks to @dustymabe for calling me out on that blob expansion again. This time when I fixed it with /usr/bin/bash -c “command” everything ‘just worked’.
Sorry I doubted you @grumpey I was sure I tested with an ExecStart that covered your concern (without a blob).