Bug 828007

Summary: --noclear on /sbin/agetty line in getty@.service/getty@tty1.service is ignored
Product: [Fedora] Fedora Reporter: Felix Miata <mrmazda>
Component: systemdAssignee: systemd-maint
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 17CC: johannbg, metherid, mschmidt, msekleta, notting, plautrba, systemd-maint
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-06-04 10:52:09 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Felix Miata 2012-06-04 01:03:44 UTC
Description of problem:
Cannot prevent clearing of boot messages on tty1 before login prompt appears, like used to be simple to do by adding --noclear to 1:2345:respawn:/sbin/mingetty tty1 line in /etc/inittab.

To Reproduce:
1.boot with '3 splash=verbose vga=794 video=1152x864@60' included on & 'quiet rhgb' excluded from cmdline
2.cd /etc/systemd/system/getty.target.wants
3.replace getty symlink with copy of getty@.service from /usr/lib/systemd/system/
4.s/ExecStart=-/sbin/agetty %I 38400/sbin/agetty --noclear %I 38400/ in getty
5.(optional) cp getty getty@.service
6.reboot
 
Actual results:
1-boot messages on tty1 disappear before login prompt appears

Expected results:
1-all boot messages able to fit above login prompt on tty1 remain visible

Additional info:
1.putting --noclear after %I 38400 doesn't work either.
2.agetty man page text: "--noclear Do not clear the screen before prompting for the login name (the screen is normally cleared)."
3.cf bug 791098, which this might depend on

Comment 1 Michal Schmidt 2012-06-04 10:52:09 UTC
The clearing of the console is done by systemd itself, because the unit asks for it with "TTYVTDisallocate=yes". Just set the option to "no". See "man systemd.exec".

Comment 2 Felix Miata 2012-06-04 12:41:47 UTC
Thanks for quickly responding. However, neither TTYVTDisallocate=no alone (nor TTYReset=no) in /etc/systemd/system/getty.target.wants/getty prevent tty1 from being cleared prior to display of prompt here in F17. Symlinking getty to getty@.service doesn't help either. Including --noclear on the /sbin/agetty line is required as well as TTYVTDisallocate=no, which makes it seem to me like there is something wrong with systemd - it doesn't look like "the clearing of the console is done by systemd" all by itself.

Comment 3 Michal Schmidt 2012-06-04 14:47:49 UTC
Both programs can clear the console.
With "TTYVTDisallocate=no" you ask systemd not to clear it.
With "/sbin/agetty --noclear" you ask agetty not to clear it.

Comment 4 Felix Miata 2012-06-04 17:33:24 UTC
Agetty defaults to clear (requires --noclear to not clear). Getty accepts the default.
TTYVTDisallocate defaults to no (do not clear), which getty rejects by setting to yes.

So, getty is twice causing clearing to occur. Why is that not a bug? Who that never reads this bug will ever figure out that two independent changes in the same config file are required to prevent tty1 from clearing?

Comment 5 Michal Schmidt 2012-06-06 09:39:16 UTC
Added --noclear to avoid redundant clearing of the VT:
http://cgit.freedesktop.org/systemd/systemd/commit/?id=3305d6806d428010b1cd2abd716aa1bb7f81311f

Comment 6 Felix Miata 2012-06-06 12:03:49 UTC
So now getty will have two lines set to cause non-default behavior so as to cause tty1 to clear by default. Why not do the opposite instead, by removing --noclear from the /sbin/agetty line, and either restoring TTYVTDisallocate to its default by changing the yes to no, or removing the TTYVTDisallocate line altogether?

How many ordinary tweakers, seeing --noclear on the /sbin/agetty line, and wanting tty1 to clear, will ever discover the cause of the clearing, with the explanation of the abstruse TTYVTDisallocate hidden away in the systemd.exec man page?

Does TTYVTDisallocate even need to exist? Don't all the alternatives to agetty that might be substituted for it in getty clear by default?

Maybe a comment regarding this unintuitive configuration needs to be included in /usr/lib/systemd/system/getty@.service?

