2024年7月14日

在Podman中,記憶體還很多卻OOM

之前使用container去build android時,發生明明記憶體還剩很多的情況下,卻直接報出OOM編譯失敗的情況,查了許久才發現是pids滿了。

在預設的情況下Podman會限制一個容器只能執行2048個process,而build android在-j 32的時候,有可能會突然跑到四千多個process,這時就會直接失敗

可以在run container時加上--pids-limit -1 來解除限制,例如:

$ podman run -it --rm --pids-limit -1 ubuntu:16.04


也可以修改 /etc/containers/containers.conf 中的 pids_limit 讓所有Container都套用相同設定

2024年3月16日

不用手動介入,在Linux下建立新User並設定密碼

export USERNAME="newuser"
export PASSWD="password"
useradd -m $USERNAME -s /bin/bash -g users
echo -e "$PASSWD\n$PASSWD" | passwd $USERNAME


2024年3月9日

最近在用的Archlinux桌面環境

留個套件名字
下次換新電腦還可以裝

顯示管理 greetd + regreet
視窗管理 hyprland
啟動器 rofi
輸入法 fcitx5
終端機 qterminal + bash
檔案管理 dolphin

2023年3月18日

Stable diffusion prompt收集

 

最近Stable diffusion、AI繪圖很紅,所以我也稍微玩了一下 

以下收集了一些prompt詞,以後需要的時候回來查比較快 




2022年12月24日

Firefox 108 滑鼠游標消失的問題

最近Firefox 升級到 108 之後發現

自訂的游標圖示會顯示錯誤,甚至有時後會直接消失

檢查Log發現是Firefox無法讀取到我的自訂游標

firefox-bin[2959]: Unable to load hand2 from the cursor theme firefox-bin[2959]: Unable to load left_ptr from the cursor theme firefox-bin[2959]: Unable to load xterm from the cursor theme

而且是放在~/.icons下的游標才會有這個問題

所以目前有一個Workaround方式就是將目前使用的游標放到

mv ~/.icons/* /usr/share/icons/

目前已經有人發了 Issue 給 Mozilla: https://bugzilla.mozilla.org/show_bug.cgi?id=1802877

su + systemctl = Failed to connect to bus: No medium found

最近想用 su - user 對修改 user 的 systemd Unit 的時候發現 systemctl --user 的所有操作都會回報 Failed to connect to bus: No medium found

 後來找到了這篇文章 只要將 su - user改為使用machinectl shell user@.host就可以正常使用 systemctl --user 了

 

從 Caddy2 對 Syncthing 以子路徑進行反向代理

有些服務 的 web UI 需要執行在網頁的根路徑或特定路徑上

例如 transmission 就需要路徑 /transmission/web/

而 Syncthing 就必須是 / 才能正確打開Web UI

如果直接反向代理的話就會發現有許多圖片或restful api會找不到

我們需要在代理時將多餘的子路徑去除才會正確找到檔案

在Caddy2下可以這麼做

http://myhost.org { handle_path /syncthing/* { reverse_proxy http://localhost:8384 { header_up Host {http.reverse_proxy.upstream.hostport} } } }

其中handle_path就會在轉送要求時將 syncthing/ 這個前綴移除

這樣有需要的話還可以在同一個host上代理多個syncthing

例如
http://myhost.org { handle_path /syncthing/* { reverse_proxy http://localhost:8384 { header_up Host {http.reverse_proxy.upstream.hostport} } } handle_path /syncthing2/* { reverse_proxy http://localhost:8385 { header_up Host {http.reverse_proxy.upstream.hostport} } } }