Package deletion then have to restart web configurator
-
I applied your changes and they fixup the ref count issue if it gets big. But the problem is still there - from my monitoring the ref count only goes to 2 anyway.
Interestingly, I was using a little script to show me the ref count, and while removing blinkled it even gave me a segmentation fault. Also, the blinkled processes hung around a long time after the removal script had said that the pbi was deleted, I guess running in memory without looking to read pages out of the file on the CF card. They even survived after the segmentation fault that I got interactively.[2.1-BETA0][root@test02.homedomain]/var/log(14): php rr.php Content-type: text/html refcount_read: 0001 [2.1-BETA0][root@test02.homedomain]/var/log(16): ps ax | grep blink 5588 ?? Ss 0:36.21 /usr/local/bin/blinkled -i vr0 -l /dev/led/led2 5876 ?? Ss 0:36.21 /usr/local/bin/blinkled -i vr1 -l /dev/led/led3 62799 u0 S+ 0:00.01 grep blink [2.1-BETA0][root@test02.homedomain]/var/log(17): php rr.php Segmentation fault [2.1-BETA0][root@test02.homedomain]/var/log(18): ps ax | grep blink 5588 ?? Ss 0:37.99 /usr/local/bin/blinkled -i vr0 -l /dev/led/led2 5876 ?? Ss 0:38.00 /usr/local/bin/blinkled -i vr1 -l /dev/led/led3 12199 u0 S+ 0:00.01 grep blink [2.1-BETA0][root@test02.homedomain]/var/log(19): ps ax | grep blink 13010 u0 S+ 0:00.01 grep blink [2.1-BETA0][root@test02.homedomain]/var/log(20): php rr.php Content-type: text/html refcount_read: 0000
-
In /etc/inc/pkg-utils.inc function uninstall_package I commented out:
// exec("/usr/bin/tar xzPfU /tmp/pkg_libs.tgz -C /"); // exec("/usr/bin/tar xzPfU /tmp/pkg_bins.tgz -C /"); // @unlink("/tmp/pkg_libs.tgz"); // @unlink("/tmp/pkg_bins.tgz");
This stuff is backed up earlier in the routine and then restored for some reason.
But it includes things like /usr/local/lib/php/20090626 which has a bunch of "so" files related to php.
With this restore commented out, I don't get the sig11 crashes, the web configurator stays available.
I wonder why lots of stuff from /usr/local/lib is being backed up and restored during every package uninstall?
The "so" files would go missing for a moment as "tar" deletes the original on disk and then restores the one from backup. -
That was next on my list of things to try but had some customers to attend to.
The libraries are backed up in case a package removed a file that was required for the system to function properly. The restore process could probably be tweaked a bit somehow though.
-
I made a couple of pull requests, which Seth has committed, to make the reference count in the shared memory section even more robust - locking it while it is incremented and decremented. Hopefully now as long as all code does actually call conf_mount_rw folowed by conf_mount_ro after it has finished changing stuff, the filesystem will always end up read-only again on nanobsd.
Also tidied up an unnecessary rw then ro mount in pkg-utils which was slowing things down every time the user navigated to System:Packages and it listed Installed Packages.
This is all good stuff for nanobsd in general, but it doesn't fix the sig11. To fix that I still need to comment out the file restore from pkg-utils.inc:// exec("/usr/bin/tar xzPfU /tmp/pkg_libs.tgz -C /"); // exec("/usr/bin/tar xzPfU /tmp/pkg_bins.tgz -C /"); // @unlink("/tmp/pkg_libs.tgz"); // @unlink("/tmp/pkg_bins.tgz");
Now it needs someone like JimP who has the big picture, to work out how best to trim down this restore - maybe can do a comparison, work out if anything essential has gone missing, and only put the missing things back?
-
I'm going over that with the other devs.
The problem is likely the U flag to tar, which unlinks files before restoring. I wager if that were removing, and even better if "k" was put in its place, it may behave better.
"k" would cause it to keep existing files, and since this is restoring a backup after files were removed, that seems to make more sense to me. I'm just not sure if there are any edge cases I'm forgetting that required U to restore properly.
If the pkg uninstall corrupted the file, U would be better… but I'm not sure if that was one of the reasons.
-
A quick test of this on NanoBSD is promising. Without U, but with k (just replaced U with k in the tar command), the GUI is fine and everything seems happy.
The blinkled process still crashed but since it was uninstalled I expected as much.
Not sure how that might help/hurt a full install. I've got a discussion started with the other devs to see if I'm missing anything there. More testing would be appreciated before I commit it.
-
Good news - I did various install/uninstalls with the new code and there are no problems. webConfigurator keeps running fine, no sig11 (apart from blinkled, which is a different issue).
Installed the following:
blinkled
openvpn client export utility
pfblocker
squid3then did a firmware upgrade to the build that just finished:
2.1-BETA0 (i386)
built on Tue Jul 31 19:07:11 EDT 2012
FreeBSD 8.3-RELEASE-p3All went well. It reinstalled all the packages and the webConfigurator stayed up. After the package installs were finished all services were running, openvpn link up, web browsing from client… working.
During the package installs it does a package removal first for each package. That now spews out a lot of "file exists" messages from the tar restore with k option, but it works.
I guess the package removal is just in case, but if the code could detect that it is a package install from the first boot after a firmware upgrade then it could know that the package removal step is not needed.I have attached a log of the serial console output for the record.
-
Looks like we might just need "2>/dev/null" at the end of the tar command to silence the errors.
If you want to test that, edit the command(s) in pkg-utils.inc and add it, and then:
touch /conf/needs_package_sync
Then reboot, that'll make it do the pkg reinstall when it boots back up.
-
Ermal has already committed a change to use mwexec() instead of plain exec() - that should stop the loads of console output. He also fixed up the %age display on the console so it doesn't keep spewing out all across the line. I'll give those a try.
-
ok, I've been a bit busy this morning so I didn't review the commit log yet.
-
I did a gitsync on my ALIX and ran the test I mentioned and it worked fine with the latest changes Ermal made, so this may be all solved now. (knock on wood)
-
Upgraded to:
2.1-BETA0 (i386)
built on Wed Aug 1 16:50:12 EDT 2012
FreeBSD 8.3-RELEASE-p3Copy of console output is attached - cleaner than before. If I am feeling OCD I will find the appropriate places to put "\n" so that the %age output doesn't scribble over the beginning of a line of text.
Everything reinstalled fine - blinkled, openvpn, pfblocker, squid3
Note: squid3 left the mount ref count at 2 after its install. Thus the mount points do not go back to read-only. It has missing and mis-placed conf_mount_ro() calls. I have submitted a separate pull request to fix that. Not an issue for this thread.
-
Yep, I did feel OCD! I have put in a couple of pull requests to tidy up the console output some more. Everything functional seems fine. I'll see how the console output looks tomorrow after the next snapshot/upgrade/package install sequence.
After the conf_mount_ro fixups for squid and squid3 it should also leave the filesystem mounted read-only when finished.