2024年11月26日 星期二

Docker 吃掉硬碟空間處理

docker container 的 log 會無限成長,可以有好幾個 GB,只能手動刪除。

-------------------
# du -h -d 1
7.6G ./usr
47G ./var

# du /var/ -h -d 1
6.9G /var/cache
509M /var/log
40G /var/lib

# du /var/cache/ -h -d 1
942M /var/cache/debtap
5.6G /var/cache/pacman
387M /var/cache/pkgfile
6.9G /var/cache/

# pacman -Sc
Packages to keep:
  All locally installed packages

Cache directory: /var/cache/pacman/pkg/
:: Do you want to remove all other packages from cache? [Y/n] 
removing old packages from cache...
error: missing package metadata in /var/cache/pacman/pkg/unzip-6.0-20-x86_64.pkg.tar.zst.part

Database directory: /var/lib/pacman/
:: Do you want to remove unused repositories? [Y/n] 
removing unused sync repositories...

# du /var/cache/ -h -d 1
3.2M /var/cache/samba
80K /var/cache/ldconfig
942M /var/cache/debtap
2.1G /var/cache/pacman
387M /var/cache/pkgfile
4.0K /var/cache/private
1.1M /var/cache/fontconfig
3.4G /var/cache/


# du -h -d 1
4.1M ./f61f4a601db2be573c2b6351a04fcf1e79540e3cd8e1de41c6c9ab4a0fa204e0
48K ./2136c92af607bfee2ca204d3c77843dce66d7706f753e944dbe84820cf72c5ee
40K ./dc1f8e5f1fb6be942dad52e52453e2960d3bedf788f1774ddfe4462a03c66dc3
21G ./f3c5128d570fec0021b34ff8650fe9dcc531a2bcc59feb52aa9ff1e3f87b7e39
10M ./a3aefcd51740895bb721982b2dff7bfbcea164290b626a1dfb226b3a85274e50

dc1f8e5f1fb6 ==> nginx-hls-vod-server-web


清除所有 container 的 log
# truncate -s 0 /var/lib/docker/containers/*/*-json.log
-------------------

可以設 option,限制log 的大小。

--------------------------
file: /etc/docker/daemon.json
{
  "log-opts": {
    "max-size": "20m",
    "max-file": "5"
  }
}
--------------------------



2024年11月23日 星期六

MKS 安裝非官方 image -- redrathnure / armbian-mkspi


安裝 MKS PI 官方的 image,問題實在多,例如,重新啟動後,USB 無線網卡不會動,無法自己編譯 USB網卡的驅動。

redrathnure / armbian-mkspi,提供依據 Armbian 的 build image 程序所建立專案。

可以自己建,也可以直接下載已建立的 image 來用。

若有裝 MKS LCD,啟動後,可以在 LCD 上動到啟動過程。

安裝 rtl8188gu 驅動

安裝的是 McMCCRU / rtl8188gu 的驅動。

make 時,要加上參數,"make ARCH=arm64"。

另外,os_dep/linux/ioctl_cfg80211.c 中,呼叫 cfg80211_ch_switch_notify() 時,少一個參數,修改後,即可成功編譯。

---------------------
cfg80211_ch_switch_notify(adapter->pnetdev, &chdef, 0, 0);
---------------------

但是在載入 module 時,會出現無法載入 firmware 的錯誤。

---------------
[ 4377.664977] usb 1-1: RTL8710BU rev A (SMIC) romver 1, 1T1R, TX queues 3, WiFi
=1, BT=0, GPS=0, HI PA=0
[ 4377.665002] usb 1-1: RTL8710BU MAC: 50:2b:73:64:0e:e6
[ 4377.665011] usb 1-1: rtl8xxxu: Loading firmware rtlwifi/rtl8710bufw_SMIC.bin
[ 4377.665131] usb 1-1: Direct firmware load for rtlwifi/rtl8710bufw_SMIC.bin failed with error -2
[ 4377.665146] usb 1-1: request_firmware(rtlwifi/rtl8710bufw_SMIC.bin) failed
[ 4377.665155] usb 1-1: Fatal - failed to load firmware
[ 4377.665187] rtl8xxxu: probe of 1-1:1.0 failed with error -11
[ 4377.681468] 8188gu: loading out-of-tree module taints kernel.
[ 4377.711868] usbcore: registered new interface driver rtl8710bu
----------------

預設是安裝 armbian-firmware,/lib/firmware 下,沒有 rtlwifi/rtl8710bufw_SMIC.bin。

-----------------------
$ sudo apt install linux-firmware
[sudo] password for mks: 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package linux-firmware is a virtual package provided by:
  armbian-firmware-full 24.8.3
  armbian-firmware 24.11.1
You should explicitly select one to install.
-----------------------

若自己下載再 copy 到那個目錄下,會出現 Invalid firmware signature 的錯誤。

