Linux: startx gives me the error "chmod: changing permissions of '/dev/null': Operation not permitted" and won't log in to graphical desktop
Matthew Martinez
In Linux (Debian 10), when I log in at the command line and type startx, I get some info about X.Org X server and the operating system, followed by
xf86EnableIOPorts: failed to set IOPL for I/O (Operation not permitted)
(II) [KMS] Kernel modesetting enabled.
chmod: changing permissions of '/dev/null': Operation not permitted
xinit: connection to X server lost
waiting for X server to shut down (II) Server terminated successfully (0). Closing log file.As a Linux noob, the only thing I could think of that I did to cause a problem with /dev/null was that some package I installed a while back kept writing gigabytes' worth of error messages every minute to a log file, so I redirected the file's contents to /dev/null (I don't remember how; looking around the internet, I assume it was either cat /dev/null > file_log.txt or cp /dev/null file_log.txt. It was a log file in my ~ directory, not /var or /tmp.) I've uninstalled that package. This is the first time I've rebooted since then, so this is the first time startx has been called.
I'm not short on disk space:
$ df -h
Filesystem Size Used Avail Use% Mounted on
udev 3.5G 0 3.5G 0% /dev
tmpfs 717M 18M 700M 3% /run
/dev/sda2 457G 13G 421G 3% /
tmpfs 3.5G 0 3.5G 0% /dev/shm
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 3.5G 0 3.5G 0% /sys/fs/cgroup
/dev/sda1 511M 5.2M 506M 2% /boot/efi
tmpfs 717M 0 717M 0% /run/user/1000(I have no idea why there are all those tmpfs filesystems. I didn't create them manually or choose to make them at install.)
These are /dev/null's permissions:
$ls -l /dev/null
crw-rw-rw- 1 root root 1, 3 Sep 21 08:45 /dev/nullI tried changing /dev/null's permissions:
$ su
# chmod 777 /dev/null
# exit
$ ls -l /dev/null
crwxrwxrwx 1 root root 1, 3 Sep 21 08:45 /dev/null
$ startxand still get the exact same error message about changing permissions of '/dev/null' not being permitted, though nothing about xf86EnableIOPorts this time.
Following the answers here, I tried both
# rm -f /dev/null; mknod -m 666 /dev/null c 1 3and basically the same thing:
# rm /dev/null
# mknod /dev/null c 1 3
# chmod 666 /dev/nullbut $ startx still gives me the same error as above.
I've also tried everything here, including uninstalling and reinstalling xserver-xorg and xinit, and startx still gives me the same error about /dev/null.
Switching to root and running # startx starts X correctly and logs in to the desktop environment, so maybe that'll be helpful to know.
This seems like a simple permissions thing, but again, noob.
Reset to default