halt.sh uses the sort program in the mount_readonly() method. Since sort is located at /usr/bin/sort this is a problem, if you have /usr at a separate partition. In this case the /usr partition is already unmounted and sort could not be found by the bash. Hence my patch uses awk to reverse the /proc/mounts content. Let's assume that / is at the first line in every case, you don't need to sort the file, before reversing. But this patch does sorting before reversing. 2nd the patch simplifies the unmounting filesystem statements. Reducing time from O(n^2) to O(n) (n is the number of lines of the mount output). The patch is against baselayout 1.9.4-r6. I looked at 1.10.4 and 1.11.2, where halt.sh has the same problems. The first part is critical, because / isn't remounted readonly if you have /usr at a separate partition. Patch is attached. Regards Georg Sauthoff Reproducible: Always Steps to Reproduce: 1. 2. 3.
Created attachment 42489 [details, diff] diff against halt.sh from baselayout 1.9.4-r6
sort is in /bin ... if it isnt on your system, you need to update your coreutils that means the only thing here is a suggested update from using sort to awk
Hi, > sort is in /bin ... if it isnt on your system, you need to update your coreutils ok, then the baselayout package should depend on a recent coreutils version, rigt? > that means the only thing here is a suggested update from using sort to awk No, I suggested two things with that patch. The 2nd thing is to simplify the unmounting fs loop. Of course this is not critical. But the current loop is somehow stupid. Regards
not really ... it's moved around between versions, latest stable should have it in the right place
> not really ... it's moved around between versions, latest stable should > have it in the right place Hm, the /usr/bin/sort is from sys-apps/textutils-2.1. Hence baselayout-1.9.4-r6 (stable version) needs a sort at /bin/sort, which is provided by sys-apps/coreutils-5.2.1, why shouldn't depend the baselayout package at a recent coreutils version? Without that dependency, you get a broken baselayout upgrade from older systems. Regards
Your awk is broken for one: ----- nosferatu ~ # mount | awk '{ \ if (($5 !~ /^(proc|sysfs|devfs|tmpfs|usb(dev)?fs)$/) && ($1 != "none") && ($1 !~ /^(rootfs|\/dev\/root)$/) && ($3 != "/")) print $3 }' | sort | uniq nosferatu ~ # mount | awk '{ if (($5 ~ /^(proc|sysfs|devfs|tmpfs|usb(dev)?fs)$/) || ($1 == "none") || ($1 ~ /^(rootfs|\/dev\/root)$/) || ($3 == "/")) print $3 }' | sort | uniq / /dev /dev/pts /dev/shm /proc /proc/bus/usb /sys nosferatu ~ # mount | awk '{ \ if (($5 !~ /^(proc|sysfs|devfs|tmpfs|usb(dev)?fs)$/) && ($1 != "none") && ($1 !~ /^(rootfs|\/dev\/root)$/) && ($3 != "/")) print $3 }' | sort | uniq nosferatu ~ # ----- Secondly, sort have been in /bin since whenever.
Below has been the case since coreutils-5.0 at least: ----- nosferatu ~ # ls -l /bin/sort -rwxr-xr-x 1 root root 62112 Oct 21 07:16 /bin/sort nosferatu ~ # ls -l /usr/bin/sort lrwxrwxrwx 1 root root 14 Oct 21 07:16 /usr/bin/sort -> ../../bin/sort nosferatu ~ # epm -qf /bin/sort coreutils-5.2.1-r2 nosferatu ~ # epm -qf /usr/bin/sort coreutils-5.2.1-r2 nosferatu ~ # -----
Sorry, I was on drugs. The first part of the patch is fine. The second part is bugus though, as we have moved sort to /bin a long time ago (baselayout only started to use it there when moved).
Another thing to change might be 'sort | uniq' -> 'sort -u' ...
Hi, > Secondly, sort have been in /bin since whenever. > the second part > is bugus though, as we have moved sort to /bin a long time ago (baselayout > only started to use it there when moved). If baselayout started using /bin/sort when moved - why don't express this change with a correct dependency? There are users, who doesn't reinstall their sytem from scratch every month. This dependency cost anything nor have side effects. Smooth updating should be a very important goal for a distribution. In the current state, if something depend on a current baselayout, you get a broken baselayout, because it doesn't depend on a recent coretutils. Hence, that sort is in /bin since whenever is really no argument. Of course the 2nd part is bogus. If sort is now in /bin, you need a right dependency and no sort replacement by awk. Regards
Because it has been like that for over a year now? If somebody have not updated in a year, and wants to do that now (or only update baselayout), there are other more severe issues he will have to worry about. It really will be a redundent dependency, and might cause issues during bootstrap again (will have to figure out correct checking of 'build' and 'bootstrap' and prob other build flags these days ...).
merged your ideas into cvs, look for it in 1.11.7 thanks :)