-----------------------
[  752.779538] usb 1-1: new high-speed USB device number 4 using dwc2
[  753.256104] usb 1-1: New USB device found, idVendor=0bda, idProduct=b711, bcdDevice= 2.00
[  753.256126] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  753.256134] usb 1-1: Product: 802.11n WLAN Adapter
[  753.256141] usb 1-1: Manufacturer: Realtek
[  753.256147] usb 1-1: SerialNumber: 00E04CB82101
[  753.284791] usb 1-1: RTL8710BU rev A (SMIC) romver 1, 1T1R, TX queues 3, WiFi=1, BT=0, GPS=0, HI PA=0
[  753.284815] usb 1-1: RTL8710BU MAC: 50:2b:73:64:0e:e6
[  753.284824] usb 1-1: rtl8xxxu: Loading firmware rtlwifi/rtl8710bufw_SMIC.bin
[  753.285626] usb 1-1: rtl8xxxu_load_firmware: Invalid firmware signature: 0x213c
[  753.285646] usb 1-1: Firmware revision 21571.89 (signature 0x213c)
[  753.285695] usb 1-1: Fatal - failed to load firmware
[  753.285731] rtl8xxxu: probe of 1-1:1.0 failed with error -22
[  753.327045] rtl8710bu 1-1:1.0 wlx502b73640ee6: renamed from wlan0
[  753.417659] rtl8710bu 1-1:1.0 wlx502b73640ee6: Current addr:  50 2b 73 64 0e e6 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[  753.417690] rtl8710bu 1-1:1.0 wlx502b73640ee6: Expected addr: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
[  753.417700] ------------[ cut here ]------------
[  753.417704] netdevice: wlx502b73640ee6: Incorrect netdev->dev_addr
[  753.417774] WARNING: CPU: 1 PID: 633 at net/core/dev_addr_lists.c:519 dev_addr_check+0xb0/0x140
[  753.417801] Modules linked in: uas lz4hc lz4 zram 8188gu(O) nls_iso8859_1 rtl8xxxu mac80211 cfg80211 snd_soc_spdif_tx rfkill snd_soc_simple_card libarc4 snd_soc_simple_card_utils hantro_vpu rockchip_vdec(C) v4l2_vp9 rockchip_rga videobuf2_dma_contig v4l2_h264 videobuf2_dma_sg v4l2_mem2mem videobuf2_memops videobuf2_v4l2 snd_soc_hdmi_codec videodev videobuf2_common mc snd_soc_rockchip_spdif snd_soc_core fb_st7796(C) snd_compress fbtft(C) snd_pcm_dmaengine snd_pcm snd_timer rk_crypto snd soundcore rng_core cpufreq_dt joydev ads7846 sunrpc ip_tables x_tables autofs4 dwmac_rk stmmac_platform stmmac pcs_xpcs lima gpu_sched drm_shmem_helper dw_hdmi_cec dw_hdmi_i2s_audio spidev gpio_syscon

-----------------------

重新裝 armbian-firmware-full 後,就有 rtlwifi/rtl8710bufw_SMIC.bin 這個檔了。重新插拔 USB WIFI 網卡,可以正常載入 firmware。

-----------------------
[ 1729.358248] usb 1-1: new high-speed USB device number 6 using dwc2
[ 1729.834781] usb 1-1: New USB device found, idVendor=0bda, idProduct=b711, bcdDevice= 2.00
[ 1729.834801] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1729.834809] usb 1-1: Product: 802.11n WLAN Adapter
[ 1729.834816] usb 1-1: Manufacturer: Realtek
[ 1729.834822] usb 1-1: SerialNumber: 00E04CB82101
[ 1729.863786] usb 1-1: RTL8710BU rev A (SMIC) romver 1, 1T1R, TX queues 3, WiFi=1, BT=0, GPS=0, HI PA=0
[ 1729.863811] usb 1-1: RTL8710BU MAC: 50:2b:73:64:0e:e6
[ 1729.863820] usb 1-1: rtl8xxxu: Loading firmware rtlwifi/rtl8710bufw_SMIC.bin
[ 1729.864170] usb 1-1: Firmware revision 16.0 (signature 0x10b1)
[ 1731.131773] rtl8xxxu 1-1:1.0 wlx502b73640ee6: renamed from wlan0
[ 1732.597696] wlx502b73640ee6: authenticate with 2c:4d:54:5f:30:c8
[ 1732.605563] wlx502b73640ee6: send auth to 2c:4d:54:5f:30:c8 (try 1/3)
[ 1732.611218] wlx502b73640ee6: authenticated
[ 1732.611797] wlx502b73640ee6: associating to AP 2c:4d:54:5f:30:c8 with corrupt probe response
[ 1732.614590] wlx502b73640ee6: associate with 2c:4d:54:5f:30:c8 (try 1/3)
[ 1732.620845] wlx502b73640ee6: RX AssocResp from 2c:4d:54:5f:30:c8 (capab=0xc31 status=0 aid=4)
[ 1732.622572] usb 1-1: rtl8xxxu_bss_info_changed: HT supported
[ 1732.625258] wlx502b73640ee6: associated
-----------------------





網誌存檔