Samba119
Posts: 5
Joined: Thu Sep 05, 2019 6:53 pm
Location: Germany

[Solved] Raspberry Pi doesn't boot without keyboard

Thu Sep 05, 2019 7:33 pm

Hi guys,
I used the forum sometimes in the past, now I have a question.
My Setup:
I use a Raspberry Pi Zero WH as a LED driver, everything for the LED's is controlled within a self-written Python-Code, this worked really well for the last half year. Now after tinkering a little bit with Samba and finally giving up on it, the Raspberry has a really strange behaviour.

Because I always used it without display and keyboard, my first measure after it didn't boot up completely (so that my program could run) was to attach a keyboard and display back to it. With both connected, it works like a charm, but with only the display, it doesn't give me the usual information about the last login and all that stuff, but it just stays at "Login: pi (automatic login)".
Nothing happens until it eventually says "Login timed out" or something like that. I get no error-code whatsoever. Then it tries again and again.
With a keyboard connected it mostly gets through and launches the Python-program (it gets started from the /etc/rc.local file), but sometimes it even then fails. Without a keyboard it also rarely works.
SSH into it also doesn't work, because after entering the username and password nothing happens.
Now I just ran out of ideas, I hope you can help me!

Samba119
Last edited by Samba119 on Sat Sep 07, 2019 11:38 pm, edited 1 time in total.

Andyroo

Re: Raspberry Pi doesn't boot without keyboard

Sat Sep 07, 2019 8:14 pm

Welcome,

What version of Raspbian are you using?

There have been odd quirks with Stretch that where addressed by the addition of rng-tools in the 2019-04-08 version and it fixed one of my Zero W headless boot issues. This applied both with and without the GUI loading or even installed.

You can either install rng-tools or haveged as generators and see if that solves the issue.

Most (if not all AFAIK) Pi boards have a random number generator built in to the main chip but the kernel does not recognise it by default so you are actually running out of entropy (feel free to Google Linux entropy and random numbers if you want to go to sleep quickly :lol: ).

Samba119
Posts: 5
Joined: Thu Sep 05, 2019 6:53 pm
Location: Germany

Re: Raspberry Pi doesn't boot without keyboard

Sat Sep 07, 2019 9:54 pm

Hey,

I'm running Raspbian 9.9 (stretch) with the kernel 4.19.66+.
I have no idea if the kernle number helps, but here you go.

Tested it today some more and found that with the keyboard connected it never failed, but when I tried booting without it, it never came to where I could be able to use the console normally, "Login timed out after 60 seconds" every time.

Hope that helps!
Samba119

Andyroo

Re: Raspberry Pi doesn't boot without keyboard

Sat Sep 07, 2019 10:08 pm

Kernel could have been updated from any :cry:

You can find out if either are loaded with:

Code: Select all

dpkg --get-selections rng-tools
dpkg --get-selections  haveged
You need to have a package installed (package name and the word install) from ONE of the tools - if both say 'no packages found matching xxxx' then install rng-tools using

Code: Select all

sudo apt update
sudo apt install rng-tools
and see if that helps your boot.

Samba119
Posts: 5
Joined: Thu Sep 05, 2019 6:53 pm
Location: Germany

Re: Raspberry Pi doesn't boot without keyboard

Sat Sep 07, 2019 11:01 pm

So:

Code: Select all

dpkg --get-selections rng-tools
isn't giving me any output, but

Code: Select all

dpkg --get-selections  haveged
says that it didn't find a package, that is based on "haveged".

Because it didn't say anything with the first Code, I installed rng-tools, and it said it would install the package rng-tools the first time.

So now I'm testing if anything changed.
Samba119

Samba119
Posts: 5
Joined: Thu Sep 05, 2019 6:53 pm
Location: Germany

Re: Raspberry Pi doesn't boot without keyboard

Sat Sep 07, 2019 11:37 pm

So I checked the boot for the last half an hour and it never failed, in every combination, with and without keyboard and display.
I cannot belive that it was that "easy". Don't know what exactly I now changed with installing rng-tools, but it worked for me!

Thank you very much Andyroo, you helped me a lot! Couldn't have done it without you.
So I would say, this problem is solved (for now at least).

Samba119

Andyroo

Re: [Solved] Raspberry Pi doesn't boot without keyboard

Sun Sep 08, 2019 1:06 am

Glad you are working.

I've never managed to track down what module hangs - VNC is a definite yes as was generating ssh keys but these are not really needed at boot time on a Lite implementation but I do know that some of the packages in Stretch require random numbers (e.g. certificates, encryption etc).

Linux has a standard generator based on keyboard / mouse movements to give a 'good' random number (I get lost in the math at about line 4 or 5) if there is not a hardware generator that the kernel knows about. and the Pi 'SOC' has a random number generator built in that the kernel does not know about by default.

By adding the rng-tools or haveged packages they link the kernel to the chip so the random number routines can always produce data without waiting a long time for something onboard to generate the it.

You may want to have a read through http://downloads.raspberrypi.org/raspbi ... _notes.txt to see if there is anything else your system has not updated.

Samba119
Posts: 5
Joined: Thu Sep 05, 2019 6:53 pm
Location: Germany

Re: [Solved] Raspberry Pi doesn't boot without keyboard

Sun Sep 08, 2019 11:12 am

Thanks not only for solving my problem but also giving the explanation of what went wrong!
Samba119

NighthawkEH
Posts: 1
Joined: Mon Nov 09, 2020 4:18 pm

Re: [Solved] Raspberry Pi doesn't boot without keyboard

Mon Nov 09, 2020 4:23 pm

Thank you for the great explanation and the clear instructions. Over a year after this post I had the exact same problem and this explanation solved my problem. I'm using a Pi Zero W and was about ready to give up on it being headless, but now I'm back in business!

Return to “Troubleshooting”