Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
cloud-init and systemd
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
spott
Tux's lil' helper
Tux's lil' helper


Joined: 07 Mar 2004
Posts: 76

PostPosted: Sun Sep 04, 2022 3:23 am    Post subject: cloud-init and systemd Reply with quote

I'm trying to build a gentoo guest for a Proxmox host for use with terraform/ansible: I'm essentially trying to create a gentoo template for use in future vms.

Part of this process is getting cloud-init to work (to make my life with terraform/ansible much simpler). Because my playing with linux is mostly about learning, I want to use systemd because pretty much every other distro that I might use for work uses systemd.

Unfortunately, cloud-init seems to depend on a generator in order to make systemd work... and open-rc prevents generators from running (I believe? That is what I understand from this section of the wiki on systemd: https://wiki.gentoo.org/wiki/Systemd#OpenRC_services).

The problem I have is that simply enabling the relevant systemd services:

/lib/systemd/system/cloud-config.service
/lib/systemd/system/cloud-init-local.service
/lib/systemd/system/cloud-init.service
/lib/systemd/system/cloud-final.service

(after linking them to /etc/systemd/system/) prevents the system from booting.

I'm aware that I'm using systemd in this process in order to learn systemd... so how to make this work is beyond me at the moment. Does anyone have any ideas on how to make this work?

(And if this isn't the right section of the forum to post in, let me know and I can attempt to move it).
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21633

PostPosted: Sun Sep 04, 2022 3:22 pm    Post subject: Re: cloud-init and systemd Reply with quote

spott wrote:
Unfortunately, cloud-init seems to depend on a generator in order to make systemd work...
What generator is required here? As I read the Wiki page, it just says that systemd does not support running openrc init scripts, and that doing so would cause so much trouble that it was deemed better to lock out those scripts. Users of systemd will therefore need a purpose-built systemd unit file to do the work that would otherwise be done by the initscript. Such a unit file, being written for systemd and hopefully by someone who knows what they're doing, would integrate better and work properly.
spott wrote:
The problem I have is that simply enabling the relevant systemd services:

/lib/systemd/system/cloud-config.service
/lib/systemd/system/cloud-init-local.service
/lib/systemd/system/cloud-init.service
/lib/systemd/system/cloud-final.service

(after linking them to /etc/systemd/system/) prevents the system from booting.
What does the system do instead? "It does not work" leaves us with a variety of potential failure modes. If we knew more about how it failed, we might be able to offer better advice. Does the kernel panic because systemd died? Does systemd not offer login services, so you cannot get a shell to control the system? Does the network not come up? Does the system appear to finish initializing (but fail to be usable) or does it get blocked somewhere, in a way that indicates that with infinite patience, it might eventually be ready?
spott wrote:
(And if this isn't the right section of the forum to post in, let me know and I can attempt to move it).
Moving is restricted to moderators and above - but feel free to use the Report link to report your thread and request a move. Networking&Security seems fine to me, but I or one of the other moderators will be happy to send it elsewhere if that's what you want.
Back to top
View user's profile Send private message
spott
Tux's lil' helper
Tux's lil' helper


Joined: 07 Mar 2004
Posts: 76

PostPosted: Sun Sep 04, 2022 5:47 pm    Post subject: Reply with quote

Quote:
What generator is required here?


Sorry, I should have linked the documentation for cloud-init. Here: https://cloudinit.readthedocs.io/en/latest/topics/boot.html Is the boot sequence for cloud-init. The first step of that is running the generator at /lib/systemd/system-generators/cloud-init-generator, which I *believe* isn't done, though I don't know enough about either openrc or systemd to know that for sure.

Quote:
Users of systemd will therefore need a purpose-built systemd unit file to do the work that would otherwise be done by the initscript. Such a unit file, being written for systemd and hopefully by someone who knows what they're doing, would integrate better and work properly.


This makes sense, however it raises two questions for me: #1 How do I write said systemd unit file? (Is there some resource you can point me to?) and #2 Does that mean that there is a bug in the cloud-init package that should be recorded somewhere as it doesn't appear to work with systemd out of the box?

Quote:
What does the system do instead?


It fails to boot. I believe the last message that I see on boot up is something about vlans and then it just hangs. Booting in recovery mode and disabling the services is necessary to boot.

Starting the services manually after boot in the order given in the documentation (systemctl start cloud-init-local.service, systemctl start cloud-init.service) does spit out some useful things in the logs... specifically (I probably should have tried this last night before posting here):

Code:
[52167.233312] cloud-init[1693]: 2022-09-04 17:42:03,759 - gentoo.py[ERROR]: Cloud-init does not support systemd with gentoo


So I guess that answers the questions. Is there a way to report a bug about this? I feel like there should be some sort of notice to make this more obvious when installing it.[/code][/quote]
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21633

PostPosted: Sun Sep 04, 2022 6:39 pm    Post subject: Reply with quote

spott wrote:
This makes sense, however it raises two questions for me: #1 How do I write said systemd unit file?
I think you should not need to. The unit file would be the same for all systemd users, so it makes more sense for this file to be maintained either in Gentoo or upstream.
spott wrote:
(Is there some resource you can point me to?)
I do not use systemd, so no. Perhaps someone more familiar with it can help you here.
spott wrote:
#2 Does that mean that there is a bug in the cloud-init package that should be recorded somewhere as it doesn't appear to work with systemd out of the box?
Since you found a way to make it fail to boot, and the system requires recovery mode to get out of it, and as I understand your report, you reached that broken mode by following the published instructions, I would definitely classify this as a bug. Users should not be specifically guided into a broken configuration.
spott wrote:
It fails to boot. I believe the last message that I see on boot up is something about vlans and then it just hangs.
That is unpleasant. Is there any way to increase log verbosity? Are there any tunables you can use to make it not use VLANs, in the hope that avoiding that feature will get past this?
spott wrote:
Code:
[52167.233312] cloud-init[1693]: 2022-09-04 17:42:03,759 - gentoo.py[ERROR]: Cloud-init does not support systemd with gentoo
This seems rather useless. If cloud-init+systemd+gentoo is known broken, then there should not be a way to enable the units that cause this to fail.
spott wrote:
Is there a way to report a bug about this? I feel like there should be some sort of notice to make this more obvious when installing it.
Yes. Start with bugs.gentoo.org for the cloud-init package. The maintainer may refer you elsewhere, though.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum