block-meta custom failed on kvm

Bug #1803672 reported by Jack Chen
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
curtin
Fix Released
Medium
Unassigned

Bug Description

I used MAAS 2.4 and maas server is Ubuntu 18.04. I'm deploying ubuntu 16.04 on vm created on kvm. There are 4 disks on vm, vda (boot disk)...vdd. At some time the disk partition fix messed up by application deployer, the vm failed to deploy.

Curtin debug log sections:
```
        Running command ['lsblk', '--noheadings', '--bytes', '--pairs', '--output=ALIGNMENT,DISC-ALN,DISC-GRAN,DISC-MAX,DISC-ZERO,FSTYPE,GROUP,KNAME,LABEL,LOG-SEC,MAJ:MIN,MIN-IO,MODE,MODEL,MOUNTPOINT,NAME,OPT-IO,OWNER,PHY-SEC,RM,RO,ROTA,RQ-SIZE,SIZE,STATE,TYPE,UUID'] with allowed return codes [0] (capture=True)

        Checking if /dev/vdc2 is a swap device

        finish: cmd-install/stage-partitioning/builtin/cmd-block-meta: FAIL: removing previous storage devices

        finish: cmd-install/stage-partitioning/builtin/cmd-block-meta: FAIL: curtin command block-meta

        Traceback (most recent call last):

          File "/curtin/curtin/commands/main.py", line 201, in main

            ret = args.func(args)

          File "/curtin/curtin/commands/block_meta.py", line 58, in block_meta

            meta_custom(args)

          File "/curtin/curtin/commands/block_meta.py", line 1471, in meta_custom

            clear_holders.clear_holders(disk_paths)

          File "/curtin/curtin/block/clear_holders.py", line 587, in clear_holders

            shutdown_function(dev_info['device'])

          File "/curtin/curtin/block/clear_holders.py", line 310, in wipe_superblock

            if is_swap_device(blockdev):

          File "/curtin/curtin/swap.py", line 108, in is_swap_device

            decode=False)

          File "/curtin/curtin/util.py", line 549, in load_file

            fp.seek(offset)

        OSError: [Errno 22] Invalid argument

        [Errno 22] Invalid argument

Stderr: ''

```

I got partition informations after using rescuing mode in MAAS:
```
$ sudo fdisk -l
Disk /dev/loop0: 158 MiB, 165711872 bytes, 323656 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/vda: 20 GiB, 21474836480 bytes, 41943040 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x4c8357c6

Device Boot Start End Sectors Size Id Type
/dev/vda1 2048 41943006 41940959 20G 83 Linux

Disk /dev/vdb: 100 GiB, 107374182400 bytes, 209715200 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 8F0B48D2-6AF7-472A-AB23-149308740E48

Device Start End Sectors Size Type
/dev/vdb1 2048 206847 204800 100M Ceph OSD
/dev/vdb2 206848 209715166 209508319 99.9G unknown

Disk /dev/vdc: 100 GiB, 107374182400 bytes, 209715200 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: BE4B2B10-EA65-4065-BFE6-8340F77B0374

Device Start End Sectors Size Type
/dev/vdc1 2048 20973567 20971520 10G unknown
/dev/vdc2 20973568 20973568 1 512B unknown
/dev/vdc3 20975616 41947135 20971520 10G unknown
/dev/vdc4 41947136 44044287 2097152 1G unknown
/dev/vdc5 44044288 44249087 204800 100M Ceph OSD
/dev/vdc6 44249088 209715166 165466079 78.9G unknown

Disk /dev/vdd: 100 GiB, 107374182400 bytes, 209715200 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: AFEA47AA-B4C4-44D3-8674-D84A53B104AB

Device Start End Sectors Size Type
/dev/vdd1 2048 20973567 20971520 10G unknown

```

After I manually deleted 6 partions on /dev/vdc, redeploy will success.

Related branches

Revision history for this message
Scott Moser (smoser) wrote :

There is a fix in the linked branch.
The bug was exposed because you had a partition of length 512.
Which is valid, just odd.

/dev/vdc2 20973568 20973568 1 512B unknown

Changed in curtin:
status: New → Confirmed
importance: Undecided → Medium
Revision history for this message
Jack Chen (scsvip) wrote :

@Scott Moser, Thanks for your quickly fix, we really appreciate it!
Learned something from your code and UT.

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

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

Changed in curtin:
status: Confirmed → Fix Committed
Revision history for this message
Ryan Harper (raharper) wrote : Fixed in curtin version 18.2.

This bug is believed to be fixed in curtin in version 18.2. 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.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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