Jan 19 2015
RPI headless working tips
installation:
while with NOOBS and NOOBS light need HDMI monitor or TV / keyboard / mouse / and WIFI or ethernet near TV /
a headless installation is only possible using the RASPBIAN distro, ( now SSH enabled default )
from there with putty can setup raspi-config, install software like xtightVNC, fix the ip address...
a tip for the MAC users from forum
RPI work headless
when you work from a desktop PC via SSH putty and tight VNC
there are many limitations.
copy paste PUTTY see here and it works only a little bit different in Bitvise SSH client ( context menu )
and lets say you have a putty terminal open and do a
nano myfirstpythonprogram.py
can paste a full code example from PC web browser into it.
THE CLIPBOARD TRANSFER -- CTRL C CTRL V to VNC
as i use the browser on desktop ( much faster as on RPI ) i need many times to copy words, commands, links, or complete program code from desktop to RPI
for this i used until now:
in PC putty / i edit nano a file ( like the program xxx.py , or a .../Desktop/info.txt file )
and there i can paste, save, and then open in VNC ( with leafpad..).
But now i learned from here
sudo apt-get install autocutsel
nano /home/pi/.vnc/xstartup
incl the line
autocutsel -fork as line 5
or
autocutsel -s CLIPBOARD -fork
autocutsel -s PRIMARY -fork
sudo reboot
works already with the first line, but NOT always CTRL V
usually must use mouse right button click ( context menu ) PASTE
actually that was a great step in productivity!
update 9.9.2015
i see at forum some use PASTEBIN to show code or logs, now i see there i even can install a tool
sudo apt-get install pastebinit
cat /var/log/syslog | pastebinit
under /usr/share/pastebin.d/ find lots of .conf files
after registration at pastebin.com find there API key
and try change at
sudo nano /usr/share/pastebin.d/pastebin.com.conf
but a
cat netinfo.sh | pastebinit -b http://pastebin.com give me
http://pastebin.com/d1aC6CdL what works, but is like a GUEST send me?? but it is not a entry in my pastebin??

