无法以 root 身份 rmdir 空目录。检查了权限。检查了lsattr

无法以 root 身份 rmdir 空目录。检查了权限。检查了lsattr

我无法以 root 用户身份删除空目录。我检查了 lsattr。该目录是由 kiwi-ng 映像生成器在 btrfs 文件系统上的 opensuse15 上创建的。

#pwd
/tmp/myimage/build/image-root/var/lib
#whoami
root
#ls -l
total 0
drwx------ 1 root root 0 Apr 19 02:00 machines
#rmdir machines
rmdir: failed to remove 'machines': Operation not permitted
#rm -rf machines/
rm: cannot remove 'machines/': Operation not permitted
#lsattr
------------------- ./machines
#
#df -h .
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda2        57G  3.5G   52G   7% /tmp
#
#btrfs filesystem show
Label: none  uuid: 57deb065-dd4d-4dea-b139-d7f0dff27eb9
        Total devices 1 FS bytes used 3.31GiB
        devid    1 size 56.37GiB used 9.02GiB path /dev/sda2

#stat machines
  File: machines
  Size: 0               Blocks: 0          IO Block: 4096   directory
Device: 39h/57d Inode: 256         Links: 1
Access: (0700/drwx------)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2020-04-19 13:16:36.108001140 -0400
Modify: 2020-04-19 02:00:28.431710719 -0400
Change: 2020-04-19 13:12:54.397531588 -0400
 Birth: -

答案1

用这个答案解决了: 如何删除空目录(btrfs 文件系统)?

我可以使用以下命令删除我的目录:

linux-9xyc:/tmp/myimage # rm -rf *
rm: cannot remove 'build/image-root/var/lib/machines': Operation not permitted
linux-9xyc:/tmp/myimage # btrfs subvolume delete build/image-root/var/lib/machines
Delete subvolume (no-commit): '/tmp/myimage/build/image-root/var/lib/machines'

相关内容