Bug 153576

Summary: Cannot mount crypted home after update
Product: [openSUSE] openSUSE 10.2 Reporter: Thorsten Kukuk <kukuk>
Component: Update ProblemsAssignee: Lukas Ocilka <locilka>
Status: RESOLVED FIXED QA Contact: E-mail List <qa-bugs>
Severity: Blocker    
Priority: P5 - None CC: aj, lnussel, mvidner, ralf, suse-beta
Version: Alpha 5 plus   
Target Milestone: ---   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: Other Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: y2logs.tgz
my YaST logs for completeness

Description Thorsten Kukuk 2006-02-26 11:30:55 UTC
Installed 10.0-i386 and created a crypted /home partition.
/etc/cryptotab entry is:

/dev/loop0  /dev/sda8 /home  reiserfs   twofish256 acl,user_xattr

During update to SL10.1Beta5 YaST2 modifies twofish256 to twofishSL92.
/etc/init.d/boot.crypto is not able to mount the partition in htis way.

Changing the entry back to twofish256 does not help, SL10.1 is still not able to mount the partition.
When I boot from the 10.0 backup partition, I can mount and access the partition.
Comment 1 Michael Gross 2006-02-27 11:32:00 UTC
Do you know why it fails? The cipher shouldn't have been changed since 10.0. Is it possible to manually mount the partition?
Comment 2 Thorsten Kukuk 2006-02-27 12:15:19 UTC
I don't know why it fails, else I would have written it. I have no knowledge about this stuff.
Comment 3 Michael Gross 2006-02-27 12:22:14 UTC
try the following (assuming the crypto-fs to be on sda8)

%modprobe twofish
%losetup -d /dev/loop0                      # assures loop0 is not busy 
%losetup -e twofish256 /dev/loop0 /dev/sda8 # should ask for pw here
%mount /dev/loop0 /mnt

Does the output indicate the error? A failed ioctl-call would indicate a problem with the cipher-module, if the filesystem cannot be mounted in the last step, it's probably another cipher here.
Comment 4 Thorsten Kukuk 2006-03-01 07:04:12 UTC
This time mounting worked after fixing /etc/cryptotab, maybe I made a mistake the last time.

But /etc/cryptotab was changed again by YaST2 to the wrong twofishSL92 entry.
Comment 5 Ludwig Nussel 2006-03-01 12:28:21 UTC
The rewrite should only happen if upgrading from <= 9.2. Could be a zypp related bug if the old proddb is used to determine the previously installed product. yast logs should show which version yast thinks it's upgrading.
Comment 6 Michael Gross 2006-03-01 13:52:02 UTC
OK, Thorsten, attach the logs, after this I'll reassign.
Comment 7 Thorsten Kukuk 2006-03-01 17:49:23 UTC
Created attachment 70841 [details]
y2logs.tgz
Comment 8 Michael Gross 2006-03-01 17:59:50 UTC
Klaus: Please check comment #5
Comment 10 Efthimios Toulas 2006-03-13 16:55:19 UTC
The problem is inside ./pkg-bindings/src/Target.cc
YCPList PkgModuleFunctions::TargetProducts () already has a warning pointing on this (indirectly).

The returned YCPList does not contain all keys, especially the version of the product.

In ./update/src/modules/Update.ycp the function GetProductName () expects this information. The version falls back to "?" and so the check for a specific version in the function Update () in ./storage/storage/src/modules/Storage.ycp is not correct and leads to above mention problem.

Klaus, which keys are supported in ./pkg-bindings/src/Target.cc TargetProducts() ?
Comment 11 Efthimios Toulas 2006-03-14 13:55:16 UTC
Patch proposal:

Index: Target.cc
===================================================================
--- Target.cc   (revision 28955)
+++ Target.cc   (working copy)
@@ -302,8 +302,10 @@
        if (it->status().isInstalled() )
        {
            YCPMap prod;
-#warning TargetProducts doesn't return all keys
-           prod->add( YCPString("name"), YCPString( product->name() ) );
+           prod->add( YCPString("label"),       YCPString( product->displayName() ) );
+           prod->add( YCPString("vendor"),      YCPString( product->vendor() ) );
+           prod->add( YCPString("name"),        YCPString( product->name() ) );
+           prod->add( YCPString("version"),     YCPString( product->edition().version() ) );
            prod->add( YCPString("relnotesurl"), YCPString( product->releaseNotesUrl().asString() ) );
            products->add(prod);
        }
Comment 12 Martin Vidner 2006-03-14 14:42:32 UTC
I have added the key "version" in yast2-pkg-bindings-2.13.26, which should fix the blocker.

This makes TargetProducts support 50% bigger!!! (product, version, relnotesurl) but Product.ycp wants quite some more. But the ycp code does not use it anyway.
Comment 13 Michael Gross 2006-03-16 13:36:24 UTC
*** Bug 158618 has been marked as a duplicate of this bug. ***
Comment 14 Michael Gross 2006-03-16 13:36:36 UTC
Looks like this problem still is not quite fixed.
Comment 15 Ludwig Nussel 2006-03-16 16:24:09 UTC
The log from #158618 shows that there is still something wrong with the old version on beta8:

Storage.ycp:4353 Update old:$["name":"?", "nameandversion":"? ?", "version":"?"] new:$["major":10, "minor":1, "name":"SUSE LINUX", "nameandversion":"SUSE LINUX 10.1", "version":"10.1"]
Comment 16 Martin Vidner 2006-03-16 18:07:23 UTC
Thanks for looking it up, I will have a look tomorrow.
Comment 17 Martin Vidner 2006-03-17 10:34:24 UTC
Jirka, in Update::GetProductName, Pkg::TargetProducts returns an empty list. I see that you made some changes in r29075. Does it mean Pkg::TargetProducts is obsolete? Or can you reimplement it in terms of ResolvablePropertiesEx?

