Bug 412204 - impossible to create and format partitions after an ext4 partition to be deleted
Summary: impossible to create and format partitions after an ext4 partition to be deleted
Status: REPORTED
Alias: None
Product: partitionmanager
Classification: Applications
Component: general (show other bugs)
Version: 4.0.0
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Andrius Štikonas
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-09-22 16:20 UTC by Patrick Silva
Modified: 2024-07-09 11:49 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
cannot create and format ext4 partition (225.00 KB, image/png)
2019-09-22 16:20 UTC, Patrick Silva
Details
cannot create and format logical nfts partition (664.18 KB, image/png)
2019-09-22 16:20 UTC, Patrick Silva
Details
speculative patch (1004 bytes, patch)
2019-09-22 18:27 UTC, Andrius Štikonas
Details
partition manager can not delete "unknown" partition (249.11 KB, image/png)
2019-09-25 00:37 UTC, Patrick Silva
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick Silva 2019-09-22 16:20:07 UTC
Created attachment 122802 [details]
cannot create and format ext4 partition

SUMMARY
My hard disk had 4 partitions, I deleted the last of them (ext4), tried to create an extended partition with a logical ntfs partition in the unallocated area, partition manager failed and shown an error message.
Partition manager also failed to create and format another ext4 partition after I delete the first one.
See the attached screenshots.


STEPS TO REPRODUCE
0. open kde partition manager
1. delete an ext4 partition (now the device has unallocated space)
2a. right click on "Unllocated" space, select "New", select "primary" radio button, set ext4 file system, click "Ok" button, click "Apply" button
OR
2b. right click on "Unllocated" space, select "extended" radio button, click "OK" button,
right click on "unallocated" area under "Extended", select "New", select "ntfs" file system,
click "Ok" button, click "Apply" button

OBSERVED RESULT
partition manager fails to create and format the ext4 and the logical ntfs partitions

EXPECTED RESULT
partition manager creates and formats partitions without errors

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 5.16.90
KDE Frameworks Version: 5.62.0
Qt Version: 5.13.1
Comment 1 Patrick Silva 2019-09-22 16:20:40 UTC
Created attachment 122803 [details]
cannot create and format logical nfts partition
Comment 2 Andrius Štikonas 2019-09-22 17:03:47 UTC
It works for me here.

How reproducible is this on your machine?

I think there might be a race in SfdiskPartitionTable::commit. mkfs tries to run before block device is available.
Possibly adding another

ExternalCommand(QStringLiteral("udevadm"), { QStringLiteral("settle"), QStringLiteral("--timeout=") + QString::number(timeout) }).run();
    
before return would fix this.

Is there any chance for you to try this fix?
Comment 3 Patrick Silva 2019-09-22 17:10:04 UTC
This problem is always reproducible here.

If you give me detailed instructions, I can try your fix.
Comment 4 Andrius Štikonas 2019-09-22 18:27:19 UTC
Created attachment 122805 [details]
speculative patch

