chroot 環境で `/dev/null’ が使えなくて困る

Kobo の chroot 環境で debian を動かしたりしているのでたまにアップデートを行うのですが,実機だと遅いのでPC のchroot 環境で実行したりします
#アーキテクチャの違いはqemu で吸収. > ユーザーモードエミュレーションqemu を使って Kono on Debian のイメージを Host PC で apt-get とかする | matoken’s meme 🏛️

そこで今回 apt-get update 中に以下のようなエラーが発生.

/bin/sh: 1: cannot create /dev/null: Permission denied

/dev/null を確認するとぱっと見デバイスは問題なさそうだけど使えない.

# ls -la /dev/null
crw-rw-rw- 1 root root 1, 3 Sep 2 02:57 /dev/null
# echo hoge > /dev/null
bash: /dev/null: Permission denied

エラーメッセージで検索するとkinnekoさんのページがヒット.

あーなるほど!

chroot 元で確認してみると確かに nodev が.

% mount |grep rootfs
/dev/sdc1 on /media/mk/rootfs type ext4 (rw,nosuid,nodev,relatime,data=ordered,uhelper=udisks2)

dev を付けて remount してみると

% sudo mount -o remount,dev /dev/sdc1
% mount |grep rootfs
/dev/sdc1 on /media/mk/rootfs type ext4 (rw,nosuid,relatime,data=ordered,uhelper=udisks2)

chroot しなおさなくても使えるようになった.毎回チェックしてるんですかね.

# echo hoge > /dev/null

てことで update 出来た :)

# apt-get install -f

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

To respond on your own website, enter the URL of your response which should contain a link to this post's permalink URL. Your response will then appear (possibly after moderation) on this page. Want to update or remove your response? Update or delete your post and re-enter your post's URL again. (Find out more about Webmentions.)