Bug 671674

Summary: systemd doesn't start getty on ttyS0
Product: [openSUSE] openSUSE 11.4 Reporter: Jiri Slaby <jslaby>
Component: BasesystemAssignee: Kay Sievers <kasievers>
Status: VERIFIED WORKSFORME QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None    
Version: Factory   
Target Milestone: ---   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Jiri Slaby 2011-02-14 11:15:41 UTC
With sysvinit, in inittab I have:
S0:12345:respawn:/sbin/agetty -L 115200 ttyS0 vt102

With systemd the logon prompt doesn't appear unless console=ttyS0 is passed as a kernel parameter.

How can I specify to start getty there always?
Comment 1 Kay Sievers 2011-02-14 11:38:54 UTC
Does this make it work?

ln -sf /lib/systemd/system/getty@.service /etc/systemd/system/getty.target.wants/getty@ttyS0.service
Comment 2 Jiri Slaby 2011-02-14 11:47:58 UTC
(In reply to comment #1)
> Does this make it work?
> 
> ln -sf /lib/systemd/system/getty@.service
> /etc/systemd/system/getty.target.wants/getty@ttyS0.service

For non-console=ttyS0, yes, the login prompt appears.
For console=ttyS0, there are 2 login prompts (I just pressed enter few times after login):
Welcome to openSUSE 11.4 "Celadon" RC 1  - Kernel 2.6.37-22-default (ttyS0).


linux-b984 login: root
Password: 
Last login: Mon Feb 14 12:45:28 CET 2011 on tty1
Have a lot of fun...
linux-b984:~ # 
linux-b984:~ # 
linux-b984:~ # 
               linux-b984:~ # 
Welcome to openSUSE 11.4 "Celadon" RC 1  - Kernel 2.6.37-22-default (ttyS0).


linux-b984 login: 
                  linux-b984:~ # 
Welcome to openSUSE 11.4 "Celadon" RC 1  - Kernel 2.6.37-22-default (ttyS0).


linux-b984 login:
Comment 3 Kay Sievers 2011-02-14 13:27:58 UTC
Ah, right, sorry. Care to try to link the serial-getty@ service instead of getty@? That should do the trick.
Comment 4 Jiri Slaby 2011-02-14 13:33:16 UTC
(In reply to comment #3)
> Ah, right, sorry. Care to try to link the serial-getty@ service instead of
> getty@? That should do the trick.

No hope, still the same, two login prompts with:
lrwxrwxrwx 1 root root 41 Feb 14 14:30 /etc/systemd/system/getty.target.wants/getty@ttyS0.service -> /lib/systemd/system/serial-getty@.service
Comment 5 Kay Sievers 2011-02-14 13:36:34 UTC
The link name should be serial-getty@ too.
Comment 6 Jiri Slaby 2011-02-14 14:16:59 UTC
(In reply to comment #5)
> The link name should be serial-getty@ too.

Yes, this one works:
lrwxrwxrwx 1 root root 41 Feb 14 15:11 /etc/systemd/system/getty.target.wants/serial-getty@ttyS0.service -> /lib/systemd/system/serial-getty@.service
Comment 7 Kay Sievers 2011-02-14 17:04:19 UTC
So we can close this bug?

There is currently no higher-level interface in systemctl, to create these links for multi-instance units (the ones with @), only for the simple ones, so this is currently the way to enable such services.
Comment 8 Jiri Slaby 2011-02-14 21:08:57 UTC
(In reply to comment #7)
> So we can close this bug?

I think so.

> There is currently no higher-level interface in systemctl, to create these
> links for multi-instance units (the ones with @), only for the simple ones, so
> this is currently the way to enable such services.

Ok, I have no problem with that. I was just confused by that it works when console=ttyS0 is used. Does it mean that systemd runs some kind of getty (agetty is not in the process list) for the kernel console? It also has to run with different ENV, because the shell prompt was colored by default...
Comment 9 Kay Sievers 2011-02-15 10:10:16 UTC
(In reply to comment #8)
> I was just confused by that it works when
> console=ttyS0 is used. Does it mean that systemd runs some kind of getty
> (agetty is not in the process list) for the kernel console?

It starts agetty automatically if the kernel commandline has the console instruction (or /sys/class/tty/console/active, which contains the same list).

> It also has to run with different ENV, because the shell prompt was colored
> by default...

I think it does different TERM= settings.
Comment 10 Kay Sievers 2011-02-16 00:00:18 UTC
Closing.

(We have the  /sys/class/tty/console/active patch in the 11.4 kernel now, so any systemd updates should be fine too)