so making it private might be more difficult
file transfer, backup,
- if the RPI SD crash or i want switch to a other distro
- for working from 2 workstations on one RPI,
- for doing python and arduino projects on RPI and PC
- bring pictures and code sniplets from the RPI to my blog site
until now i not find the perfect way for file handling. but see here
+ as i have a powered USB hub connected to my RPI
( that usually even can power the RPI via that usb cable /
the second port is used for the radio keyboard mouse adapter)
i have per default a WIFI and a USB stick on that HUB.
all my project work ( python.. )
or system logs / command line sniplets
i backup to USB stick. with:
as i grew up with Norton commander DOS, and until today skipped the windows file manager, using Total Commander ( Win 7 ) and on RPI first install the MC.
ok, on the new RPI RASPBIAN desktop can use the PCManFM
what has the [view][dual pane mode] or [F3]
but still the MC has its use: it can run in putty window and can FTP ( without install FTP on RPI )
second backup media ( network type):
i have installed a other USB stick in my router with FTP enabled (user / password )
from PCs i use Total commander
+ with FTP login to the LAN USB stick,
+ with the SFTP plugin for Total commander i can access RPI file system ( incl the USB stick there )
for readback SD card under windows use www.diskinternals.com/download/Linux_Reader.exe
but they also have a plugin for TotalCommander to read that linux partitions ( must start TotalCommander as ADMIN )
on RPI i use MC and type in command line
cd ftp://user:password@192.168.1.1:2121/path/ ( works only inside MC not to bash! )
or save to MC [command][directory hotlist]. or edit manually nano /home/pi/.config/mc/hotlist
as i have 2 PC and one RPI i could make the RPI a Network server,
( in case the RPI is down, still can take the USB stick to the PC)
using samba like i see here and here
sudo apt-get install samba samba-common-bin 36MB
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.org
sudo nano /etc/samba/smb.conf
workgroup = WORKGROUP check control panel / system / Workgroup: on your PC
security = user remove #
at the end add
[RPI]
comment = RPI USB STICK
path = /media/KINGSTON my stick as RPI mounts it
valid users = @users
force group = users
create mask = 0660
directory mask = 0771
read only = no
sudo /etc/init.d/samba restart
you can make a separate user or use pi:
sudo smbpasswd -a pi 2 times pi password
but that way you see the stick ( read write )
and the system SD card / pi home path! ( for read )
the windows network need some time to see the new computer in the network,
the ip you fix after the installation of the RPI in /etc/network/interfaces
the computer name is the "hostname" you see also when you open a terminal
pi@RPIname
and you can change in sudo raspi-config / advanced / A2 hostname
if you not want to use Totalcommander..for file transfer and putty nano for remote edit code,
i think you should check on 2 more software for your win PC: instead of PUTTY use the
- 1 - Bitvise SSH Client ( free for private use)
that gives you a xterm window ( little bit different from putty ) and a SFTP file transfer window, it remembers the RPI ssh login!
but still there is something missing, because the file edit would be same, ( putty nano )
- 2 - notepad++ is a good code editor AND it can login to RPI by SSH FTP. after you adjust the nppFTP settings, it remembers the RPI ssh login!
pls set the TAB -> spaces ( or you would have big problems with python )
making a new ( remote ) file is tricky.
add notes on MC,
- you can start it from desktop menu or from terminal, and there you can choose to start it as sudo mc
-- i backup a path to stick and later copy it back, somehow all file privileges got changed.
so i had to chmod -R 644 *.py it back.
more about octal privilege numbers and g:rwx,o:rwx,w:rwx see here
and from command line you will see the rwx privileges by the ls -la
and the 777 AND rwx privileges by stat * in the Access: info
usually i use the xtightVNCserver on the RPI and the VNC viewer on the PC ( Win7 or Linux )
and in various other articles / like the install script../ i talk about the installation, but there are many ways. pls check also here and here
i follow the second tip
sudo apt-get install xrdp
sudo reboot to check if it really auto starts
use the Win 7 [Start][Accessories][Remote Desktop Connections]
++ the RPI not need add autostart setup, xrdp installs/works as server.
++ you get a full screen of the RPI
++ not need any installation on a win PC ( for win 7 , 8 )
( but if you need, pls check download links here )
- - might be little bit slower as xtightVNC ( like double click timing..)
-- sadly the CTRL C / CTRL V paste buffer seems to be again a issue with xrdp

when you check on the forum you will find some warnings about xrdp,
it says that it always open a NEW desktop on the RPI ( ? killing the old one ?), i not sure about the risks. well, my tests show that it works perfect:
i edit a file and leave it unsaved open, close the xrdp session and open it again and see same windows, nothing lost, pls see also the close info


