Maybe I'm just having a brainstorm, in which case, Sorry! Trying to set up a netboot based system using unionfs. The setup I've built means that / is mounted rw by the time checkroot runs. However, the system still tries to remount / rw. I think there's a bug in /etc/init.d/checkroot: # Should we mount root rw ? if mount -vf -o remount / 2> /dev/null | \ awk '{ if ($6 ~ /rw/) exit 0; else exit 1; }' then ebegin "Remounting root filesystem read/write" Shouldn't the awk exit codes be the other way around? Even if I run this code fragment on a normal, disk based system, with root mounted read-write, it reports that it needs to remount. I suspect this hasn't been noticed before because "mount -o remount,rw /" will normally succeed on a simple mount. The unionfs mount comes back with an error, highlighting the bug.
no, the awk exit codes are correct
(In reply to comment #1) > no, the awk exit codes are correct > I'm not convinced! Isn't "exit 0" true in Bourne shell, so won't the "if" will execute if / is mounted rw? Not trusting my own brain, I have tried it out on another machine. This is on an up to date Gentoo box (not netboot, it's my desktop machine): penguin tmp # cat mountcheck # Should we mount root rw ? if mount -vf -o remount / 2> /dev/null | \ awk '{ if ($6 ~ /rw/) exit 0; else exit 1; }' then echo "Remounting root filesystem read/write" fi penguin tmp # mount -vf -o remount / /dev/sda2 on / type ext3 (rw) penguin tmp # sh mountcheck Remounting root filesystem read/write penguin tmp # There's certainly something wrong there!
(In reply to comment #2) > (In reply to comment #1) > > no, the awk exit codes are correct > > I'm not convinced! it doesnt really matter whether you're convinced, it doesnt change the facts :) > Isn't "exit 0" true in Bourne shell, so won't the "if" will execute if > / is mounted rw? yes, but the reason this hasnt been an issue before is on every normal system, the / is read only at this point, especially considering the fact we remounted / readonly earlier in the same script
(In reply to comment #3) > (In reply to comment #2) > > (In reply to comment #1) > > > no, the awk exit codes are correct > > > > I'm not convinced! > > it doesnt really matter whether you're convinced, it doesnt change the facts :) :-) > > Isn't "exit 0" true in Bourne shell, so won't the "if" will execute if > > / is mounted rw? > > yes, but the reason this hasnt been an issue before is on every normal system, > the / is read only at this point, especially considering the fact we remounted > / readonly earlier in the same script ... if /fastboot doesn't exist. If /fastboot exists then root doesn't get remounted readonly, and then subsequently it attempts to remount it read-write when it doesn't need to. This causes problems if remounting read-write isn't a supported option (which will be true for readonly NFS or unionfs root filesystems). I'm not really that obsessed about this, I've fixed it in my own script. I'd just like it addressed (or I'd like to understand why I'm wrong!) so I don't have to worry whenever I do an update that it's going to break the 200 machines that'll be booting off this image. At the moment, this is the only change I've had to make to any init script to get my netboot system working with Gentoo.
(In reply to comment #4) > This causes problems if remounting > read-write isn't a supported option (which will be true for readonly > NFS or unionfs root filesystems). Duh! I've just realised, NFS won't be read-write beforehand anyway. It's probably only unionfs that's an issue because it starts out read-write but doesn't like remounting read-write. I'll shut up now!
not just nfs but most systems ... the kernel mounts / readonly when first booting, so the check above is just a sanity check this should fix it though for everyone: if mount -vf -o remount / 2> /dev/null | \ - awk '{ if ($6 ~ /rw/) exit 0; else exit 1; }' + awk '{ if ($6 ~ /rw/) exit 0; else exit 1; }' && \ + ! touch -c / >& /dev/null then
ok, ive added my proposed touch check to svn