I have a hunch that [database version mismatch/bump detected] Permission denied might be the important hint here, but even removing the /var/db/pkg/pkgdb.db files does not make any difference. And removing /var/db/pkg/pkgdb.db and then directly invoking portupgrade -a runs into exactly the same issue. sputnik1# cd /var/db/pkg/ sputnik1# rm pkgdb.db sputnik1# pkgdb -F ---> Checking the package registry database [Rebuilding the pkgdb <format:bdb_btree> in /var/db/pkg ... - 57 packages found (-0 +57) ......................................................... done] sputnik1# portupgrade -a [database version mismatch/bump detected] Permission denied /usr/local/lib/ruby/site_ruby/1.8/portsdb.rb:493:in `open_db': database file error (PortsDB::DBError) from /usr/local/lib/ruby/site_ruby/1.8/portsdb.rb:647:in `port' from /usr/local/lib/ruby/site_ruby/1.8/portsdb.rb:835:in `all_depends_list' from /usr/local/lib/ruby/site_ruby/1.8/pkgdb.rb:825:in `tsort_build' from /usr/local/lib/ruby/site_ruby/1.8/pkgdb.rb:817:in `each' from /usr/local/lib/ruby/site_ruby/1.8/pkgdb.rb:817:in `tsort_build' from /usr/local/lib/ruby/site_ruby/1.8/pkgdb.rb:839:in `sort_build' from /usr/local/lib/ruby/site_ruby/1.8/pkgdb.rb:843:in `sort_build!' from /usr/local/sbin/portupgrade:738:in `main' from /usr/local/lib/ruby/1.8/optparse.rb:755:in `initialize' from /usr/local/sbin/portupgrade:221:in `new' from /usr/local/sbin/portupgrade:221:in `main' from /usr/local/sbin/portupgrade:2172 /usr/local/lib/ruby/site_ruby/1.8/portsdb.rb:493: [BUG] Segmentation fault ruby 1.8.5 (2006-08-25) [i386-freebsd6] Abort (core dumped) sputnik1# gdb /usr/local/bin/ruby18 ruby18.core ...bt... #0 0x48243ecb in kill () from /lib/libc.so.6 [New LWP 100047] (gdb) bt #0 0x48243ecb in kill () from /lib/libc.so.6 #1 0x48169236 in raise () from /lib/libpthread.so.2 #2 0x48242b78 in abort () from /lib/libc.so.6 #3 0x4809638d in rb_bug () from /usr/local/lib/libruby18.so.18 #4 0x480f81df in sigsegv () from /usr/local/lib/libruby18.so.18 #5 0x4816ff5d in sigaction () from /lib/libpthread.so.2 #6 0xbfbfff94 in ?? () #7 0x0000000b in ?? () #8 0xbfbfe750 in ?? () #9 0xbfbfe490 in ?? () #10 0x00000000 in ?? () #11 0x4816fa24 in sigaction () from /lib/libpthread.so.2 #12 0x48287dd0 in i_close () from /usr/local/lib/ruby/site_ruby/1.8/i386-freebsd6/bdb.so #13 0x48098c09 in rb_protect () from /usr/local/lib/libruby18.so.18 #14 0x48287e90 in bdb_free () from /usr/local/lib/ruby/site_ruby/1.8/i386-freebsd6/bdb.so #15 0x480b55fe in rb_gc_call_finalizer_at_exit () from /usr/local/lib/libruby18.so.18 #16 0x48098b19 in ruby_finalize_1 () from /usr/local/lib/libruby18.so.18 #17 0x480ab350 in ruby_cleanup () from /usr/local/lib/libruby18.so.18 #18 0x480ab417 in ruby_stop () from /usr/local/lib/libruby18.so.18 #19 0x480ab46e in ruby_run () from /usr/local/lib/libruby18.so.18 #20 0x08048607 in main ()
Responsible Changed From-To: freebsd-ports-bugs->sem Over to maintainer
What about /usr/ports/INDEX.db file? Remove it too. -- Dixi. Sem.
State Changed From-To: open->feedback Ask submitter for an action
State Changed From-To: feedback->closed Not a portupgrade bug
State Changed From-To: closed->open The current version of portupgrade-devel (2.3.1) behaves differently: sputnik1# portupgrade -a cd: can't cd to /usr/ports cd: can't cd to /usr/ports/ports-mgmt/portupgrade cd: can't cd to /usr/ports Fetching the ports index ... index file directory /usr/ports not writable! index generation error /usr/local/lib/ruby/site_ruby/1.8/portsdb.rb:493:in `open_db': database file error (PortsDB::DBError) from /usr/local/lib/ruby/site_ruby/1.8/portsdb.rb:647:in `port' from /usr/local/lib/ruby/site_ruby/1.8/portsdb.rb:835:in `all_depends_list' from /usr/local/lib/ruby/site_ruby/1.8/pkgdb.rb:825:in `tsort_build' from /usr/local/lib/ruby/site_ruby/1.8/pkgdb.rb:817:in `each' from /usr/local/lib/ruby/site_ruby/1.8/pkgdb.rb:817:in `tsort_build' from /usr/local/lib/ruby/site_ruby/1.8/pkgdb.rb:839:in `sort_build' from /usr/local/lib/ruby/site_ruby/1.8/pkgdb.rb:843:in `sort_build!' from /usr/local/sbin/portupgrade:741:in `main' from /usr/local/lib/ruby/1.8/optparse.rb:755:in `initialize' from /usr/local/sbin/portupgrade:221:in `new' from /usr/local/sbin/portupgrade:221:in `main' from /usr/local/sbin/portupgrade:2175 Ah, I should set PORTSDIR since this is a non-default setup. sputnik1# setenv PORTSDIR /sw/test/FreeBSD/ports/ sputnik1# portupgrade -a Fetching the ports index ... index file directory /sw/test/FreeBSD/ports not writable! index generation error /usr/local/lib/ruby/site_ruby/1.8/portsdb.rb:493:in `open_db': database file error (PortsDB::DBError) from /usr/local/lib/ruby/site_ruby/1.8/portsdb.rb:647:in `port' from /usr/local/lib/ruby/site_ruby/1.8/portsdb.rb:835:in `all_depends_list' from /usr/local/lib/ruby/site_ruby/1.8/pkgdb.rb:825:in `tsort_build' from /usr/local/lib/ruby/site_ruby/1.8/pkgdb.rb:817:in `each' from /usr/local/lib/ruby/site_ruby/1.8/pkgdb.rb:817:in `tsort_build' from /usr/local/lib/ruby/site_ruby/1.8/pkgdb.rb:839:in `sort_build' from /usr/local/lib/ruby/site_ruby/1.8/pkgdb.rb:843:in `sort_build!' from /usr/local/sbin/portupgrade:741:in `main' from /usr/local/lib/ruby/1.8/optparse.rb:755:in `initialize' from /usr/local/sbin/portupgrade:221:in `new' from /usr/local/sbin/portupgrade:221:in `main' from /usr/local/sbin/portupgrade:2175 Okay, so use the (undocumented) INDEXDIR setting. sputnik1# setenv INDEXDIR /var/tmp sputnik1# portupgrade -a Fetching the ports index ... index file directory /sw/test/FreeBSD/ports not writable! index generation error Hmm, portupgrade ignores INDEXDIR, it seems! So, I believe there are two bugs here: 1. portupgrade ignores INDEXDIR, always going into $PORTSDIR. 2. portupgrade should not issue a full ruby backtrace when it's not able to read the database (the INDEX, I assume) but exit after the error message "index generation error".
Out of curiosity... > cd: can't cd to /usr/ports > cd: can't cd to /usr/ports/ports-mgmt/portupgrade > cd: can't cd to /usr/ports > Fetching the ports index ... index file directory /usr/ports not writable! Are you running as root or suing to root first? does /usr/ports exist? who owns /usr/ports? did you download the ports.tgz file and uncompress it until /usr/ports? Rich
> 2. portupgrade should not issue a full ruby backtrace when it's not able > to read the database (the INDEX, I assume) but exit after the error > message "index generation error". If you'll take a look inside portupgrade code you see no backtrace prints. It's a ruby issue. If you know how to shut up ruby, tell us. -- Dixi. Sem.
State Changed From-To: open->feedback Confirm please if the bug still exists?
State Changed From-To: feedback->open Yes, I can still reproduce this, just a bit differently: sputnik1# pkgdb -F ---> Checking the package registry database sputnik1# portupgrade -a Fetching the ports index ... index file directory /sw/test/FreeBSD/ports not writable! index generation error /usr/local/lib/ruby/site_ruby/1.8/portsdb.rb:493:in `open_db': database file error (PortsDB::DBError) from /usr/local/lib/ruby/site_ruby/1.8/portsdb.rb:647:in `port' from /usr/local/lib/ruby/site_ruby/1.8/portsdb.rb:835:in `all_depends_list' from /usr/local/lib/ruby/site_ruby/1.8/pkgdb.rb:825:in `tsort_build' from /usr/local/lib/ruby/site_ruby/1.8/pkgdb.rb:817:in `each' from /usr/local/lib/ruby/site_ruby/1.8/pkgdb.rb:817:in `tsort_build' from /usr/local/lib/ruby/site_ruby/1.8/pkgdb.rb:839:in `sort_build' from /usr/local/lib/ruby/site_ruby/1.8/pkgdb.rb:843:in `sort_build!' from /usr/local/sbin/portupgrade:786:in `main' from /usr/local/lib/ruby/1.8/optparse.rb:755:in `initialize' from /usr/local/sbin/portupgrade:229:in `new' from /usr/local/sbin/portupgrade:229:in `main' from /usr/local/sbin/portupgrade:2173
State Changed From-To: open->feedback Ask for an additional info
On Fri, 18 Jul 2008, Sergey Matveychuk wrote: > What about permissions for the directories? Sorry about the delay in getting back to this -- I've been travelling and access to my remote tester where I have been seeing this was flaky. You are right: root could not write into $PORTSDIR even though it looked as it should, but NFS root squashing hit even though the directory had group wheel and was group-writeable. Making $PORTSDIR world writable addressed this. So I guess this mainly leaves the question how we can improve the failure mode here? Thanks for your patience! Gerald
On Mon, 11 Aug 2008, Gerald Pfeifer wrote: > So I guess this mainly leaves the question how we can improve the failure > mode here? I've thought a bit about this; how about something like the following if $PORTSDIR is not writeable? Cannot write INDEX into $PORTSDIR; set PORTS_INDEX to save the index at an alternate location. And similarily for distfiles: Cannot save into $DISTDIR; set DISTDIR to a writeable location to proceed. With these two changes, I now have an apparently successful portupgrade run, for the first time with a centralized (NFS mounted) ports tree that is not writeable for root. :-) portupgrade works like a charm in such a setting, it's really only a bit of usability that may deter users. Great work! Gerald
State Changed From-To: feedback->closed Positive feedback. Thanks.
State Changed From-To: closed->open Umm, I'm afraid not. This really is about error handling and the current failure mode, and I ran into it today: sputnik1# portupgrade -a Fetching the ports index ... index file directory /sw/test/FreeBSD/ports not writable! index generation error /usr/local/lib/ruby/site_ruby/1.8/portsdb.rb:493:in `open_db': database file error (PortsDB::DBError) from /usr/local/lib/ruby/site_ruby/1.8/portsdb.rb:661:in `port' from /usr/local/lib/ruby/site_ruby/1.8/portsdb.rb:849:in `all_depends_list' from /usr/local/lib/ruby/site_ruby/1.8/pkgdb.rb:843:in `tsort_build' from /usr/local/lib/ruby/site_ruby/1.8/pkgdb.rb:835:in `each' from /usr/local/lib/ruby/site_ruby/1.8/pkgdb.rb:835:in `tsort_build' from /usr/local/lib/ruby/site_ruby/1.8/pkgdb.rb:857:in `sort_build' from /usr/local/lib/ruby/site_ruby/1.8/pkgdb.rb:861:in `sort_build!' from /usr/local/sbin/portupgrade:791:in `main' from /usr/local/lib/ruby/1.8/optparse.rb:785:in `initialize' from /usr/local/sbin/portupgrade:229:in `new' from /usr/local/sbin/portupgrade:229:in `main' from /usr/local/sbin/portupgrade:2208 See my 11 Aug 2008 comment on how I suggest to handle this instead, to give more guidance to the user. And avoid those 10+ lines of a Ruby backrace.
Note: Fetching the ports index ... index file directory /sw/test/FreeBSD/ports not writable! Have you tried to set INDEXDIR to another place? -- Dixi. Sem.
On Sat, 31 Jan 2009, Sergey Matveychuk wrote: > Have you tried to set INDEXDIR to another place? Yes, that works. Here is what I suggest to address the PR: 1. Change "Fetching the ports index ... index file directory /sw/test/FreeBSD/ports not writable!" to "Fetching the ports index ... directory /sw/test/FreeBSD/ports not writable; consider setting INDEXDIR." 2. Abort portupgrade at that point, instead of running into problems later on and issuing a Ruby backtrace. Gerald
Sorry, I was wrong: My Sun Sep 16 22:56:16 UTC 2007 comment still applies, and there are in fact three issues here: 3. portupgrade ignores INDEXDIR.
Responsible Changed From-To: sem->ruby sem@ has turned over maintainership of portupgrade to the ruby mailing list.
Responsible Changed From-To: ruby->pgollucci I will take it
Responsible Changed From-To: pgollucci->freebsd-ports-bugs going to have enotime for the next 2 weeks, sorry
Responsible Changed From-To: freebsd-ports-bugs->ruby Over to maintainer(s).
State Changed From-To: open->suspended Over to maintainer.
Responsible Changed From-To: ruby->freebsd-ports-bugs Over to maintainer.
State Changed From-To: suspended->open This should not be suspended.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 This has been fixed in the upstream. INDEXDIR is now respected. It is now available in the latest portupgrade-devel port and will be included in the next release. Thanks, Bryan Drewery -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQIcBAEBAgAGBQJPi4cfAAoJEG54KsA8mwz51vUP/3JJsI75oWr4NaS8TYZ/46ZS tHAFSkEfjaQ2BMqD17zyxrMmoj1v31Pq/d5rIN//sfceDGyyCszYiGkxGzddPy0M VLGeFyJ25Y8UqBpFw0a+xJGD9JA2ITazXcYNcaViBpSBtSYXcPwZy30PulOLvTg3 R1rm1rljhUqpzmgVmsKZS0gMBLKzPcpLKkoaZRmxAIvDmc1oozyB9UskYL9pyHaT QNHuWjN1SPS07vEjP3x2GbXcKoRoDIIsmy4p+9y91OrWqq2RB4k1gOXqRz7zdd5Z 9gzeQOJ04ZdyfvtCQyLyTN6o6wyDAvxHCBm02pIEW5zdnrZW/aEa18AcTEeDlmFy ZIcST/ptCJ3jiAPe9ZQp0hLun0HVfuq6ljzRtKI7mZ2PtWuivUTGQm2oDv4w0hoD GLUPzJE3k308wWETxID5OThHr//nvnTJVvKX2VMxFn9fGSGKqhQsGEa92ENUiS5z rmvuUNahSyvjZyGoaR5fuH+xsQabozFVdWiS9cp19PH0/ymlhQF8grBTmLIWRMJd A8UoJ0tfkjbqKUJmIH/P4X17eWp8KbVxCJxFUy8jY0QOfgIRaFPPKqeUTbREw+a0 OBVs+mFaABYjZ+4Nbj/uHoBzBkHi40Ufp/DA40y/VbVWNtjIq87v//85DwhDqY11 RV0j4AnjyNoA7LeHKVIY =0L45 -----END PGP SIGNATURE-----
State Changed From-To: open->closed Fixed in upstream.
Responsible Changed From-To: freebsd-ports-bugs->crees Take responsibility