Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System messages are printed over tuigreet #68

Closed
gnull opened this issue Jun 14, 2022 · 37 comments
Closed

System messages are printed over tuigreet #68

gnull opened this issue Jun 14, 2022 · 37 comments
Labels
wontfix This will not be worked on

Comments

@gnull
Copy link

gnull commented Jun 14, 2022

The systemd-networkd-wait-online service often fails on my machine on startup. When it does so, Systemd writes

systemd[1]: Failed to start Wait for Network to be Configured.

to the system journal and that gets printed to some of the consoles (not sure which ones and how it works). If this happens when I'm in Tuigreet, the messages gets printed right over the Tuigreed interface. In my case the message fills the password field (that's where the cursor is).

Could Tuigreet somehow disable printing of system log messages to the console it works in? (And maybe reenable it when Tuigreet quits.)

I'm using tuigreet 0.7.3 running Archlinux.

@UltraBlackLinux
Copy link

You should generalise this: All of grub bleeds into tuigreet, for me a few of the bottom grub lines cover parts of tuigreet.

@gnull
Copy link
Author

gnull commented Jun 29, 2022

There's a chance this is not an issue for tuigreet, since it's logger daemons that are writing stuff to console. Users probably need to configure their systemd-journald to stop writing messages to console. After some quick googling, I couldn't find a way to disable the messages on just one specific console.

I would be nice though to have a paragraph in tuigreet docs explaining this.

@UltraBlackLinux
Copy link

I am facing this overflow issue since I removed the quiet option from grub. I really value seeing a log, so I won't disable that. I hope it can be fixed somehow.

@gnull
Copy link
Author

gnull commented Jul 6, 2022

I think I found a way to fix this. Do

[terminal]
# The VT to run the greeter on. Can be "next", "current" or a number
# designating the VT.
vt = next

in your greetd (not tuigreet) config. I can't reproduce the issue since I did this (but I don't have a reliable way of reproducing it, so I don't know how much that's worth).

I suspect that tty1 is the only one getting those error messages printed to it. So putting greetd on another tty might solve the problem.

Ivan

@gnull gnull closed this as completed Jul 6, 2022
@Occhioverde
Copy link

Personally, I am afraid that this change in Greetd's configuration does not really solve the problem.

My /etc/greetd/config.toml file is something like

[terminal]
vt = "next"

[default_session]
command = "tuigreet --remember --time --issue --asterisks --cmd sway"
user = "greeter"

while this is what Tuigreet looks like when I boot without the kernel quiet parameter:

SystemD Log bleeding in Tuigreet

@gnull
Copy link
Author

gnull commented Jul 7, 2022

You're right. I just saw some error messages with vt = "next" and quiet in kernel parameters. So the issue still exists.

@gnull gnull reopened this Jul 7, 2022
@apognu
Copy link
Owner

apognu commented Jul 7, 2022

I feel you, and I have the same issue from time to time. Unfortunately, I have no idea if and how this could be solved, the same issue happens to me with any console program I invoke.

Short of rewriting the whole screen, including whitespace, at every frame, I don't see a solution.

If anyone has an idea within the scope of tuigreet, I'm all ears, but for now, I'm blank. A root program, if it wants to write on a tty, will write on a tty, there is little I can do.

@UltraBlackLinux
Copy link

It might be worth looking at ly. They are kinda doing the same thing as tuigreet but different, and they don't have the problem described here.

I have no experience in using C, but you might be able to find what updates their screen. My best guess currently is the very bottom of the file

@foopsss
Copy link

foopsss commented Jul 22, 2022

I followed a suggestion given on Arch forums and the log messages on tuigreet seem to be gone.

Basically, redirect all the logs to a different TTY than the one you are using to boot tuigreet.

EDIT: after a reboot, the issue was still there with this method.

@gnull
Copy link
Author

gnull commented Jul 22, 2022 via email

@Occhioverde
Copy link

