raspberry-pi
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
raspberry-pi [2013/11/22 02:02] – [Logs] dblume | raspberry-pi [2023/04/12 20:44] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Raspberry Pi ====== | ====== Raspberry Pi ====== | ||
- | From [[http:// | + | From [[http:// |
+ | |||
+ | Also, highly recommended: | ||
Partway down the page, it says there' | Partway down the page, it says there' | ||
Line 61: | Line 63: | ||
===== Logs ===== | ===== Logs ===== | ||
- | Consider [[http://people.virginia.edu/~ll2bf/docs/ | + | Consider [[https://github.com/azlux/log2ram|installing |
- | <code bash> | + | When there are problems, check for logs in '' |
- | # X-Start-Before: | + | |
- | # X-Stop-After: | + | |
- | </code> | + | |
- | And then | + | I think we need to update ''/ |
- | <code> | + | <file bash log2ram.service> |
- | $ sudo insserv | + | [Unit] |
- | </code> | + | Description=Log2Ram |
+ | DefaultDependencies=no | ||
+ | Before=basic.target rsyslog.service syslog.target systemd-journald.service sysinit.target shutdown.target apache2.service nginx.service | ||
+ | After=local-fs.target | ||
+ | Conflicts=shutdown.target reboot.target halt.target | ||
+ | RequiresMountsFor=/var/log / | ||
+ | IgnoreOnIsolate=yes | ||
- | When there are problems, check for logs in ''/ | + | [Service] |
+ | Type=oneshot | ||
+ | ExecStart= / | ||
+ | ExecStop= / | ||
+ | ExecReload= / | ||
+ | RemainAfterExit=yes | ||
+ | |||
+ | [Install] | ||
+ | WantedBy=sysinit.target | ||
+ | </ | ||
+ | |||
+ | Otherwise, it turns out that log2ram does screw up nginx's ability to start on power-cycle. Maybe need something like the following... | ||
+ | |||
+ | <file bash todo_after_powercycle.sh> | ||
+ | # | ||
+ | |||
+ | # The tool we use to save flash affects the startup of nginx | ||
+ | if [ ! -d "/var/log/nginx" ]; then | ||
+ | sudo mkdir /var/log/nginx | ||
+ | fi | ||
+ | # if service --status-all | grep -Fq '[ - ] nginx'; | ||
+ | if ! service nginx status | grep -Fq ' | ||
+ | sudo / | ||
+ | # systemctl start nginx | ||
+ | fi | ||
+ | </ | ||
===== Keyboard Repeat Problem ===== | ===== Keyboard Repeat Problem ===== | ||
Line 91: | Line 121: | ||
===== Camera ===== | ===== Camera ===== | ||
+ | A list of [[http:// | ||
Here's a [[http:// | Here's a [[http:// | ||
+ | Here's [[https:// | ||
+ | Video Tutorials: | ||
+ | |||
+ | * [[https:// | ||
+ | * [[https:// | ||
===== Headless Xwin ===== | ===== Headless Xwin ===== | ||
Line 106: | Line 142: | ||
It'd be interesting to see [[http:// | It'd be interesting to see [[http:// | ||
+ | |||
+ | **Note**: See history-of-nginx-start.txt, | ||
+ | |||
+ | ===== Backup ===== | ||
+ | |||
+ | (Old link: [[http:// | ||
+ | |||
+ | I put the microSD in the SamSung SD Adaptor, and [[https:// | ||
+ | |||
+ | ==== Reading from Device to Image File ==== | ||
+ | |||
+ | * Specify a new Image File name. (On a big disk.) | ||
+ | * Select " | ||
+ | |||
+ | |||
+ | ==== Writing from Image File to SD Card ==== | ||
+ | |||
+ | * Specify an existing Image File. | ||
+ | * Select " | ||
+ | |||
+ | My Raspberry Pi is up-to-date as of 2017-02-05. | ||
+ | ===== Cert Bot ===== | ||
+ | |||
+ | - https:// | ||
+ | - Fix it with this recipe: https:// | ||
+ | |||
+ | This seems useful: https:// | ||
+ | |||
+ | In detail: | ||
+ | |||
+ | 1. Add Backports to / | ||
+ | |||
+ | 2. Do the apt-get | ||
+ | |||
+ | sudo apt-get install certbot -t jessie-backports | ||
+ | |||
+ | 3. Run certbot | ||
+ | |||
+ | sudo certbot certonly --webroot -w / | ||
+ | | ||
+ | You should find that / | ||
+ | | ||
+ | 4. Renew (and reload if successful) with | ||
+ | |||
+ | sudo certbot renew && / | ||
+ | |||
+ | 5. Consider using a root cronjob | ||
+ | |||
+ | sudo crontab -e | ||
+ | 0 5 * * 0 certbot renew --post-hook " | ||
+ | |||
+ | < | ||
+ | IMPORTANT NOTES: | ||
+ | - Congratulations! Your certificate and chain have been saved at | ||
+ | / | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | - If you lose your account credentials, | ||
+ | | ||
+ | - Your account credentials have been saved in your Certbot | ||
+ | | ||
+ | | ||
+ | also contain certificates and private keys obtained by Certbot so | ||
+ | | ||
+ | - If you like Certbot, please consider supporting our work by: | ||
+ | |||
+ | | ||
+ | | ||
+ | </ | ||
+ | |||
+ | 6. Port forward ports 80 and 443. At the local router: | ||
+ | |||
+ | http:// | ||
+ | |||
+ | WAN -> Virtual Server / Port Forwarding | ||
+ | |||
+ | 7. Update nginx | ||
+ | |||
+ | https:// | ||
+ | |||
+ | Update / | ||
+ | |||
+ | server { | ||
+ | listen 80 default_server; | ||
+ | listen [::]:80 default_server; | ||
+ | server_name pi.dlma.com; | ||
+ | return 301 https:// | ||
+ | } | ||
+ | | ||
+ | server { | ||
+ | # SSL configuration | ||
+ | # | ||
+ | listen 443 ssl default_server; | ||
+ | listen [::]:443 ssl default_server; | ||
+ | | ||
+ | ssl_certificate / | ||
+ | ssl_certificate_key / | ||
+ | ssl_trusted_certificate / | ||
+ | ... | ||
+ | |||
+ | **TODO**: Maybe figure out [[https:// | ||
+ | |||
+ | Then check and restart nginx: | ||
+ | |||
+ | $ sudo nginx -t | ||
+ | $ sudo systemctl restart nginx | ||
+ | | ||
+ | **TODO**: Renew with '' | ||
+ | |||
+ | ===== Updating CertBot to use ACMEv2 ===== | ||
+ | |||
+ | Got an email from the EFF saying my current CertBot client uses ACMEv1 and it needs to be upgraded. Followed some instructions here: | ||
+ | |||
+ | sudo apt-get remove certbot | ||
+ | wget https:// | ||
+ | sudo mv certbot-auto / | ||
+ | sudo chown root / | ||
+ | sudo chmod 0755 / | ||
+ | |||
+ | But the next step (they suggested'' | ||
+ | |||
+ | sudo / | ||
+ | | ||
+ | is broken because it first an apt-get and Jessie Backports is gone, and then because the pip installation failed Hash verification. | ||
+ | |||
+ | ==== Problem: Jessie Backports is gone. ==== | ||
+ | |||
+ | Follow the instructions here: [[https:// | ||
+ | |||
+ | Remove "< | ||
+ | |||
+ | deb http:// | ||
+ | deb-src http:// | ||
+ | |||
+ | And then essentially (I did it with a sudo vim session): | ||
+ | |||
+ | echo ' | ||
+ | | ||
+ | ==== Problem pip install hash verification ==== | ||
+ | |||
+ | [[https:// | ||
+ | |||
+ | <file bash / | ||
+ | [global] | ||
+ | extra-index-url=https:// | ||
+ | </ | ||
+ | |||
+ | ===== Upgrading Distros ===== | ||
+ | |||
+ | When upgrading from Jessie to Stretch, I followed this recipe: [[https:// | ||
+ | |||
+ | I didn't keep PiHole working, as I would get occasional network drops when working from home, and it was resolved when taking PiHole out of the mix. Will probably have to do a fresh install. | ||
+ | |||
+ | ===== PiHole ===== | ||
+ | |||
+ | **Note**: I've currently got an incompatibility between PiHole and HTTPS redirecting. So I'm not using CertBot at the moment. Will have to figure that out. | ||
+ | |||
+ | PiHole connects to FTL over port 4711. If FTL were running, it'd have a logfile you could view like so: | ||
+ | |||
+ | <code bash> | ||
+ | $ cat / | ||
+ | </ | ||
+ | |||
+ | You could also do the following: | ||
+ | |||
+ | <code bash> | ||
+ | telnet 127.0.0.1 4711 | ||
+ | >stats | ||
+ | </ | ||
+ | |||
+ | or | ||
+ | |||
+ | <code bash> | ||
+ | echo "> | ||
+ | </ | ||
+ | |||
+ | If you can't connect, you can see which services are listening like so: | ||
+ | |||
+ | <code bash> | ||
+ | $ sudo netstat -tulpn | ||
+ | $ sudo netstat -tulpn | grep FTL | ||
+ | </ | ||
+ | |||
+ | I eventually clued in to my problem here: | ||
+ | |||
+ | <code bash> | ||
+ | $ pihole-FTL running | ||
+ | FATAL: Opening of FTL log (/ | ||
+ | Make sure it exists and is writeable by user pi | ||
+ | raspberrypi: | ||
+ | -rw-r--r-- 1 pihole | ||
+ | -rw-r--r-- 1 pihole | ||
+ | -rw-r----- 1 dnsmasq root | ||
+ | -rw-r----- 1 dnsmasq root | ||
+ | ... | ||
+ | raspberrypi: | ||
+ | [2017-09-03 15: | ||
+ | [2017-09-03 15: | ||
+ | $ sudo chmod +r / | ||
+ | $ sudo service pihole-FTL restart | ||
+ | $ sudo netstat -tulpn | grep FTL | ||
+ | tcp 0 0 127.0.0.1: | ||
+ | </ | ||
+ | |||
+ | And eventually discovered that my actual problem was that my log2ram mount was full. After fixing /var/log, I still had to ask pihole to restart its DNS. | ||
+ | |||
+ | < | ||
+ | $ pihole restartdns | ||
+ | </ | ||
+ | |||
+ | ==== Example PiHole API ==== | ||
+ | |||
+ | < | ||
+ | curl " | ||
+ | </ | ||
+ | |||
+ | ===== New ACMEv2 Certbot overwrites / | ||
+ | |||
+ | We keep backups at '' | ||
+ | |||
+ | sudo service nginx restart | ||
+ | |||
+ | ===== Jessie or earlier: Add piwheels for fast Python pip installations ===== | ||
+ | |||
+ | If you're not installing Stretch or later, here's [[https:// | ||
+ | <file bash / | ||
+ | [global] | ||
+ | extra-index-url=https:// | ||
+ | </ | ||
+ | |||
+ | ====== Keywords ====== | ||
+ | |||
+ | Keywords: Lets Encrypt, LetsEncrypt, |
raspberry-pi.1385114578.txt.gz · Last modified: 2023/04/12 20:44 (external edit)