Bug 148105

Summary: no error message when RPM database is missing
Product: [openSUSE] openSUSE 10.2 Reporter: Christian Boltz <suse-beta>
Component: Update ProblemsAssignee: Lukas Ocilka <locilka>
Status: VERIFIED FIXED QA Contact: Stanislav Visnovsky <visnov>
Severity: Normal    
Priority: P5 - None CC: ke, locilka, lslezak
Version: Beta 2   
Target Milestone: ---   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: Other Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: y2logs
Relevant part of update.pot

Description Christian Boltz 2006-02-03 20:07:08 UTC
I have /tmp and large portions of /var symlinked to my encrypted home which I didn't mount for the update (don't wonder, I have a separate "testroot" partition with /var on the root partition and simply choosed the wrong partition for update accidently).

However, YaST did not display any warning because of the missing RPM database. Instead, it simply suggested several packages (I guess the default selection) for installation.

IMHO, there should be an error message if the RPM database is not found when installing as update.
Comment 1 Christian Boltz 2006-02-03 20:07:49 UTC
Created attachment 66412 [details]
y2logs
Comment 2 Christian Boltz 2006-03-04 10:48:08 UTC
problem still exists in beta6
Comment 3 Lukas Ocilka 2006-03-15 10:39:24 UTC
[packagemanager] InstTargetProdDB.cc(open):256 Error create: /mnt/var/adm/YaST/ProdDB{does not exist} (errno 2)
[packagemanager] InstTargetSelDB.cc(open):103 Error create: /mnt/var/adm/YaST/SelDB{does not exist} (errno 2)
[rpmdb] RpmDb.cc(initDatabase):347 Calling initDatabase: '(/mnt)/var/lib/rpm'
...
[rpmdb] RpmDb.cc(initDatabase):371 Cleanup on error: state NO_INIT
[Y2PM] Y2PM.cc(instTargetInit):339 Init InstTarget at '/mnt' returned ERROR(InstTarget:E_RpmDB_init_failed)
[Interpreter] clients/update_proposal.ycp:85 ERROR(InstTarget:E_RpmDB_init_failed)
[YCP] Update.ycp:209 First installed product $[]

I'm afraid this is a pretty weird system for Update :)
Comment 4 Christian Boltz 2006-03-15 12:27:06 UTC
(In reply to comment #3)
> I'm afraid this is a pretty weird system for Update :)

I know - the reason is that my encrypted /home (containing most of /var) also is not mounted. My point isn't that update doesn't work as expected - without /var, this is not very surprising ;-)

The problem is: There's *no error message*. YaST silently switches to "new installation" instead - but I requested an update.

I suggest to add an error message "old RPM database not found, will do fresh installation instead".


BTW:
# ls -l /var/ |sed 's/.*[0-9] //'
account -> ../home/var/account/
adm -> ../home/var/adm/
cache -> ../home/var/cache/
cvs -> ../home/var/cvs/
games -> ../home/var/games/
lib -> ../home/var/lib/
lock/
log/
mail -> spool/mail/
opt -> ../home/var/opt/
run/
spool -> ../home/var/spool/
tmp -> ../home/var/tmp/
-> ../home/var/X11R6/
yp -> ../home/var/yp/
(remember /home was not mounted...)
Comment 5 Lukas Ocilka 2006-04-19 14:28:17 UTC
Christian, is this problem about the situation that when you boot to the instsys, your /var is mounted to the /mnt/var and symlinks point somewhere where such objects don't exist - because of not-mounted /home (to /mnt/home)?

