Bug 416967 - KDE Partition manager fails to format USB with ntfs
Summary: KDE Partition manager fails to format USB with ntfs
Status: CONFIRMED
Alias: None
Product: partitionmanager
Classification: Applications
Component: general (show other bugs)
Version: 4.0.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Andrius Štikonas
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-01-30 23:22 UTC by Josh Freeno
Modified: 2023-02-28 16:06 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Screenshot of error (320.04 KB, image/png)
2020-01-30 23:22 UTC, Josh Freeno
Details
KPM 4.1 (140.00 KB, image/png)
2020-02-28 20:56 UTC, Patrick Silva
Details
no device detected (42.67 KB, image/png)
2020-02-28 22:11 UTC, Patrick Silva
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Josh Freeno 2020-01-30 23:22:14 UTC
Created attachment 125561 [details]
Screenshot of error

SUMMARY
NTFS format fails


STEPS TO REPRODUCE
1. Open KDE Partition manager
2. Try to format USB with ntfs
3. 

OBSERVED RESULT
It fails with errors

EXPECTED RESULT
Format USB with ntfs without errors

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 5.17.5
KDE Frameworks Version: 5.66.0
Qt Version: 5.14.1
Kernel Version: 5.4.15-arch1-1
OS Type: 64-bit
Processors: 12 × Intel® Core™ i7-9750H CPU @ 2.60GHz
Memory: 15.4 GiB of RAM


ADDITIONAL INFORMATION
Comment 1 Andrius Štikonas 2020-01-30 23:27:15 UTC
What are the errors?

