So far so good, I used to have a simple /etc/inittab line like this:
T3:23:respawn:/sbin/mgetty -D -s 115200 ttyS0
But... The fucking almighty systemd came to create hell on earth for Linux users... No /etc/inittab anymore, no nothing. Well, UTFG, so I get completely wrong advice to try:
# systemctl start getty@ttyS0.service
And that's it... (?) No, it isn't! It simply does not accept the call, because it uses agetty and agetty can't do that or it is not configured or whatever.
After one particularly hot, unpleasant and exhausting afternoon spent on experimenting with this I came to following config for systemd that works for me (place it to /etc/systemd/system/mgetty.service):
[Unit] Description=Smart Modem Getty(mgetty) Documentation=man:mgetty(8) Requires=systemd-udev-settle.service After=systemd-udev-settle.service [Service] Type=simple ExecStart=/sbin/mgetty -D -s 115200 /dev/ttyS0 Restart=always PIDFile=/var/run/mgetty.pid.ttyS0 [Install] WantedBy=multi-user.target
And of course:
# systemctl start mgetty.service # systemctl enable mgetty.service
I hate systemd! I really do. But I'll learn about it. It has spread to all reasonable distros like a nasty infection so we have to learn living with it, I guess.
Thanks. Finally surrendered to systemd since it seemed inevitable, and needed my trusty faxmodem still receiving for legal documents.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteI didn't fully understand this ...
ReplyDelete(still reeling from the systemd crap)
I created a directory entry:
serial-getty@ttyUSB0.service.d
much like the one I created for ttyS0 where my terminal is, but the modem just keeps running. It's treating the modem like a terminal.
How did you specify that it use mgetty instead of agetty?
Sorry ... still trying to grasp this.
/etc/inittab was soooooo much easier!
-rAllcorn-
After reviewing this, I have come to the conclusion that "YOU SIR" are the ONLY ONE who ever explained this on how to do with a "systemd infected system".
ReplyDeleteTHANK YOU SO VERY MUCH!!!!
I am copying the file I created, to make things simple, and to honor YOUR labors ... again, I thank you!!
(see following post)
# /etc/systemd/system/mgetty.service
ReplyDelete#
# credit for creating this goes to:
# "Snarky Brill", who posted a guide that helped me to create this one
#
# see URL:
# https://snarkybrill.blogspot.com/2015/08/mgetty-in-systemd-for-modem-dial-in.html?showComment=1533868591623#c3913812844269156303
#
#
# This file enables model dial-in services using mgetty for ttyUSB0
# where the modem resides on my system.
#
# You can tailor this for whatever serial port your modem may reside
#
#
# Copy this file to: /etc/systemd/system
[Unit]
Description=Smart Modem Getty(mgetty)
Documentation=man:mgetty(8)
Requires=systemd-udev-settle.service
After=systemd-udev-settle.service
[Service]
Type=simple
ExecStart=/sbin/mgetty -D -s 38400 /dev/ttyUSB0
Restart=always
PIDFile=/var/run/mgetty.pid.ttyUSB0
[Install]
WantedBy=multi-user.target
# Don't forget to run the following commands:
#
#
# $ sudo systemctl start mgetty.service
# $ sudo systemctl enable mgetty.service
#
#
# ... after copying the file to /etc/systemd/system/
#
Thank you very much.
ReplyDeleteI am the author of mgetty, but I stopped using Linux a while ago due to systemd plague - and today I needed to install mgetty on a customer's Ubuntu system. Which brought a nice precompiled package, but NO UNIT FILE...
Now I have one, thanks to your blog :-)