Hmm, maybe the problem is with the encryption. Update of the encrypted partition needs a very special workflow.
Comment 6 Christian Boltz 2006-04-19 17:48:52 UTC
(In reply to comment #5)
> Christian, is this problem about the situation that when you boot to the
> instsys, your /var is mounted to the /mnt/var and symlinks point somewhere
> where such objects don't exist - because of not-mounted /home (to /mnt/home)?

Exactly.

> Hmm, maybe the problem is with the encryption. Update of the encrypted
> partition needs a very special workflow.

No - the only needed "special workflow" is "do not skip mounting the encrypted partition". (If I mount the encrypted partition when offered by YaST, everything works fine.)

The fix is easy - simply test for the required files and display a warning message if one of them is missing. The user should be informed what's going on.

bash-alike pseudocode to add:
    test -f /var/lib/rpm/Packages || alert "can't find RPM database - will do a
                                     fresh installation instead of update"
(maybe you want/need to test for some other files also)
Comment 7 Gerald Pfeifer 2006-04-28 23:56:22 UTC
Agreed, we really ought to have a better failure mode.  This should not
be hard, even.  Raising to major.
Comment 8 Christian Boltz 2006-10-02 22:02:01 UTC
ping ;-)

Will the missing error message be added in 10.2?
Comment 9 Ladislav Slezák 2006-10-30 12:48:51 UTC
Sorry, it's too late for 10.2 (text freeze), will be solved for the next release.
Comment 10 Christian Boltz 2006-11-01 21:43:48 UTC
(In reply to comment #9)
> Sorry, it's too late for 10.2 (text freeze),

Are you joking? This bug is about 9 months old ;-)

That said: an untranslated error message is ways better than having no error message at all!
Comment 11 Ladislav Slezák 2006-11-08 15:08:18 UTC
Lukas, I think this one is for you - the check should be either in yast2-install or in yast2-update, I don't know where exactly...

Check wheter there is a RPM DB on the target partition (/mnt)/var/lib/rpm/Packages or (/mnt)/var/lib/rpm/packages.rpm in case of v3 DB.