Does "mkfs.ntfs --quick --verbose deviceNode" work?
Comment 2 Josh Freeno 2020-01-30 23:31:54 UTC
(In reply to Andrius Štikonas from comment #1)
> What are the errors?
> 
> Does "mkfs.ntfs --quick --verbose deviceNode" work?

Screenshot is of what is does every time and I tried this three or four times but I finally just put into my windows PC and formatted it so I did not try to manually do it. I have package ntfs-3g installed too.
Comment 3 Andrius Štikonas 2020-01-30 23:41:33 UTC
Unfortunately, without more info, I won't be able to do anything.
I just tried with my USB, it works fine.

My theory (although I have no strong proof) is that for some reason your Linux kernel marked USB as read only... Note that error happened immediately (in 0 seconds). In that case there is nothing KDE Partition Manager can do...
Comment 4 Josh Freeno 2020-01-31 00:41:31 UTC
(In reply to Andrius Štikonas from comment #3)
> Unfortunately, without more info, I won't be able to do anything.
> I just tried with my USB, it works fine.
> 
> My theory (although I have no strong proof) is that for some reason your
> Linux kernel marked USB as read only... Note that error happened immediately
> (in 0 seconds). In that case there is nothing KDE Partition Manager can do...

What more info do you need or want and I will get to you as soon as possible. Unless the partition manager is marking it read only then I can tell you that is not the problem.
Comment 5 Andrius Štikonas 2020-01-31 00:54:02 UTC
(In reply to Josh Freeno from comment #4)
> (In reply to Andrius Štikonas from comment #3)
> > Unfortunately, without more info, I won't be able to do anything.
> > I just tried with my USB, it works fine.
> > 
> > My theory (although I have no strong proof) is that for some reason your
> > Linux kernel marked USB as read only... Note that error happened immediately
> > (in 0 seconds). In that case there is nothing KDE Partition Manager can do...
> 
> What more info do you need or want and I will get to you as soon as
> possible. Unless the partition manager is marking it read only then I can
> tell you that is not the problem.

If you can, try to format the same USB again and see if you can still reproduce this.

If yes, try to see more logs by clicking Details button.

Running "cat /sys/block/sdb/ro" might tell you if device is read only.
Running "dmesg" in terminal might also give some clues.

ntfs-3g is needed but I think in this case error happens much earlier. You can't even create partition (formatting partition happens after first creating unformatted partition).
Comment 6 Josh Freeno 2020-01-31 03:51:08 UTC
(In reply to Andrius Štikonas from comment #5)
> (In reply to Josh Freeno from comment #4)
> > (In reply to Andrius Štikonas from comment #3)
> > > Unfortunately, without more info, I won't be able to do anything.
> > > I just tried with my USB, it works fine.
> > > 
> > > My theory (although I have no strong proof) is that for some reason your
> > > Linux kernel marked USB as read only... Note that error happened immediately
> > > (in 0 seconds). In that case there is nothing KDE Partition Manager can do...
> > 
> > What more info do you need or want and I will get to you as soon as
> > possible. Unless the partition manager is marking it read only then I can
> > tell you that is not the problem.
> 
> If you can, try to format the same USB again and see if you can still
> reproduce this.
> 
> If yes, try to see more logs by clicking Details button.
> 
> Running "cat /sys/block/sdb/ro" might tell you if device is read only.
> Running "dmesg" in terminal might also give some clues.
> 
> ntfs-3g is needed but I think in this case error happens much earlier. You
> can't even create partition (formatting partition happens after first
> creating unformatted partition).

I will look for logs although it happened three or four times on same USB. The very same USB I have formatted with windows to go on it now. I will look though and post here anything I find.
Comment 7 Bug Janitor Service 2020-02-15 04:33:21 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 8 Patrick Silva 2020-02-28 20:56:27 UTC
Created attachment 126485 [details]
KPM 4.1

Same problem with KDE Partition Manager 4.1.
My pen drive was formatted with fat32 file system, I opened KPM and deleted fat32 partition, tried to create another one (but ntfs) labeled "PENDRIVE" and got the error shown in my screenshot. Tried again to create a ntfs partition with and without label and also got failures. I even disconnected the device from usb port and connected it again but KPM failed to create a ntfs partition again. Then I tried to format my device with fat32 and KPM failed again. Then I tried Gparted and it formatted the same device with ntfs file system without any problem.
Comment 9 Patrick Silva 2020-02-28 20:58:21 UTC
Operating System: Arch Linux 
KDE Plasma Version: 5.18.2
KDE Frameworks Version: 5.67.0
Qt Version: 5.14.1
Kernel Version: 5.4.22-1-lts
Comment 10 Andrius Štikonas 2020-02-28 21:06:08 UTC
(In reply to Patrick Silva from comment #9)
> Operating System: Arch Linux 
> KDE Plasma Version: 5.18.2
> KDE Frameworks Version: 5.67.0
> Qt Version: 5.14.1
> Kernel Version: 5.4.22-1-lts

Would you be able to test with this patch?

https://github.com/calamares/calamares/issues/1332#issuecomment-592721828
Comment 11 Patrick Silva 2020-02-28 22:11:17 UTC
Created attachment 126488 [details]
no device detected

I have applied your patch, but apparently I did something wrong.
Now KPM does not detect any device.
I tried to rebuild KPM and got errors:

CMake Error at CMakeLists.txt:88 (find_package):
  Could not find a configuration file for package "KPMcore" that is
  compatible with requested version "4.1.0".

  The following configuration files were considered but not accepted:

    /usr/lib64/cmake/KPMcore/KPMcoreConfig.cmake, version: 4.0.1
    /usr/lib/cmake/KPMcore/KPMcoreConfig.cmake, version: 4.0.1
    /lib64/cmake/KPMcore/KPMcoreConfig.cmake, version: 4.0.1
    /lib/cmake/KPMcore/KPMcoreConfig.cmake, version: 4.0.1



-- Configuring incomplete, errors occurred!
Comment 12 Andrius Štikonas 2020-02-28 22:17:07 UTC
(In reply to Patrick Silva from comment #11)
> Created attachment 126488 [details]
> no device detected
> 
> I have applied your patch, but apparently I did something wrong.
> Now KPM does not detect any device.
> I tried to rebuild KPM and got errors:
> 
> CMake Error at CMakeLists.txt:88 (find_package):
>   Could not find a configuration file for package "KPMcore" that is
>   compatible with requested version "4.1.0".
> 
>   The following configuration files were considered but not accepted:
> 
>     /usr/lib64/cmake/KPMcore/KPMcoreConfig.cmake, version: 4.0.1
>     /usr/lib/cmake/KPMcore/KPMcoreConfig.cmake, version: 4.0.1
>     /lib64/cmake/KPMcore/KPMcoreConfig.cmake, version: 4.0.1
>     /lib/cmake/KPMcore/KPMcoreConfig.cmake, version: 4.0.1
> 
> 
> 
> -- Configuring incomplete, errors occurred!

Did you install kpcore 4.1.0 to /usr? It looks like you are trying to compile KDE Partition Manager 4.1 with KPMcore 4.0.
Comment 13 Patrick Silva 2020-02-28 22:36:53 UTC
(In reply to Andrius Štikonas from comment #12)
> Did you install kpcore 4.1.0 to /usr? It looks like you are trying to
> compile KDE Partition Manager 4.1 with KPMcore 4.0.
Yes.
I built remotes/origin/4.0 branch of kpmcore with your patch, then I tried to build master branch of KPM. "git branch -a" shows that there is no branch 4.0 of KPM.

$ git branch -a
* master
  remotes/origin/1.0
  remotes/origin/1.1
  remotes/origin/2.0
  remotes/origin/3.2
  remotes/origin/3.3
  remotes/origin/HEAD -> origin/master
  remotes/origin/master
  remotes/origin/raid-support
Comment 14 Patrick Silva 2020-02-28 23:04:01 UTC
Ok, I have just built master branch of both kpmcore (with your patch) and KPM.
KPM can not create a ntfs partition yet.
Comment 15 Andrius Štikonas 2020-02-29 00:07:33 UTC
(In reply to Patrick Silva from comment #14)
> Ok, I have just built master branch of both kpmcore (with your patch) and
> KPM.
> KPM can not create a ntfs partition yet.

Can you try to use sfdisk manually. Let's see if error is more useful (strangely I don't see any sfdisk output...)

Try running (on empty usb stick, this is destructive operation)

sudo sfdisk --force --append /dev/sdd

Then type start=2048
Press Ctrl+D to write partition table.
Comment 16 Patrick Silva 2020-02-29 15:36:35 UTC
here is the output of your commands:

$ sudo sfdisk --force --append /dev/sdd
[sudo] password for myusername: 

Welcome to sfdisk (util-linux 2.35.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Checking that no-one is using this disk right now ... OK

Disk /dev/sdd: 7.47 GiB, 8004304896 bytes, 15633408 sectors
Disk model: Cruzer Blade    
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: 0x04e9854c

Old situation:

Type 'help' to get more information.

/dev/sdd2: start=2048
Created a new partition 1 of type 'Linux' and of size 7.5 GiB.
   /dev/sdd1 :         2048     15633407 (7.5G) Linux
/dev/sdd2: Done.

New situation:
Disklabel type: dos
Disk identifier: 0x04e9854c

Device     Boot Start      End  Sectors  Size Id Type
/dev/sdd1        2048 15633407 15631360  7.5G 83 Linux

Do you want to write this to disk? [Y]es/[N]o: Y

The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
Comment 17 Bug Janitor Service 2020-03-15 04:33:10 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 18 Patrick Silva 2020-03-15 09:19:07 UTC
Requested info was provided.
Comment 19 Hannus 2020-03-27 18:54:02 UTC
I had the same problem. Can you try to leave 1 mb empty before the new partition? That seems to be the trick for partitionmanager to not give an error when creating a new partition.
See also https://askubuntu.com/questions/948837/why-does-gparted-force-1mb-free-space-preceeding.
I don't know why partitionmanager doesn't do this automatically.
Comment 20 Andrius Štikonas 2020-03-27 19:03:33 UTC
(In reply to Hannus from comment #19)
> I had the same problem. Can you try to leave 1 mb empty before the new
> partition? That seems to be the trick for partitionmanager to not give an
> error when creating a new partition.
> See also
> https://askubuntu.com/questions/948837/why-does-gparted-force-1mb-free-space-
> preceeding.
> I don't know why partitionmanager doesn't do this automatically.

I think it does. There is an option in settings which says align partitions along MB boundaries. I think it is enabled by default.
Comment 21 nilsocket 2020-06-17 16:54:13 UTC
I can confirm the same, I was unable to create new partition with format NTFS.

Align partitions per default is already set, but doesn't work.
i.e., it isn't living 1 MiB space before, after I have done it manually, it is able to create the partition.

Thank you.
Comment 22 nilsocket 2020-06-17 16:54:49 UTC
Forgot to add System Info:

Operating System: Arch Linux
KDE Plasma Version: 5.19.1
KDE Frameworks Version: 5.71.0
Qt Version: 5.15.0
Kernel Version: 5.7.2-arch1-1
OS Type: 64-bit
Processors: 8 × Intel® Core™ i7-8550U CPU @ 1.80GHz
Memory: 15.5 GiB of RAM
Graphics Processor: Mesa Intel® UHD Graphics 620