Hi there,
still messing around finding the perfect ignintion file configuration for myself.
I love using tools like btop on my FCOS system so at the moment i am already installing these tools right at OS-installation time via ignition file via rpm-ostree install
To get a even more cleaner OS i am asking myself if it is possible to perform at system installation time via ignition file
Install applications like btop via sudo yum install btop right from the start
I know i can use toolbox create maybe but is it possible to trigger commands inside of the toolbox from “the outside”?
Is my plan good practice or is there no reason for now trying to shift my “convenience applications” i even want to keep on an FCOS system into toolbox
May 08 05:34:14 blackpearl toolbox[1359]: Error: failed to get the user config directory
May 08 05:34:14 blackpearl systemd[1]: toolbox-prepare.service: Main process exited, code=exited, status=1/FAILURE
May 08 05:34:14 blackpearl systemd[1]: toolbox-prepare.service: Failed with result 'exit-code'.```
Shifting the unit to multi-user.target and specifying User= for the unit ends up in the following error
May 08 06:11:19 blackpearl systemd[1]: Starting toolbox-prepare.service - Create toolbox and install convenience applications...
May 08 06:11:19 blackpearl toolbox[1619]: Error: failed to create runtime directory toolbox: mkdir toolbox: operation not permitted
May 08 06:11:19 blackpearl systemd[1]: toolbox-prepare.service: Main process exited, code=exited, status=1/FAILURE
systemd:
units:
# Create Toolbox and Preinstall applications
- name: toolbox-prepare.service
enabled: true
contents: |
[Unit]
Description=Create toolbox and install convenience applications
# Run after all other services
Wants=multi-user.target
After=multi-user.target
[Service]
# Very important otherwise config directory can not be found
User=core
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/toolbox -y create
ExecStart=/bin/toolbox -y run sudo yum -y install btop inxi pciutils ncdu vim neofetch fzf
[Install]
WantedBy=multi-user.target
I think you are nearly there. You might want to try installing the service as a user service instead, which is described here in the documentation. Don’t forget to enable lingering, else it wont be executed on boot. I tried your service locally as a user service and it seems to work (I removed the User=core line).
You also want to add a check to the service so it is only executed on the first boot, else it will try to create a toolbox on every boot. For that see this documentation page.