The complex case here is upgrading a system which had addon products. Fortunately we do not have to get that one right for this release yet :-)

Another aspect of this bug is that the old product map is already filled correctly in RootPart::GetproductName - cut-n-paste programming :( - search the logs for "nameandversion". But I don't know the module dependencies enough to tell whether we can use that info in Update.
Comment 18 Jiri Srain 2006-03-17 22:35:31 UTC
TargetProduct cannot return any data from older release - the reason is that it is not able to read all metadata stored on the disk.

Martin, as you already investigated, does what you wrote mean that if I delete Update::GetProductName and use RootPart::GetProductName instead, the bug will be solved?
Comment 19 Christian Boltz 2006-03-18 13:18:37 UTC
/etc/cryptotab again contained twofishSL92 after update from beta6 -> beta8 :-(

I'll add this bug to the most annoying bugs because it can cause filesystem corruption.
Comment 20 Martin Vidner 2006-03-20 15:28:26 UTC
> Martin, as you already investigated, does what you wrote mean that if I
> delete Update::GetProductName and use RootPart::GetProductName instead,
> the bug will be solved?

Why not fix Pkg::TargetProducts? If that's hard, I can fix it tomorrow by *moving* RootPart::GetProductName to replace Update::GetProductName.
Comment 21 Martin Vidner 2006-03-21 13:05:39 UTC
(Pkg::TargetProducts is explained in comment 18, I missed that)

Fixed in yast2-update-2.13.9
Comment 22 Christian Boltz 2006-04-02 17:45:20 UTC
Encryption alghorythmus still ok after updating beta8 to beta9 - your fix works :-)

Thanks!
Comment 23 Ralf Haferkamp 2006-10-20 11:10:00 UTC
The bug is there again when updating to 10.2 alpha5plus.
Comment 25 Lukas Ocilka 2006-10-25 13:03:22 UTC
OK, I'll check it in 10.2 Beta1
Comment 27 Lukas Ocilka 2006-10-26 08:26:50 UTC
I see. Storage module uses keys "major" and "minor" but such keys are not defined in the Update::installedVersion map which is used in Storage. That's why it considers system version to be major==0, minor=0.

Thomas, I'll add them into the Update module but I suggest you should also add some checking into your function Storage::Update().
Comment 28 Lukas Ocilka 2006-10-26 08:29:04 UTC
Created attachment 102678 [details]
my YaST logs for completeness

Updating 10.0 GM DVD to 10.2 Beta2 DVD
Comment 29 Lukas Ocilka 2006-10-26 08:52:30 UTC
Thomas, there might be a problem when upadting from SLE or SLD. In this case, there is only a major version (9, 10) but no minor one despite the fact that SLE 10 has the same base as openSUSE 10.1. Any proposed solution?
Comment 30 Thomas Fehr 2006-10-26 09:07:26 UTC
The interface to function Storage::Update was designed some years ago (2004, 
I think for SLES9) and the maps contained keys "major" and "minor" back then.
So something must have changed since then without telling me.

I will add a check that logs an error when they keys are missing.
Comment 31 Thomas Fehr 2006-10-26 09:09:23 UTC
Ad comment#29:

SLES9 used code base of SL 9.1 and SLES10 code base of SL 10.1.
Why not simply add an entry for "minor":1 in these two cases.
Comment 32 Lukas Ocilka 2006-10-26 10:47:45 UTC
Ad comment #30
  Martin has probably changed something - see comment #21

Ad comment #31
  Because in this case, the information would have to be somehow hardcoded into the source code. Update module take this information from SuSERelease module which thakes that from /etc/SuSE-release from the installed system.

  It would be better to handle it this way: If a major version is defined and a minor one isn't - it 'must be' SLES/SLED. But I'd still be just guessing... I'd rather create another key like "enterprise":true in this case than to guess a minor version.
Comment 33 Thomas Fehr 2006-10-26 11:03:33 UTC
But since we need to compare the minor number to decide which updates need
to be done it is necessary to hardcode it somewhere. Of course I could also 
hardcode minor number corresponding to SLES in Storage::Update function itself.
Should i?

Somewhere the knowledge that SLES9 is SL 9.1 and SLES10 is SL 10.1 needs to 
be hardcoded anyway and it is IMHO no problem to hardcode it since these 
facts will and can not change.

Comment 34 Lukas Ocilka 2006-10-26 11:07:56 UTC
I guess, that hardcoding minor=1 if minor is not defined and major is defined because Update itself doesn't need it anywhere. These major/minor numbers are there just because of Storage.

Additionally, you would know that it isn't openSUSE but an enterprise version. That's even better because, for instance, openSUSE 10.1 is not exactly the same as SLE 10.
Comment 35 Thomas Fehr 2006-10-26 11:20:32 UTC
Ok, I added a mapping to minor number if no "minor" entry is present to
Storage::Update.
Comment 36 Lukas Ocilka 2006-10-26 11:41:58 UTC
Fixed in yast2-update-2.14.2 (openSUSE 10.2) and yast2-update-2.13.38 (SLE 10 SP1).

Comment #26 filed as FATE request #301717.
Comment 37 Lukas Ocilka 2006-10-26 11:43:58 UTC
Thomas, just a reminder, fix it also for SLE 10 SP1, please.
Comment 38 Thomas Fehr 2006-10-26 11:50:00 UTC
Fix will be in 2.13.74 (SLES10 SP1) and 2.14.14 (SL 10.2)