WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: can't get static ip without keyboard  (Read 857 times)

Offline jbbum

  • Newbie
  • *
  • Posts: 33
can't get static ip without keyboard
« on: August 29, 2023, 07:31:35 AM »
Trying to set up static ip on raspberry zero w.  Using the following code
#!/bin/sh
interface="wlan0"
ssid="xxxxxx"
pass="xxxxxx"
ipaddr="192.168.1.249"
netmask="255.255.255.0"
gateway="192.168.1.1"
dns1="192.168.1.251"
dns2="8.8.8.8"

wpa_passphrase  ${ssid}  ${pass} > /etc/wpa_supplicant.conf
wpa_supplicant -i  ${interface}  -c /etc/wpa_supplicant.conf -B >/dev/null 2>&1
ifconfig  ${interface}  ${ipaddr}  netmask  ${netmask}  up
route add default gw ${gateway}
echo nameserver ${dns1} >> /etc/resolv.conf
echo nameserver ${dns2} >> /etc/resolv.conf

This will boot to prompt and set up the static ip consistently with a keyboard dongle plugged in.  Unplug the keyboard and reboot, no static ip until a keyboard is plugged in.

This is for a wifi camera using mjpeg-streamer.  Works great until I try to setup a static ip.  The satellite modem we're using here in the middle of a desert can reset during a thunderstorm and change addresses of local devices.  Of course, this necessitates a rescan to determine which is now the camera server.

How to boot to server completely headless using static ip?  Motioneyeos and motion are not options as they perform poorly.

Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1079
Re: can't get static ip without keyboard
« Reply #1 on: August 29, 2023, 09:06:47 AM »
I don't think this is a static IP issue vs wpa supplicant needing enough random entropy to start the connection.   Entropy sources are generated from external devices like keyboards and mice.   Alternatively, you can install rng-tools.tcz and use rngd. Which will allow the processor to generate entropy from the arm core.


Offline jbbum

  • Newbie
  • *
  • Posts: 33
Re: can't get static ip without keyboard
« Reply #2 on: August 29, 2023, 09:34:59 AM »
Hi Paul,  can't find that extension.

Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1079
Re: can't get static ip without keyboard
« Reply #3 on: August 29, 2023, 09:44:21 AM »
You never mentioned what version of piCore you were running.  Assuming you are on the latest version 14.0

http://www.tinycorelinux.net/14.x/armv6/tcz/rng-tools.tcz

Offline jbbum

  • Newbie
  • *
  • Posts: 33
Re: can't get static ip without keyboard
« Reply #4 on: August 29, 2023, 01:21:00 PM »
Using version 13.  got rng tools

Offline Greg Erskine

  • Sr. Member
  • ****
  • Posts: 402
Re: can't get static ip without keyboard
« Reply #5 on: August 29, 2023, 05:13:11 PM »
It's usually easier to setup a static IP on your router.

Offline CNK

  • Full Member
  • ***
  • Posts: 239
Re: can't get static ip without keyboard
« Reply #6 on: August 29, 2023, 07:24:31 PM »
I had the same problem but used haveged instead of rng-tools:

Code: [Select]
# Speed up enthropy collection for /dev/random (otherwise takes 1min after Pi Zero boots up)
sudo haveged

I'm not sure which is better, but haveged.tcz doesn't have any dependencies, unlike rng-tools.tcz (I can't remember whether I knew of it before or not).

Offline jbbum

  • Newbie
  • *
  • Posts: 33
Re: can't get static ip without keyboard
« Reply #7 on: August 30, 2023, 09:08:33 AM »
Sorry Paul, but the vote is in for CNK's suggestion.  Could not get rng-tools to make a difference.  Restarted with new sdcard and haveged started in bootsync.  So far, booted headless with static ip consistently.
Thank you.

Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1079
Re: can't get static ip without keyboard
« Reply #8 on: August 30, 2023, 09:59:57 AM »
Either works.   I use rngd on all my pies.  haveged would only offend a cryptography expert.