edit mount failure on swap partition

Bug #2002413 reported by corrado venturini
202
This bug affects 44 people
Affects Status Importance Assigned to Milestone
subiquity
Fix Released
High
Olivier Gayot

Bug Description

new installer setting existing partition (already formatted as swap) for swap

ProblemType: Bug
DistroRelease: Ubuntu 23.04
Package: subiquity (unknown)
ProcVersionSignature: Ubuntu 5.19.0-21.21-generic 5.19.7
Uname: Linux 5.19.0-21-generic x86_64
NonfreeKernelModules: zfs zunicode zavl icp zcommon znvpair
ApportVersion: 2.24.0-0ubuntu1
Architecture: amd64
CasperMD5CheckResult: pass
CasperVersion: 1.477
CurtinAptConfig: /var/log/installer/subiquity-curtin-apt.conf
Date: Tue Jan 10 15:04:15 2023
ExecutablePath: /snap/ubuntu-desktop-installer/712/bin/subiquity/subiquity/cmd/server.py
InterpreterPath: /snap/ubuntu-desktop-installer/712/usr/bin/python3.8
LiveMediaBuild: Ubuntu 23.04 "Lunar Lobster" - Alpha amd64 (20230110)
MachineType: Gigabyte Technology Co., Ltd. H510M H
ProcAttrCurrent: snap.hostname-desktop-installer.subiquity-server (complain)
ProcCmdline: /snap/hostname-desktop-installer/712/usr/bin/python3.8 -m subiquity.cmd.server --use-os-prober --storage-version=2 --postinst-hooks-dir=/snap/hostname-desktop-installer/712/etc/subiquity/postinst.d --autoinstall=
ProcEnviron:
 LANG=C.UTF-8
 PATH=(custom, no user)
ProcKernelCmdLine: BOOT_IMAGE=/casper/vmlinuz layerfs-path=minimal.standard.live.squashfs maybe-ubiquity --- quiet splash
Python3Details: /usr/bin/python3.10, Python 3.10.9, python3-minimal, 3.10.6-1ubuntu1
PythonDetails: N/A
SnapChannel:

SnapRevision: 712
SnapUpdated: False
SnapVersion: 0+git.518d1ff6
SourcePackage: subiquity
Title: request to /storage/v2/edit_partition crashed with Exception
UpgradeStatus: No upgrade log present (probably fresh install)
dmi.bios.date: 03/25/2022
dmi.bios.release: 5.19
dmi.bios.vendor: American Megatrends International, LLC.
dmi.bios.version: F14
dmi.board.asset.tag: Default string
dmi.board.name: H510M H
dmi.board.vendor: Gigabyte Technology Co., Ltd.
dmi.board.version: x.x
dmi.chassis.asset.tag: Default string
dmi.chassis.type: 3
dmi.chassis.vendor: Default string
dmi.chassis.version: Default string
dmi.modalias: dmi:bvnAmericanMegatrendsInternational,LLC.:bvrF14:bd03/25/2022:br5.19:svnGigabyteTechnologyCo.,Ltd.:pnH510MH:pvr-CF:rvnGigabyteTechnologyCo.,Ltd.:rnH510MH:rvrx.x:cvnDefaultstring:ct3:cvrDefaultstring:skuDefaultstring:
dmi.product.family: H510 MB
dmi.product.name: H510M H
dmi.product.sku: Default string
dmi.product.version: -CF
dmi.sys.vendor: Gigabyte Technology Co., Ltd.

Revision history for this message
corrado venturini (corradoventu) wrote :
information type: Private → Public
Revision history for this message
Ubuntu QA Website (ubuntuqa) wrote :

This bug has been reported on the Ubuntu ISO testing tracker.

A list of all reports related to this bug can be found here:
https://iso.qa.ubuntu.com/qatracker/reports/bugs/2002413

tags: added: iso-testing
Revision history for this message
Olivier Gayot (ogayot) wrote :

From the logs, we see two distinct calls to ModifyPartitionV2 for the swap partition:

2023-01-10 15:03:47,890 DEBUG subiquity.server.controllers.filesystem:775 ModifyPartitionV2(disk_id='disk-sda', partition=Partition(size=8589934592, number=2, preserve=True, wipe=None, annotations=['existing', 'already formatted as swap', 'unused'], mount=None, format='swap', grub_device=False, boot=False, os=None, offset=269484032, estimated_min_size=1048576, resize=None, path='/dev/sda2'))

2023-01-10 15:04:15,912 DEBUG subiquity.server.controllers.filesystem:775 ModifyPartitionV2(disk_id='disk-sda', partition=Partition(size=8589934592, number=2, preserve=True, wipe=None, annotations=['existing', 'already formatted as swap', 'used'], mount='', format='swap', grub_device=False, boot=False, os=None, offset=269484032, estimated_min_size=1048576, resize=None, path='/dev/sda2'))

The value of the mount argument changes from mount=None to mount='' but I was able to reproduce the exception with two calls with mount=None so it is not the root cause of the error.

