NOOBS "very headless" setup
Posted by kll on July 22 2015 07:05:47
in case you have only
+ a laptop with WIFI.. to internet and a cardreader ( internal or USB ),
+ a RPI + power,
+ a ethernet cable,
+ a fresh NOOBS SD card
how you can set this up without HDMI keyboard mouse...
your router is at 192.168.1.1
with fix IP on laptop 192.168.1.10 and RPI 192.168.1.101
and direct ethernet ( not need crossover )
can ping and putty, same as when RPI ethernet on router.
but internet commands from RPI like wget, apt-get update.. will not work
unless your laptop is online by WIFI ( or even aircard )
and you enable win 7 wifi internet sharing: now your laptop ethernet port get new subnet IP like 192.168.137.11
this now you may change to fix 192.168.10.10

how to setup a NOOBS SD to connect to laptop AND use its internet connection?
NOOBS BLACK EDITION ( noobs noir )via laptop cardreader:
- use NOOBS SD or format 8GB SDcard, unzip NOOBS 1.4.1 to SD
- delete subdir \os\Data_Partition\ completely
- edit recovery.cmdline in first line add: [blank]silentinstall
- edit \os\Raspbian\flovours.json ( delete line 3,4,5,6,7 the boot to scratch option )
- edit \os\Raspbian\partition_setup.sh
after line:
sed /tmp/1/cmdline.txt -i -e "s|root=/dev/[^ ]*|root=${part2}|"
add this line:
sed /tmp/1/cmdline.txt -i -e "s|rootwait|rootwait ip=192.168.1.101|"
that would give you access with putty, lets say for example manually setup a RPI WIFI..
- - if you want use internet from the wifi laptop there must be internet sharing enabled
( what gives a new subnet add to the ethernet port like from 192.168.1.10 to 192.168.137.11 . )
that again you can fix to 192.168.10.10 ( old was 192.168.1.10 ) so the NOOBS need also change:
use instead
sed /tmp/1/cmdline.txt -i -e "s|rootwait|rootwait ip=192.168.10.101::192.168.10.10|"
RPI IP :: laptop IP
and add
sed /tmp/2/etc/network/interfaces -i -e "/iface eth0/a\dns-nameservers 8.8.8.8 8.8.4.4"
defines google as nameserver so RPI can go internet via ethernet - laptop - wifi/aircard

++ now put SD from cardreader to RPI powerup and wait
you are headless, blind, and ethernet "shortwired / crosswired" between laptop and RPI.
pls wait longer as 30 min / RPI1B and RPI2B, about same time!
actually you see on led blinking and ping if system ready; and then putty works:
putty pi@192.168.10.101 pw raspberry

while in first case ( RPI IP 192.168.1.101 )
it is possible to connect RPI by ethernet cable to router/hub OR direct to laptop

with the new subnet setup RPI can be reached only by laptop ethernet cable.
even a ping 192.168.10.101 via WIFI router cable RPI will not work anymore.
well, but you are ready for the beach!

the LAPTOP cmd ipconfig

laptop can ping RPI

RPI ifconfig

internet access like for sudo apt-get update works



after
sudo raspi-config could change NAME, keyboard, timezone
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install xrdp ( add i like: mc lsb-release scrot to be installed )
you can login headless via MS Remote Desktop Connection by 192.168.10.101 and "pi" "raspberry"
or after
tightvncserver pw,pw,n
after reboot need again manually by putty vncserver :1 unless you do the autostart for VNC
you can login headless via VNC viewer by 192.168.10.101:1 and that new pw


