Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid path: The drive name does not exist for ZFS filesystem #4251

Open
1 task done
SinisterCrayon opened this issue Nov 6, 2024 · 27 comments
Open
1 task done

Invalid path: The drive name does not exist for ZFS filesystem #4251

SinisterCrayon opened this issue Nov 6, 2024 · 27 comments
Labels
Bug Something is not working as intended Core (ckan.dll) Issues affecting the core part of CKAN Linux Issues specific for Linux Mono Issues specific for Mono

Comments

@SinisterCrayon
Copy link

Is there an existing issue for this?

  • I have checked the existing issues for an existing issue. I even actually looked at the ones that are pinned to the top!

Operating System

Ubuntu 22.04

CKAN Version

1.35.2+24280

Games

KSP 1

Game Version

1.12.5.3190

Did you make any manual changes to your game folder (i.e., not via CKAN)?

No response

Describe the bug

Installed CKAN from DEB. Made sure all dependencies (mono) were installed and working as expected. However, will not run properly.

Steps to reproduce

Launched CKAN and it appears to start normally. I can select mods and go to the download screen after clicking "Apply". At that point top menu items are grayed out and the three buttons Back / Clear / Apply are clickable. However, clicking "Apply" does nothing at all. Clicking "Back" returns me to the mod list but the top menus remain blank and I can't exit CKAN without killing the process. Clicking "Clear" works some of the time and some of the time it covers the app with a red X and I again have to kill the process.

Tried executing "mono ckan.exe" within installation folder but it makes no difference.

ckan consoleui also does not work. Hit "+" to install the mod and then nothing. Mod pops to the top of the list. I never get the option to download.

Mono is version 6.8.0.105

Relevant log output

No response

@HebaruSan

This comment was marked as resolved.

@HebaruSan HebaruSan added Support Issues that are support requests Linux Issues specific for Linux labels Nov 6, 2024
@netkan-bot

This comment was marked as outdated.

@netkan-bot netkan-bot closed this as not planned Won't fix, can't repro, duplicate, stale Nov 14, 2024
@SinisterCrayon
Copy link
Author

SinisterCrayon commented Nov 30, 2024

Screenshot from 2024-11-30 11-29-17

I clicked "Update All" and then the "Apply" button from the top

Screenshot from 2024-11-30 11-29-59

From the second screen, the "Apply" button in the bottom right does nothing. The back button will take me back.

Pressing the clear button results in

Screenshot from 2024-11-30 11-31-35

Since I executed this from the command line, this is what comes up on the CLI after the crash;

