An error occured handling 'dm_crypt-0': TypeError - join() argument must be str or bytes, not 'NoneType'

Bug #1874243 reported by Andreas Hasenack
16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
curtin
Fix Released
High
Unassigned
subiquity
Fix Released
Undecided
Łukasz Zemczak

Bug Description

Crash file attached. This was an attempt at installing on /dev/sdb, which is an external sata drive. I selected lvm with encryption, but no customization.

Related branches

Revision history for this message
Andreas Hasenack (ahasenack) wrote :
Revision history for this message
Andreas Hasenack (ahasenack) wrote :
Revision history for this message
Paride Legovini (paride) wrote :

This can be reproduced with subiquity 20.03.2 (currently candidate). No need to have a separate disk: it is sufficient to add a partition and configure it as an encrypted LVM volume.

I'm attaching the full /var/log of the installer system.

Revision history for this message
Paride Legovini (paride) wrote :

From curtin's install.log:

Running command ['blockdev', '--rereadpt', '/dev/vda'] with allowed return codes [0] (capture=True)
Error rescanning devices, possibly known issue LP: #1489521
cmd: ['blockdev', '--rereadpt', '/dev/vda']
stdout:''
stderr:blockdev: ioctl error on BLKRRPART: Device or resource busy
exit_code:1

Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Confirmed on a KVM, the test case is really trivial. This is a release critical bug.

Revision history for this message
Ryan Harper (raharper) wrote :

Can you provide the virtual machine configuration, either libvirt xml or qemu command line?

Changed in curtin:
status: New → Incomplete
Revision history for this message
Łukasz Zemczak (sil2100) wrote :

I was running subiquity via this, as I run most of my quick tests:
`kvm -drive if=virtio,file=/path/to/hdd.qcow2 -m 3072 -boot d -smp 2 --cdrom focal-live-server-amd64.iso`

Changed in curtin:
status: Incomplete → New
Revision history for this message
Ryan Harper (raharper) wrote :

- id: dm_crypt-0
        key: ubuntu
        preserve: false
        type: dm_crypt
        volume: partition-2

The block schema for dm_crypt types requires 'dm_name' field, this is not present. The error message is not great, so I;ll sort out curtin.

Subiquity has a bug here in not emitting a dm_name in the type: dm_crypt config dictionary.

Changed in curtin:
importance: Undecided → High
status: New → Triaged
Revision history for this message
Brian Murray (brian-murray) wrote :

add_dm_crypt() in subiquity/model/filesystems.py isn't passing dm_name and it looks like that defaults to None.

Changed in subiquity:
assignee: nobody → Łukasz Zemczak (sil2100)
Revision history for this message
Łukasz Zemczak (sil2100) wrote :

So it's as Brian commented, but it seems that this part of the code is the same since May 2019, and we have confirmed that encrypted LVM worked fine with 19.10. What I do find weird is that even with an empty dm_name things should still work in curtin, no? Per:

        dm_name = vol.get('dm_name')
        if not dm_name:
            dm_name = vol.get('id')
        volume_path = os.path.join("/dev", "mapper", dm_name)

from curtin/commands/block_meta.py. The id attribute seems to be set correctly, so I wouldn't expect it to suddenly be None? Though the logs seem to indicate that.

Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Ok, wrong thing I checked, so I see the issue. So on the 2020-03-10 with commit bf03e4f78 the "dmcrypt_dev = os.path.join("/dev", "mapper", dm_name)" line has been added to dm_crypt_handler() which is now crashing. As per the snippet above, in other places we are defaulting to using 'id' when 'dm_name' is not available, so I'd recommend doing the same here. Is there a reason for not following the same procedures in both places?

Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Ok, attached MP for a quick fix that I hope might help? Let me try hacking that live to see if it helps.

Revision history for this message
Server Team CI bot (server-team-bot) wrote :

This bug is fixed with commit 2f226905 to curtin on branch master.
To view that commit see the following URL:
https://git.launchpad.net/curtin/commit/?id=2f226905

Changed in curtin:
status: Triaged → Fix Committed
Revision history for this message
Paride Legovini (paride) wrote :

The fix works works perfectly, thanks!

Changed in subiquity:
status: New → Fix Released
Revision history for this message
Ryan Harper (raharper) wrote : Fixed in curtin version 20.1.

This bug is believed to be fixed in curtin in version 20.1. If this is still a problem for you, please make a comment and set the state back to New

Thank you.

Changed in curtin:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.