1

Running Ubuntu Server on a Raspberry Pi 3 B+ and I am unable to disable the console attached to the GPIO UART for the initial boot sequence. I am able to disable it in general execution (and have done so) but every restart it is enabled for the "Hit any key to stop autoboot" dialogue.

The board is to be placed in an autonomous vehicle, the accompanying board is constantly streaming telemetry through the interface. If it starts up first (it always does unless deliberately delayed) then the RPi is unable to boot because of that dialogue. Apart from the nuisance of the delayed start there is the obvious danger of the RPi being unable to recover in the event of a power cycle mid mission.

Ubuntu Server 18.04.4. LTS Raspberry Pi 3 B+ GPIO UART (ttyAMA0)

To disable the automatic start I did the following:

  • Removed console=ttyAMA0,115200 from /boot/firmware/nobtcmd.txt
  • Added dtoverlay=pi3-miniuart-bt to /boot/firmware/config.txt (or usercfg.txt, makes little difference)
  • Disabled serial-getty@ttyAMA0.service

The above steps have ensured its functionality in general use only, how do I prevent the initial service from running?

2
  • You seem to have confused two releases, you both mention Ubuntu Core which has a year release or Ubuntu Core 18, and Ubuntu 18.04 LTS which is a different system. Which are you running? Ubuntu Core uses the yy format as it's a specialist release, Ubuntu server & desktop releases use the standard yy.mm format and use standard deb packages. (wiki.ubuntu.com/ARM/RaspberryPi)
    – guiverc
    Mar 9, 2020 at 8:30
  • Depends which section of the download page you read unfortunately. Having since identified the difference it is definitely the server edition. Mar 10, 2020 at 3:15

3 Answers 3

2

I had this issue resolved for 18.04 by bypassing grub completely by adding these lines to the [ALL] section of /boot/firmware/config.txt:

kernel=vmlinuz
initramfs initrd.img followkernel

I also had device tree commented out in the same file as well but not sure if it was necessary.

3
  • Answer is needed for 18.04 not 20.04.
    – Rinzwind
    Apr 30, 2020 at 13:50
  • the answer is for 18.04 as stated, but it hasn't worked yet for 20.04 Apr 30, 2020 at 13:51
  • 8 years ago I did the same ;-) had a mod fix it all up and he took 15 minutes to fix it :D Just returning the favor.. edit: yes so not needed in the answer ;-) someone that has this issue in 20.04 should make their own q with this q as a reference as a non-workable solutution
    – Rinzwind
    Apr 30, 2020 at 13:52
2

Here is a video which explains step by step how to prevent U-boot console from interrupting autoboot and sending debug messages on UART. I know links only answers are frowned upon, so here's a quick breakdown of a solution:

Install the dependencies

sudo apt install git make gcc gcc-aarch64-linux-gnu

Git clone the official u-boot repository. Alternatively you can git clone my fork of repository, where I already have the necessary changes for silent autoboot - but if you need the latest version, then you need to clone the official repository and make changes yourself.

git clone --depth 1 git://git.denx.de/u-boot.git

cd u-boot

Find the raspberry pi config files - they depend on the model, rpi_3_defconfig for Raspberry Pi 3, rpi_4_defconfig for Raspberry Pi 4 and so on.

Add the following lines to the end of the file:

CONFIG_BOOTDELAY=-2
CONFIG_SILENT_CONSOLE=y
CONFIG_SYS_DEVICE_NULLDEV=y
CONFIG_SILENT_CONSOLE_UPDATE_ON_SET=y
CONFIG_SILENT_U_BOOT_ONLY=y

The first line removes the boot delay, so autoboot will not be interrupted by messages sent on UART interface. The next four lines enable silent boot, so U-boot will not send any messages on UART itself, because the messages might in turn confuse your device. One more little thing left, set silent boot environmental variable. Change include/configs/rpi.h file

#define CONFIG_EXTRA_ENV_SETTINGS \
    "dhcpuboot=usb start; dhcp u-boot.uimg; bootm\0" \
    "silent=1\0" \
    ENV_DEVICE_SETTINGS \
    ENV_DFU_SETTINGS \
    ENV_MEM_LAYOUT_SETTINGS \
    BOOTENV

Now configure with

make rpi_3_defconfig

from repository main folder

And build with

make CROSS_COMPILE=aarch64-linux-gnu-

When build process finishes you will have a u-boot.bin file, which you need to rename and copy to Raspberry Pi SD card. Now your Raspberry Pi will not be disturbed by any messages on UART during boot. The UART functionality after boot will not be affected.

1
  • 1
    Dmitry Maslov thanks for the response and it works for my raspberry pi 4 re-Building uboot for - RPI4 1 GB RAM The system used to build - Ubuntu 20.04 Aaeoon UP squared device (x86 based) 1 thing I need to do before building sudo apt get install flex bison
    – drone4ya z
    Aug 4, 2021 at 19:25
1

Before of booting the kernel, the Pi is running u-boot which gets interrupted by data received via UART by default, even if it is disabled for the kernel afterwards.

I have solved this issue for Ubuntu 20.04 on my Raspberry Pi 4 through changing u-boot to do not listen for an abort signal.

You can set it to boot without delay and not check for abort through setting the environment variable bootdelay to -2. To do so you can either compile a new u-boot binary or you connect to your Pi with a serial console (for example using screen):

$ sudo screen /dev/ttyUSB0 115200

Boot the Pi and abort the boot process through pressing a key and set the bootdelay variable to -2:

U-Boot> setenv bootdelay -2
U-Boot> saveenv

The saveenv command saves the environment variable to make the change permanent.

Further information about the environment variables of u-boot can be found here.

1
  • While it's horrible to have to do this, this works, for example when you want to use the Adafruit Ultimate GPS HAT on a Raspberry Pi with Ubuntu.
    – Daniel F
    Sep 12 at 14:04

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.