cloudflare 使用home assistant 出现400:Bad Request错误的处理

在configuraiton.yaml添加

http:
   # Cloudflare setting to unlock reverse proxy
   use_x_forwarded_for: true
   trusted_proxies:
     - 192.168.0.109

https://community.home-assistant.io/t/issue-with-nginx-reverse-proxy-setup-external-access/321776/8

# Uncomment this if you are using SSL/TLS, running in Docker container, etc.
http:
  ip_ban_enabled: true
  login_attempts_threshold: 5
  use_x_forwarded_for: true
  trusted_proxies:
    - 172.30.33.0/24
取而代之的是:

# Uncomment this if you are using SSL/TLS, running in Docker container, etc.
 http:
  ip_ban_enabled: true
  login_attempts_threshold: 5
  use_x_forwarded_for: true
  trusted_proxies:
    - 172.30.33.0/24

实践解决如下:

nano /usr/share/hassio/homeassistant/configuration.yaml

# Loads default set of integrations. Do not remove.
default_config:

# Load frontend themes from the themes folder
frontend:
  themes: !include_dir_merge_named themes

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
 http:
  ip_ban_enabled: true
  use_x_forwarded_for: true
  trusted_proxies:
    - 192.168.0.0/24
    - 127.0.0.1
    - 172.16.0.0/12
    - 172.30.33.0/24
    - 172.30.32.0/23

emmc启动失败后解决方案

故障现象:线刷显示能找到设备并且可以刷成功,但系统无法启动(所有指示灯都不亮)

1、刷系统到sd卡

2、启动sd卡

3、armbian-config

从sd将系统刷入emmc

手动扩展空间

扩展SD卡/eMMC上的空间 – 恩智浦8MMNAVQ:NavQ配套计算机 (gitbook.io)

手动扩展空间

如果不想使用该脚本,可以运行以下命令。

安装 ROS 时,您可能会遇到 eMMC 或 SD 卡空间不足的问题。若要展开 rootfs 分区,请按照下列步骤操作:

如果您在 eMMC 上,您将使用 /dev/mmcblk2。如果您使用的是 SD 卡,请使用 /dev/mmcblk1。默认情况下,NavQ 从套件中随附的 SD 卡启动。

$ sudo fdisk /dev/mmcblk1

Command (m for help): p

Device Boot Start End Blocks Size Id System

/dev/mmcblk1p1 * 16384 186775 170392 83.2M c W95 FAT32 (LBA)

/dev/mmcblk1p2 196608 <end> <blocks> <size> 83 Linux

Command (m for help): d

Partition number (1,2, default 2): 2

Partition 2 has been deleted.

Command (m for help): p

Device Boot Start End Blocks Size Id System

/dev/mmcblk1p1 * 16384 186775 170392 83.2M c W95 FAT32 (LBA)

Command (m for help): n

Partition type

e extended

p primary partition (1-4)

Select (default p): p

Partition number (1-4, default 1): 2

First sector (2048-30621695, default 2048): 196608

Last sector, +sectors or +size{K,M,G} (2048-30621695, default 30621695): <press enter for default>

Created a new partition 2 of type ‘Linux’ and of size 14.5 GiB.

Partition #2 contains a ext4 signature.

Do you want to remove the signature? [Y]es/[N]o: n

Command (m for help): p

Device Boot Start End Blocks Size Id System

/dev/mmcblk1p1 * 16384 186775 170392 83.2M c W95 FAT32 (LBA)

/dev/mmcblk1p2 196608 30621695 39425088 14.5G 83 Linux

Command (m for help): w

The partition table has been altered!

完成这些步骤后,请运行以下命令:

$ sudo resize2fs /dev/mmcblk1p2

并重新启动。您现在应该能够安装 ROS Melodic 而不会出现大小问题。

fdisk 的命令

如果您只想查看命令,这些是您需要在 fdisk 中运行的命令,以便调整磁盘大小。

d <enter>

2 <enter>

n <enter>

p <enter>

2 <enter>

196608 <enter>

<enter>

n <enter>

w <enter>

<fdisk should exit>

$ sudo resize2fs /dev/mmcblk2p2 <enter> (FOR eMMC)

$ sudo resize2fs /dev/mmcblk1p2 <enter> (FOR SD CARD)

armbian下压缩磁盘镜像包

dedalodaelus/ArmbianShrink:让你的 armbian 图像更小! (github.com)

wget https://raw.githubusercontent.com/dedalodaelus/ArmbianShrink/master/armbianshrink.sh
chmod +x armbianshrink.sh
sudo mv armbianshrink.sh /usr/local/bin

[user@localhost ArmbianShrink]$ sudo armbianshrink.sh armbian.img
e2fsck 1.42.9 (28-Dec-2013)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/loop1: 88262/1929536 files (0.2% non-contiguous), 842728/7717632 blocks
resize2fs 1.42.9 (28-Dec-2013)
resize2fs 1.42.9 (28-Dec-2013)
Resizing the filesystem on /dev/loop1 to 773603 (4k) blocks.
Begin pass 2 (max = 100387)
Relocating blocks             XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Begin pass 3 (max = 236)
Scanning inode table          XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Begin pass 4 (max = 7348)
Updating inode references     XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
The filesystem on /dev/loop1 is now 773603 blocks long.

Shrunk armbian.img from 30G to 3.1G
sudo armbianshrink.sh [-s] imagefile.img [newimagefile.img]

dedalodaelus/ArmbianShrink: Make your armbian images smaller! (github.com)