Troubleshooting

When things don't seem to be working as expected, it's time to troubleshoot. These are some of the common tools and commands that come in very handy for this process. You can also post in the Adafruit Forums and we'll try and help as well.

If your Pi is not booting at all, this sticky in the Raspberry Pi forums is a good place to start.

Getting System Information

Knowing specifics of your operating system and hardware are very useful for troubleshooting. Here are some commands to use to get this information.

To figure out what version of Linux you are running, use:

Download: file
uname -a

To get hardware details, use the following, cat is used to dump the contents of a file::

Download: file
cat /proc/cpuinfo

The model info can also be found here:

Download: file
cat /sys/firmware/devicetree/base/model ; echo

An echo was added to the above since the file apparently does not end on a new line. This just makes the output look cleaner.

Viewing System Log

There are actually numerous system log files (look in /var/log), but the basic kernel one, accessed with the command dmesg, is the first place to look. There can be a lot of output from running this command. Too much to fit on one screen. One option is to send the output to a file:

Download: file
dmesg > dmesg.txt

And then you can view that file in a text editor, or upload it to the forums so support there can take a look.

Another option is to "pipe" the output to something like more, which will allow you to paginate through the listing:

Download: file
dmesg | more

Another useful way is to filter for specific text using grep (the -i ignores case):

Download: file
dmesg | grep -i some_text

Hmmm. My network cable is not plugged in. Guess that's why eth0 is not ready.

And yet another way - this may be the most useful - is to only show the most recent output by using tail.  This is good for when you are trying to do SomeThing and it's not working as expected. Try running the command before doing SomeThing:

Download: file
dmesg | tail -10

and then do SomeThing and run the command again. This way you can see the operating system kernel messages associated with what happened when you did SomeThing. The -10 limits it to the last 10 lines.

For example, how do I know my Raspberry Pi is even seeing my USB Thermal Printer when I plug it in? Well, run the command before plugging in the printer:

Nothing exciting, just boot messages about Bluetooth. What we are really interested in is what happens after plugging the printer in:

Cool. It saw a new USB device being attached, recognized it as pl2303 and attached it to ttyUSB0. That is all as expected. But if you got the same thing as the first output again - then nothing happened and something is wrong. Or maybe there would be messages that are flagged more as *error*, etc.

Note:

  • The numbers relate to time when message was logged. You can generally ignore them for basic checks like this.
  • You can change -10 to some other value to increase/decrease the number of lines shown.

Is my I2C device there?

A lot of breakout boards use I2C to communicate with the Raspberry Pi. Each I2C devices has a unique address. A quick way to check that the Raspberry Pi can see the connected device is to scan for the addresses of everything attached. To do that, use:

Download: file
i2cdetect -y 1

The numbers that show up are the addresses, in hex. For the example above, something with the address 0x48 is seen. To find out what address your device should have, check the product page, or The List:

Make Sure Power Is Good

Raspberry Pi's have gotten more power hungry over the years, with the current high end models recommending a whopping 2.5 amps! The actual current consumption will vary depending on what the Raspberry Pi is doing, but you need to accommodate the worst case scenario. Maintaining a good voltage of 5V is also important. Some power supplies will drop in voltage as current draw goes up - even if they claim they are rated for that current.

How do I know if I have a good power supply?

It actually can be difficult to know. At a minimum, look for the label on the supply and check its voltage and current rating.

The power supply above has an output of 5.25 volts and is rated for 2 amps.

Make sure USB cable is good.

Another important factor for power is the USB cable being used to deliver it to the Raspberry Pi. Cheap charge only cables may have conductors that can only carry a couple 100 milliamps. Even if you have a good power supply, these cables will fail to adequately deliver it to the Raspberry Pi.

How do I know if I have a good USB cable?

This is even more difficult to check. Ideally, the cable itself will have a printed label that will indicate the gauge of the wires used.

The units will probably be AWG (American Wire Gauge). For the cable above, the wires are 28 AWG. For Raspberry Pi usage, that's probably about as thin as you want to go.

The thinner the cable, the higher the AWG number.

If you can't find a label on your USB cable, the only other option is to try other cables.

Use an updated operating system image.

The Raspberry Pi Foundation typically roles out a new release of their operating system with each new Raspberry Pi model. These updated releases are needed to be able to boot the latest models. So make sure you are running latest software with latest hardware.

You should get your operating system images from here:

 

If you are just starting out, it's best to steer clear of the Third Party images and use the main Raspbian distribution. Installation onto and SD card has become very easy:

This guide was first published on Mar 13, 2019. It was last updated on Mar 13, 2019. This page (Troubleshooting) was last updated on Aug 18, 2019.