Can you try to recompile kpmcore with this patch?
Comment 5 Andrius Štikonas 2019-09-22 18:30:00 UTC
(In reply to Patrick Silva from comment #3)
> This problem is always reproducible here.
> 
> If you give me detailed instructions, I can try your fix.

By the way, how detailed instruction do you need?

Basically in kpmcore dir apply patch with

patch -p1 < patch_name.patch
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=/usr
make
sudo make install
Comment 6 Patrick Silva 2019-09-24 13:40:57 UTC
(In reply to Andrius Štikonas from comment #5)
> (In reply to Patrick Silva from comment #3)
> > This problem is always reproducible here.
> > 
> > If you give me detailed instructions, I can try your fix.
> 
> By the way, how detailed instruction do you need?
> 
> Basically in kpmcore dir apply patch with
> 
> patch -p1 < patch_name.patch
> mkdir build
> cd build
> cmake .. -DCMAKE_INSTALL_PREFIX=/usr
> make
> sudo make install

building was successful, but kpmcore can not be installed:
Compiling... succeeded (after 2 minutes, and 51 seconds)
        Installing.. failed (after 0 seconds)
        Unable to install kpmcore!

 

<<<  PACKAGES FAILED TO BUILD  >>>
kpmcore - ~/kde/src/log/2019-09-24-01/kpmcore/install.log
:-(

and when I run "patch -p1 < bug412204.patch" in kpmcore directory, I get a "File to patch:" prompt.
Comment 7 Patrick Silva 2019-09-24 14:13:20 UTC
building log

# kdesrc-build running: 'make' 'install/fast'
# from directory: /home/mysusername/kde/build/kpmcore
Install the project...
-- Install configuration: "RelWithDebInfo"
-- Installing: /home/mysusername/kde/usr/lib/cmake/KPMcore/KPMcoreConfig.cmake
-- Installing: /home/mysusername/kde/usr/lib/cmake/KPMcore/KPMcoreConfigVersion.cmake
-- Installing: /home/mysusername/kde/usr/lib/cmake/KPMcore/KPMcoreTargets.cmake
-- Installing: /home/mysusername/kde/usr/lib/cmake/KPMcore/KPMcoreTargets-relwithdebinfo.cmake
-- Installing: /home/mysusername/kde/usr/lib/kauth/kpmcore_externalcommand
-- Installing: /home/mysusername/kde/usr/share/dbus-1/system.d/org.kde.kpmcore.helperinterface.conf
-- Installing: /home/mysusername/kde/usr/share/dbus-1/system.d/org.kde.kpmcore.applicationinterface.conf
-- Installing: /home/mysusername/kde/usr/share/dbus-1/system.d/org.kde.kpmcore.externalcommand.conf
-- Installing: /home/mysusername/kde/usr/share/dbus-1/system-services/org.kde.kpmcore.externalcommand.service
-- Installing: /usr/share/polkit-1/actions/org.kde.kpmcore.externalcommand.policy
CMake Error at src/cmake_install.cmake:75 (file):
  file INSTALL cannot copy file
  "/home/mysusername/kde/build/kpmcore/src/org.kde.kpmcore.externalcommand.policy"
  to "/usr/share/polkit-1/actions/org.kde.kpmcore.externalcommand.policy".
Call Stack (most recent call first):
  cmake_install.cmake:68 (include)


make: *** [Makefile:135: install/fast] Error 1
Comment 8 Andrius Štikonas 2019-09-24 20:50:47 UTC
(In reply to Patrick Silva from comment #6)
> (In reply to Andrius Štikonas from comment #5)
> > (In reply to Patrick Silva from comment #3)
> > > This problem is always reproducible here.
> > > 
> > > If you give me detailed instructions, I can try your fix.
> > 
> > By the way, how detailed instruction do you need?
> > 
> > Basically in kpmcore dir apply patch with
> > 
> > patch -p1 < patch_name.patch
> > mkdir build
> > cd build
> > cmake .. -DCMAKE_INSTALL_PREFIX=/usr
> > make
> > sudo make install
> 
> building was successful, but kpmcore can not be installed:
> Compiling... succeeded (after 2 minutes, and 51 seconds)
>         Installing.. failed (after 0 seconds)
>         Unable to install kpmcore!
> 
>  
> 
> <<<  PACKAGES FAILED TO BUILD  >>>
> kpmcore - ~/kde/src/log/2019-09-24-01/kpmcore/install.log
> :-(
> 
> and when I run "patch -p1 < bug412204.patch" in kpmcore directory, I get a
> "File to patch:" prompt.

What about "git apply bug412204.patch" ?

I don't use kdesrc-build, so I'm not the best person to advise on that. You can try asking somebody else. Alternatively, you can just copy
libpmsfdiskbackendplugin.so from build tree to your install folder (on my distro it is /usr/lib64/qt5/plugins/libpmsfdiskbackendplugin.so)
Comment 9 Patrick Silva 2019-09-25 00:37:44 UTC
Created attachment 122848 [details]
partition manager can not delete "unknown" partition

I changed my partitioning scheme since I opened this report.
Today I reverted such changes to try your patch and try to reproduce the problem reported here.
I tried your patch, apparently it solved the problem after the step 2a, but partition formatting was still failling after the step 2b.
And partition manager failed to delete the "unknown" partition created in the step 2b.
I reinstalled kmpcore package from Arch repos and got the same results.
Comment 10 Andrius Štikonas 2019-09-25 20:52:32 UTC
(In reply to Patrick Silva from comment #9)
> Created attachment 122848 [details]
> partition manager can not delete "unknown" partition
> 
> I changed my partitioning scheme since I opened this report.
> Today I reverted such changes to try your patch and try to reproduce the
> problem reported here.
> I tried your patch, apparently it solved the problem after the step 2a, but
> partition formatting was still failling after the step 2b.
> And partition manager failed to delete the "unknown" partition created in
> the step 2b.
> I reinstalled kmpcore package from Arch repos and got the same results.

ok, so the patch is at least partially helpful. So probably worth pushing.

I guess there are two different problems here then.
Comment 11 Andrius Štikonas 2019-09-25 21:34:36 UTC
Git commit 467ea50aeb73b975d87a2c9107a04ac21033b048 by Andrius Štikonas.
Committed on 25/09/2019 at 21:33.
Pushed by stikonas into branch 'master'.

Run udevadm settle once more after udevadm trigger.

M  +1    -0    src/plugins/sfdisk/sfdiskpartitiontable.cpp

https://invent.kde.org/kde/kpmcore/commit/467ea50aeb73b975d87a2c9107a04ac21033b048
Comment 12 Andrius Štikonas 2019-10-05 11:19:03 UTC
Git commit 6f17476b75185886f57e340bbfb1912b2b62c42e by Andrius Štikonas.
Committed on 05/10/2019 at 11:03.
Pushed by stikonas into branch '4.0'.

Run udevadm settle once more after udevadm trigger.

M  +1    -0    src/plugins/sfdisk/sfdiskpartitiontable.cpp

https://invent.kde.org/kde/kpmcore/commit/6f17476b75185886f57e340bbfb1912b2b62c42e