¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Headless from the Get-Go


 

Hey all;

I decided to install BAP 3.0.2 this past weekend on a well-tested
Pi4-4gB *without* needing to plug-in a monitor, keyboard, or mouse.

Here are the steps;

A - Be sure to install raspios_buster_armhf_latest (OR *possibly*
raspios-buster-full_latest) to your sd-card. Do NOT use the "lite"
version, as it is missing needed packages of software. (I used
something like "rpi-imager" on my manjaro-linux-aarch64-RPi4-8gB
desktop. The sd-card was plugged into a sd-card-2-usb device.)

B - It's probably a GREAT idea to use something like 'gparted' to
enlarge the "second" (root) partition. (I cannot image running
Build-A-Pi (BAP) on anything less than 25gB !)

C - Be sure to add an empty file to the "first" (boot) partition that
is named "ssh". This item is covered in Jason's video;



D - Boot up your new op system on your headless RPi with an ethernet
cable attached to your local network router.

E - Use ssh on your regular "desktop" machine (which you probably used
to create your NEW sd-card) to log into your "new" Rpi-headless
machine. Something like this from a command line should "do-it"; ssh
pi@... <- where the "xxx" stuff is replaced by the ip
number your local network router assigned to your new RPi.

F - Run "raspi-config" to both update the system AND add VNC software.
Do NOT use raspi-config to configure (adjust settings of) the VNC !

G - Add the following to the /etc/rc.local file;

"
sudo -u pi vncserver -Encryption PreferOff -Authentication VncAuth
-Password=e0fd0472492935da -randr=1024x768 -IdleTimeout=0
"

(Be sure this is all on one line !!! AND be sure this is at the end
immediately BEFORE the final line; which is simply the single word
"exit".

**** Note: I use the nano editor to do this as follows;

"
sudo nano /etc/rc.local
"

** BTW; I am setting the password to "foobar", the screen size to
1024x768 and inhibiting the Idle-Timeout so that vncserver does not
stop after a period of inactivity from the network connection.

H - Reboot your headless RPi and then log-in with your desktop's vnc
client (in my case tigervnc) by using the
ip-address-number-of-your-headless-rpi:1 <- The colon 1 (:1) is to
indicate the correct "desktop-environment" on your headless-rpi !

*** Remember the password is "foobar", and that is login is the
ip-address:1 . This is all you should need to login into your
"remote-vnc-connection".

I - From here you can Build-A-Pi (BAP) and be sure to HAVE FUN OM !!!!

es VY 73 om de ¡°baab¡± w9ya


 

You should also be able to set one up wirelessly, without the need for plugging it in via an Ethernet cable in step (D).

After creating the empty SSH file as described in step (C) above, create another file named?wpa_supplicant.conf with the following contents (be sure to edit and enter you network details), and save this file to the boot partition also:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 country=US network={ ssid="Your network name/SSID" psk="Your WPA/WPA2 security key" key_mgmt=WPA-PSK }

This is how you set up a Raspberry Pi Zero since there is no onboard Ethernet jack. I've set up all my RPis headless this way. It should automatically connect to your wireless network once it boots up. You can then proceed as outlined above.

¡ªMitch Smith, N7USU


 

Great write-up as well as N7USU's suggestion for wi-fi.

Question: Even though it would be less secure, am I also correct that you can do this without changing password up front?? Couldn't you VNC into the new pi, and then do the password change later using the graphical interface? That way you wouldn't need to remember the hex equivalent for 'foobar" (e0fd0472492935da), or whatever password you choose, right?
--
73 de N5RKE


 

That is correct. I've never really changed the password at the time of setting up the RPi. I usually just flash the SD card, create those two files, toss it in the Pi, and then set it all up headless. Then I'll change the password later if the Raspberry Pi is something I plan on using longer term (like the Pi-hole I have running 24/7 at home).

¡ªMitch Smith, N7USU?


 

GREAT question Jerry. (Astute actually, as it touches on the unusual
"security" framework of raspios.) And YES, change your password as
wanted/needed. (And as Mitch suggests, after you get things rolling.)

es vy 73 om de "baab" w9ya

On Wed, Jul 29, 2020 at 10:34 PM Mitch Smith <pxls2prnt@...> wrote:

That is correct. I've never really changed the password at the time of setting up the RPi. I usually just flash the SD card, create those two files, toss it in the Pi, and then set it all up headless. Then I'll change the password later if the Raspberry Pi is something I plan on using longer term (like the Pi-hole I have running 24/7 at home).

¡ªMitch Smith, N7USU


 

P.S.... Um, you don't "need" to remember the hex poop you add to the /etc/rc.local file.... you only need to remember that the vnc password IS foobar. i.e. The user "pi" has it's own password (default = "raspberry"), and the vnc login has it's own password ("foobar").

Um, the documentation at realvnc's web-presence is needlessly obtuse, and what I proposed is merely a way to get going headless. So changes after you are up and running are not only suggested, they are encouraged !


 

Bob and Mitch,

Thanks for confirming that my logic wasn't askew.

Bob, what I meant about remembering the hex was that if I was to set it up after connecting using VNC using standard password, was that I could then change using ASCII instead of having to get the hex string correct. That way I never need to know the hex string in the first place for the password that I have chosen.

Strange that I should have just written that, since for years I have secured my router using the hex string for a word that has significant importance for me, and no, it is not my Amateur Radio callsign nor my wife's name. :)
--
73 de N5RKE


 

...and MANY thanks to you for your astute input.

Simple answer:

sudo vncpasswd -service

MUCH BETTER answer;

I have been fighting a few things, raspian/raspios 's weirdo (non-standard) setup and security models, along with realvnc's obtuse docs and it's default server installation that favors/requires the client also be realvnc while not supplying an aarch64 client that my manjaro-arm-aarch64 system could use. ( I am using tigervnc as the client on the Manjaro-aarch64 system. More on why "tigervnc" as a client at a later date.)

SO... I am working towards a MUCH BETTER solution, which is showing A LOT of promise. In fact it is already working much better than my previous solution !! SO....In the next couple of days I will be testing it on a new install, and I will write it up then.

Wish me luck om es vy 73 de "baab" w9ya


 
Edited

Hey again - I've done TWO complete tests AND written up a draft of the instructions.

With these new instructions the user can now connect with just about ANY vnc-client, and the RPi is wireless from the start. Further this now conforms to the raspios/rasbian structure, and allows the RPi's "new-birthday" software to auto-magically start and complete the necessary system updates and password change options (and so forth) with the first VNC-based log-in !

SO.... I will start a new thread as soon as I finish editing the new instructions. Probably sometime this coming weekend.

I want to thank Jason - KM4ACK,? Mitch - N7USU, and Jerry - N5RKE for their feedback. I would NOT have improved things without their input.

es vy 73 om de "baab" w9ya