Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8374

Raspberry Pi OS • Re: Headless Trixie with static IP set before first boot - here is how

$
0
0
I completely agree with Chupo_cro about the need for both statically configured IP address and a manual method to construct a microSD card with a trixie distribution for a headless, non-DHCP IP assignment setup.

I have been using a (similar) manual method for many, many RPi for many years prior to attempting to do it for trixie for the first time now.

For many years attempting to use the raspberry.org image configuration tool(s) to produce the image to download and image to the microSD has NEVER worked for me! I have performed this process on a Ubuntu 14 linux laptop forever! So long ago I, similar to Chupo_cro's methods presented here, figured a way to simply download the xxx.img.xz, use the linux disks gui tool to restore this image to a new microSD, mount it, and create/edit certain files in the bootfs file system to allow me to ssh in and run the raspi-config script to do all the rest of initial stuff. This has worked flawlessly for many years. Although some of these files and their contents have changed over the years (and VERY difficult in finding out what each has needed to be as discovered by Chupo_cro too) it was quick and simple and could be replicated for many RPi destined for remote locations as I have done.

So I applaud Chupo_cro for this posting for trixie!

Unfortunately, I cannot using this method make the login with ssh successfully!

I touch the file ssh in the mounted bootfs partition to enable the ssh on first boot. Note after the first boot this file vaporizes!
Note- on trixie the bootfs user-data file EXISTS from the image! Next, I edit user-data and create the following (note a template commented out already exists in user-data):

Code:

users:  - default  - name: painter    groups: users,adm,sudo    shell: /bin/bash    lock_passwd: false    plain_text_password: mypw
Next, from my Ubuntu 14 I:
ssh -l painter 10.0.0.23
ssh responds to accept the digital certificate which I accept. Then the password prompt appears.
At this point the password always FAILS!

I have gone back and changed user-data to pi/pi and pi/respberry yet none of these work either. I have even tried NO modifications to user-data and then tried pi/pi and pi/respberry yet this didn't work either.

What is going wrong and how to I get the initial SSH username and password set and accepted?

thanks,
oldunixguy

Hi,

filnally someone for whom the instructions were made and who wants to use them :-)

Your configuration didn't work because the contents of your meta-data and user-data files weren't correct (you didn't generate them by using Raspberry Pi Imager) and because you created ssh file. Just do as I described and it will work:

1. Do not create ssh file.

2. Generate meta-data, network-config and user-data files using Rasbperry Pi Imager (enable SSH during image customisation) and then edit network-config file.

Next time you will not have to use Rasbperry Pi Imager because you will already have the correct meta-data, network-config and user-data files. You have to use it just once, to generate meta-data, network-config and user-data for the very first time.

If you, during image customisation delete network credentials user-data file will look something like this:

Code:

#cloud-configmanage_resolv_conf: falsehostname: YOUR_HOSTNAMEmanage_etc_hosts: truepackages:- avahi-daemonapt:  preserve_sources_list: true  conf: |    Acquire {      Check-Date "false";    };timezone: Europe/Zagrebkeyboard:  model: pc105  layout: "hr"users:- name: YOUR_USERNAME  groups: users,adm,dialout,audio,netdev,video,plugdev,cdrom,games,input,gpio,spi,i2c,render,sudo  shell: /bin/bash  lock_passwd: false  passwd: "auto-generated-password-hash"enable_ssh: truessh_pwauth: truerpi:  interfaces:    serial: trueruncmd:  - [ rfkill, unblock, wifi ]  - [ sh, -c, "for f in /var/lib/systemd/rfkill/*:wlan; do echo 0 > \"$f\"; done" ]

Of course, your localisation setting will be different.

Statistics: Posted by Chupo_cro — Thu Feb 19, 2026 10:28 pm



Viewing all articles
Browse latest Browse all 8374

Trending Articles