34

It's fairly easy now to run headless from scratch with a Raspberry Pi.

One area that might have an issue though is debugging issues with devices that have been added to the Raspberry Pi. Often you get indication of these problems in the messages that scroll through during boot.

Are these messages echoed anywhere - to a log - or are they only available if you connect a monitor during boot?

Peter Mortensen
  • 2,004
  • 2
  • 15
  • 18
Jon Egerton
  • 3,083
  • 2
  • 22
  • 32
  • 17
    The title of this question sounds terrifying. – Jivings Jul 05 '12 at 13:00
  • 1
    if you are using raspbrian (you probably are), then installing bootlogd will add boot logs. I did not have any boot logs on my laptop running debian-x86, until I installed this package. – ctrl-alt-delor Jun 28 '14 at 23:07

3 Answers3

44

You can see bootup messages by connecting to the UART on pin 14/15 of the GPIO port

Here is how to connect it to one of the PL2303 UARTs that can be found on ebay for a few dollars.

I didn't need to connect GND because I am powering the RPi from a USB port on the same computer.

If you just want to see the boot messages, you'd only need the orange wire. If you want to log in once it boots, you'll need the purple wire too.

If you need to connect GND, it should go to the pin to the left of the orange wire.

PL2303 UART

Set the serial port to 115200 baud and you are all set

John La Rooy
  • 11,947
  • 9
  • 47
  • 75
  • I really need to get one of those! My remote headless Pi just failed to start up properly after a full update. Kind of ugly if you cannot ssh into the system any more to check the logs. – Ghanima Apr 20 '15 at 19:26
  • But what software do you use on your other computer to connect? – MikeSchinkel Sep 24 '16 at 02:23
  • 1
    @MikeSchinkel, Any terminal emulator: on linux I usually use minicom or screen. putty on windows – John La Rooy Sep 25 '16 at 10:36
  • Just to mention rx from one side should be connected to tx at the other side and opposite for tx. Also don't forget to connect GND pin if you're using a separate power supply (other that usb) for rpi – artronics May 13 '20 at 18:27
27

Yes, there are logs for everything.

If you connect a new device to the Pi then the module being loaded will show in dmesg. Eg;

$ dmesg | tail 
[16037.102139] Initializing USB Mass Storage driver...
[16037.102299] scsi4 : usb-storage 2-2:1.0
[16037.102422] usbcore: registered new interface driver usb-storage
[16037.102425] USB Mass Storage support registered.

All other logs will have their place in /var/log/. Some important ones include:

  • /var/log/boot - For all boot messages, such as daemons starting.

  • /var/log/Xorg.0.log - All Xorg logs. Including any errors.

  • /var/log/errors.log - Any system error will also be logged here.

Jivings
  • 22,538
  • 11
  • 90
  • 139
2

If you're looking for systemd boot messages, you could find them in /var/log/boot.log (I think you have to install bootlogd for that) or in the virtual console /dev/vcs1.

vcs1 is just one line so you could format it with fold or fmt

For me it worked with: # fold -w 148 /dev/vcs1 (each line = 148 columns)

Note: corrected device file name typos

grim_i_am
  • 113
  • 5
Sdlion
  • 121
  • 2