in the linux community it is IN to talk bad about microsoft ( or the products windows... )
i do same, but yesterday when i installed debian on a old harddisk of my desktop,
one of the first things i installed was skype.
lets face it, when someone has a windows PC and want learn linux by buy a RPI, it is valid to make that easy by a one line installation on the RPI so he can work from his old PC without any add hardware for RPI ( HDMI monitor/TV keyboard, mouse ) and without any add software on the PC. so install xrdp on RPI is a valid tip.
while on my win 7 PC it works ( from the start menu ..)
i read, on LINUX need to install the client:
sudo apt-get update
sudo apt-get install rdesktop
and start with rdesktop 192.168.0.26 -g 800x600
( and that you can do also on the RPI to see your windows computer )
or on the tablet / phone the App: Microsoft Remote Desktop
first must start the program from the application list, there configure the RPI / I.P. / pi / raspberry /
then you can make a shortcut to RPI on the screen.
but basically the concept for remote access to RPI ( linux ) is to open a new session,
if you login by putty ( multiple ) or VNCviewer ...
but if you need to run the RPI with a HDMI monitor/TV and from remote you want
access that exact session need something different, i will try this
to have a screen shot program is nice: ( even when work headless RDP could use PC screenshot )
sudo apt-get install scrot
mkdir images
see below the config of a alias "snap" what waits 5 sec ( so you can select a other window in the desktop as that terminal you call "snap" from ) and creates a picture in subdir home/pi/images/
with a name YYYY-MM-DD_HH-MM-SS_snap.png of the active window only.
in putty or desktop terminal i needed some things to be remembered, my alias settings:
there i do a
nano /home/pi/.bash_aliases like here
i like the trick with "current" work // workedit
and the
nano /home/pi/sysinfo.sh like here # pls also make it executable
chmod +x /home/pi/sysinfo.sh
here a short note again about the linux / windows conflict, possibly only the linux specialists see.
i can buy a PI to play / learn linux.
now i can also buy PI 2 and install the windows 10 ( a kind of anti android ?)
but if you want have the PI as linux / raspbian computer, but integrate it into your windows network,
the combination xrdp and samba on PI is perfect, ( still would need install putty for the headless setup),
but on the windows computer you not have to change anything.
if you want to use NOOBS or BERRYBOOT and want be able to do boot select from remote,
pls see my hard learning here
headless is not same as remote!
it just means there is no HDMI TV ..connected to the RPI and you connect via ethernet by a
LAN / router / from PC.
i wanted to test something ( a idea i had to a question in forum: RPI on travel )
-1- power supply
what is good and easy is a battery pack / so called power bank
what includes a USB power in DC/ charger / a accu ( usually 3.xxV ) / a DC/DC to USB 5V output.
here i test a MELON power bank, a special offer from JIB
( 10400mAh / input 1A / output1 1A / output2 2A ) where i got a
second 5200mAh / input 1A / output 1A power bank additional for free, for 21USD.( but a charger was not included! )
i just run it 1 h display from 99(%) down to 76(%), if that "meter" is good could be max a 4h run possible.

but when i try to charge / load at same time as discharge / run RPI / it did not work.
so my idea of a RPI ON-LINE UPS was a dream.
-2- ethernet connect
for a travel situation best would be just a ethernet cable from laptop to RPI.
my RPI has fix IP already, at my laptop i could use the ethernet port there
for a 1 to 1 connection. sadly i don't know how to do, a ping ... not worked.
-2a- i heard today i can use any ethernet cable also for 1 to 1 , not need a cross over cable??
-2b- possibly i need a fix IP on that laptop ethernet port too?
while i play on that i got a bad warning about using same gateway ( like for my normal LAN )
need to look here
update:
on RPI use fix IP, on PC use fix IP, no gateway config, reboot
ping, putty, RDP ok

