WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

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

Offline jbbum

  • Newbie
  • *
  • Posts: 39
can't get static ip without keyboard
« on: August 29, 2023, 10: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: 1243
Re: can't get static ip without keyboard
« Reply #1 on: August 29, 2023, 12:06:47 PM »
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: 39
Re: can't get static ip without keyboard
« Reply #2 on: August 29, 2023, 12:34:59 PM »
Hi Paul,  can't find that extension.

Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1243
Re: can't get static ip without keyboard
« Reply #3 on: August 29, 2023, 12:44:21 PM »
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: 39
Re: can't get static ip without keyboard
« Reply #4 on: August 29, 2023, 04:21:00 PM »
Using version 13.  got rng tools

Offline Greg Erskine

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

Offline CNK

  • Wiki Author
  • Sr. Member
  • *****
  • Posts: 278
Re: can't get static ip without keyboard
« Reply #6 on: August 29, 2023, 10: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: 39
Re: can't get static ip without keyboard
« Reply #7 on: August 30, 2023, 12:08:33 PM »
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: 1243
Re: can't get static ip without keyboard
« Reply #8 on: August 30, 2023, 12:59:57 PM »
Either works.   I use rngd on all my pies.  haveged would only offend a cryptography expert.