Another solution could be to check how many packages are installed on the target (Pkg::GetPackages(`installed, true), the target has to be initialized).
Comment 12 Lukas Ocilka 2006-11-09 09:51:10 UTC
Karl, this came to me too late. Can we add a new text informing user that the RPM Database couldn't have been found?

Something like:
--- popup ---
Failed to find RPM Database.

Neither /mnt/var/lib/rpm/Packages nor /mnt/var/lib/rpm/packages.rpm has been found. Are you sure you want to continue the update?

[ Continue ] [ Retry ] [ Abort ]
--- popup ---

Retry is for users that could mount their partitions manually (or whatever...).
Any better text? Any better idea?
Comment 13 Lukas Ocilka 2006-11-09 09:52:01 UTC
Anyway, --> openSUSE 10.2
Comment 14 Lukas Ocilka 2006-11-09 10:12:34 UTC
Hmm, at least one another string... (for update proposal) ... needed:

"warning" : _("Cannot read the current RPM Database.")
Comment 15 Lukas Ocilka 2006-11-09 10:20:19 UTC
As far as I can see, packager uses buttons:

[ Abort ] [ Retry ] [ Ignore ]

So I'd rather use the very same buttons here instead of:

[ Continue ] [ Retry ] [ Abort ]
Comment 16 Lukas Ocilka 2006-11-09 12:26:28 UTC
- Checking for RPM Database. Reporting error when it is missing and
  offering `abort, `retry, `ignore (#148105).

Fixed in yast2-update
  * 2.14.6  (openSUSE 10.2)
  * 2.13.42 (SLE10 SP1)
Comment 17 Lukas Ocilka 2006-11-09 12:28:01 UTC
Created attachment 104462 [details]
Relevant part of update.pot

Text were as minimized as possible...
Comment 18 Lukas Ocilka 2006-11-09 12:30:22 UTC
Karl, I'm reassigning this bug to you because you can either add that part of the update.pot or ignore it for 10.2 (it should not almost happen).

Anyway, critical -> normal, because it is now only about translations, not about some missing functionality.
Comment 19 Karl Eichwalder 2006-11-09 13:12:04 UTC
I checked in the new strings in our repo with this checkin msg:

add t[w]o messages; see #148105
no need to update the translations now

I consider it fixed.
Comment 20 Karl Eichwalder 2006-11-09 13:18:38 UTC
For the record, I previously tried to add the following comment:

This looks like a very corner case to me; we do not need translations for this
feature right now.
Comment 21 Lukas Ocilka 2006-11-09 13:20:14 UTC
Thanks a lot.

Yes, I do agree...
Comment 22 Christian Boltz 2006-11-09 16:23:13 UTC
Thanks for fixing this. However, the error message is a bit incomplete ;-)

If I interpret comment #12, #15 and #17 correct, the error popup will look like this:

    Cannot read the current RPM Database.
    None of these files exist: /var/lib/rpm/...
    [ Abort ] [ Retry ] [ Ignore ]

While the meaning of [Retry] and [Abort] are obvious, it's unclear what [Ignore] does. At least experienced users will wonder how an upgrade can work if the rpm database is missing.

Please add the following text to the popup to make it clear:

    If you ignore this error, a fresh installation will be done instead of the 
    upgrade.

(Well, my english isn't perfect, but you should get the point. Feel free to find some better wording.)
Comment 23 Lukas Ocilka 2006-11-09 16:28:06 UTC
Karl?

Well, actually, I neither know what happens in case of `ignore :)
Christian, are you sure, it really installs a 'fresh installation', how fresh would it be ;)?
Comment 24 Karl Eichwalder 2006-11-09 16:55:53 UTC
I'd simply remove the "{Ignore]" option.

For 10.3 we can evaluate this feature again.  It's probably a good idea to check whether the RPM DB is accessible.  But more is wasted energie.  If the user decides to shoot himself in the foot, there is no way to help him ;)  Updataing default systems it hard enough.
Comment 25 Lukas Ocilka 2006-11-09 17:03:22 UTC
That's fair ;)
Comment 26 Lukas Ocilka 2006-11-09 17:05:16 UTC
Christian, do you agree with Karl?

We would have [ Abort ] && [ Retry ] buttons then...
and they are both obvious...
Comment 27 Christian Boltz 2006-11-09 22:35:26 UTC
(In reply to comment #23)
> Well, actually, I neither know what happens in case of `ignore :)
> Christian, are you sure, it really installs a 'fresh installation', how fresh
> would it be ;)?

The package selection looked as if a fresh installation would be done. However, you'll probably [1] end up with several outdated files because rpm can't clean up packages that are not installed this time (but were before).
-> probably the same "interesting" result as if you do a fresh installation 
   without formatting the partition - it should work, but wastes some hard disk
   space ([1] is valid here too)

If you are unsure about the result, simply remove the [Ignore] button.

If you are sure YaST will switch to "new installation" (easy to test:
rm -r /var/lib/rpm and start an upgrade ;-) add my sentence from comment #22.

I can live with both ways - the important thing is that there is an error message. The ignore button would be an extra bonus, OTOH it could also cause problems for people who blindly click ignore (well, that's their very own fault - you should always read error messages *g*)


[1] No, I never did such an installation to test what will happen ;-) -
    I always aborted before actually writing something to the harddisk.
Comment 28 Lukas Ocilka 2006-11-10 08:02:08 UTC
Hmm, we are after Beta2, rather removing [Ignore] button...

changelog:
- Removing `ignore button for now (#148105, comments #22-#28).

yast2-update
  * 2.14.7
  * 2.13.43
Comment 29 Christian Boltz 2007-08-12 18:08:45 UTC
VERIFIED in 10.3 beta1 - nice error message ;-)

BTW:
(In reply to comment #28 from Lukas Ocilka)
> Hmm, we are after Beta2, rather removing [Ignore] button...
> 
> changelog:
> - Removing `ignore button for now (#148105, comments #22-#28).

Even without the ignore button, the installation doesn't cancel immediately - but the proposal shows "couldn't read rpm database". (No, I did not test what happens if I click continue ;-)