-3-
BUT, what you do when you have no network at all, not even to setup the raspian,
there is the idea to set the fix ip on the SD card: [ forum by DougieLawson ยป Wed Jul 15, 2015 2:52 pm ]
burn raspbian, edit cmdline.txt to add ip=169.254.3.14 to the end of that single line, boot, connect ethernet direct.
more about that file here
i not tested, but with NOOBS it could be the recovery.cmdline file? no, thats just noobs linux os
here more about the silent install
now i try:
8GBSD format
copy all from NOOBS_v1_4_1.zip
edit \os\Raspbian\flovours.json ( delete line 3,4,5,6,7 the boot to scratch option )
edit recovery.cmdline add in first line: [blank]silentinstall
boot rpi and let it run 1 hour ( if it runs as expected you can not see it, the green ethernet leds are bllinking,
but green ( first led ) off , red ON, green green blink, yellow ON (RPI1B)
router dhcp client tells some old story, advanced ip scanner wrong as usual, how to find anything with wireshark??
but as i usually have names like RPI, RPI1, RPI2 i just wait for "raspberry" in router DHCP list,
but that you can not do as you are expected to have only 1:1 ethernet in that specific situation,
headless, blind, and direct ethernet cable connection RPI / PC
hm, after one hour, still nothing, i reboot, nothing, i look at HDMI/keyboard,mouse system
and see it still just wants to install something, rest of noobs menu still grey.
but space now only 800MB, so the resizing did work? ok try again,
format, copy, edit.. but now also delete that datapartition entry from /os/
i see a partition_setup.sh what even "sed" the cmdline.txt, here i could add the fix ip thing if i know how to do,
ok lets start slowly.
this time the first led heavy blinking, a good sign
after 30min the ethernet leds go OFF for 3 sec, some sec later i see the raspberry name in DHCP list, and soon the green LED stays OFF.
SSH putty into that IP OK.
last word in cmdline.txt is "rootwait" so in partition_setup.sh need after:
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|"
this SD i now put in the RPI2 ( expecting it to be much faster ) and also with the 1:1 ethernet connected to laptop.
( with fix IP on ethernet 192.168.1.10, subnetmask 25.255.255.0, no gateway!, but still online with wifi ) ( as i type this text now here )
only to check: leds on RPI2 green and red heavy blinking,
laptop cmd ping 192.168.1.101
after 32 minutes ping ok ( yes there is one more indication, when RPI reboots the USB Stick blinks!
and putty ok.
try internet connection sharing on laptop, reboot RPI, but RPI still offline.
that is a little bit more complicated:
3-1- you have a laptop wifi and a router at 192.168.1.1
and a fix ip on laptop ethernet port 192.168.1.10
and a fix ip on RPI ethernet port 192.168.1.101
with a ethernet ( not need crossover ) cable between RPI and laptop putty...works
3-2- but if you want to use the internet sharing ( laptop wifi properties sharing enable )
the ethernet port gets automatic a new subnet like ip 192.168.137.11
but you can change that to laptop fix ip 192.168.10.10 and on RPI side 192.168.10.101
and if you configure at RPI: /boot/cmdline.txt ... ip=192.168.1.101::192.168.10.10
you get putty connection. and a ping to google ip works also
ping 110.164.10.114
3-3- but a wget or sudo apt-get update does still not work because a nameserver is missing.
i tried to overwrite /etc/resolv.conf with ( in first line ) with google nameserver ip
nameserver 8.8.8.8
nameserver 8.8.4.4
and that works, until you reboot
but if you add a line in
sudo nano /etc/network/interfaces
dns-nameservers 8.8.8.8 8.8.4.4
after the eth0 config. ( or do this also by sed in noobs setup
and reboot it works, and now see it also in /etc/resolv.conf
and you have internet via wifi laptop ethernet cable and can do
sudo apt-get update....
pls see more here
this is not connected to headless or not, more to: do you want work in terminal or desktop, install with apt-get / search with apt-cache / or GUI based?
i want see if i get the SYNAPTIC package manager running.
sudo apt-get install -y synaptic
what installs a lot of add python, perl, database tools,
you find it under Menu / Preferences /Synaptic Package Manager
and wants at start the PI password. With the [Status][Installed] selector you see for the first time whats inside RPI.
You can select new software and only with the APPLY button the installation will be executed. ( its slow / drives RPI on the limit / but the apt-get is for me like running blind / and that i want for batch routines only / see install script)
i tried 2 plugins to the TOTAL COMMANDER about ext 2,3,4 file systems, but i did not see the SD partitions of a noobs SD in card reader.
so i searched on and installed Freeware Linux Reader for Windows
and it is nice, as it says, it can READ ( so not edit files ....) and also save / ( upload ) files to your HD.
so when you are very desperate, a SD is not booting.. you want look into but have no linux PC / USB stick... thats the tool,
the paragon version says it is a FREE download, but later requires a registration, need a account? must pay or not? even if it is very good tool, i hate that style. but it is said you can also edit files..
in my .bash_aliases now have some additional short sysinfo

well, i am so old, i can remember using "ncd" Norton Change Directory
when you work from terminal and you sick of remember and type all that path structure
it is nice to have a tool like this, searching path and even allow interactive semi graphic operation " walk to a subdir"
i search in forum ? they never heard of it, but from ncd and wcd to debian and armhf to setup
actually it is easy:
sudo apt-get install wcd
only a small mistake in documentation, the tool is:
/usr/bin/wcd.exec
so i edit:
with call from terminal
wcd -ga get the semi graphic tree

wcd i* lists all subdir starting with "i" and you can select from that list with a,,b,c,
wcd -S / make a list of all dirs on SD and even /media/USB stick..
but now the wcd -ga call gets slow because now that dir file
cat /home/pi/.treedata.wcdis > 500kB.
unlike with "mc", wcd can not use mouse when called from desktop terminal and it has only that black background!
with nano .bash_aliases
add line "alias ncd='wcd -ga' i have my old environment back.
it still can be combined with search like ncd /boot


if you work mostly headless, there is no use to
enable in sudo raspi-config the boot to Desktop user pi option!
see also here, it takes about 20 more running programs and about 80MB RAM
update 01/2017
using RPI 1 / 2 / 3 with the current DEBIAN JESSIE
and i recently start to dig again about FTP for backup and deeper use of
MC MIDNIGHT COMMANDER
as there is no good WIKI pls check Link Link Link Link or Link
sudo apt-get install -y mc
++ main point is i can use it via PUTTY and via HDMI Desktop ( where also the mouse works )
++ also with the use of its internal file / programming editor
-- but it does not work like a SFTP tool on PC ( can not map remote computer directories UNLESS BY MC's INTERNAL FTP )
here some special settings i tested
i installed / used the "wcd" ( like ncd) for navigation but now better use MC ( possibly in tree view )
for the ftp can use
cd ftp://user:password@ftp.HOSTER.com/htdocs/../ in the MC command line, a alias did not work???
or from the [CTRL][\] directory hotlist
now, that is for security reasons deleting your password, so next time you will be asked for it.
you should not but can edit
/.config/mc/hotlist to
ENTRY "myFTP" URL "/ftp://user:password@ftp.HOSTER.com/htdocs/../"
to finish FTP type cd
there is no need to install a ftp on the raspberry pi, as it is inside MC already.
with newest OS and new Bitvise SSH client i found that now even the MOUSE works
in the SSH window, and the window can be sized bigger. using MC in the new SSH window with mouse
i would call SHH++

for backup reasons i used already the PC ( via SFTP ) or a USB stick on the RPI via MC but
all that is very limited as you loose info like original path and some file settings ( executable.root... )
for linux still best way to copy/backup files and directories is by TAR and XZ
and MC can handle that zip file type ( in its internal virtual file system ),
the usermenu [F2][6] ( you must be inside THAT sub directory to do it, and the file is one level up cd ..
or manually ( in a new subdirectory /backup/ )
tar cvf mybackup.tar /home/pi/myworkdir
xz -zv mybackup.tar
mc
now, in MC i see all that file content and i can copy out files AND directories ( like unzip...)

but tests to add new content to that zip file type ( like i can do on win7 with total commander ) did not work.
tests with "tar -u" ( 2 times executed ) resulted in 2 times that files in the tar file
also it can not be combined with the compression in a oneline command.
here a idea for a bash to backup RPI settings:
regarding headless and headless short wired ( ethernet cable between windows laptop and RPI )
i write 2 posts at forum
new headless setup
direct cable setup
update: just learned at forum that it is possible to do a wpa_supplicant.config file at /boot/ and it is moved by the booting to /etc/wpa_supplicant/wpa_supplicant.config
test with a RPI3: burn raspbian
make ssh file
make wpa file
and boot RPI3
and find wifi IP