What I want to accomplish

I would like to have remote terminal access to my NAS (which runs Debian Stretch) via an USB-RS232 adapter. As this machine is supposed to be headless, I would also like to see the boot process on the serial line.

(Still, for the sake of assessing this problem, there is a screen connected on the HDMI port at the moment.)

The actions I took

I appended console=ttyUSB0 to the kernel argument list. When booting, this causes my system to freeze.

The last lines of boot output are: (Bootloader is extlinux)

Loading /vmlinuz... ok
Loading /initrd.img...ok
Probing EDD (edd=off to disable)... ok

When not using said kernel parameter the machine is booting without problems. From there on, I could accomplish serial terminal access easily by running

systemctl enable serial-getty@ttyUSB0.service
systemctl start serial-getty@ttyUSB0.service

on the remote server, and

screen -F /dev/ttyUSB0 9600

on my local machine. Hence, the USB-RS232 adapters are working correctly. The server is a Intel NUC 5CPYH with Braswell chipset and runs a Linux 4.9.0-4-amd64 debian kernel.

My question

Which actions do I have to take to get it working?

Edit № 1

When providing console=tty0 console=ttyUSB0,9600n8 as boot parameters the machine boots just fine, but I still cannot connect to the serial port. Also, systemctl status serial-getty@ttyUSB0.service says that the service is loaded and inactive (dead). I would have expected it to be up and running then.

Edit № 2

I did a bit of research and found out that my initramfs was lacking the relevant kernel modules. I managed to enter the initramfs shell by providing break=init as kernel parameter and saw that there was no /dev/ttyUSB0 device.

I added cp210x, pl2303 and ftdi_sio to /etc/initramfs-tools/modules and, after recreating the initramfs, saw that now there is a /dev/ttyUSB0 device in initramfs shell.

Still, I couldn't connect from my other machine. So I tried to start getty on that device manually:

# /sbin/getty -L 9600 /dev/ttyUSB0 vt100
getty: setsid: Operation not permitted
# su root -c "/sbin/getty -L 9600 /dev/ttyUSB0 vt100"
sh: su: not found

So that's where I am now.

  • 1
    So sad to see motherboards without even a vestigial serial port these days. If you just want boot messages you might look at netconsole instead, to get them over the ethernet. Also, lots of articles say you need a kernel compiled with CONFIG_USB_SERIAL_CONSOLE=y to get boot messages on usb, and this is not often the case as it still marked "experimental". – meuh Feb 21 '18 at 11:20

Your system is not freezing. You just directed ALL your output to the serial console.

Passing console arguments to the kernel, you have got to include both the local console and the serial interface.

See TLDP - Remote Serial Console HOWTO - Chapter 5. Configure Linux kernel

Figure 5-2. Recommended kernel parameters, PCs with video card

console=tty0 console=ttyS0,9600n8

Kernel messages will appear on both the first virtual terminal and the serial port. Messages from the init system and the system logger will appear only on the first serial port. This can be slightly confusing when looking at the attached monitor: the machine will appear to boot and then hang. Don't panic, the init system has started but is now printing messages to the serial port but is printing nothing to the screen. If a getty has been configured then a login: prompt will eventually appear on the attached monitor.

For PCs without a video card, this HOWTO suggests the kernel parameters:

Figure 5-3. Recommended kernel parameters, PCs without video card


These parameters are passed to the booting kernel by the boot loader. Next we will configure the boot loader used by your Linux installation to pass the console parameters to the kernel.

  • Unfortunately this didn't work either. I edited my questions with the results of your suggestion. This was a very valid concern though, hence I upvoted your answer. – Multisync Feb 19 '18 at 21:58
  • what did not work? When I setup this in kernel, I had also to start the service afterwards for serial to work. – Rui F Ribeiro Feb 19 '18 at 22:09
  • 1
    I could not see boot output on the other machine which was connected over the serial line. Also, the blog page of the systemd author suggests that starting the service manually should not be necessary when using the console boot parameter: TL;DR: To make use of a serial console, just use console=ttyS0 on the kernel command line, and systemd will automatically start a getty on it for you. – Multisync Feb 19 '18 at 22:22

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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