Why cant I create a directory in /sys

First, you should change /sys's permissions back (sudo chmod a-r /sys will do it, since the default permissions are dr-xr-xr-x). /sys should not be world-writeable!

In general, to create files and directories in parts of the system outside your home folder, external media, and the /tmp folder, you should do it as root with sudo, rather than by changing permissions or ownership to give yourself access. Making directories world-writeable is particularly not recommended.

For information on the recommended way, see:

  • RootSudo (in the Ubuntu documentation wiki)
  • How can I rename items in places I don't own, like / , and why shouldn't I?
    (about renaming, but related, and details some of the important concepts)

You can even use gksudo nautilus (or sudo -H nautilus if you don't have gksudo) to open a root-owned file browser window. Be careful with this, though--it can do just about anything, and most of those things are things you probably don't want done. Also, note that if you launch a program from a root-owned file browser window, that program will run as root too.

That's generally what you should do, to edit or create new contents of directories owned by root. However...

/sys is different; even root can't directly create stuff there

Like /proc and /dev, in Ubuntu and other OSes using the Linux kernel, /sys is a virtual filesystem, what it represents is not real files on your disk (or anywhere).

In short, /sys is a way the kernel provides information about (physical and virtual) devices.

Some entries in the /sys filesystem are also meaningfully writable and writing to them is a way to dynamically set configuration for devices. (This should not be confused with the /dev filesystem; writing to entries in /dev is a way of sending data to devices.)

But this still must be done as root. Rather than changing permission on /sys or any part of it, you should just perform those action as root with sudo as explained above.

This answer on Unix.SE explains how to do that, and even how to allow some non-administrators (who cannot perform most actions as root) to change some /sys settings.

For more information about how /sys works, see:

  • sysfs (Wikipedia)
  • kernel.org docs on sys (as linked to from here)

Entries in /sys are created by the kernel and by drivers; you cannot just create them from the command-line. (As stated above, you can edit some as root, but you cannot generally make new ones from userspace except by loading kernel modules or otherwise installing drivers or modifying the kernel.)

If you happen to be interested in writing drivers, see:

  • man 2 sysfs
  • How to Create a `sysfs File Correctly

Yes, /sys is a "special" directory. From Wikipedia:

Modern Linux distributions include a /sys directory as a virtual filesystem (sysfs, comparable to /proc, which is a procfs), which stores and allows modification of the devices connected to the system, whereas many traditional UNIX and Unix-like operating systems use /sys as a symbolic link to the kernel source tree.

The "Stores and allows modification of the devices connected to the system" is pretty important. The fact that /sys is used as a virtual filesystem, mounted specially, is why you (and root) can't write to it. I would avoid messing with /sys. With Linux, which is very open and transparent, things are usually not changeable for a good reason; either for security purposes, or, in this case, because there is another way to achieve your goal that is a lot less risky.