i'm fairly new to linux, and ran ubuntu the other day. it is running dual boot with windwos 8. now, the problem is, even though i log in as root and give a specific folder ALL PERMISSIONS (#chmod 777 filename), it still doesn't let me create a directory or save an edited file, saying (cannot create directory: no such file or directory). it gave me the same error even as i logged in as root GUI. since then, i have tried centOS 6.4, and it gives me the same problem. i mention again that i gave the directory full permission. i ran linux before on other computers and never came across this problem. my computer now is DELL XPS L502X.

migrated from stackoverflow.com Jun 17 '13 at 11:40

This question came from our site for professional and enthusiast programmers.

  • 2
    what is the folder path ? – Raptor Jun 17 '13 at 1:28
  • this is not a programming question. – Jason Jun 17 '13 at 1:29
  • folder path: /sys/module/snd – user2491795 Jun 17 '13 at 1:30
  • Do you have selinux enabled? – Ex Umbris Jun 17 '13 at 1:34
  • ah i'm sory i'm fairly new to linux, but i'll look up selinux right now – user2491795 Jun 17 '13 at 1:36
up vote 1 down vote accepted

The /sys directory in Linux is deceptive. Unlike most other directories, it does not provide persistent storage for arbitrary files.

Rather, it's a way to look at the systems's devices - their states and configurations. These files go away between boots and are dynamically generated by your system at startup. It is normal to be denied permission to write new files or directories there, even as root. You can detect these filesystems by viewing the mount type:

$ mount
none on /dev/pts type devpts (rw,nosuid,noexec,relatime,mode=600)
none on /proc type proc (rw,nosuid,nodev,noexec,relatime)
none on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,nosuid,nodev,noexec,relatime)
none on /sys/fs/fuse/connections type fusectl (rw,relatime)
none on /run type tmpfs (rw,nosuid,noexec,relatime,size=3284248k,mode=755)
/dev/md2 on /home type ext4 (rw,relatime,user_xattr,acl,barrier=1,data=ordered,discard)
  • devpts, proc, sysfs, binfmt_misc, and fusectl are all dynamically generated filesystems that reflect internal system information, and aren't for normal filesystem use. You will likely get permission denied errors even as root or other issues if you try to use these as a normal filesystem.
  • tmpfs is a temporary filesystem which resides within RAM - You can write to here and use it like a normal filesystem, but anything saved here will be erased as soon as the computer shuts down. Copy your files elsewhere if you want to save them.
  • ext4 is an actual filesystem on a device somewhere. Data saved here will be preserved like you would expect on a harddisk. There are many filesystems, but the key note is how this line has /dev/md2 instead of none: none means that there is no device backing the filesystem - it doesn't really exist, and is entirely virtual. If a mount point has an actual device (like /dev/sda1 or /dev/md1), then that means the contents actually exist on a device somewhere.

Would you be able to put your edited files in another directory? Or do you specifically mean to edit the configuration of a device?

  • thanks. someone told me already that i would not be able to write files inside /sys directory... have to get used to the linux filesystem.. in windows you could do anything anywhere – user2491795 Oct 3 '13 at 15:05

I suspect this is happening because the filesystem you are attempting to write to is a read-only file system.

Run the command df to check this. If you run mkdir from your home directory as a check - this should work.

  • hey suspectus, i think it might also be read-only, but i just tried the command: [#mount -o remount,rw /] but it's still giving me the error EVEN AFTER REBOOT. i thought root could do everything, but even root cannot create a simple directory or edit anything... i can change permissions, but they don't change anything. i changed the distro to openSUSE 12.3 KDE last night, and the problem isn't even close to being solved... – user2491795 Jun 18 '13 at 2:36

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.