sorry, i got confused by win 7,
but i am new to that network and internet sharing thing
i just try noobs SD setup ( #6) this time using
sed /tmp/1/cmdline.txt -i -e "s|rootwait|rootwait ip=192.168.1.101::192.168.1.10|"
yes, i could have just sudo nano /boot/cmdline.txt but i wanted to test the full way again
and ( 30min later ) while internet sharing OFF i could connect putty to RPI with direct cable.
i enabled WIFI internet sharing and this time forced the ethernet port add back to 192.168.1.10
and i was able to use internet from RPI...
AND
when i connected RPI back to router still all worked!

so i think, that the win 7 change ethernet port IP ( to a different subnet ) when you enable WIFI internet sharing, it is just a smart recommendation.

i know that there is now in that router network a WRONG ?gateway? config 192.168.1.10 instead 192.168.1.1 ( router ) in RPI
possible slows down something, but i tested via RDP, RPI browser google, in both situations.
now i can change the ethernet cable on the fly and not need to change anything when i want
play RPI here on the beach ( not forget to take the loaded power bank with the 2A outlet )


Thanks to that great WIFI info i want check on a WIFI ONLY version too.
what i try first is to find the edit syntax for sed by tests, do a new
SD with noobs (1.4.1) noir, but
/os/Raspbian/partition_setup.shsed /tmp/2/etc/network/interfaces -i -e '/wpa-conf/d'
sed /tmp/2/etc/network/interfaces -i -e 's|iface wlan0 inet manual|iface wlan0 inet static|'
sed /tmp/2/etc/network/interfaces -i -e '/iface wlan0/a\wpa-ssid "my-ssid" '
sed /tmp/2/etc/network/interfaces -i -e '/wpa-ssid/a\wpa-psk "We-love-Raspberry-Pi" '
sed /tmp/2/etc/network/interfaces -i -e '/wpa-psk/a\address 192.168.1.101'
sed /tmp/2/etc/network/interfaces -i -e '/address/a\gateway 192.168.1.1'

i needed to exchange the " and ' s because interfaces want only " s

now i have RPI with PS and this noobs noir SD, powered USB HUB with W-Lan adapter
and wait and see 2 address in IP scanner ( and some mixed up descriptions )
but i could putty login at the fix 192.168.1.101 ( what is essential if you have no IP info from router...)
and do first sudo raspi-config ...
the old problem to setup noobs headless WIFI only is solved!
after my usual setup /30min more/ not try ethernet in/out yet/ it looks like this

here you see that we have the 2 IP addr. thing again, also for WIFI ( dhcpcd5 / dhcpcdui).


why is that interesting? why try anyhow about noobs, where i only use raspbian pure.

the experts only see their hardware pool and how easy and fast it is to burn raspbian and start it headless.

- but the basis concept RPI is
+ the board
+ the delivered SD
+ connected HDMI + keyboard + mouse.
some starter kit have also the WIFI adapter ... ( did you see a kit with a card reader? )
from this:
if the SD is a raspbian image: just start in a minute ( i not see that as SD offer )
if it is a noobs must install ( example raspbian ) or
-- if internet available can download more and select multi OS for installation.
so definitive, noobs offers more options

all other options require a add PC with cardreader! to make a SD.
so the noobs concept is still the best, because it allows even the
"MY FIRST PC" setup using mama's TV.

now all above test
-> headless ( PC router RPI ) or
-> very headless ( PC RPI direct cable )
require PC and cardreader and ethernet connection
but are also very valid working style:
no HDMI, or on the road/beach/hotel..
but even you want/need to work in that situation, doing the setup there is more a academic challenge, and i had always the ethernet / router cable ready for check / troubleshooting / fallback.

now i not know, even i read most beginner questions at the forum, how many people would need
the silent install? i had the idea that with a delivered noobs noir ( but a timeout ) all could be happy. with HDMI / keyboard [shift] can use noobs as usual, without operation / timeout / raspian is installed automatically.
with the PC cardreader a partition_setup.sh HACK ( for noobs ) can prepare
== FIX IP for ethernet and WIFI
== ( and ssid,pw ) if required.
== gateway and dns nameserver for very headless
WITH RASPBIAN ONLY THE FIX IP IS POSSIBLE ( cmdline.txt )


and a hour after i write that i play with a code what can do that!!
-a- the startup manual of OCTOPI octoprint talks about to edit a 'octopi-network.txt' file, so i got very interested, see here
-b- after install and check interfaces i see how he do that

-c- here i see it again.
so in the raspbian image, in /etc/network/interfaces
can be a default config and the rest can come from a 'include file' from the /boot/partition
and that can be written at the raspbian only image in 'DOS' mode
and for noobs /os/raspbian by the same way i changed the cmdline.txt there.

even i like it, i think the problem will be, that with the fix ip and network config in interfaces, the wpa_gui and dhcpcd5 and dhcpcdui not work anymore! Hmm how to make both possible?


how to test?
first again overwrite the SD with raspbian only ( from PC )
then switch the USB cable ( of the card reader) to the RPI where a other raspbian is running.

working way? use xrdp desktop / that automount drives
filemanager go to that directories, filemanager tools / open terminal in directory / sudo nano filename

i can edit now that new interfaces.conf file
and here already booted ( with xrdp installed ) and ethernet works

and now disconnect ethernet and connect powered usb hub WIFI adapter

all works ?
play with WIFI only i had a bad situation, IP scanner show me 4 IP address, ping ssh not work to any!
needed long to find a config where boot to WIFI worked, and when WIFI dead ( pull cable) and connect Ethernet that comes up good!
here short / cleaned up version
/etc/network/interfacesauto lo
iface lo inet loopback

allow-hotplug eth0
iface eth0 inet dhcp

auto wlan0
allow-hotplug wlan0

source /boot/interfaces.conf

/boot/interfaces.conf# interfaces.conf
# RASPBIAN BOOT NETWORK CONFIG
# this file is included into the /etc/network/interfaces
iface wlan0 inet static
address 192.168.1.102
wpa-ssid "My-ssid"
wpa-psk "We-Love-Raspberry-Pi"

only the eth0 hot-plug and dhcp combination did allow that?
you can play hours without any result, and only with WIFI and router Ethernet cable ready you have a chance.
If you are in a real WIFI ONLY situation might have a hard time.
i read many about erase ( sudo apt-get purge ) ifplugd and dhspcd5...
well, that's not my job, if there are problems in the Raspbian distro now, they might be solved with the next version.
only after it works you may play with other options, like the power...
i use a RPI1B with camera and 2A PS and a powered BELKIN USB Hub and "Venus Suppy Co" 802.11bgn WIFI
and use the "RPi Cam Control v6.0.2" from here see here
you still can find the forum threads from the beginning of this tool.
now i try to use one ( the BELKIN ) powersupply only, by a cable back from USB Hub USB port to RPI mini USB power port. ( and even i play with IP address again all worked)
now, if there is any current limitations in that path, still could use one of that USB Y cables from a ext. HD, like feed power to RPI from front and back!
anyhow its good that the WIFY is on the Hub and not on the RPI, because
-a- it gets hot
-b- you may need to move it for optimal reception.
in a RPI2B all that might not be needed?


so again,
if
/etc/network/interfacesauto lo
iface lo inet loopback

allow-hotplug eth0
iface eth0 inet dhcp

auto wlan0
allow-hotplug wlan0
iface wlan0 inet static
address 192.168.1.102
# can use " or NO " but not '
wpa-ssid "my-wlan"
wpa-psk "We_Love_RPi"

wifi comes up alone, and if i plug in ethernet later, it works too, gets IP from router.
if i use
/etc/network/interfacesauto lo
iface lo inet loopback

auto eth0
allow-hotplug eth0
iface eth0 inet static
address 192.168.1.101

auto wlan0
allow-hotplug wlan0
iface wlan0 inet static
address 192.168.1.201
wpa-ssid "my-wlan"
wpa-psk "We_Love_RPi"

wifi and ethernet work, but ethernet must be connected at boot,
if ethernet not connected at boot
ping not work at all, even i see the wifi in the router!
put in ethernet cable good, even take out again, wifi still good!


network check?
the tools:
- router dhcp lease is limited, not see devices with a configured fix IP
- the "Advanced IP Scanner" has its description errors and you must press the SCAN button, like when wait for RPI WIFI come up its not funny.
- wireshark is difficult to use and actually not work because error NPF driver not running ( i reinstall it and OK )
but still no idea how to just get the info like from a local lan IP scan.

I am a complete network idiot, i never got my "homegroup" running between 2 WIN 7 computers. I remember times when i work engineering we even used redundant ethernet networks... but for that IT work always some "specialists" set it up, so i learned nothing.
the router switch or hub devices are also hidden in a box, and when you ask the "specialists" they only worry you want hack their system.

and even i used 'ping' i now, with above situation that i see 4 IP of one device but i could not ping one! ask, what is the lower level, below ping?
how a IP scanner software catch MAC, brand, device name, of network devices. ( but why ping not show any of that info? a anti hacker measure? )
now i found ( in windows ) arp -a 192.168.1.1..
what shows the MAC also

ok, i start google and search, and start on PC python2, auto ping
give 255 errors,
it really call cmd ping with Popen(['ping', '-c', '3', ip]
and in RPI i works, but well, my win 7 ping not knows '-c' but '-n'!
not has that respose code so i must scan the ping result text for the "TTL" string ( 5min for a scan in windows! GRRR )
i commented lots of lines to make it snappy

and the code

- and sockets

and the code


so i check again , with ethernet disconnected at boot
i can arp 4 IP, ping 0 IP
compare the dmesg in RPI just show the one difference:
[ 27.951311] smsc95xx 1-1.1:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0xCDE1
[ 31.213539] cfg80211: Calling CRDA to update world regulatory domain
[ 31.400413] wlan0: authenticate with d8:fe:e3:dc:f3:19
[ 31.507699] wlan0: direct probe to d8:fe:e3:dc:f3:19 (try 1/3)
[ 31.714061] wlan0: send auth to d8:fe:e3:dc:f3:19 (try 2/3)
[ 31.715823] wlan0: authenticated
[ 31.724213] wlan0: associate with d8:fe:e3:dc:f3:19 (try 1/3)
[ 31.733714] wlan0: RX AssocResp from d8:fe:e3:dc:f3:19 (capab=0x411 status=0 aid=2)
[ 31.745733] wlan0: associated

the ethernet link comes up first. if i plug the cable in later that line will be at the end.
and no reason why wlan0 does not work when eth0 is not up first.


now i see at forum this see also this
sudo nano /etc/network/interfacesauto lo
iface lo inet loopback

auto eth0
allow-hotplug eth0

auto wlan0
allow-hotplug wlan0

source /boot/interfaces.conf

sudo nano /boot/interfaces.conf# interfaces.conf
# RASPBIAN BOOT NETWORK CONFIG
# this file is included into the /etc/network/interfaces

iface eth0 inet manual

iface wlan0 inet manual
wpa-ssid "my-wlan"
wpa-psk "We_Love_RPi"

sudo nano /etc/dhcpcd.confinterface eth0
static ip_address=192.168.1.101/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.1
interface wlan0
static ip_address=192.168.1.201/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.1


but now comes the real test:
reboot without ethernet cable: 201 OK hot plug ethernet cable 101 OK
reboot without wlan adapter: 101 OK hot plug adapter 201 NOT WORK
reboot without cable and adapter: blind hot plug adapter blind hot plug ethernet cable 101 OK after some time
reboot eth0 AND wlan0 OK remove wlan0 201 NOT WORK hot plug wlan0 201 OK
now, even the wlan adapter hot plug not work from boot, that is a great progress,
THANKS @knute


after i have learned the latest tricks ( about dhcpcd..) now try again the NOOBS NOIR with that:
incl in /os/Raspbian/partition_setup.sh# for a short ethernet connection PC RPI
#sed /tmp/1/cmdline.txt -i -e "s|rootwait|rootwait ip=192.168.10.101::192.168.10.10|"
#sed /tmp/2/etc/network/interfaces -i -e "/iface eth0/a\dns-nameservers 8.8.8.8 8.8.4.4"
# for WIFI with fix ssid in interfaces
sed /tmp/2/etc/network/interfaces -i -e '/wpa-conf/d'
sed /tmp/2/etc/network/interfaces -i -e '/iface wlan0/a\wpa-ssid "my-wlan" '
sed /tmp/2/etc/network/interfaces -i -e '/wpa-ssid/a\wpa-psk "We_Love_RPi" '
#sed /tmp/2/etc/network/interfaces -i -e '/wpa-psk/a\address 192.168.1.101'
#sed /tmp/2/etc/network/interfaces -i -e '/address/a\gateway 192.168.1.1'
# using dhcpcd.conf for fix ip now
sed /tmp/2/etc/dhcpcd.conf -i -e '$a\ interface eth0'
sed /tmp/2/etc/dhcpcd.conf -i -e '$a\ static ip_address=192.168.1.101/24 '
sed /tmp/2/etc/dhcpcd.conf -i -e '$a\ static routers=192.168.1.1 '
sed /tmp/2/etc/dhcpcd.conf -i -e '$a\ static domain_name_servers=192.168.1.1 '
sed /tmp/2/etc/dhcpcd.conf -i -e '$a\ interface wlan0'
sed /tmp/2/etc/dhcpcd.conf -i -e '$a\ static ip_address=192.168.1.201/24 '
sed /tmp/2/etc/dhcpcd.conf -i -e '$a\ static routers=192.168.1.1 '
sed /tmp/2/etc/dhcpcd.conf -i -e '$a\ static domain_name_servers=192.168.1.1 '



now above noobs noir setups i did run more then 10 times, only the first time i forget to delete
the data partition "OS" and nothing happened.
but what we got?
-a- with this we can setup a raspian ( under noobs ) by preparing the card and powering it up in the RPI.
-b- with the above settings in /os/Raspbian/partition_setup.sh
we can prepare also a normal ( HDMI.. ) noobs setup regarding network.
#_______________________________________________________________
but we just have here at forum the usual question about setting up noobs without ethernet network connection TO install other OS? ( as noobs install not work with WIFI )
for that it would be necessary to get the other OS from repository to SD card first,
so no network download is needed at installation.
that might look like a question what is the absolute opposit of noobs noir,
as the silent install is restricted to the installation of ONE OS ( for me until now RASPBIAN )
but that is the point, if i am able to build the "FAT NOOBS", i am also able to build a noobs noir pidora...
i just have to find out from where and how the other OS are downloaded.
very fast i understand that i have no tools to download a directory to my win7 PC
after WGET/Windows 1.5.3.1, and WinWget_0.20beta_setup.exe and
visualwget: well, i still do not know how to do it!
i change my mind and and play on RPI, on the USB stick make a NOOBS dir
and try wget of that other OS directories.
-1- a full directory can only get with the -r recursive option
-2- but there are 2 sub directories full of old images and archives what i not want
-3- that website gives me a index.html file i not want
-4- there is a robot.txt what prohibits a download
so i need a hour to learn about "wget"
i download 7 OS ( there are different versions for RPI1 and RPI2 )
to the USB stick. that stick i bring to the PC where i setup the NOOBS SD and copy them under /os/
the SD back to RPI(1B) and downstairs to the HDMI TV.( no ethernet cable )
perfect, i see the RASPBIAN / DATA PARTITION / and the 7 new OS
all with the SD card symbol.
for test i install 2 ( arch and pidora ) and boot pidora, all OK.
bring back upstairs and connect to network, i can even ssh putty into pidora but all very different there!
now, as i already know how to download i want try again from PC, slowly build up my "FAT NOOBS", so i can later select what to copy to a SD
for creating MY-NOOBS ( not waste space with OS i not want and not waste time with downloading what i need additionally )


as in RPI terminal it is also in windows cmd window the first problem to go to the path you need to store the files, luckily i use the
TotoalCommander, i can find my NOOBs setup directory and open a "open command prompt window"
here i download the wgetwin-1_5_3_1-binary.zip
and unzip and tested it already.
just to make the path thing go away i copy now wget.exe,url.c,url.h,version.c temporary to my noobs setup dir, so i can just type wget.
in a browser open RPIORG and see i could load the OS "osmc_pi1"
in windows it did not work as expected, i got the index.html and 4 very strange files like @C=D;O=A ( but i can delete manually )
i not want waste time to try to adjust the GUI versions for windows to do that too, or try to find other "downloaders"
i got the files i need with that command, i used in windows and in RPI.
wget -r --level=1 -nH -e robots=off --no-parent --reject "index.html*" http://downloads.raspberrypi.org/osmc_pi1/

in RPI i open a terminal window and first try to mount the fresh NOOBS SD in cardreader

then i make a script:
nano getOS.sh#!/bin/bash
# NOOBS add OS
# for copy to USB stick use:
#cd /media/MYUSBSTICK/NOOBS/
# for mount cardreader: (while sda1 is USB stick )
# just do a manual mount / no fstab..
sudo mount -t vfat -o uid=pi,gid=pi /dev/sdb1 /mnt/
cd /mnt/os/

MYOS='pidora'
RPIORG='http://downloads.raspberrypi.org'

wget -r --level=1 -nH -e robots=off --no-parent --reject "index.html*" $RPIORG/$MYOS/

ls
cd

chmod +x getOS.sh
./getOS.sh

loads the OS "pidora" to the noobs setup SD