8

I've chrooted into an external disk with sudo chroot /mnt/disk, but almost everything I do (logging in, tab-completion, lessing a file, ...) results in an error mentioning /dev/null: Permission denied, even if the command seems to work.

/dev/null has the correct permissions (666), and file says it's a character device, so it's not like anything has overwritten it with a regular file or changed the permissions.

What can I do to fix this?

Here's what tab-completion (of ls /u) results in:

$ ls /ubash: /dev/null: Permission denied
bash: _upvars: `-a2': invalid number specifier
bash: /dev/null: Permission denied
bash: _upvars: `-a0': invalid number specifier

1 Answer 1

10

The disk might be mounted with the nodev option, which mount interprets thusly:

Do not interpret character or block special devices on the file system.

You can verify this by checking the output of mount outside the chroot:

$ mount
...
/dev/sda1 on /mnt/disk type ext4 (rw,nosuid,nodev,relatime,data=ordered,uhelper=udisks2)

(This is a particularly tricky problem to spot, as configuration outside of the chroot is affecting the behaviour of programs inside it!)

Fixing it is as easy as remounting without the nodev option. The following command will accomplish this (even while the chrooted process is running!), although there's probably a way that removes just the nodev option without removing all the other options too:

sudo mount -o remount /dev/sda1 /mnt/disk

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .