2

I have a 2TB external drive with an NTFS partition. If I connect it to my main desktop, it mounts fine in Dolphin - I just click the drive when it appears on the sidebar, and I can see all the files, navigate, work with them etc. This computer is running Kubuntu 22.04, and it might be useful to know that it was the first computer I used this drive with.

When I connect the drive to a laptop, running a newly-installed Kubuntu 23.10, the drive appears, but clicking it on Dolphin's sidebar gives me an error message:

Error mounting /dev/sdb1: GDBus.Error:org.freedesktop.UDisks2.Error.Failed: Error mounting /dev/sdb1 at /media/root/TOSHIBA EXT: wrong fs type, bad option, bad superblock on /dev/sdb1, missing codepage or helper program, or other error

I was scared of disk/partition failure, but it's a brand new external drive; I took it back to the desktop machine and it operated just fine.

I then took it back to the laptop and tried mounting it with udiskctl, it not only didn't work but gave me the same error message - so I know Dolphin is probably using it as a backend, which means it's not a KDE problem but a udisks or permissions problem.

Finally I used a simple mount command. Terminal told me I had to be root. I then ran

sudo mount /dev/sdb1 /media/mountpoint

and it worked fine! I could even operate the files inside without any complaints regarding permissions.

I tested the external HD in another laptop, also running 23.10 (although this is an upgraded system). I got the same error, and the same solution applied.

I searched Google and AskUbuntu for an answer. The closest scenario I found gave me some ideas; I tried:

  • deleting /media/"username" so the system could create it anew;
  • chowning /media/"username" to username:username and later username:root; and
  • chowning /media to username:username and later username:root.

Nothing worked, and I returned /media to full root ownership, deleting the username's folder inside (it has since been recreated by a new attempt to mount the drive, which failed as per the error message above. It's always the same error message).

Notice that when I mounted it with 'sudo mount' Dolphin turns the drive's sidebar entry into the mounted kind, where I can see its free space, etc. - and it allows me to unmount the drive graphically, but it asks for my password. Even though it wouldn't be optimal behaviour, I don't understand why it couldn't ask for my password to mount the damn thing in the first place...

I am aware I could add the partition's UUID to fstab in both laptops, but this wouldn't really solve the issue - this is not supposed to happen! Besides, I'm tidying up the first laptop for a person who's not going to mess with the terminal in case she's unable to plug in e.g. a friend's external drive.

I should also add that fat32 pen drives don't present a similar issue, they mount just fine.

Thanks in advance!

1 Answers1

4

I asked this question in another forum (in a different language) and over there they put me in the right path. I'm going to describe the path in question so that other people facing something similar may know whether this solution would work for them or not.

Apparently in 2021 there was a whole thing that required a change to the file /etc/udisks2/mount_options.conf (which by default I don't think exists in a newly-installed Ubuntu; I had to create it). It should be populated with:

[defaults]
ntfs_defaults=uid=$UID,gid=$GID

This (and variations, such as a backslash before the $s and a "ntfs:" opening the line) did not work.

But wait: I realised this tip was from 2021. My 22.04 Dolphin was mounting the HD just fine; it should also be affected by the bug but isn't. How? Then I found a complaint by someone somewhere in 2021 or 2022 that Ubuntu was still using ntfs-3g despite the availability of ntfs3 in its kernel. This led me to search for ways to force the 23.10 udisks to use ntfs-3g, which I presumed (but never found out if it was actually the case) my 22.04 machine was doing. Apparently I only had to remove the ntfs3 module from the kernel so that the alternative (ntfs-3g) would be used.

But I never got to do any of that, as I found something else.

Somebody in the udisks github was complaining that ntfs3, unlike ntfs-3g, refuses to mount any partition flagged as damaged, even if it obviously isn't (seeing as ntfs-3g was able to handle it normally). The solution was simple: running

ntfsfix -d

on the affected partition (as root / with sudo)

I did and it worked! Now both laptops running Kubuntu 23.10 mount the HD in Dolphin perfectly.

I didn't check if KDE's Partition Manager can do it, but if anyone's suffering from this in Ubuntu/Gnome, I know Gnome Disks has a menu option to repair a partition, which in the case of ntfs ones I guess it does the same thing. It worked for this person here in AskUbuntu, a post that I missed because it was about a pen drive.

Here's what I take away from this:

  1. I didn't check the filesystem because it was working so well in another linux machine, but I guess one shouldn't count on that. The partition might still be marked as damaged and ntfs3 will not mount it... Or, well, udisks won't, as the mount command worked fine.
  2. I was also only confident enough to use ntfsfix because I knew the partition was good, so I didn't feel there was any serious risk of data loss.
  3. Hence this is still kind of an issue; this laptop will be used by a layperson and if they try to access an actually damaged ntfs filesystem (say, a friend's or a coworker's) I will NOT tell them to try to fix it to mount it. But I guess that's for the best...