5

I used to be able to start and stop processes in Terminal with sudo start or sudo stop

Example: sudo start ttyS0 This would start a getty so I could log in from a serial terminal. It doesn't work in Ubuntu 15.04. Is there an alternate way to start and stop processes in 15.04?

  • Wich getty package? – A.B. May 8 '15 at 13:52
5

The service management system has changed.

Every system management toolset has own utilities. The utilities that you are used to using are the ones that come with upstart, which are trivial shims for initctl start and initctl stop. But this is Ubuntu version 15. You aren't using upstart any more.

You're using systemd, and the service control commands are subcommands of systemctl rather than of initctl. So services are started with systemctl start, stopped with systemctl stop, enabled with systemctl enable, disabled with systemctl disable, and queried with systemctl status.

Services and service configuration have changed.

You've presumably followed instructions like the Serial Console How-To to turn the supplied /etc/init/tty1.conf into an /etc/init/ttyS0.conf. This is an upstart configuration file and it will simply be ignored by systemd. None of what you have learned from there applies to systemd, not even the concept of run levels, which is "obsolete" in the systemd world.

The systemd configuration file for a getty on a real terminal device is /lib/systemd/system/serial-getty@.service. This is a template unit, parameterized on the name of the serial device file. So the actual service name to use will be serial-getty@ttyS0.service. You just enable/disable/start/stop it like any other service.

If you want an actual serial console, rather than just an ordinary serial terminal, then you don't even do that. systemd has a mechanism that automatically instantiates serial-getty@.service whenever the kernel is told to not have its console on a virtual terminal.

Further reading

0

If you don't need to start/stop tty service at runtime and just need it to be started during boot phase, then you don't have to worry about learning complicated systemd and systemctl things.

You can simply start a ttyS0 port for instance by adding below lines in GRUB2 (or other boot loader).

 GRUB_CMDLINE_LINUX="console=tty0 console=ttyS0,115200n8"

 #Uncomment to disable graphical terminal (grub-pc only)
 GRUB_TERMINAL=serial
 GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no -->
 stop=1"

I got this done in ubuntu 15.10 server running on a Virtualbox env.

[  OK  ] Started Serial Getty on ttyS0. -- started by GRUB2
[  OK  ] Started Getty on tty1. -- started by systemd
[  OK  ] Reached target Login Prompts.
...
Ubuntu 15.10 server1 ttyS0  -- redirect console to ttyS0, if necessary
  • 4
    this seems to be a comment on the other answer... – Zanna Oct 15 '16 at 21:49
  • Trying to give an alternative if systemctl and systemd are over-killing the case. And unused instructions are removed according to your comments, thanks! – baofeng Oct 16 '16 at 9:51
  • And comments from JdeBP doesn't really give a direct answer to the question. I have tried to start a service root@server1:~# systemctl start ttyS0 but it fails without giving more clue to continue: Failed to start ttyS0.service: Unit ttyS0.service failed to load: No such file or directory. – baofeng Oct 16 '16 at 13:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.