I have a Raspberry Pi B+ for my project with Raspbian Jessie OS installed on it.. I have to receive "Real-time" electric current values coming from a wireless Nordic module. So to start this serial communication I am trying to free the UART pins from showing the kernel output. For this purpose I tried the steps mentioned on this link: Using UART on Raspberry Pi – Python.

This asks me to make two changes - one in cmdline.txt file and the other in /etc/inittab file. I was successful in making the first change. However, for the other step, I could not find the /etc/inittab file in my Raspberry Pi b+. What should I do now to make my RPi be able to receive the Serial Data from the Nordic module?

Can someone please help me out quickly, as it is urgent project!

  • Try sudo systemctl stop getty.target – joan Mar 3 '16 at 15:06

There are many ways of doing this, but the simplest is to run sudo raspi-config - The Advanced option has a setting to disable console.

  • Will that take care of both the config.txt file AND the "serial-console" spawning of a getty instance or just the first of those - which the OP has already sorted? 8-) – SlySven Mar 4 '16 at 0:46
  • @SlySven Yes, AFAIK it should do both. I have been using serial for many purposes with no problems (unless I get the baud rate wrong ;-) – Milliways Mar 4 '16 at 0:59
  • Can you posting up the changes that raspi-config makes to the files (what ever they are?) that toggling the state does - or is it all buried in a binary "registry" that only systemd understands? – SlySven Mar 4 '16 at 4:37
  • @SlySven if you want to see how it works try cat /usr/bin/raspi-config. I have tried looking through it before - there are 1300 lines of code, and it not that easy to follow. – Milliways Mar 4 '16 at 4:49
  • Ah, spaghetti code! I'll have to dive into a pasta meal. 8-@==< – SlySven Mar 4 '16 at 4:53

On systemd enabled systems, to disable the serial console from starting on boot run:

sudo systemctl disable serial-getty@ttyAMA0.service

In systemd, start/stop starts/stops the service now (but not on boot) and enable/disable starts/stops the service on boot (but not now).


What @joan was hinting at in their comment was that those original instructions relate to the /etc/inittab file which is used by SysV init the default "first process" on Raspbian versions up to the previous one which was "Wheezy". As of "Jessie" the default has changed to systemd and most people using Rasbian will be using that. {I am an exception and have taken the option that is still there in Jessie to stick with the older one and had to do exactly what you are doing so that my RPi can talk to a UPS add-on}. The sudo systemctl stop getty.target is probably the command you have to tell that new-fangled systemd to stop running a getty on the serial port - which is what the original changes to the /etc/inittab would have done.

As I say - I have virtually no exposure to systemd - but I am uncertain whether that change would be permanent or would have to be done each time the RPi is booted. It may be that you will have to edit a "service file" I think they call it, if you want to permanently produce the same effect.

  • Hey @SlySven! I tried that command sudo systemctl stop getty.target . After that I checked on minicom and did not see the text ( Uncompressing Li) on the screen. But then when I reboot the raspberry pi, and then check the output on the minicom, the kernel output (i.e. Uncomressing Li) is seen again. How to keep that change permanent?? – Sakshi Mar 4 '16 at 14:42
  • That is why I warned that I am not knowledgeable about systemd - I do not know! - I was only reiterating/expanded on what @joan had said... – SlySven Mar 5 '16 at 13:35
  • getty.target will stop all gettys, you only wnat to stop the serial getty. – Michael Daffin Sep 1 '16 at 13:57
  • Can you say how to do that? I don't have a systemd setup to experiment on! 8-P – SlySven Sep 1 '16 at 23:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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