Tiny Core Linux

Tiny Core Base => Raspberry Pi => Topic started by: jbbum on August 29, 2023, 07:31:35 AM

Title: can't get static ip without keyboard
Post by: jbbum 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.
Title: Re: can't get static ip without keyboard
Post by: Paul_123 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.

Title: Re: can't get static ip without keyboard
Post by: jbbum on August 29, 2023, 09:34:59 AM
Hi Paul,  can't find that extension.
Title: Re: can't get static ip without keyboard
Post by: Paul_123 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
Title: Re: can't get static ip without keyboard
Post by: jbbum on August 29, 2023, 01:21:00 PM
Using version 13.  got rng tools
Title: Re: can't get static ip without keyboard
Post by: Greg Erskine on August 29, 2023, 05:13:11 PM
It's usually easier to setup a static IP on your router.
Title: Re: can't get static ip without keyboard
Post by: CNK 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).
Title: Re: can't get static ip without keyboard
Post by: jbbum 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.
Title: Re: can't get static ip without keyboard
Post by: Paul_123 on August 30, 2023, 09:59:57 AM
Either works.   I use rngd on all my pies.  haveged would only offend a cryptography expert.