proot-me / proot

chroot, mount --bind, and binfmt_misc without privilege/setup for Linux
https://proot-me.github.io
GNU General Public License v2.0
1.96k stars 369 forks source link

Unknown directory attributes when viewed by non-root user in proot #362

Open capslockwizard opened 1 year ago

capslockwizard commented 1 year ago

Expected Behavior

Directories with normal directory attributes

Actual Behavior

When I do ls -lth /, I get:

ls: cannot access 'boot': No such file or directory ls: cannot access 'etc': No such file or directory ls: cannot access 'home': No such file or directory ls: cannot access 'media': No such file or directory ls: cannot access 'mnt': No such file or directory ls: cannot access 'opt': No such file or directory ls: cannot access 'root': No such file or directory ls: cannot access 'run': No such file or directory ls: cannot access 'srv': No such file or directory ls: cannot access 'tmp': No such file or directory ls: cannot access 'usr': No such file or directory ls: cannot access 'bin': No such file or directory ls: cannot access 'lib': No such file or directory ls: cannot access 'lib32': No such file or directory ls: cannot access 'lib64': No such file or directory ls: cannot access 'libx32': No such file or directory ls: cannot access 'sbin': No such file or directory ls: cannot access 'var': No such file or directory total 0 dr-xr-xr-x 13 root root 0 Jul 7 07:47 sys dr-xr-xr-x 530 root root 0 May 9 16:46 proc drwxr-xr-x 20 root root 3.4K May 9 07:47 dev l????????? ? ? ? ? ? bin d????????? ? ? ? ? ? boot d????????? ? ? ? ? ? etc d????????? ? ? ? ? ? home l????????? ? ? ? ? ? lib l????????? ? ? ? ? ? lib32 l????????? ? ? ? ? ? lib64 l????????? ? ? ? ? ? libx32 d????????? ? ? ? ? ? media d????????? ? ? ? ? ? mnt d????????? ? ? ? ? ? opt d????????? ? ? ? ? ? root d????????? ? ? ? ? ? run l????????? ? ? ? ? ? sbin d????????? ? ? ? ? ? srv d????????? ? ? ? ? ? tmp d????????? ? ? ? ? ? usr d????????? ? ? ? ? ? var

Steps to Reproduce the Problem

  1. Downloaded the latest rootfs (rootfs.tar.xz) from https://sgp1lxdmirror01.do.letsbuildthe.cloud/images/ubuntu/jammy/amd64/cloud/
  2. Extract rootfs to directory and add local account by:
    mkdir /home/capz/ubuntu
    proot --link2symlink \
    tar -C /home/capz/ubuntu_new --warning=no-unknown-keyword \
    --delay-directory-restore --preserve-permissions \
    -xvf rootfs.tar.xz --exclude='dev'
    proot -0 -b /dev -b /proc -b /sys -r /home/capz/ubuntu_new /bin/bash
    addgroup --gid 200 capz
    adduser --home /home/capz --shell /bin/bash --uid 640 capz --ingroup capz
    exit
  3. proot with non-root user account and list files/directories:
    proot -b /dev -b /proc -b /sys -r /home/justin/ubuntu_new /bin/bash
    ls -lth /

Specifications

I should note that if I proot with arg -0 (root), everything looks fine, it is only when I proot as my non-root user account that I get the unknown file/directory attributes.

Fierelier commented 11 months ago

Similar issue with Arch, but also when root in guest -- pacman fails to run. Folders are accessible with non-root user on host.

[root@B456A857 /]# pacman
error: failed to initialize alpm library:
(root: /, dbpath: /var/lib/pacman/)
could not find or read directory

[root@B456A857 /]# ls -l /var/lib/             
ls: cannot access '/var/lib/arpd': No such file or directory
ls: cannot access '/var/lib/krb5kdc': No such file or directory
ls: cannot access '/var/lib/pacman': No such file or directory
total 0
d????????? ? ?    ?      ?            ? arpd
d????????? ? ?    ?      ?            ? krb5kdc
drwxr-xr-x 1 root root   0 May 10 17:09 misc
d????????? ? ?    ?      ?            ? pacman
drwxr-xr-x 1 root root 114 Aug 26 11:16 systemd