System.ArgumentOutOfRangeException: ControlCollection does not have that many controls
Parameter name: index
Actual value was 1.
  at System.Windows.Forms.Control+ControlCollection.get_Item (System.Int32 index) [0x0002d] in <a3daa9b84fd241a497578a25f68bc3c7>:0 
  at System.Windows.Forms.TabControl.GetTab (System.Int32 index) [0x00006] in <a3daa9b84fd241a497578a25f68bc3c7>:0 
  at (wrapper remoting-invoke-with-check) System.Windows.Forms.TabControl.GetTab(int)
  at System.Windows.Forms.TabControl+TabPageCollection.get_Item (System.Int32 index) [0x00000] in <a3daa9b84fd241a497578a25f68bc3c7>:0 
  at System.Windows.Forms.TabControl.get_SelectedTab () [0x0000e] in <a3daa9b84fd241a497578a25f68bc3c7>:0 
  at System.Windows.Forms.TabControl.OnEnter (System.EventArgs e) [0x00007] in <a3daa9b84fd241a497578a25f68bc3c7>:0 
  at System.Windows.Forms.Control.FireEnter () [0x00000] in <a3daa9b84fd241a497578a25f68bc3c7>:0 
  at System.Windows.Forms.ContainerControl.set_ActiveControl (System.Windows.Forms.Control value) [0x001cf] in <a3daa9b84fd241a497578a25f68bc3c7>:0 
  at System.Windows.Forms.Control.Select (System.Boolean directed, System.Boolean forward) [0x00019] in <a3daa9b84fd241a497578a25f68bc3c7>:0 
  at System.Windows.Forms.Control.SelectNextControl (System.Windows.Forms.Control ctl, System.Boolean forward, System.Boolean tabStopOnly, System.Boolean nested, System.Boolean wrap) [0x00076] in <a3daa9b84fd241a497578a25f68bc3c7>:0 
  at System.Windows.Forms.ContainerControl.ChildControlRemoved (System.Windows.Forms.Control control) [0x00054] in <a3daa9b84fd241a497578a25f68bc3c7>:0 
  at (wrapper remoting-invoke-with-check) System.Windows.Forms.ContainerControl.ChildControlRemoved(System.Windows.Forms.Control)
  at System.Windows.Forms.Control+ControlCollection.Remove (System.Windows.Forms.Control value) [0x00071] in <a3daa9b84fd241a497578a25f68bc3c7>:0 
  at System.Windows.Forms.TabControl+ControlCollection.Remove (System.Windows.Forms.Control value) [0x0005d] in <a3daa9b84fd241a497578a25f68bc3c7>:0 
  at System.Windows.Forms.TabControl+TabPageCollection.Remove (System.Windows.Forms.TabPage value) [0x0000b] in <a3daa9b84fd241a497578a25f68bc3c7>:0 
  at CKAN.GUI.TabController+<>c__DisplayClass2_0.<HideTab>b__0 () [0x00065] in <e2499e8577f2402a87c97189d2e3067a>:0 
  at CKAN.GUI.Util.Invoke[T] (T obj, System.Action action) [0x00026] in <e2499e8577f2402a87c97189d2e3067a>:0 
  at CKAN.GUI.TabController.HideTab (System.String name) [0x00014] in <e2499e8577f2402a87c97189d2e3067a>:0 
  at CKAN.GUI.Main.ManageMods_OnChangeSetChanged (System.Collections.Generic.List`1[T] changeset, System.Collections.Generic.Dictionary`2[TKey,TValue] conflicts) [0x00075] in <e2499e8577f2402a87c97189d2e3067a>:0 
  at CKAN.GUI.ManageMods.<ChangeSetUpdated>b__60_0 () [0x00053] in <e2499e8577f2402a87c97189d2e3067a>:0 
  at CKAN.GUI.Util.Invoke[T] (T obj, System.Action action) [0x00026] in <e2499e8577f2402a87c97189d2e3067a>:0 
  at CKAN.GUI.ManageMods.ChangeSetUpdated () [0x00000] in <e2499e8577f2402a87c97189d2e3067a>:0 
  at CKAN.GUI.ManageMods.set_ChangeSet (System.Collections.Generic.List`1[T] value) [0x00010] in <e2499e8577f2402a87c97189d2e3067a>:0 
  at CKAN.GUI.ManageMods.UpdateChangeSetAndConflicts (CKAN.GameInstance inst, CKAN.IRegistryQuerier registry) [0x001d1] in <e2499e8577f2402a87c97189d2e3067a>:0 
  at CKAN.GUI.ManageMods.WithFrozenChangeset (System.Action action) [0x00055] in <e2499e8577f2402a87c97189d2e3067a>:0 
  at CKAN.GUI.ManageMods.ClearChangeSet () [0x00000] in <e2499e8577f2402a87c97189d2e3067a>:0 
  at (wrapper remoting-invoke-with-check) CKAN.GUI.ManageMods.ClearChangeSet()
  at CKAN.GUI.Main.Changeset_OnCancelChanges (System.Boolean reset) [0x00003] in <e2499e8577f2402a87c97189d2e3067a>:0 
  at CKAN.GUI.Changeset.CancelChangesButton_Click (System.Object sender, System.EventArgs e) [0x00011] in <e2499e8577f2402a87c97189d2e3067a>:0 
  at System.Windows.Forms.Control.OnClick (System.EventArgs e) [0x0001c] in <a3daa9b84fd241a497578a25f68bc3c7>:0 
  at System.Windows.Forms.Button.OnClick (System.EventArgs e) [0x00024] in <a3daa9b84fd241a497578a25f68bc3c7>:0 
  at System.Windows.Forms.ButtonBase.OnMouseUp (System.Windows.Forms.MouseEventArgs mevent) [0x00081] in <a3daa9b84fd241a497578a25f68bc3c7>:0 
  at System.Windows.Forms.Button.OnMouseUp (System.Windows.Forms.MouseEventArgs mevent) [0x00000] in <a3daa9b84fd241a497578a25f68bc3c7>:0 
  at System.Windows.Forms.Control.WmLButtonUp (System.Windows.Forms.Message& m) [0x0007e] in <a3daa9b84fd241a497578a25f68bc3c7>:0 
  at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message& m) [0x0016f] in <a3daa9b84fd241a497578a25f68bc3c7>:0 
  at System.Windows.Forms.ButtonBase.WndProc (System.Windows.Forms.Message& m) [0x0004e] in <a3daa9b84fd241a497578a25f68bc3c7>:0 
  at System.Windows.Forms.Button.WndProc (System.Windows.Forms.Message& m) [0x00000] in <a3daa9b84fd241a497578a25f68bc3c7>:0 
  at System.Windows.Forms.Control+ControlWindowTarget.OnMessage (System.Windows.Forms.Message& m) [0x00000] in <a3daa9b84fd241a497578a25f68bc3c7>:0 
  at System.Windows.Forms.Control+ControlNativeWindow.WndProc (System.Windows.Forms.Message& m) [0x0000b] in <a3daa9b84fd241a497578a25f68bc3c7>:0 
  at System.Windows.Forms.NativeWindow.WndProc (System.IntPtr hWnd, System.Windows.Forms.Msg msg, System.IntPtr wParam, System.IntPtr lParam) [0x0008e] in <a3daa9b84fd241a497578a25f68bc3c7>:0 
System.ArgumentOutOfRangeException: ControlCollection does not have that many controls
Parameter name: index
Actual value was 1.
  at System.Windows.Forms.Control+ControlCollection.get_Item (System.Int32 index) [0x0002d] in <a3daa9b84fd241a497578a25f68bc3c7>:0 
  at System.Windows.Forms.TabControl.GetTab (System.Int32 index) [0x00006] in <a3daa9b84fd241a497578a25f68bc3c7>:0 
  at System.Windows.Forms.TabControl.GetTabRect (System.Int32 index) [0x00000] in <a3daa9b84fd241a497578a25f68bc3c7>:0 
  at (wrapper remoting-invoke-with-check) System.Windows.Forms.TabControl.GetTabRect(int)
  at System.Windows.Forms.Theming.Default.TabControlPainter.Draw (System.Drawing.Graphics dc, System.Drawing.Rectangle area, System.Windows.Forms.TabControl tab) [0x00112] in <a3daa9b84fd241a497578a25f68bc3c7>:0 
  at System.Windows.Forms.ThemeWin32Classic.DrawTabControl (System.Drawing.Graphics dc, System.Drawing.Rectangle area, System.Windows.Forms.TabControl tab) [0x0000a] in <a3daa9b84fd241a497578a25f68bc3c7>:0 
  at System.Windows.Forms.TabControl.Draw (System.Drawing.Graphics dc, System.Drawing.Rectangle clip) [0x00005] in <a3daa9b84fd241a497578a25f68bc3c7>:0 
  at System.Windows.Forms.TabControl.OnPaintInternal (System.Windows.Forms.PaintEventArgs pe) [0x0001a] in <a3daa9b84fd241a497578a25f68bc3c7>:0 
  at System.Windows.Forms.Control.WmPaint (System.Windows.Forms.Message& m) [0x00078] in <a3daa9b84fd241a497578a25f68bc3c7>:0 
  at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message& m) [0x0015f] in <a3daa9b84fd241a497578a25f68bc3c7>:0 
  at System.Windows.Forms.TabControl.WndProc (System.Windows.Forms.Message& m) [0x0006e] in <a3daa9b84fd241a497578a25f68bc3c7>:0 
  at System.Windows.Forms.Control+ControlWindowTarget.OnMessage (System.Windows.Forms.Message& m) [0x00000] in <a3daa9b84fd241a497578a25f68bc3c7>:0 
  at System.Windows.Forms.Control+ControlNativeWindow.WndProc (System.Windows.Forms.Message& m) [0x0000b] in <a3daa9b84fd241a497578a25f68bc3c7>:0 
  at System.Windows.Forms.NativeWindow.WndProc (System.IntPtr hWnd, System.Windows.Forms.Msg msg, System.IntPtr wParam, System.IntPtr lParam) [0x0008e] in <a3daa9b84fd241a497578a25f68bc3c7>:0 
System.ArgumentOutOfRangeException: ControlCollection does not have that many controls
Parameter name: index
Actual value was 1.
  at System.Windows.Forms.Control+ControlCollection.get_Item (System.Int32 index) [0x0002d] in <a3daa9b84fd241a497578a25f68bc3c7>:0 
  at System.Windows.Forms.TabControl.GetTab (System.Int32 index) [0x00006] in <a3daa9b84fd241a497578a25f68bc3c7>:0 
  at (wrapper remoting-invoke-with-check) System.Windows.Forms.TabControl.GetTab(int)
  at System.Windows.Forms.TabControl+TabPageCollection.get_Item (System.Int32 index) [0x00000] in <a3daa9b84fd241a497578a25f68bc3c7>:0 
  at System.Windows.Forms.TabControl.get_SelectedTab () [0x0000e] in <a3daa9b84fd241a497578a25f68bc3c7>:0 
  at System.Windows.Forms.TabControl.OnLeave (System.EventArgs e) [0x00000] in <a3daa9b84fd241a497578a25f68bc3c7>:0 
  at System.Windows.Forms.Control.FireLeave () [0x00000] in <a3daa9b84fd241a497578a25f68bc3c7>:0 
  at System.Windows.Forms.ContainerControl.set_ActiveControl (System.Windows.Forms.Control value) [0x00093] in <a3daa9b84fd241a497578a25f68bc3c7>:0 
  at System.Windows.Forms.Control.Select (System.Windows.Forms.Control control) [0x00021] in <a3daa9b84fd241a497578a25f68bc3c7>:0 
  at System.Windows.Forms.Form.SelectActiveControl () [0x0005b] in <a3daa9b84fd241a497578a25f68bc3c7>:0 
  at System.Windows.Forms.Form.WmActivate (System.Windows.Forms.Message& m) [0x0005d] in <a3daa9b84fd241a497578a25f68bc3c7>:0 
  at System.Windows.Forms.Form.WndProc (System.Windows.Forms.Message& m) [0x000dc] in <a3daa9b84fd241a497578a25f68bc3c7>:0 
  at CKAN.GUI.Main.WndProc (System.Windows.Forms.Message& m) [0x00000] in <e2499e8577f2402a87c97189d2e3067a>:0 
  at System.Windows.Forms.Control+ControlWindowTarget.OnMessage (System.Windows.Forms.Message& m) [0x00000] in <a3daa9b84fd241a497578a25f68bc3c7>:0 
  at System.Windows.Forms.Control+ControlNativeWindow.WndProc (System.Windows.Forms.Message& m) [0x0000b] in <a3daa9b84fd241a497578a25f68bc3c7>:0 
  at System.Windows.Forms.NativeWindow.WndProc (System.IntPtr hWnd, System.Windows.Forms.Msg msg, System.IntPtr wParam, System.IntPtr lParam) [0x0008e] in <a3daa9b84fd241a497578a25f68bc3c7>:0 

I've now tried this on two separate PC's both running Ubuntu 22.04 and both show the exact same symptoms. One PC has no mods installed, the other already has mods.

Possibly a mono version problem? It's mono version mono-runtime/jammy,now 6.8.0.105+dfsg-3.2

@SinisterCrayon
Copy link
Author

Tried upgrading to latest mono mono-runtime/stable-focal 6.12.0.200-0xamarin2+ubuntu2004b1

Same result as above.

@HebaruSan HebaruSan reopened this Nov 30, 2024
@HebaruSan HebaruSan changed the title [Bug]: Ubuntu 22.04 fresh install from DEB, can't download mods ArgumentOutOfRangeException: ControlCollection does not have that many controls in TabControl Nov 30, 2024
@HebaruSan
Copy link
Member

Thanks. And we have some pretty solid previous investigation notes for the same exception in #2501.

@SinisterCrayon
Copy link
Author

Thank you so much. Anything else I can do to help dig into this I am happy to help with whatever I can.

@HebaruSan

This comment was marked as resolved.

@HebaruSan HebaruSan added Bug Something is not working as intended Mono Issues specific for Mono GUI Issues affecting the interactive GUI and removed Support Issues that are support requests labels Nov 30, 2024
@SinisterCrayon
Copy link
Author

Screenshot from 2024-11-30 11-29-59

Sorry, I swear it was right when I posted it LOL...

I don't see anything here that jumps out at me.

@HebaruSan
Copy link
Member

Wow, that is wild! You've got seven rows there with blank cells in the "Mod" column. That definitely should not be happening.

It might be useful to document which mods those are. Can you please show what the is:installed filter looks like in the main mod list?

And does that only happen for upgrades? Or is the mod name missing if you just install or uninstall something?

@SinisterCrayon
Copy link
Author

image

@SinisterCrayon
Copy link
Author

Worth noting though; the other computer with the problem has no mods and a fresh install of KSP. Same issue, and the mod column is blank there too.

@HebaruSan
Copy link
Member

Just in case, I checked the Mod column in my Ubuntu VM, and it's still working fine (same for the buttons):

image

So whatever is weird with your first PC, got set up the same way on the second one.

@SinisterCrayon
Copy link
Author

SinisterCrayon commented Nov 30, 2024

Well, that IS a slightly newer revision of CKAN. I don't see a current download for 1.35.3.24334; I'm running 1.35.2.24280 (current latest) binary

Thing is, the PC I'm posting these screenshots from was working fine up until recently. It was only after updates that it seems to have broken. The other PC was a fresh install on a fresh Ubuntu 22.04 (make sure you're on 22.04?)

What version of Mono are you running?

@HebaruSan
Copy link
Member

Well, that IS a slightly newer revision of CKAN. I don't see a current download for 1.35.3.24334; I'm running 1.35.2.24280 (current latest) binary

That's the current dev build, same as the nightly builds:
https://github.com/KSP-CKAN/CKAN/blob/master/doc/apt-repo.md#nightly-builds

Thing is, the PC I'm posting these screenshots from was working fine up until recently. It was only after updates that it seems to have broken. The other PC was a fresh install on a fresh Ubuntu 22.04 (make sure you're on 22.04?)

Yeah, that sounds plausible; something changed on the PC that broke something in Mono. The trick is figuring out what it was.

What version of Mono are you running?

That was with 6.12.0.200, but pretty much any version after 6 has always worked fine.

https://www.mono-project.com/download/stable/#download-lin-ubuntu

@SinisterCrayon
Copy link
Author

I'm at a bit of a loss then. The Mono install on my other PC was fresh as well so I'm pretty confused here.

I did try the nightly build as well on this PC but no joy... same problem. Note I didn't change anything in Mono, just installed it to support CKAN.

@HebaruSan
Copy link
Member

How are you installing Mono? Are you using the one from Ubuntu? Following the directions I linked above? Something else?

@SinisterCrayon
Copy link
Author

Tried both the one that ships with Ubuntu 22.04 and tried the one from the mono project. Both had the same results too.

@HebaruSan
Copy link
Member

HebaruSan commented Dec 1, 2024

This is a bit of a long shot, but auditing the code behind the Mod column suggests the possibility of a problem with the download cache (that's one of the ways ModChange.NameAndStatus hypothetically could return null). What does the settings dialog look like for you? There's a section in there that depends on the cache, so maybe we'll find another clue there.

@SinisterCrayon
Copy link
Author

SinisterCrayon commented Dec 1, 2024

Now this is interesting. Settings here look fine;
image

But on a whim I attempted to change the download location... I used the "Create new folder" function;
image

I then get this message;
image

So yeah... I think it's having some problems with the download location even if I try to create a new one. Looking at the current location ~/.local/share/CKAN;

drwxrwxr-x  4 agh8459 agh8459    7 May  6  2024 .
drwxr-xr-x 93 agh8459 agh8459  104 Dec  1 07:07 ..
-rw-rw-r--  1 agh8459 agh8459 2.7K Dec  1 07:02 builds-ksp.json
-rw-rw-r--  1 agh8459 agh8459  632 Dec  1 07:07 config.json
drwxrwxr-x  3 agh8459 agh8459  188 Aug 14 19:22 downloads
-rw-rw-r--  1 agh8459 agh8459  288 Aug  8  2020 labels.json
drwxrwxr-x  2 agh8459 agh8459    4 May  6  2024 repos

so permissions look good. Permissions on that CKAN-Download folder I created above are the same.

Plenty of free disk space in that location (2.3T). The only one caveat I think might be relevant here is that on both computers that location is on a ZFS filesystem. I don't know that it should make any difference but it's the only thing I can come up with that is different from a stock install of Ubuntu.

@SinisterCrayon
Copy link
Author

SinisterCrayon commented Dec 1, 2024

Alright... that's it. I created a temporary zvol, formatted it as ext4 and mounted it in the downloads folder. I can now operate normally.

Now, the question is why this revision of CKAN is suddenly sensitive to ZFS filesystems when I know for a fact that at least this PC has been using ZFS since I built it ~3 years ago as its only filesystem... there's something that's been introduced in that timeframe that has made this tool sensitive to ZFS but I couldn't tell you exactly when as I haven't been playing KSP in about a year. It's only now that I've started to want to play it again.

EDIT: Scratch that. While downloads now work it now won't update my KSP installation as it's also on ZFS. I really don't want to have to set up a random EXT4 filesystem particularly since I don't have any drives to do it with. I can do it with zvols but that seems to be kludgy at least in my head. When I go to complete the updates this is what I get

image

So it's definitely some sort of problem with ZFS.

@HebaruSan
Copy link
Member

Settings here look fine;

Nah, this means it has some problem getting the number of files in the cache and their size (that's a default value for the label without meaningful data):

image

That's what I suspected we might see. The cache object is definitely null.

image

So it's definitely some sort of problem with ZFS.

Is that one of those filesystems where it's impossible to determine the remaining free space? If so, I'm guessing this exception is thrown when we attempt to do that (see #3631, #3850, and #4125). I'll have to contemplate how to handle that.

@HebaruSan HebaruSan changed the title ArgumentOutOfRangeException: ControlCollection does not have that many controls in TabControl Invalid path: The drive name does not exist for ZFS filesystem Dec 1, 2024
@SinisterCrayon
Copy link
Author

I'm not a .net coder so I couldn't say for sure. I know I've got other apps using mono just fine with ZFS but I'm not sure how much validation they do of disk space before they perform disk operations. I know at least with Linux tools in general ZFS reports free space just fine to all of them, but again not sure about mono.

Interesting problem. ZFS is an easy install in Ubuntu (sudo apt-get install zfsutils-linux) and you can create a ZFS pool and filesystem pretty quickly for testing purposes. A quick primer on ZFS in case you want to add a ZFS pool to your test VM. It's a very popular filesystem as it's pretty advanced and easy to work with.

@HebaruSan
Copy link
Member

HebaruSan commented Dec 1, 2024

Mono is open source, so we can look up exactly what it's doing:

https://github.com/mono/mono/blob/0f53e9e151d92944cacab3e24ac359410c606df6/mcs/class/corlib/System.IO/DriveInfo.cs#L57-L66

			DriveInfo [] drives = GetDrives ();
			Array.Sort (drives, (DriveInfo di1, DriveInfo di2) => String.Compare (di2.path, di1.path, true));
			foreach (DriveInfo d in drives){
				if (driveName.StartsWith (d.path, StringComparison.OrdinalIgnoreCase)){
					this.path = d.path;
					this.drive_format = d.drive_format;
					return;
				}
			}
			throw new ArgumentException ("The drive name does not exist", "driveName");

https://github.com/mono/mono/blob/0f53e9e151d92944cacab3e24ac359410c606df6/mcs/class/corlib/System.IO/DriveInfo.cs#L150-L159

		public static DriveInfo[] GetDrives ()
		{
			var drives = Environment.GetLogicalDrives ();
			DriveInfo [] infos = new DriveInfo [drives.Length];
			int i = 0;
			foreach (string s in drives)
				infos [i++] = new DriveInfo (s, GetDriveFormat (s));


			return infos;
		}

https://github.com/mono/mono/blob/0f53e9e151d92944cacab3e24ac359410c606df6/mcs/class/corlib/System/Environment.cs#L751-L755

		[EnvironmentPermission (SecurityAction.Demand, Unrestricted=true)]
		public static string[] GetLogicalDrives ()
		{
			return GetLogicalDrivesInternal ();
		}

https://github.com/mono/mono/blob/0f53e9e151d92944cacab3e24ac359410c606df6/mcs/class/corlib/System/Environment.cs#L990-L991

		[MethodImplAttribute (MethodImplOptions.InternalCall)]
		internal extern static string [] GetLogicalDrivesInternal ();

https://github.com/mono/mono/blob/0f53e9e151d92944cacab3e24ac359410c606df6/mono/metadata/icall.c#L7406-L7410

MonoArrayHandle
ves_icall_System_Environment_GetLogicalDrivesInternal (MonoError *error)
{
	return mono_icall_get_logical_drives (error);
}

https://github.com/mono/mono/blob/0f53e9e151d92944cacab3e24ac359410c606df6/mono/metadata/icall.c#L7342-L7404

static MonoArrayHandle
mono_icall_get_logical_drives (MonoError *error)
{
	gunichar2 buf [256], *ptr, *dname;
	gunichar2 *u16;
	guint initial_size = 127, size = 128;
	gint ndrives;
	MonoArrayHandle result = NULL_HANDLE_ARRAY;
	MonoStringHandle drivestr;
	MonoDomain *domain = mono_domain_get ();
	gint len;


	buf [0] = '\0';
	ptr = buf;


	while (size > initial_size) {
		size = (guint) mono_w32file_get_logical_drive (initial_size, ptr, error);
		if (!is_ok (error))
			goto leave;
		if (size > initial_size) {
			if (ptr != buf)
				g_free (ptr);
			ptr = (gunichar2 *)g_malloc0 ((size + 1) * sizeof (gunichar2));
			initial_size = size;
			size++;
		}
	}


	/* Count strings */
	dname = ptr;
	ndrives = 0;
	do {
		while (*dname++);
		ndrives++;
	} while (*dname);


	dname = ptr;
	result = mono_array_new_handle (domain, mono_defaults.string_class, ndrives, error);
	goto_if_nok (error, leave);


	drivestr = MONO_HANDLE_NEW (MonoString, NULL);
	ndrives = 0;
	do {
		len = 0;
		u16 = dname;
		while (*u16) {
			u16++; len ++;
		}
		MonoString *s = mono_string_new_utf16_checked (domain, dname, len, error);
		goto_if_nok (error, leave);
		MONO_HANDLE_ASSIGN_RAW (drivestr, s);


		mono_array_handle_setref (result, ndrives, drivestr);
		ndrives ++;
		while (*dname++);
	} while (*dname);


leave:
	if (ptr != buf)
		g_free (ptr);


	return result;
}

https://github.com/mono/mono/blob/0f53e9e151d92944cacab3e24ac359410c606df6/mono/metadata/w32file-unix.c#L4258-L4328

gint32
mono_w32file_get_logical_drive (guint32 len, gunichar2 *buf, MonoError *error)
{
	return GetLogicalDriveStrings_Mtab (len, buf);
}
#endif
static gint32
GetLogicalDriveStrings_Mtab (guint32 len, gunichar2 *buf)
{
	FILE *fp;
	gunichar2 *ptr, *dir;
	glong length, total = 0;
	gchar buffer [512];
	gchar **splitted;


	memset (buf, 0, sizeof (gunichar2) * (len + 1)); 
	buf [0] = '/';
	buf [1] = 0;
	buf [2] = 0;


	/* Sigh, mntent and friends don't work well.
	 * It stops on the first line that doesn't begin with a '/'.
	 * (linux 2.6.5, libc 2.3.2.ds1-12) - Gonz */
	MONO_ENTER_GC_SAFE;
	fp = fopen ("/etc/mtab", "rt");
	MONO_EXIT_GC_SAFE;
	if (fp == NULL) {
		MONO_ENTER_GC_SAFE;
		fp = fopen ("/etc/mnttab", "rt");
		MONO_EXIT_GC_SAFE;
		if (fp == NULL)
			return 1;
	}


	ptr = buf;
	while (1) {
		gchar *fgets_res;
		MONO_ENTER_GC_SAFE;
		fgets_res = fgets (buffer, 512, fp);
		MONO_EXIT_GC_SAFE;
		if (!fgets_res)
			break;
		if (*buffer != '/')
			continue;


		splitted = g_strsplit (buffer, " ", 0);
		if (!*splitted || !*(splitted + 1)) {
			g_strfreev (splitted);
			continue;
		}


		unescape_octal (*(splitted + 1));
		dir = g_utf8_to_utf16 (*(splitted + 1), -1, NULL, &length, NULL);
		g_strfreev (splitted);
		if (total + length + 1 > len) {
			MONO_ENTER_GC_SAFE;
			fclose (fp);
			MONO_EXIT_GC_SAFE;
			g_free (dir);
			return len * 2; /* guess */
		}


		memcpy (ptr + total, dir, sizeof (gunichar2) * length);
		g_free (dir);
		total += length + 1;
	}


	MONO_ENTER_GC_SAFE;
	fclose (fp);
	MONO_EXIT_GC_SAFE;
	return total;

The Linux implementation of mono_w32file_get_logical_drive seems to work by retrieving the second space-delimited piece of each line from /etc/mtab, so I guess ZFS devices aren't listed there? 😵‍💫

@HebaruSan HebaruSan added Core (ckan.dll) Issues affecting the core part of CKAN and removed GUI Issues affecting the interactive GUI labels Dec 1, 2024
@Gh0stReaper123
Copy link

Alright... that's it. I created a temporary zvol, formatted it as ext4 and mounted it in the downloads folder. I can now operate normally.

Now, the question is why this revision of CKAN is suddenly sensitive to ZFS filesystems when I know for a fact that at least this PC has been using ZFS since I built it ~3 years ago as its only filesystem... there's something that's been introduced in that timeframe that has made this tool sensitive to ZFS but I couldn't tell you exactly when as I haven't been playing KSP in about a year. It's only now that I've started to want to play it again.

EDIT: Scratch that. While downloads now work it now won't update my KSP installation as it's also on ZFS. I really don't want to have to set up a random EXT4 filesystem particularly since I don't have any drives to do it with. I can do it with zvols but that seems to be kludgy at least in my head. When I go to complete the updates this is what I get

image

So it's definitely some sort of problem with ZFS.

Had the exact same issue on my ubuntu-ish hybrid of a system, same workaround fixed the issue.

@HebaruSan
Copy link
Member

@SinisterCrayon and @Gh0stReaper123, can either or both of you please share what your /etc/mtab file looks like and whether it contains your ZFS partitions?

@SinisterCrayon
Copy link
Author

SinisterCrayon commented Dec 20, 2024

It does, and they all look pretty normal. Not posting the entire MTAB here as there's some private information in some of the mount names but here's some of the pretty standard stuff I see;

rpool/ROOT/ubuntu_7lb4sf / zfs rw,relatime,xattr,posixacl,casesensitive 0 0
rpool/boot /oldboot zfs rw,relatime,xattr,posixacl,casesensitive 0 0
rpool/USERDATA/root_xqcv5n /root zfs rw,relatime,xattr,posixacl,casesensitive 0 0
rpool/ROOT/ubuntu_7lb4sf/srv /srv zfs rw,relatime,xattr,posixacl,casesensitive 0 0
rpool/ROOT/ubuntu_7lb4sf/usr/local /usr/local zfs rw,relatime,xattr,posixacl,casesensitive 0 0
rpool/ROOT/ubuntu_7lb4sf/var/games /var/games zfs rw,relatime,xattr,posixacl,casesensitive 0 0
rpool/ROOT/ubuntu_7lb4sf/var/log /var/log zfs rw,relatime,xattr,posixacl,casesensitive 0 0
rpool/ROOT/ubuntu_7lb4sf/var/lib /var/lib zfs rw,relatime,xattr,posixacl,casesensitive 0 0
rpool/ROOT/ubuntu_7lb4sf/var/snap /var/snap zfs rw,relatime,xattr,posixacl,casesensitive 0 0
rpool/ROOT/ubuntu_7lb4sf/var/mail /var/mail zfs rw,relatime,xattr,posixacl,casesensitive 0 0
rpool/ROOT/ubuntu_7lb4sf/var/spool /var/spool zfs rw,relatime,xattr,posixacl,casesensitive 0 0
rpool/ROOT/ubuntu_7lb4sf/var/www /var/www zfs rw,relatime,xattr,posixacl,casesensitive 0 0
rpool/ROOT/ubuntu_7lb4sf/var/lib/AccountsService /var/lib/AccountsService zfs rw,relatime,xattr,posixacl,casesensitive 0 0
rpool/ROOT/ubuntu_7lb4sf/var/lib/NetworkManager /var/lib/NetworkManager zfs rw,relatime,xattr,posixacl,casesensitive 0 0
rpool/ROOT/ubuntu_7lb4sf/var/lib/apt /var/lib/apt zfs rw,relatime,xattr,posixacl,casesensitive 0 0
rpool/var/lib/docker /var/lib/docker zfs rw,relatime,xattr,posixacl,casesensitive 0 0
rpool/ROOT/ubuntu_7lb4sf/var/lib/dpkg /var/lib/dpkg zfs rw,relatime,xattr,posixacl,casesensitive 0 0
rpool/ROOT/ubuntu_7lb4sf /var/snap/firefox/common/host-hunspell zfs ro,noexec,noatime,xattr,posixacl,casesensitive 0 0

@HebaruSan
Copy link
Member

Aha, that explains it! The Mono C code skips lines that don't start with /, so those are all getting ignored because they start with rpool/... instead!

		if (*buffer != '/')
			continue;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is not working as intended Core (ckan.dll) Issues affecting the core part of CKAN Linux Issues specific for Linux Mono Issues specific for Mono
Projects
None yet
Development

No branches or pull requests

4 participants