7

How to access the grub menu using a usb serial converter?

I know it's possible to have grub menu in serial console, putting these lines in grub.conf:

serial --unit=0 --speed=9600 --word=8 --parity=no --stop=1
terminal serial

But with usb serial converter? In linux it is /dev/ttyUSB0 and I can use it to see boot messages.

1

2 Answers 2

3

Didn't tried it myself, but I've found this information on the coreboot wiki (https://www.coreboot.org/GRUB2#On_a_USB_serial_or_USB_debug_adapter)

To enable serial, first find out the name of your usb serial port trough:

insmod nativedisk # needed not to get the disk disapearing when insmoding the *hci
insmod ehci
insmod ohci
insmod uhci
insmod usb
insmod usbserial_pl2303
insmod usbserial_ftdi
insmod usbserial_usbdebug
terminal_output

The terminal_output command should print it:

grub> terminal_output 
Active output terminals:
serial_usb1 gfxterm 
Available output terminals:
console vga_text serial 
Here we can see "serial_usb1" so we now know that its name is usb1

Then add the following on top of your grub.cfg:

insmod nativedisk
insmod ehci
insmod ohci
insmod uhci
insmod usb
insmod usbserial_pl2303
insmod usbserial_ftdi
insmod usbserial_usbdebug
serial --speed=115200 --word=8 --parity=no --stop=1 usb1
terminal_output --append serial_usb1
terminal_input --append serial_usb1

The following chips/protocols are supported:

usbdebug
ftdi
pl2303

The Wiki is outdated, but the answer seems legit.

3
  • Thanks for answering after almost 8 years. I don't even remember if 8 years ago I solved this problem (but I guess not, otherwise there should be my answer here too). I suspect 8 years ago those grub modules didn't exist. But now, this is the correct answer. Thanks. Commented Feb 16, 2021 at 13:36
  • 1
    Some systems may require nativedisk ahci (whereas ahci is the disk type) after insmod nativedisk in order to have the disks show up properly.
    – RlonRyan
    Commented Apr 21, 2021 at 22:13
  • 1
    @RlonRyan this works for me on SATA systems, but with NVMe systems grub stil looses drives information after insmod ehci. And no wonder, ahci si for SATA disks, what about NVMe ssd's? is there another patameter for nativedisk that would work for them?
    – StefanoN
    Commented Jan 11, 2023 at 15:16
1

I guess serial output works only if there is something at the default address of the serial port. The kernel does not know what USB is in the moment when its output begins. A USB to serial converter does this: It looks like a serial port to the other device but like USB to the system itself. You need it the other way round: It must look like a serial port to the local system, not matter what it looks like to the other device.

3
  • You're right. This is obvious. Linux kernel can use it as a serial device through /dev/ttyUSB0. But grub? Commented Jun 18, 2013 at 15:04
  • 1
    @AlessandroPezzato Even the kernel cannot simply access it as a serial port. It needs to talk to the USB controller. Thus no output is possible until both USB and the adapter driver are available (usually as a module). Commented Jun 18, 2013 at 15:10
  • 1
    Right, kernel uses a module, usally ftdi or prolific. I guess something similar exists for grub. Commented Jun 18, 2013 at 15:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .