On an RHEL 7.8 installed system, I am able to install snapd and also install a program using snapd.
However, I’m trying to do both of those within a RHEL7 kickstart post script so I can install all my packages in an automated process.
I’m able to install snapd via RPMs within the kickstart script, but the problem I have later is that when I try to snap ack the new program, I get the following error:
error: cannot assert: cannot communicate with server: Post http://localhost/v2/assertions: dial unix /run/snapd.socket: connection refused.
I believe this is because the systemctl enable --now snapd.socket command I’m running is failing since (apparently) you cannot run systemctl commands within the kickstart post chroot environment.
Is there a non-systemctl command I can run to set up the sockets in this environment?
Right, that’s because the commands are actually executed in a chroot as far as I remember.
I think you could prepare the seed for snapd. On the first run, snapd will load up all the snap files and their metadata and install them in the system. This is how for instance the LXD snapd is set up in Ubuntu Cloud images.
Unfortunately, there’s not much documentation about building the seed from scratch. Apparently this was investigated before right there Seed.yaml documentation and even someone wrote a blog post on setting up the seed Seed.yaml documentation though it seems to be a bit outdated.