Raspberry Pi troubleshooting

Error: ‘No space left on device’
# check memory size.

$ df -h

# None should have 100% but if so here is how to fix it

$ sudo raspi-config

# select ‘Expand Filesystem’ then restart computer when prompted
https://steve0hh.wordpress.com/2013/02/10/raspberry-pis-no-space-left-on-device-error-message/

Changing keyboard layout

$ sudo raspi-config

# select Internatinalisation Options->Change Keyboard Layout->Generic 105-key (Intl) PC->Other->English (US)->English (US)->Right Alt (AltGr)->No compose key->…
# alternative http://baligena.com/changing-keyboard-layout/

Fix Raspberry pi zero wifi disconnect/sleeps after a certain period of time. source, and here

$ sudo nano /etc/modprobe.d/8192cu.conf

Add these lines
# Disable power management
options 8192cu rtw_power_mgnt=0 rtw_enusbss=0

After a while the monitor will wont work and you will not be able to see the command line once you plug in the HDMI. It goes black and you cannot see the screen. In order to keep the terminal alive here what is need to be done. source, source2

$ sudo nano /etc/rc.local

ABOVE the “exit 0” line insert:
setterm -blank 0 -powerdown 0 -powersave off

$ sudo reboot

# As of 2016-07-03 you cannot update raspberry pi packages thus some programs cannot be updated such as git.
# to have the latest git version you will need to install it by source
How To Install Git from Source

Remote Access Raspberry Pi desktop using VNC

Super Easy using windows “Remote Desktop Connection” and “xrdp”
http://www.raspberrypiblog.com/2012/10/how-to-setup-remote-desktop-from.html

So first we need to install some software on the Raspberry Pi, but don’t worry it is very easy!
  1. Start up your Pi to the terminal prompt.
  2. Type the following command “sudo apt-get install xrdp”
  3. If promoted enter your password (the default is “raspberry”)
  4. Type “Y” and press enter.
  5. This is now installing xrdp onto your Pi which is the software we are going to use for the remote desktop connection.  Wait for it to complete.
  6. Restart your Pi.  We are going to check that xrdp is going to start up automatically.
  7. When your Pi has booted to the command prompt look for [ ok ] Starting Remote Desktop Protocol server : xrdp sesman.  This shows you that xrdp is installed and automatically starting up on start up of your Pi
  8. The last step is to make a note of the IP address of your Pi which should also be displayed on the start up screen.  In my case below it is 192.168.1.9.  This is the address of your Pi on your network and what we will use to connect to your Pi from the second machine.
  9. Port forwarding 3389

 

 

OR

 

VNC in browser using tightvncserver and noVNC
https://www.raspberrypi.org/forums/viewtopic.php?f=99&t=81165

Tunnel Traffic Proxy

Want to use your local machine firefox browser but want to tunnel your traffic thru your server. Here is how its done using ssh.
$ ssh -D 1080 username@server

additional reading
http://www.redpill-linpro.com/sysadvent//2015/12/13/socks-proxy-as-poor-mans-vpn.html
https://news.ycombinator.com/item?id=10726158
https://github.com/apenwarr/sshuttle

Firefox extension Proxy Switcher

Useful linux application that does similar action without all the browser configuration
https://github.com/apenwarr/sshuttle
$ sshuttle -r username@sshserver 0/0

network proxy configuration

iptables

iptables is a unix firewall.  The name is not self descriptive.  Below are some notes I gathered.

Allow node.js port 3000 to be accessed outside the machine.  Vagrant (the inside) and windows (the outside).  The 1st one is to add a rule to the beginning and the 2nd is to append at the end of all the rules.  Ultimately they are the same.  Be careful with the second one because rules before will take preference.
$ sudo iptables -I INPUT -p tcp --dport 3000 -j ACCEPT
$ sudo iptables -A INPUT -p tcp --dport 3000 -j ACCEPT

Using Iptables on Linux

Webmin

Webmin is a web-based system configuration tool for Unix-like systems.  Can configure shorewall6.

Installation:
$ sudo nano /etc/apt/sources.list.d/webmin.list

deb http://download.webmin.com/download/repository sarge contrib

$ wget -q http://www.webmin.com/jcameron-key.asc -O- | sudo apt-key add -
$ sudo apt-get update
$ sudo apt-get install webmin

Finally, in your client’s web browser, go to the webmin login page, https://localhost:10000.
The server username and password is the credentials to login.

Sources:
https://askubuntu.com/questions/638066/is-there-a-simple-web-gui-for-apache-that-runs-on-ubuntu#answer-638070
https://www.digitalocean.com/community/tutorials/how-to-install-webmin-with-ssl-on-ubuntu-14-04

PuPHPet troubleshooting

You may avoid issues by using the MINGW32 terminal instead of something else.

 

Installed a new puphpet and the web page won’t show up.

  1. vagrant ssh
    • inside the puphpet folder
  2. $ telnet locahost 80
    • verify a successful response
  3. $ sudo service apache2 restart
    • if apache2: Configuration error: More than one MPM loaded.
      1. $ sudo a2dismod worker
      2. $ sudo service apache2 restart

If php file is being read as plain text.  This was a phpmyadmin issue

  1. run $ sudo apt-get install libapache2-mod-php5
  2.  restart apache

You may get an phpmyadmin error ‘phpmyadmin.pma_table_uiprefs doesn’t exist’ when you attempt to open database tables
http://stackoverflow.com/questions/20731487/phpmyadmin-pma-table-uiprefs-doesnt-exist#answer-24937839
run this command
$ sudo dpkg-reconfigure phpmyadmin