For normal filesystems, we create the "mount" as part of the FilesystemManipulator.create_mount() method. There is a guard clause that returns immediately if the mount parameter is None.

https://github.com/canonical/subiquity/blob/d3099728eaa17247c02bfbf3935970669f7d0521/subiquity/common/filesystem/manipulator.py#L32
    def create_mount(self, fs, spec):
        if spec.get('mount') is None:
            return
        mount = self.model.add_mount(fs, spec['mount'])

That said, for the swap, we create the mount one level higher, where the guard clause does not look for the mount parameter:

https://github.com/canonical/subiquity/blob/d3099728eaa17247c02bfbf3935970669f7d0521/subiquity/common/filesystem/manipulator.py#L69
        if spec.get('fstype') == "swap":
            self.model.add_mount(fs, "")
        if spec.get('fstype') is None and spec.get('use_swap'):
            self.model.add_mount(fs, "")
        self.create_mount(fs, spec)

I believe this inconsistency is what causes the exception. I'm not sure what's the right way to fix it though.

Revision history for this message
corrado venturini (corradoventu) wrote : Re: [Bug 2002413] Re: request to /storage/v2/edit_partition crashed with Exception

Yes, iI think I changed from mount none to mount yes.
thjanks

Corrado Venturini

Il giorno lun 16 gen 2023 alle ore 11:30 Olivier Gayot <
<email address hidden>> ha scritto:

> From the logs, we see two distinct calls to ModifyPartitionV2 for the
> swap partition:
>
> 2023-01-10 15:03:47,890 DEBUG
> subiquity.server.controllers.filesystem:775
> ModifyPartitionV2(disk_id='disk-sda',
> partition=Partition(size=8589934592, number=2, preserve=True, wipe=None,
> annotations=['existing', 'already formatted as swap', 'unused'],
> mount=None, format='swap', grub_device=False, boot=False, os=None,
> offset=269484032, estimated_min_size=1048576, resize=None,
> path='/dev/sda2'))
>
> 2023-01-10 15:04:15,912 DEBUG
> subiquity.server.controllers.filesystem:775
> ModifyPartitionV2(disk_id='disk-sda',
> partition=Partition(size=8589934592, number=2, preserve=True, wipe=None,
> annotations=['existing', 'already formatted as swap', 'used'], mount='',
> format='swap', grub_device=False, boot=False, os=None, offset=269484032,
> estimated_min_size=1048576, resize=None, path='/dev/sda2'))
>
> The value of the mount argument changes from mount=None to mount='' but
> I was able to reproduce the exception with two calls with mount=None so
> it is not the root cause of the error.
>
> For normal filesystems, we create the "mount" as part of the
> FilesystemManipulator.create_mount() method. There is a guard clause
> that returns immediately if the mount parameter is None.
>
>
> https://github.com/canonical/subiquity/blob/d3099728eaa17247c02bfbf3935970669f7d0521/subiquity/common/filesystem/manipulator.py#L32
> def create_mount(self, fs, spec):
> if spec.get('mount') is None:
> return
> mount = self.model.add_mount(fs, spec['mount'])
>
> That said, for the swap, we create the mount one level higher, where the
> guard clause does not look for the mount parameter:
>
>
> https://github.com/canonical/subiquity/blob/d3099728eaa17247c02bfbf3935970669f7d0521/subiquity/common/filesystem/manipulator.py#L69
> if spec.get('fstype') == "swap":
> self.model.add_mount(fs, "")
> if spec.get('fstype') is None and spec.get('use_swap'):
> self.model.add_mount(fs, "")
> self.create_mount(fs, spec)
>
> I believe this inconsistency is what causes the exception. I'm not sure
> what's the right way to fix it though.
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/2002413
>
> Title:
> request to /storage/v2/edit_partition crashed with Exception
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/subiquity/+bug/2002413/+subscriptions
>
>

Dan Bungert (dbungert)
Changed in subiquity:
status: New → Confirmed
importance: Undecided → High
Dan Bungert (dbungert)
summary: - request to /storage/v2/edit_partition crashed with Exception
+ edit mount failure on swap partition
Revision history for this message
Olivier Gayot (ogayot) wrote :
Changed in subiquity:
assignee: nobody → Olivier Gayot (ogayot)
Dan Bungert (dbungert)
Changed in subiquity:
status: Confirmed → In Progress
Revision history for this message
Dan Bungert (dbungert) wrote :

We believe this issue has been resolved in Subiquity 23.04.2.

If you had tested this with a pre-final version of Ubuntu 23.04, it's
recommended to download the final install media.

For testing with Ubuntu Server 22.04.x or 20.04.x, when running
Subiquity, you should offered a new version of the installer. Please
take that update to version 23.04.2 or later to get the fix.

If this is still a problem for you, please make a comment and set the state
back to New. Thank you for the bug report.

Changed in subiquity:
status: In Progress → Fix Released
Revision history for this message
Salvador Serrano (invisiblesalvador) wrote :

okay im pretty new to this i did add this to my usb and decied to give it a try i did have debian 11 for a few days and i saw this new os, so i installed and deleted the swap partition there for i dont know.

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.