Open9

lima でファイルの変更が反映されない( inotify 周りの挙動が変わったかもしれない)

sashimisashimi
# date の出力をファイルに書き込む
% date > sample.txt

# ホスト側で確認する
% cat sample.txt
Wed Mar 12 01:47:06 JST 2025

# lima 側で中身を見る
% lima cat sample.txt
Wed Mar 12 01:47:06 JST 2025

# ファイルを更新する
% date > sample.txt

# lima 側で確認するも、更新が反映されていない!
% lima cat sample.txt
Wed Mar 12 01:47:06 JST 2025

# ホスト側で見れば更新されている
% cat sample.txt
Wed Mar 12 01:47:21 JST 2025

# 削除してみる
% rm sample.txt
remove sample.txt? y

# 削除されている
% lima cat sample.txt
cat: sample.txt: No such file or directory

# 再度書き込んでファイルを作成してみる
% date > sample.txt

# 内容の更新が反映されていない!
% lima cat sample.txt
Wed Mar 12 01:47:06 JST 2025

# もちろんホスト側では新しい内容になっている
% cat sample.txt
Wed Mar 12 01:48:00 JST 2025
sashimisashimi

今までこの事象が発生したことはなかった.
1ヶ月ほど前に VM を作り直しており, 最近になってこの事象が発生することに気づいた.

なお, limactl stop docker && limactl start docker でVMを再起動すればファイルの変更は完全に反映される.

sashimisashimi

lima の設定(定義ファイル)で writable に設定されている /tmp/lima/ への変更は問題なく反映された.

% date > /tmp/lima/sample.txt
% lima cat /tmp/lima/sample.txt
Wed Mar 12 02:03:42 JST 2025

% date > /tmp/lima/sample.txt
% lima cat /tmp/lima/sample.txt
Wed Mar 12 02:03:53 JST 2025
sashimisashimi
% limactl info
(中略)
        "mounts": [
            {
                "location": "~",
                "mountPoint": "~",
                "writable": false,
                "sshfs": {
                    "cache": true,
                    "followSymlinks": false,
                    "sftpDriver": ""
                },
                "9p": {
                    "securityModel": "none",
                    "protocolVersion": "9p2000.L",
                    "msize": "128KiB",
                    "cache": "fscache"
                },
                "virtiofs": {}
            },
            {
                "location": "/tmp/lima",
                "mountPoint": "/tmp/lima",
                "writable": true,
                "sshfs": {
                    "cache": true,
                    "followSymlinks": false,
                    "sftpDriver": ""
                },
                "9p": {
                    "securityModel": "none",
                    "protocolVersion": "9p2000.L",
                    "msize": "128KiB",
                    "cache": "mmap"
                },
                "virtiofs": {}
            }
        ],
        "mountTypesUnsupported": [
            "9p"
        ],
        "mountType": "virtiofs",
        "mountInotify": false,
(中略)
sashimisashimi

(返信とスレッド?の使い分けが良くわかってない)

sashimisashimi

投稿主は単発で投げたほうが個別にコメントしてもらいやすいとかあるのだろうか

sashimisashimi

再起動を繰り返していたら, いつの間にか即時反映されるようになった...(一番困るやつ...)

sashimisashimi

と思ったら再発した...
ゆっくり時間をとってデバッグしたいものだが... 🕐