1

I was using debootstrap to setup a chroot environment but accidentally cancelled midway through. As I was trying to delete the file that got downloaded and installed I was met with an "Operation not permitted error" This error occurred only on file of the /sys and /proc directories.

I am running Debian 10.

The output of lsattr on these directories is as follows:

lsattr: Inappropriate ioctl for device While reading flags on ./sys
lsattr: Inappropriate ioctl for device While reading flags on ./proc

The output of ls -l is:

total 0
dr-xr-xr-x 208 root root 0 May 25 16:48 proc
dr-xr-xr-x  13 root root 0 May 30 19:47 sys

And the output of strace rm -f on the sys/power/disk file is:

execve("/usr/bin/rm", ["rm", "-f", "disk"], 0x7ffc53952bf0 /* 53 vars */) = 0
brk(NULL)                               = 0x55e820b48000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=107991, ...}) = 0
mmap(NULL, 107991, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f2cfd66e000
close(3)                                = 0
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\260A\2\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1824496, ...}) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f2cfd66c000
mmap(NULL, 1837056, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f2cfd4ab000
mprotect(0x7f2cfd4cd000, 1658880, PROT_NONE) = 0
mmap(0x7f2cfd4cd000, 1343488, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x22000) = 0x7f2cfd4cd000
mmap(0x7f2cfd615000, 311296, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x16a000) = 0x7f2cfd615000
mmap(0x7f2cfd662000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1b6000) = 0x7f2cfd662000
mmap(0x7f2cfd668000, 14336, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f2cfd668000
close(3)                                = 0
arch_prctl(ARCH_SET_FS, 0x7f2cfd66d540) = 0
mprotect(0x7f2cfd662000, 16384, PROT_READ) = 0
mprotect(0x55e81f5d4000, 4096, PROT_READ) = 0
mprotect(0x7f2cfd6b0000, 4096, PROT_READ) = 0
munmap(0x7f2cfd66e000, 107991)          = 0
openat(AT_FDCWD, "/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=3036320, ...}) = 0
mmap(NULL, 3036320, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f2cfd1c5000
close(3)                                = 0
brk(NULL)                               = 0x55e820b48000
brk(0x55e820b69000)                     = 0x55e820b69000
ioctl(0, TCGETS, {B38400 opost isig icanon echo ...}) = 0
newfstatat(AT_FDCWD, "disk", {st_mode=S_IFREG|0644, st_size=4096, ...}, AT_SYMLINK_NOFOLLOW) = 0
unlinkat(AT_FDCWD, "disk", 0)           = -1 EPERM (Operation not permitted)
openat(AT_FDCWD, "/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=2995, ...}) = 0
read(3, "# Locale name alias data base.\n#"..., 4096) = 2995
read(3, "", 4096)                       = 0
close(3)                                = 0
openat(AT_FDCWD, "/usr/share/locale/en_IN/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale/en/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
write(2, "rm: ", 4rm: )                     = 4
write(2, "cannot remove 'disk'", 20cannot remove 'disk')    = 20
openat(AT_FDCWD, "/usr/share/locale/en_IN/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/locale/en/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
write(2, ": Operation not permitted", 25: Operation not permitted) = 25
write(2, "\n", 1
)                       = 1
lseek(0, 0, SEEK_CUR)                   = -1 ESPIPE (Illegal seek)
close(0)                                = 0
close(1)                                = 0
close(2)                                = 0
exit_group(1)                           = ?
+++ exited with 1 +++

I have checked this other answer but the result of lsattr is different and the suggested solution doesn't work.

NeilB
  • 11

0 Answers0