/dev/null permission denied in chroot environment

6,302

Solution 1

Figured out the issue. It wasn't readable/writable by all users. Changed it so all users could read and write and it worked. Thanks anyways!

Solution 2

I know this is old and you already found your answer, but another possibility (which I just faced) is that the drive was mounted with the nodev option, disabling any character devices such as /dev/null, even though they show up with the proper permission. Just issuing a mount -o remount,rw /dev/hdaN /mnt from outside the chroot fixed it.

Solution 3

From man null:

   These devices are typically created by:

          mknod -m 666 /dev/null c 1 3
          mknod -m 666 /dev/zero c 1 5
          chown root:root /dev/null /dev/zero

These commands would have to be executed in the chroot environment.

Share:
6,302
Batcastle
Author by

Batcastle

Lead Drauger OS Dev.

Updated on September 18, 2022

Comments

  • Batcastle
    Batcastle over 1 year

    I have Xubuntu 18.04 in a chroot environment. I just dropped it in there from a VM I had of it.

    Going into the chroot environment, if I try to run apt update I get this error:

    /usr/bin/apt-key: 624: /usr/bin/apt-key: cannot create /dev/null: Permission denied

    I have tried most of the solutions here: https://unix.stackexchange.com/questions/146633/bash-dev-null-permission-denied As well as this solution: https://superuser.com/a/814594 Neither worked. Same exact output.

    Is there some way I can get this working? Thanks in advance.

  • Batcastle
    Batcastle over 5 years
    I tried this and It didn't help. Same exact error.