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?

2
  • 17
    The title of this question sounds terrifying.
    – Jivings
    Jul 5, 2012 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. Jun 28, 2014 at 23:07

3 Answers 3

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.

4
  • 1
    If you ssh into the running headless pi, then typing dmesg at the command prompt will do this for you.
    – Amos
    Jul 23, 2012 at 22:29
  • @Amos yes it will do this for you
    – Suhaib
    May 13, 2013 at 12:09
  • As mentioned in another answer: you need bootlogd to have boot messages (daemons startup messages) in /var/log/boot.log
    – Marki555
    Jul 29, 2015 at 14:04
  • Try journalctl --boot
    – Alex
    Oct 25, 2022 at 9:56
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

4
  • 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, 2015 at 19:26
  • But what software do you use on your other computer to connect? Sep 24, 2016 at 2:23
  • 1
    @MikeSchinkel, Any terminal emulator: on linux I usually use minicom or screen. putty on windows Sep 25, 2016 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, 2020 at 18:27
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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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