Free Your Raspberry Pi Serial Port


By default Raspbian configures the Raspberry Pi serial port (GPIO14-GPIO15) to provide boot-up information. It also allows you to login via a connected device. If you need to use the Pi’s serial port for something else (i.e. a specific add-on board) you will need to disable this default functionality.

It’s something I needed to do when I played with the Ciseco Pi-Lite and luckily isn’t too difficult as the instructions below will hopefully show.

Disable Login Via Serial Port

To disable the login feature we can run the following command to edit the inittab system file :

sudo nano /etc/inittab

Use the cursor keys to find the line :

T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100

and add a # character at the beginning of the line to give :

#T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100

Press “CTRL-X”, “Y” and finally “Enter” or “Return” to save the file.

Disable Boot Messages

When the Pi is booting all the debug messages are sent to the serial port. This can be useful for some purposes but we need to turn this off to free the port for our own use.

To stop the messages being sent to the port we need to edit another system file. Run the following command to edit the cmdline.txt file :

sudo nano /boot/cmdline.txt

Use the cursor keys to find the line :

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait

and remove the block of console parameters in the middle to give you :

dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait

Press “CTRL-X”, “Y” and finally “Enter” or “Return” to save. You should be returned to the command prompt.

Restart Pi

Now the changes have been made the Pi must be restarted for them to take effect.

Reboot using :

sudo reboot

Test Using Minicom (optional)

If you have a suitable device (e.g. a PC) to connect to your Pi via a serial interface you can use the “Minicom” utility to send data to it via the Pi’s serial port. This is a quick way to test the configuration changes have been successful.

You can install Minicom using the following command :

sudo apt-get install minicom

Press “Y” when prompted.

You can then use Minicom to send and receive data over the serial port :

minicom -b 9600 -o -D /dev/ttyAMA0

Pressing keys on your keyboard should result in them appearing on your connected device.

To exit Minicom press “CTRL-A”, then “X” and finally press “Return” to select “Yes” from the prompt.

Your serial port is now ready for whatever plans you have for it.



  1. Ok I have tried this and it’s not working at all nor can I edit /boot/cmdline.txt because it is completely blank. I am using the current version raspbian.

    • Is it raspberian OS? It’s there by default even now, but of course doesn’t exist in XMBC or other OS. It’s software so depends on the OS at startup 😉

  2. Is it possible to retain the debug output and at the end of the boot cycle, disconnect it and reconnect as an available port? And at every boot?

    I would like to retain the debug portion since it makes sense to be able to see the data in the event of an error. Then, afterwards use another application (e.g., PuTTY ) and make use of the port.

    I actually want to connect a serial GPS to the port for use with GPSd.

    As a Linux/RPi noob I may not have the wording correct but I hope it is understandable.


  3. Hi I have tried testing Minicom from 1pi (AMA0) to 2pi(USB0) and the connection is ok and communication exists however when I Type in one the other just displays Strange characters. why?

    If I try USB0 to AMA0 nothing appears at all.


  4. Hi
    I tried to communicate RPI B+ and my PC thru minicom. I can only receive datas on PC from RPi, but couldnt RPI from PC. If i type any characters on minicom, the minicom will get hang, nothing happen on both sides (in PC as well as in RPI). Am using CP2102 serial bridge. Pl reply asap

  5. Hi,

    Sorry, another noob here.

    I tried to modify cmdline.txt as you suggested but then my Pi failed to boot.

    I got an error message: “PANIC: VFs: unable to root fs on unknown-block(179,2)”

    Googling this totally confused me.

    Yours is the sanest explanation of how to modify the serial port and I still failed!

    The only discrepancy I found; on my Pi the root directory is “/dev/mmcblk0p6”.

    Any comments invited.



    • Are you using NOOBS? If you can edit the cmdline.txt file try replacing “/dev/mmcblk0p2” with “/dev/mmcblk0p6”.

      • Hi Matt,

        Yes, tried both. Same result.

        I remember some trouble enabling the SPI. It used to be done by altering a file, now it’s done via ‘raspi-config’.

        There’s a setting in ‘raspi-config’ that mentions the serial port.

        • ‘raspi-config’ > advanced settings > disable serial results in the last line in ‘inittab’ being commented out.

          I wonder if this is enough?

Leave A Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.