2017-01-13 4 views
1

LXDの新機能で、私のコンテナのrootユーザーのsubuidとsubgidマップを作成しようとしているところで問題が発生しました。ディレクトリ/ megalith、それは165536:65536のuid/gidではなく、ホストユーザ(1000:1000)のUID/GIDになります。私はここにリストされている指示に従っしようとしています:rootのsubuidとsubgid情報が変更されたときにLXDコンテナを起動できません

http://insights.ubuntu.com/2016/12/08/mounting-your-home-directory-in-lxd/

をしかし、私はコンテナを起動しようとすると、私は、下記のエラーが表示されます。 rootのsubuidとsubgidのエントリをroot:165536:65536に戻すと、すべてが正しく動作するようになります。ただし、/ megalithに書き込むと、UIDとGIDは明らかに165536:65536です。

ルートサブユニットとサブジッドマッピングを正しく動作させるために必要なことはありますか?ドキュメントに記載されていないか、見つからない可能性がありますか?

[email protected] /megalith $ id 
uid=1000(cliff) gid=1000(cliff) groups=1000(cliff),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),113(lpadmin),130(sambashare),132(lxd) 

[email protected] /megalith $ cat /etc/subuid 
cliff:100000:65536 
lxd:165536:65536 
root:1000:1 

[email protected] /megalith $ cat /etc/subgid 
cliff:100000:65536 
lxd:165536:65536 
root:1000:1 

[email protected] /megalith $ lxc init ubuntu-daily:z zestytest 
Creating zestytest 

[email protected] /megalith $ lxc config set zestytest raw.idmap 'both 1000 1000' 

[email protected] /megalith $ lxc config device add zestytest megalith disk source=/megalith path=/megalith 
Device megalith added to zestytest 

[email protected] /megalith $ lxc start zestytest 
error: Error calling 'lxd forkstart zestytest /var/lib/lxd/containers /var/log/lxd/zestytest/lxc.conf': err='exit status 1' 
    lxc 20170112215311.265 ERROR lxc_start - start.c:lxc_spawn:1163 - Failed to set up id mapping. 
    lxc 20170112215311.303 ERROR lxc_start - start.c:__lxc_start:1338 - Failed to spawn container "zestytest". 
    lxc 20170112215311.855 ERROR lxc_conf - conf.c:run_buffer:347 - Script exited with status 1 
    lxc 20170112215311.855 ERROR lxc_start - start.c:lxc_fini:546 - Failed to run lxc.hook.post-stop for container "zestytest". 
    lxc 20170112215311.858 ERROR lxc_conf - conf.c:userns_exec_1:4374 - Error setting up child mappings 
    lxc 20170112215311.858 ERROR lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:1274 - Error destroying /sys/fs/cgroup/systemd//lxc/zestytest 
    lxc 20170112215311.861 ERROR lxc_conf - conf.c:userns_exec_1:4374 - Error setting up child mappings 
    lxc 20170112215311.861 ERROR lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:1274 - Error destroying /sys/fs/cgroup/cpuset//lxc/zestytest 
    lxc 20170112215311.864 ERROR lxc_conf - conf.c:userns_exec_1:4374 - Error setting up child mappings 
    lxc 20170112215311.864 ERROR lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:1274 - Error destroying /sys/fs/cgroup/hugetlb//lxc/zestytest 
    lxc 20170112215311.867 ERROR lxc_conf - conf.c:userns_exec_1:4374 - Error setting up child mappings 
    lxc 20170112215311.867 ERROR lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:1274 - Error destroying /sys/fs/cgroup/cpu//lxc/zestytest 
    lxc 20170112215311.869 ERROR lxc_conf - conf.c:userns_exec_1:4374 - Error setting up child mappings 
    lxc 20170112215311.869 ERROR lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:1274 - Error destroying /sys/fs/cgroup/pids//lxc/zestytest 
    lxc 20170112215311.872 ERROR lxc_conf - conf.c:userns_exec_1:4374 - Error setting up child mappings 
    lxc 20170112215311.872 ERROR lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:1274 - Error destroying /sys/fs/cgroup/perf_event//lxc/zestytest 
    lxc 20170112215311.875 ERROR lxc_conf - conf.c:userns_exec_1:4374 - Error setting up child mappings 
    lxc 20170112215311.875 ERROR lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:1274 - Error destroying /sys/fs/cgroup/freezer//lxc/zestytest 
    lxc 20170112215311.878 ERROR lxc_conf - conf.c:userns_exec_1:4374 - Error setting up child mappings 
    lxc 20170112215311.878 ERROR lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:1274 - Error destroying /sys/fs/cgroup/memory//lxc/zestytest 
    lxc 20170112215311.881 ERROR lxc_conf - conf.c:userns_exec_1:4374 - Error setting up child mappings 
    lxc 20170112215311.881 ERROR lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:1274 - Error destroying /sys/fs/cgroup/net_cls//lxc/zestytest 
    lxc 20170112215311.884 ERROR lxc_conf - conf.c:userns_exec_1:4374 - Error setting up child mappings 
    lxc 20170112215311.884 ERROR lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:1274 - Error destroying /sys/fs/cgroup/devices//lxc/zestytest 
    lxc 20170112215311.886 ERROR lxc_conf - conf.c:userns_exec_1:4374 - Error setting up child mappings 
    lxc 20170112215311.886 ERROR lxc_cgfsng - cgroups/cgfsng.c:recursive_destroy:1274 - Error destroying /sys/fs/cgroup/blkio//lxc/zestytest 

Try `lxc info --show-log zestytest` for more info 

答えて

0

私は戻ってルートにルートsubuidとsubgidエントリを返す場合:165536:65536 1000:1の範囲65536

あなたは165536の両方が必要です。

前者は、コンテナ内で使用されているuid/gidの大半を保持していました。後で、あなたのuid/gidをコンテナ内で同じにするようにマップします。これは、あなたの質問に対処場合

+0

ありがとうございました!あなたの提案の後でも問題はまだ見えます。ここに私の/ etc/subuidと/ etc/subgidは今です: '崖の@ reventon〜$猫の/ etc/subuid 崖:100000:65536 LXD:165536:65536 ルート:165536:65536 ルート:1000: 100000:65536 LXD:165536:65536 ルート:16553:65536 ルート:1000:1 ' 私が使用してLXDを再起動し、' sudoのサービスLXDのrestart' 1つの 崖の@ reventon〜$猫の/ etc/ 崖をsubgidそれはうまくいくように見えました。 bindmountedディレクトリ/ megalithにあるファイルにもう一度触れようとしたとき、私はまだ1000:1000の代わりにUID:GID 165536:16553を得ました。 –

0

かなりわからない:https://github.com/lxc/lxc/issues/1622

そのスレッドの主旨は、コンテナのルートのuidおよび/またはGIDへのホストのuidおよび/またはホストGIDをマップするために無意味/危険なことです。あなたが何を記述したいのであれば、デフォルトのコンテナユーザにマッピングするか、新しいコンテナユーザを作成し、そのコンテナユーザでコマンドを実行する必要があります。次に、ホストのuid/gidをそのコンテナーのuid/gidにマップできます。

関連する問題