Hi, when trying to create a directory path with 'mkdir -p' with the root being a mount point of a writeable filesystem that exists inside a read-only file system, mkdir return -EROFS. This was tested with the latest git-tree from: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 The last kernel I know of this has been working was 2.6.22. E.g.: |root@triton1:/# mount |rootfs on / type rootfs (rw) |/dev/root on / type jffs2 (ro) |proc on /proc type proc (rw) |sysfs on /sys type sysfs (rw) |/dev/root on /dev/.static/dev type jffs2 (ro) |tmpfs on /dev type tmpfs (rw,size=10240k,mode=755) |tmpfs on /var type tmpfs (rw) |tmpfs on /tmp type tmpfs (rw) |devpts on /dev/pts type devpts (rw,gid=5,mode=620) |tmpfs on /dev/shm type tmpfs (rw) |root@triton1:/# mkdir -p /dev/.udev/db |mkdir: Cannot create directory `/dev/': Read-only file system While: |root@triton1:/# cd /dev |root@triton1:/# mkdir -p .udev/db works as expected... Has anyone else encountered this problem already? I've searched the archives but could not find anything related to this problem. Lothar Wa
(y'know that ~4000 people read your email and hit 'n'? Except for me? I had a shot at scripting this, but for me, everything works OK. #!/bin/sh dd if=/dev/zero of=file1 bs=1M count=32 dd if=/dev/zero of=file2 bs=1M count=32 yes | mkfs -t ext2 file1 yes | mkfs -t ext2 file2 mkdir -p mountpoint mount -o loop file1 mountpoint mkdir mountpoint/dir umount mountpoint mount -o loop,ro file1 mountpoint mount -o loop file2 mountpoint/dir mkdir -p $(/bin/pwd)/mountpoint/dir/subdir are you able to modify the above so that it demonstrates the failure? Thanks. --
Hmmm. The thing you are doing differently is that the reporter's root
filesystem is mounted read only but in your case (and the quick try I
had at it) the read only file system is mounted below root.
However, I tried reproducing that scenario with a chroot and I still
couldn't get it to happen. No time to try a real root mount ro this
morning but perhaps others can.
Cheers,
Dan
--
/--------------- - - - - - -
| Dan Noé
| http://isomerica.net/~dpn/
--My guess is that you have an old/buggy version of mkdir.
What does
mkdir --version
say?
Mine says:
mkdir (GNU coreutils) 6.10
Copyright (C) 2008 Free Software Foundation, Inc.
etc...
What does
strace mkdir -p /dev/.udev/db
show ???
NeilBrown
--I would bet this is the problem for the reporter.
I tried the same here, and cannot exhibit the problem. Just like the
reporter, my / is ro and /dev is rw :
# mkdir --version
mkdir (coreutils) 5.2.1
...
# uname -a
Linux alix-2C3 2.6.25-wt4-alix #3 Thu Apr 24 08:30:05 CEST 2008 i586 i586 i386 GNU/Linux
(this is essentially 2.6.25+squashfs+some geode patches)
# mount
/dev/sda4 on / type ext3 (ro,errors=continue,data=ordered)
/dev on /dev type tmpfs (rw,size=0k,nr_inodes=4096,mode=755)
# mkdir -p /dev/a/b/c
# ls -lad /dev/a/b/c
drwxr-xr-x 2 root root 40 Jan 3 00:49 /dev/a/b/c/
# rmdir -p /dev/a/b/c
rmdir: `/dev': Read-only file system
# strace mkdir -p /dev/a/b/c
stat64("/dev/a/b/c", 0xbf9175dc) = -1 ENOENT (No such file or directory)
umask(0) = 022
open(".", O_RDONLY|O_LARGEFILE|O_DIRECTORY) = 3
chdir("/") = 0
mkdir("dev", 0755) = -1 EEXIST (File exists)
stat64("dev", {st_mode=S_IFDIR|0755, st_size=17080, ...}) = 0
chdir("dev") = 0
mkdir("a", 0755) = 0
chdir("a") = 0
mkdir("b", 0755) = 0
chdir("b") = 0
umask(022) = 0
mkdir("c", 0777) = 0
fchdir(3) = 0
close(3) = 0
Regards,
Willy
--Hi,
This is what strace shows in my case:
mkdir("/", 0777) = -1 EEXIST (File exists)
stat64("/", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0
mkdir("/dev/", 0777) = -1 EROFS (Read-only file system)
umask(022) = 022
write(2, "mkdir: ", 7mkdir: ) = 7
write(2, "Cannot create directory `/dev/\'", 31Cannot create directory `/dev/') = 31
write(2, ": Read-only file system\n", 24: Read-only file system
) = 24
io_submit(0x1, 0x1, 0xfbad2088 <unfinished ... exit status 1>
Lothar WaSo you should send this trace to the busybox maintainer. It obviously exhibits a small but easily fixable bug in the program ; it should check whether the directory exists in case of error. It seems it only checks for EEXIST. What puzzles me is why you have this problem only with a new kernel. I suspect that previous ones did report EEXIST and now we report EROFS for an existing directory on an ro fs. Willy --
Hi,
^^^^^^
Interestingly your strace output showed a return value of EEXIST where
mine had EROFS.
Lothar WaOh you're right! I did not notice. There's something odd here. And I can reproduce it right now (2.6.25.1). I really have EEXIST. Willy --
Hi, As I noted in my first message I have this problem with the kernel from git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 which is currently 2.6.26-rc1 and still exhibits this behaviour. So, this problem obviously does not exist in the 2.6.25 release kernel but would probably hit mainline in the 2.6.26 release. Lothar Wa
Aye. That's ro-bind fallout we'd not noticed; will fix... And a fine example of the reasons why * relying on which particular errno value you get when several are applicable is a Bad Idea(tm) and * changing the choice of the errno value in such situation might be legal, but is to be done with care; sometimes it really has impact... --
| Alex Samad | page swap allocation error/failure in 2.6.25 |
| Bart Van Assche | Re: Integration of SCST in the mainstream Linux kernel |
| Andrea Arcangeli | [PATCH 06 of 11] rwsem contended |
| Chuck Ebbert | Why do so many machines need "noapic"? |
git: | |
| Andy Parkins | svn:externals using git submodules |
| Elijah Newren | Trying to use git-filter-branch to compress history by removing large, obsolete bi... |
| Marcus Griep | [PATCH] git-svn: Make it scream by minimizing temp files |
| Tommi Virtanen | [PATCH] "git shell" won't work, need "git-shell" |
| Marcos Laufer | dmesg IBM x3650 OpenBSD 4.3 |
| Theo de Raadt | Re: Chatting with developers? Is it soo 1996? |
| Ted Unangst | Re: MAXDSIZ 1GB memory limit for process |
| Richard Stallman | Real men don't attack straw men |
| Denys Fedoryshchenko | Re: thousands of classes, e1000 TX unit hang |
| Suresh Siddha | Re: Kernel oops with 2.6.26, padlock and ipsec: probably problem with fpu state ch... |
| Simon Horman | Re: [PATCH] sendfile() and UDP socket |
| Jeff Garzik | Re: [PATCH] sky2: jumbo frame regression fix |
