VsCode v1.77以降のDevContainers拡張でalpine v3.12コンテナに接続できない


vscode - v1.77以降のalpine - v3.12のコンテナイメージ(php:7.2-fpm-alpine)で、DevContainers拡張でコンテナに接続できなくなった。
ログを見ると何やらsymbol not foundエラーが出ていて、コンテナ内のVsCodeServerの起動に失敗しているためVsCodeから通信ができないようだ。


なお、コンテナ単体は起動する。


[5733 ms] Container server: Error relocating /root/.vscode-server/bin/b3e4e68a0bc097f0ae7907b217c1119af9e03435/node: _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE7reserveEv: symbol not found
Error relocating /root/.vscode-server/bin/b3e4e68a0bc097f0ae7907b217c1119af9e03435/node: _ZSt28__throw_bad_array_new_lengthv: symbol not found
[5752 ms] Error: stream ended with:0 but wanted:9
        at c (/Users/fullhouse/.vscode/extensions/ms-vscode-remote.remote-containers-0.292.0/dist/extension/extension.js:24:101670)
        at /Users/fullhouse/.vscode/extensions/ms-vscode-remote.remote-containers-0.292.0/dist/extension/extension.js:24:101851
        at s (/Users/fullhouse/.vscode/extensions/ms-vscode-remote.remote-containers-0.292.0/dist/extension/extension.js:27:5371)
        at Socket.<anonymous> (/Users/fullhouse/.vscode/extensions/ms-vscode-remote.remote-containers-0.292.0/dist/extension/extension.js:27:5541)
        at Socket.emit (node:events:525:35)
        at endReadableNT (node:internal/streams/readable:1358:12)
        at process.processTicksAndRejections (node:internal/process/task_queues:83:21)

原因




spdlogと他のネイティブモジュールは、microsoft/vscode-linux-build-agent@007bc8f以降のnode:16.9.1-alpineでビルドされており、libstdc++ v6.0.30が付属しているのに対し、ruby:2.7-alpine3.13にはlibstdc++ v6.0.28しか含まれていません。また、node.jsバイナリのアップストリームalpineイメージは、libstdc++ v6.0.30 https://github.com/nodejs/docker-node/tree/bd6c00f07c5a3b311ce0e346ab69df6b9ef8d08f/16/alpine3.17 でビルドされています。したがって、nodejs/node#41058で述べられているように、ユーザがコンテナ内のlibstdc++バージョンをアップグレードするしか解決策はないと思います。

1.77 you can no longer have any extensions on a remote container as of 10295b5 · Issue #178748 · microsoft/vscode · GitHub


VsCodeリポジトリのフォーラムによるとvscode-v1.77以降でvscode-server(nodejs)の依存ライブラリspdlogと他のネイティブモジュールのビルド環境のアップデートによって、これらが依存するlibstdc++ライブラリがv6.0.30に引き上げられたようだが、古いalpineイメージにおいてはv6.0.28がインストールされるため互換が失われた。的なことのようだ。

php:7.2-fpm-alpineコンテナでlibstdc++のバージョンを確認すると、確かにlibstdc++.so.6.0.28がインストールされていた。


cat /etc/os-release 

NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.12.3
PRETTY_NAME="Alpine Linux v3.12"
HOME_URL="https://alpinelinux.org/"
BUG_REPORT_URL="https://bugs.alpinelinux.org/"

ls -lav /usr/lib | grep libstdc++.so
lrwxrwxrwx    1 root     root            19 Oct 19  2022 libstdc++.so -> libstdc++.so.6.0.28
lrwxrwxrwx    1 root     root            19 Oct 19  2022 libstdc++.so.6 -> libstdc++.so.6.0.28
-rwxr-xr-x    1 root     root       1657328 May 18  2020 libstdc++.so.6.0.28 < これ


# apk infoで確認すると-9.3.0-r2なのでバージョン満たしているかと思いきや
# これはGCCバージョンで、libstdc++.soのバージョンニングではない
apk info libstdc++
libstdc++-9.3.0-r2 description:
GNU C++ standard runtime library

libstdc++-9.3.0-r2 webpage:
https://gcc.gnu.org

libstdc++-9.3.0-r2 installed size:
1724416

対策



応急処置


libstdc++のアップデートによる影響が未知過ぎるため、まずはVsCodeのダウングレードで凌ぐ。vscideの公式アーカイブから直前のvscode - v1.76バイナリを取得して置き換えたら復帰した。VsCodeが自動更新される度にまた戻してやる必要があるが、今後奇跡的にパッチが発明されることを願って旧バージョンで凌ぐことにした。


ためだ


これこれ1年くらい粘って旧バージョンで凌いだが、いよいよ機能拡張やらバージョン互換が切れ出して辛くなってきたので対応する。


alpineイメージを移行する


The issue here is from nodejs binary nodejs/node#41058, @hamad-9 is it possible for you update to >=alpine-3.15 as base image ?


Thank you, it's finally worked. I updated the base image to python:3.9-alpine3.18.

Container Build Failed - An error occurred setting up the container. · Issue #8450 · microsoft/vscode-remote-release · GitHub


こちらの公式フォーラムによるとalpine - v3.15が互換要件のalpineバージョンとのこと。


要件を満たしつつ、php:7.2-fpm-alpineから最も近いイメージDocker | php:7.3-fpm-alpine3.15を試したが変化がなかった。
もうひとつアップストリームのphp:7.4-fpm-alpine3.16だとvscode-serverの起動に無事成功して、DevContainer拡張で接続することが出来た。


なお、libstdc++の場合はv6.0.29がインストールされていた。v6.0.29 ~ v6.0.30間の互換性があるようだ。


cat /etc/os-release 
NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.16.3
PRETTY_NAME="Alpine Linux v3.16"
HOME_URL="https://alpinelinux.org/"
BUG_REPORT_URL="https://gitlab.alpinelinux.org/alpine/aports/-/issues"

ls -lav /usr/lib | grep libstdc++.so
lrwxrwxrwx    1 root     root            19 Jan 25 09:11 libstdc++.so -> libstdc++.so.6.0.29
lrwxrwxrwx    1 root     root            19 Jan 25 09:11 libstdc++.so.6 -> libstdc++.so.6.0.29
-rwxr-xr-x    1 root     root       1952104 Apr 11  2022 libstdc++.so.6.0.29
Share:

0 Comments:

コメントを投稿