Score:0

cloud-init messages cluttering login screen in Ubuntu Server 22.04

kn flag

I'm sorry to bring this up again as I know this question has been asked a few times before as shown here, here and here.

These solutions have worked excellently for me right up until 22.04, but now despite following the same instructions I cannot get these messages to away, as shown in this screenshot:

cloud-init messages on login tty:

cloud-init messages on login tty

Has the configuration of cloud-init changed in 22.04? Is there another way to fix this?

To be clear, I don't want to disable cloud-init, I want its initialization to stop cluttering my login screen.

Artur Meinild avatar
vn flag
This was the sane on Ubuntu 20.04. I removed the service entirely..
Artur Meinild avatar
vn flag
Does this answer your question? [How can I disable cloud-init?](https://askubuntu.com/questions/405442/how-can-i-disable-cloud-init)
Davorian avatar
kn flag
Thanks guys, but I don't particularly want to disable cloud-init. I know I don't need it, and that this is pedantry at its best, but I'd just like to duplicate the behaviour that seemed to work successfully on previous versions of Ubuntu. After much messing around I found something that *appears* to work, however. See below.
Score:1
kn flag

So after much messing around and trying to wrap my head around the inner workings of systemd after reading DigitalOcean's rather excellent guide, I essentially tried the reverse of the previous recommendations. Instead of instructing getty@tty not to start until cloud-init had finished, I asked cloud-init not to allow getty@tty to start until it had finished (if that makes sense).

In detail, this means I made a directory called cloud-init.service.d within which I made a .conf file that looks like this:

[Unit]

Before=getty@tt1.service

This appears to work, though in theory this should be logically equivalent to the previous solutions. Anyhow I hope this helps others with the same problem.

Any further comments or clarifications would be appreciated.

Artur Meinild avatar
vn flag
Good solution, if you indeed still want to have cloud-init running.
Score:0
jp flag

If you want cloud-init to run and to not write to the console then you can change the Systemd setting for StandardOutput for the cloud-init service files.

One method to do this is to create an override file. This snippet will change the setting for the services cloud-init-local.service, cloud-init.service, cloud-config.service, and cloud-final.service.

for i in init-local init config final ; do 
  mkdir -p /etc/systemd/system/cloud-${i}.service.d
  cat <<EOF > /etc/systemd/system/cloud-${i}.service.d/override.conf
[Service]
StandardOutput=journal
EOF
done
systemctl daemon-reload

This might have negative consequences because the service files include the comment

Output needs to appear in instance console output

I don't know why the output needs to be written to the console but the commit history says

write stdout to tty so it shows up in GetConsoleOutput

GetConsoleOutput appears to be an Amazon EC2 call, so writing to console might be a way for cloud-init to provide information to users with cloud servers.

Davorian avatar
kn flag
Thanks for that, very interesting and I'll keep it in mind. Surely there's got to be a better way for them to get information to Amazon EC2 without writing to the actual tty1 console, but then I'm not a cloud computing expert so maybe not.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.