Legacy

/bin/bash^M: bad interpreter

Bash scripts are very sensitive to line endings which can cause some portability issues between windows and unix-like systems (depending on how the text editor encodes line breaks). If you would like to see the invisible characters that are making your life confusing simply type:

cat -v <FILE>

The easiest solution to this issue is a simple sed replace line:

sed -i -e 's/\r$//' <FILE>

400: Bad Request in HomeAssistant

So for some reason in v2021.7.0 HomeAssistant introduced a bug that breaks a lot of systems that rely on its NGINX reverse proxy add-on to provide ssl capabilities. Thankfully the fix itself is pretty simple.

  • To begin, try to navigate to the site to produce the error, then in the HAS web GUI navigate to the Supervisor Logs (Settings>System>Logs)

  • Grab the IP that shows up in the error that reads

    Read more >

400: Bad Request in HomeAssistant

So for some reason in v2021.7.0 HomeAssistant introduced a bug that breaks a lot of systems that rely on its NGINX reverse proxy add-on to provide ssl capabilities. Thankfully the fix itself is pretty simple.

  • To begin, try to navigate to the site to produce the error, then in the HAS web GUI navigate to the Supervisor Logs (Settings>System>Logs)

  • Grab the IP that shows up in the error that reads

    Read more >

Change Proxmox Default Port (Kinda)

The Proxmox team doesnt really have any plans on changing the default port assigned to Proxmox (8006) and their documentation just tells you to use nginx to proxy the traffic if you want to change the default port so the following script should change your port to the port of your choosing [with 443 as the default].

#!/bin/bash
#Install nginx
apt install nginx

#Checks for your default nginx file and deletes it
FILE=/etc/nginx/conf.d/default
if [-f "FILE"];then
	rm $FILE
else
	rm /etc/nginx/sites-enabled/default
fi

#Pull the FQDN out of the hosts file
read -p "Enter the FQDN of your server or [ENTER] to set to default from /etc/hosts file" FQDN
if [ -z FQDN ]
then FQDN=$(hostname -f)
fi

#Create your new nginx File
cat > /etc/nginx/conf.d/proxmox.conf << EOF
upstream proxmox {
    server "$FQDN";
}

server {
    listen 80 default_server;
    rewrite ^(.*) https://$host$1 permanent;
}

server {
    listen 443;
    server_name _;
    ssl on;
    ssl_certificate /etc/pve/local/pve-ssl.pem;
    ssl_certificate_key /etc/pve/local/pve-ssl.key;
    proxy_redirect off;
    location / {
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade"; 
        proxy_pass https://localhost:8006;
	proxy_buffering off;
	client_max_body_size 0;
	proxy_connect_timeout  3600s;
        proxy_read_timeout  3600s;
        proxy_send_timeout  3600s;
        send_timeout  3600s;
    }
}
EOF

#test your config
nginx -t
#reload nginx
nginx -s reload

#creating some dependencies via systemd overrides
cat > /etc/systemd/system/nginx.service.d/override.conf << EOF
[Unit]
Requires=pve-cluster.service
After=pve-cluster.service
EOF

systemctl restart nginx
systemctl enable --now nginx

Change Proxmox to DHCP Client

I don’t really like like allowing servers to set their own IP addresses, i think its kinda weird and i like to handle things at the network level so I typically have all my servers as DHCP clients and I set their addresses statically on the network device they’re attached to. Unfortunately proxmox doesn’t like that so it doesn’t include DHCP in the installer, which is fine. Its easily fixed.

Read more >

Clear Home Assistant Refresh Tokens

As much as I love Home assistant there are some small papercuts that can make it annoying to deal with, this is one of them. Every time you elect to “stay signed in” and you don’t sign out before exiting the page you’ll have a nice token sitting in this long list of your previous mistakes. I found this quick fix on Reddit, but understand that this will clear ALL the tokens in your home assistant (even the session that youre currently in) so you’ll have to log back in. In order to do it, just pop open your web console and paste the following javascript in there, your browser might bark at you saying something about pasting untrusted code, just allow pasting and keep it pushing.

Read more >

Connecting ProxMox cluster over Tailscale

This tutorial is assuming that you already have Tailscale installed on your Proxmox hosts, if you havent done so look at the installation for Tailscale on Debaian Bullseye.

Install

  1. Because /etc/hosts has priority in all host lookups we are just going to edit the these files on any of the machines that we would like to connect. To do so you can simply vim /etc/hosts and your new host files will end up looking like this with host being the node you want to start the cluster on and remote being the node that will join the cluster

    Read more >

Copy ssh keys without ssh-copy-id

I ran into this issue today so I thought that i would put a solution that I found on here. If you ever run into a situation in which you need to copy your ssh keys to another box but you dont have the handy dandy ssh-copy-id tool, the following one liner should work. Check out this oracle web page for more info.

cat ~/.ssh/id_rsa.pub | ssh <USER>@<IP> 'cat >> .ssh/authorized_keys && echo "Done"'

Creating a random private IPv6 Range

If you’re anything like me and (and a good other portion of the internet) you don’t want to be bothered with IPv6 addressing because “IPv4 still works” but eventually its time to grow up and realize you need to start becoming more familiar with IPv6 outside of basic textbook knowledge and today I’m gonna teach you how to create a random IPv6 private range for if you need to set up VLANs, VPN tunnels, or whatever.

Read more >

How to Clone a Virtual Machine in ESXI (without vCenter)

When you’re running ESXI without vCenter, sometimes really niche things come up and you have situations that are kind of a pain without the appropriate management software so sometimes you gotta be a little janky.

  • So Primarily you’re going to want to power off the VM you want to clone.

  • Then you want to right click the VM and chose Edit Settings.

    • In the Virtual Hardware tab take not of the name and location of your Disk File.
  • Next you’re going to open your Datastore Browser by going Storage and in the Datastores tab click the Datastore Browser button.

    Read more >