Comment 7 Michal Schmidt 2012-06-06 12:56:02 UTC
(In reply to comment #6)
> Why not do the opposite instead, by removing --noclear from the /sbin/agetty
> line, and either restoring TTYVTDisallocate to its default by changing the yes
> to no, or removing the TTYVTDisallocate line altogether?

VT disallocation is a stronger operation that clearing. And vt_disallocate() in systemd falls back to clearing if disallocation cannot be performed for some reason.

> How many ordinary tweakers, seeing --noclear on the /sbin/agetty line, and
> wanting tty1 to clear, will ever discover the cause of the clearing, with
> the explanation of the abstruse TTYVTDisallocate hidden away in the
> systemd.exec man page?

Did you look at the git commit I linked to? There is a comment above the ExecStart line:
# the VT is cleared by TTYVTDisallocate

> Does TTYVTDisallocate even need to exist?

We could live without it, but it's nice to have and it's already there.

> Don't all the alternatives to agetty that might be substituted for it in
> getty clear by default?

I don't know and I don't care. I am not interested in alternatives to util-linux. We're unifying the OS platform, not supporting pointless differences. Whoever is substituting other software for agetty in the unit file can modify the value of TTYVTDisallocate too if really necessary.

Comment 8 Felix Miata 2012-06-06 13:22:39 UTC
(In reply to comment #7)
> Did you look at the git commit I linked to? There is a comment above the
> ExecStart line:
> # the VT is cleared by TTYVTDisallocate
 
As a non-programmer, I usually find patches incomprehensible, so am not in the habit of looking at them. This is one of the unusual cases where doing so would have precluded any need to comment or question further.

Comment 9 Fedora Update System 2012-06-13 00:14:47 UTC
systemd-44-13.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/systemd-44-13.fc17

Comment 10 Felix Miata 2012-06-15 14:35:10 UTC
I installed systemd-44-14 and systemd-sysv-44-14 from updates testing, modified the new /etc/systemd/system/getty@.service -> getty with TTYVTDisallocate=no, but still tty1 clears on boot. :-(

Comment 11 Michal Schmidt 2012-06-15 14:48:25 UTC
Did you do "systemctl daemon-reload" or reboot after modifying the unit file?

Comment 12 Felix Miata 2012-06-15 15:10:16 UTC
multiple reboots with same disappointing result

Comment 13 Michal Schmidt 2012-06-15 15:21:07 UTC
(In reply to comment #10)
> modified the new /etc/systemd/system/getty@.service -> getty

What exactly do you mean by this notation? Which file is a symlink to where? And which files did you edit?

Comment 14 Felix Miata 2012-06-15 15:32:35 UTC
I copied the new getty@.service from /usr/lib/systemd/system to /etc/systemd/system, changed its name to getty, made the edit, rebooted.

Comment 15 Michal Schmidt 2012-06-15 15:39:05 UTC
Hm, the method works for me.

What do you get from this command?:

 systemctl show -p ActiveState -p FragmentPath -p TTYVTDisallocate \
   getty

Comment 16 Michal Schmidt 2012-06-15 15:44:52 UTC
An alternative method, which also works for me, is saving this small file as /etc/systemd/system/getty :

.include /lib/systemd/system/getty@.service
[Service]
TTYVTDisallocate=no

Comment 17 Felix Miata 2012-06-15 16:11:28 UTC
(In reply to comment #15)
> What do you get from this command?:
 
> systemctl show -p ActiveState -p FragmentPath -p TTYVTDisallocate \
> getty

ActiveState=active
FragmentPath=/usr/lib/systemd/system/getty@.service
TTYVTDisallocate=yes

To be clear, there is purposely no longer any symlink between /usr/lib/systemd/system and /etc/systemd/system/getty.target.wants.

(In reply to comment #16)
> An alternative method, which also works for me, is saving this small file as
> /etc/systemd/system/getty :
 
> .include /lib/systemd/system/getty@.service
> [Service]
> TTYVTDisallocate=no

I tried the comment 16 suggestion after emptying /etc/system/systemd/getty.target.wants and recreating the symlink in it to /usr/lib/systemd/system/getty@service.
# ls -l /etc/systemd/system/getty.target.wants 
lrwxrwxrwx 1 root root 38 Jun 15 11:58 getty@.service -> /usr/lib/systemd/system/getty@.service
-rw-r--r-- 1 root root 78 Jun 15 12:00 getty

Still tty1 is clearing on boot.

Comment 18 Michal Schmidt 2012-06-15 21:28:12 UTC
(In reply to comment #17)
> FragmentPath=/usr/lib/systemd/system/getty@.service

This shows that the original unit file is used.

> # ls -l /etc/systemd/system/getty.target.wants 
> lrwxrwxrwx 1 root root 38 Jun 15 11:58 getty@.service ->
> /usr/lib/systemd/system/getty@.service
> -rw-r--r-- 1 root root 78 Jun 15 12:00 getty

That's not right. The *.target.wants/ directories should not contain unit files, only symlinks to them. Unit files should go into /{lib,etc}/systemd/system/, not in the deeper subdirectories.

This is how I have it now:

$ ls -l /etc/systemd/system/getty*
-rw-r--r--. 1 root root   74 Jun 15 23:22 /etc/systemd/system/getty

/etc/systemd/system/getty.target.wants:
total 0
lrwxrwxrwx. 1 root root 34 Jun 15 23:20 getty -> /lib/systemd/system/getty@.service

Comment 19 Felix Miata 2012-06-15 22:28:09 UTC
(In reply to comment #18)
>The *.target.wants/ directories should not contain unit
> files, only symlinks to them. Unit files should go into
> /{lib,etc}/systemd/system/, not in the deeper subdirectories.
 
By what definition or standard? /etc was made for global customization/configuration files, not the directories whose content is controlled by package management systems. http://refspecs.linuxfoundation.org/FHS_2.3/fhs-2.3.html#ETCHOSTSPECIFICSYSTEMCONFIGURATION

Rather than doing as in comment 18, I tried the following, which is working without making any changes to existing files outside of the /etc tree:
# ls -l /etc/systemd/system/getty.target.wants
-rw-r--r-- 1 root root 1571 Jun 15 18:07 getty

# ls -l /usr/lib/systemd/system/gett*
-rw-r--r-- 1 root root 1572 Jun 14 18:17 /usr/lib/systemd/system/getty@.service
-rw-r--r-- 1 root root  353 Jun 14 18:17 /usr/lib/systemd/system/getty.target
lrwxrwxrwx 1 root root   57 Jun 15 18:07 /usr/lib/systemd/system/getty -> /etc/systemd/system/getty.target.wants/getty

Comment 20 Michal Schmidt 2012-06-17 19:48:15 UTC
I think you either misread what I wrote, or misunderstood what I meant by "/{lib,etc}". All my customizations are under /etc.

Comment 21 Felix Miata 2012-06-18 23:55:34 UTC
(In reply to comment #20)
> All my customizations are under /etc.

You may have been in /etc/systemd/system/gettyy.target.wants/ when you wrote your change, but (from comment 18):

/etc/systemd/system/getty.target.wants:
total 0
lrwxrwxrwx. 1 root root 34 Jun 15 23:20 getty -> /lib/systemd/system/getty@.service

says what you changed by editing the content of a symlink was /lib/systemd/system/getty@service, the original file (via another symlink, actually /usr/lib/systemd/system/getty@service). That means when I backup /etc and later need to restore it, I'll be restoring a symlink, which may or may not result in the content of the original in /usr/lib... being available via the symlink, depending on whether the original in /usr/lib... has been altered in the mean time or backed up and restored in conjunction with the /etc backup/restore process. I see this as a FHS violation. Maybe I see it wrong, but that's how I see it nevertheless.

Comment 22 Michal Schmidt 2012-06-19 07:46:07 UTC
(In reply to comment #21)
> /etc/systemd/system/getty.target.wants:
> total 0
> lrwxrwxrwx. 1 root root 34 Jun 15 23:20 getty ->
> /lib/systemd/system/getty@.service
> 
> says what you changed by editing the content of a symlink was
> /lib/systemd/system/getty@service, the original file (via another symlink,
> actually /usr/lib/systemd/system/getty@service).

No, I did no such thing. My /usr/lib/systemd/system/getty@.service is unmodified. "rpm -V systemd" is silent.

Comment 23 Fedora Update System 2012-06-20 19:24:57 UTC
systemd-44-14.fc17 has been pushed to the Fedora 17 stable repository.  If problems still persist, please make note of it in this bug report.