crontab -e:crontabs:没有该文件或目录

crontab -e:crontabs:没有该文件或目录

我正在尝试在 VPS 上的 debian 11 映像上的用户 crontab 中设置一个 cron 作业。

但是我遇到了问题,无法打开 crontab:

flo@debian-2gb:~$ crontab -e
crontabs: No such file or directory
flo@debian-2gb:~$ crontab -l
crontabs: No such file or directory
flo@debian-2gb:~$ sudo crontab -l
crontabs: No such file or directory
crontabs: mkdir: Operation not permitted
flo@debian-2gb:$ file /usr/bin/crontab
/usr/bin/crontab: setgid ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=e7fb2e8014f70bd0f4222e0c69566c721a323513, for GNU/Linux 3.2.0, stripped

由于没有设置,我尝试echo "export EDITOR=nano" >> ~/.bashrc并找到了它,但没有帮助。

我尝试重新安装 cron:

flo@debian-2gb:~$ sudo apt-get reinstall cron
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 25 not upgraded.
Need to get 99.6 kB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://deb.debian.org/debian bullseye/main amd64 cron amd64 3.0pl1-137 [99.6 kB]
Fetched 99.6 kB in 0s (3470 kB/s)
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LC_CTYPE = "UTF-8",
    LC_TERMINAL = "iTerm2",
    LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
(Reading database ... 59567 files and directories currently installed.)
Preparing to unpack .../cron_3.0pl1-137_amd64.deb ...
Unpacking cron (3.0pl1-137) over (3.0pl1-137) ...
dpkg: error processing archive /var/cache/apt/archives/cron_3.0pl1-137_amd64.deb (--unpack):
 unable to create '/etc/cron.d/.placeholder.dpkg-new' (while processing './etc/cron.d/.placeholder'): Operation not permitted
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/cron_3.0pl1-137_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

我在另一个 vps 上运行着 debian,在那里编辑 crontab 没有任何问题,两个系统上的语言环境相同。

我完全不知道问题出在哪里,到目前为止我找到的所有解决方案都无济于事。我该如何调试它?

谢谢!

编辑

root@debian-2gb:/# ls -ld /var/spool/cron/crontabs/
ls: cannot access '/var/spool/cron/crontabs/': No such file or directory

编辑2

ls -al /var/spool/
total 16
drwxr-xr-x  4 root root 4096 Nov 23 10:33 .
drwxr-xr-x 11 root root 4096 Nov 23 10:33 ..
drwxr-xr-x  2 root root 4096 Jan 18 01:54 cron
lrwxrwxrwx  1 root root    7 Nov 23 10:33 mail -> ../mail
drwx------  2 root root 4096 Feb 17  2021 rsyslog
cat /etc/*-release
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

相关内容