Finally, after reading lots of threads and trying out different possible solutions, I found out that SystemD stops printing its status messages (like it was started with the quiet parameter) upon receiving SIGRTMIN+21 and then restarts doing it when a SIGRTMIN+20 signal is sent (Source: https://man.archlinux.org/man/systemd.1#SIGNALS).

So I created a file named /usr/lib/systemd/system/greetd.service.d/00-nobleed.conf, I pasted into it the following content and restarted my machine:

[Service]
ExecStartPre=kill -SIGRTMIN+21 1
ExecStopPost=kill -SIGRTMIN+20 1

Thanks to this modification, SystemD stops printing its log before launching greetd (and tuigreet along with it) restarting it only after the login screen is closed.

I'm not entirely sure that this solution can stop error messages too from being printed over tuigreet, but for now this is the best workaround I was able to find.

@foopsss
Copy link

foopsss commented Jul 22, 2022

Lucas,

Do the journald messages still go away when you remove quiet kernel
commandline argument? (I.e. remove it from /etc/default/grub, do
grub-mkconfig and reboot.)

For me, the above still produces the messages over tuigreet
interface. Although with quiet set I don't see anything (maybe I
haven't testing it enough).

Ivan

Hello.

It seems I rushed a bit with my first comment, because the log messages came back after a full reboot with the workaround I posted before. My apologies.

I also tried what you asked me to do. After three reboots, I've seen no log messages over the tuigreet prompt every time I tried to log in. However, I did not have the quiet flag set in my GRUB config before.

I'll wait a few more days, and, if the log messages come again, I'll try the workaround proposed by occhioverde and report back.

My tuigreet version is 0.7.2. Cheers.

@DotIN13
Copy link

DotIN13 commented Aug 4, 2022

I tried @Occhioverde's solution and it seemed to have worked. The logs and errors are gone now, will report again if it comes back.

EDIT: @foopsss's suggestion I also tried, but no luck though.

@Lorilandly
Copy link

@apognu What about adding an option, for example by pressing F5, to allow user to manually update the screen?
Screen bleeding is a common issue for tui applications, and many solves it by allowing a manual update, e.g., vim refresh the screen with CTL_L.

@e-l-i-j-a-h
Copy link

IMG_20221115_114307.jpg

I'm having a similar issue. I'll try the fixes above and see if they work.

@DotIN13
Copy link

DotIN13 commented Nov 16, 2022

I tried @Occhioverde's solution and it seemed to have worked. The logs and errors are gone now, will report again if it comes back.

EDIT: @foopsss's suggestion I also tried, but no luck though.

After sometime, I reverted the changes from @Occhioverde's solution as I happened needed to check the systemd logs at the login screen as my system won't boot into desktop environment. So I had to boot into a livecd and delete the lines in the service file. I guess it's just hard to get them all, debuggability and cleanliness.

@Yakkhini
Copy link

Here is a more elegant way to fix this problem. Inspired by @UltraBlackLinux and I checked ly's repo to find how did they fix this issue. In #4ab41f0 I found that they just change service file with "Type = idle".

In getty - ArchWiki, 2.3.1, a small tip point out how it works:

The option Type=idle found in the default getty@.service will delay the service startup until all jobs (state change requests to units) are completed in order to avoid polluting the login prompt with boot-up messages. When starting X automatically, it may be useful to start getty@tty1.service immediately by adding Type=simple into the drop-in file. Both the init system and startx can be silenced to avoid the interleaving of their messages during boot-up.

—— Tip, 2.3.1, getty - ArchWiki

Then I add a new line "Type=idle" in greetd.service file.

yakkhini@20221231161109

And tuigreet looks fine after restart.

@octvs
Copy link

octvs commented Feb 15, 2023

And tuigreet looks fine after restart.

I wonder if I'm alone in this, but this doesn't solve the issue for me.

I saw the exact error msgs as @literal-line above.

Edit: I don't think it is related to this issue but I got it fixed with setting up the silent boot.

@paulolieuthier
Copy link

Setting Type=idle in greetd.service file gets rid of Systemd logs, but there is still log from the kernel. What fixed it for me was to reduce the kernel log level, as explained here: https://superuser.com/questions/351387/how-to-stop-kernel-messages-from-flooding-my-console.

@sjcobb2022
Copy link

sjcobb2022 commented Jun 11, 2023

I found this config from some thread on reddit. For working with NixOS.

Here is the original post. I've been using it in my config and it works like a charm.

  # this is a life saver.
  # literally no documentation about this anywhere.
  # might be good to write about this...
  # https://www.reddit.com/r/NixOS/comments/u0cdpi/tuigreet_with_xmonad_how/
  systemd.services.greetd.serviceConfig = {
    Type = "idle";
    StandardInput = "tty";
    StandardOutput = "tty";
    StandardError = "journal"; # Without this errors will spam on screen
    # Without these bootlogs will spam on screen
    TTYReset = true;
    TTYVHangup = true;
    TTYVTDisallocate = true;
  };

Edit: An example config for arch. I actually haven't tested this one but based on other systemd configs i've seen it should work.

# /etc/systemd/system/greetd.d/no_spam.conf
[Service]
Type = "idle"
StandardOutput = "tty"
# Without this errors will spam on screen
StandardError = "journal"
# Without these bootlogs will spam on screen
TTYReset = true
TTYVHangup = true
TTYVTDisallocate = true

The arch wiki says systemctl edit unit --drop-in=drop_in_name is the easiest way to create new configs for your systemd

@farbeiza
Copy link

farbeiza commented Sep 24, 2023

As an idea, why not making ESC key clear and redraw the whole screen?

@Chess3D
Copy link

Chess3D commented Dec 19, 2023

I was having the same problem in Arch and fixed it using by adding the below systemd config with systemctl edit greetd --drop-in=quite

# /etc/systemd/system/greetd.service.d/quite.conf
[Unit]
After=getty@tty2.service

[Service]
Type=idle
StandardInput=tty
TTYPath=/dev/tty2
TTYReset=yes
TTYVHangup=yes

@apognu
Copy link
Owner

apognu commented Jan 2, 2024

A comment on Reddit seems to have had some luck with these systemd directives in the greetd service:

Type=idle
StandardInput=tty
StandardOutput=tty
StandardError=journal
TTYReset=true
TTYVHangup=true
TTYVTDisallocate=true

I can't really reproduce the issue on my systems, but if someone wants to give it a try, have at it.

@sjcobb2022
Copy link

A comment on Reddit seems to have had some luck with these systemd directives in the greetd service:

Type=idle
StandardInput=tty
StandardOutput=tty
StandardError=journal
TTYReset=true
TTYVHangup=true
TTYVTDisallocate=true

I can't really reproduce the issue on my systems, but if someone wants to give it a try, have at it.

This is what I have in my system config. It works very well and I do not have any spam on my screen.

philipwilk added a commit to philipwilk/nixconf that referenced this issue Jan 21, 2024
@deviantsemicolon
Copy link

I found this config from some thread on reddit. For working with NixOS.

Here is the original post. I've been using it in my config and it works like a charm.

  # this is a life saver.
  # literally no documentation about this anywhere.
  # might be good to write about this...
  # https://www.reddit.com/r/NixOS/comments/u0cdpi/tuigreet_with_xmonad_how/
  systemd.services.greetd.serviceConfig = {
    Type = "idle";
    StandardInput = "tty";
    StandardOutput = "tty";
    StandardError = "journal"; # Without this errors will spam on screen
    # Without these bootlogs will spam on screen
    TTYReset = true;
    TTYVHangup = true;
    TTYVTDisallocate = true;
  };

Edit: An example config for arch. I actually haven't tested this one but based on other systemd configs i've seen it should work.

# /etc/systemd/system/greetd.d/no_spam.conf
[Service]
Type = "idle"
StandardOutput = "tty"
# Without this errors will spam on screen
StandardError = "journal"
# Without these bootlogs will spam on screen
TTYReset = true
TTYVHangup = true
TTYVTDisallocate = true

The arch wiki says systemctl edit unit --drop-in=drop_in_name is the easiest way to create new configs for your systemd

the nix thing works perfectly. thank you so much

@medv
Copy link

medv commented Mar 18, 2024

This is one of the greatest solutions I've ever seen. The source is a lonely comment sourcing another post. That post is a 0 upvote question by someone new to linux.

And now our tuigreet is fixed.

@tmccombs
Copy link

Is there any chance this could merged into greetd?

Or maybe have tuigreet send the signals described in #68 (comment) to systemd as part of tuigreet itself?

@apognu
Copy link
Owner

apognu commented Apr 23, 2024

I do not think this should be the responsibility of tuigreet to do that, unfortunately.

@sjcobb2022
Copy link

It should be the responsibility of the packaging system (e.g. AUR or nixpkgs), correct @apognu?

@apognu
Copy link
Owner

apognu commented Apr 23, 2024

In my opinion, yes. But one precision: the responsibility of the package that actually starts a service, so in our case greetd. ŧuigreet. The issue there is that greetd needs to cater to a lot of greeters.

I could add a drop-in systed override for greetd in our package to include the aforementioned directives, but I do not know how I feel that installing service B actively changes system configuration for service A. Happy to discuss, though.

@tmccombs
Copy link

tmccombs commented Apr 24, 2024

Another possible solution is to set console=tty1 on the kernel commandline so that console output only goes to tty1 instead of all ttys.

I haven't confirmed this actually fixes the problem yet though.

Edit: This doesn't seem to work. Although I don't know why.

@johanbluecreek
Copy link

I tried the override dropins on Gentoo with systemd, and it does not solve the problem. The particular journal entries that show up for me are the messages from the docker daemon starting containers.

@sjcobb2022
Copy link

I tried the override dropins on Gentoo with systemd, and it does not solve the problem. The particular journal entries that show up for me are the messages from the docker daemon starting containers.

Could start greetd.service after docker. Would add a little bit of boot time but remove the logs.

@apognu
Copy link
Owner

apognu commented Sep 16, 2024

Even though I sympathize with people encountering this issue, I do not think this is tuigreet's fault and am unsure if I can prevent that. After all, the Linux consoles are shared resources, and if things are writing to it, they will appear.

I will not lock discussion but will close this.

I will still monitor responses just in case something comes up.

@apognu apognu closed this as completed Sep 16, 2024
@apognu apognu added the wontfix This will not be worked on label Sep 16, 2024
@apognu apognu changed the title Systemd error message gets printed over Yuigreet interface System messages are printed over tuigreet Sep 16, 2024
@apognu apognu pinned this issue Sep 16, 2024
@Yakkhini
Copy link

Glad to see this issue finally closed and the typo in title fixed. ;)

Thanks for concerning from apognu and all you guys.

@medv
Copy link

medv commented Sep 16, 2024

It was consistently fixed with the above solution, but has returned after several updates.

This is a fine outcome. Knowing it is not a simple issue and not the result of my incompetence, it's really not that much of an eyesore. tuigreet is still a net positive in my config and morning routine, thank you @apognu.

@timon-schelling
Copy link

I like tuigreet but this drove me crazy. My final solution was running tuigreet in a minimal desktop environment. tuigreet inside rio terminal inside cage wayland compositor

see https://github.com/timon-schelling/timonos/blob/535220b36dd6c37f85988d6df9552271b3eb2372/src/system/desktop/login/system.nix#L15

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests