Skip to content

Installing CKAN on Arch

HebaruSan edited this page Mar 7, 2024 · 28 revisions

Arch User Repository

CKAN is available in the AUR: https://aur.archlinux.org/packages/ckan/

  1. Make sure your system is up to date:
    sudo pacman -Syu
    
  2. Install Mono:
    sudo pacman -S mono
    
  3. Install msbuild:
    sudo pacman -S msbuild
    
  4. If you haven't already, install base-devel and git so you can access packages in the Arch User Repository:
    sudo pacman -S --needed base-devel git
    
Arch's msbuild was somewhat recently broken (May 2021), but seems to be fixed now (August 2022). Expand this if you need the workaround instructions.
  1. Copy System.Reflection.Metadata.dll from the .deb package provided by mono-project.com (Arch's copy was too old for msbuild):
    mkdir -p /tmp/mono-deb
    cd /tmp/mono-deb
    FILE=$(curl --silent https://download.mono-project.com/repo/ubuntu/dists/preview-focal/main/binary-amd64/Packages | grep -Po "(?<=Filename: ).+mono-roslyn.+\\.deb")
    curl https://download.mono-project.com/repo/ubuntu/${FILE} > mono.deb
    ar p mono.deb data.tar.xz | tar xJf -  ./usr/lib/mono/4.5/System.Reflection.Metadata.dll --strip-components 5
    sudo mv /usr/lib/mono/4.5/System.Reflection.Metadata.dll /usr/lib/mono/4.5/System.Reflection.Metadata.dll_OLD
    sudo cp System.Reflection.Metadata.dll /usr/lib/mono/4.5
    
  1. Get the CKAN AUR package and build it:
    mkdir -p ~/builds
    cd ~/builds
    git clone https://aur.archlinux.org/ckan.git
    cd ckan
    makepkg
    
  2. Install the package you built:
    sudo pacman -U ckan*.zst
    

This will add CKAN to your system application menus, so you can run it from there.

Import certificates

See SSL-certificate-errors#importing-system-certificates if you encounter unexpected errors downloading mods.

Further information and troubleshooting options available in the Arch Wiki.

Run CKAN

If you download the ckan.exe file from our release page, run it with:

mono ckan.exe

Troubleshooting

Crash while adding a new instance

If you install the game by unpacking a ZIP file from the KSP Store, you may see this exception when you try to open the game folder in CKAN:

System.ArgumentOutOfRangeException: Valid values are between -62135596800 and 253402300799, inclusive.
Parameter name: seconds
  at System.DateTimeOffset.FromUnixTimeSeconds (System.Int64 seconds) [0x00043] in <62b430b945fa49a19a75382ef03e7bed>:0 
  at System.IO.FileStatus.UnixTimeToDateTimeOffset (System.Int64 seconds, System.Int64 nanoseconds) [0x00000] in <62b430b945fa49a19a75382ef03e7bed>:0 
  at System.IO.FileStatus.GetLastAccessTime (System.ReadOnlySpan`1[T] path, System.Boolean continueOnError) [0x00018] in <62b430b945fa49a19a75382ef03e7bed>:0 
  at System.IO.FileSystemInfo.get_LastAccessTimeCore () [0x00011] in <62b430b945fa49a19a75382ef03e7bed>:0 
  at System.IO.FileSystemInfo.get_LastAccessTimeUtc () [0x00000] in <62b430b945fa49a19a75382ef03e7bed>:0 
  at System.IO.FileSystemInfo.get_LastAccessTime () [0x00000] in <62b430b945fa49a19a75382ef03e7bed>:0 
[...]

This happens because the access times in the extracted directory are mangled. To fix it, you can update the timestamps from the command line with touch:

touch KSP_linux/*

Crash while downloading multiple mods at once (Mono.Unix.UnixIOException)

Mono's versions 6.12.0.86 and upward, which includes the version 6.12.0.122 presents in Arch Linux' official repos as of this writing, are affected by a bug which causes CKAN to crash while downloading multiple mods at the same time, with a stack trace similar to the following:

exception inside UnhandledException handler: (null) assembly:/usr/lib/mono/gac/Mono.Posix/4.0.0.0__0738eb9f132ed756/Mono.Posix.dll type:UnixIOException member:(null)
[...]
exception inside UnhandledException handler: (null) assembly:/usr/lib/mono/gac/Mono.Posix/4.0.0.0__0738eb9f132ed756/Mono.Posix.dll type:UnixIOException member:(null)

[ERROR] FATAL UNHANDLED EXCEPTION: Mono.Unix.UnixIOException: Resource temporarily unavailable [EWOULDBLOCK].
  at Mono.Unix.UnixMarshal.ThrowExceptionForLastError () [0x00005] in <7bcd6d815ebc477ab0521e0361c44f6c>:0
  at Mono.Unix.UnixStream.Write (System.Byte[] buffer, System.Int32 offset, System.Int32 count) [0x00055] in <7bcd6d815ebc477ab0521e0361c44f6c>:0
  at System.Windows.Forms.XplatUIX11.WakeupMain () [0x00000] in <4b6c441381804088ab0fff508a3fbabf>:0
  at System.Windows.Forms.XplatUIX11.SendAsyncMethod (System.Windows.Forms.AsyncMethodData method) [0x00080] in <4b6c441381804088ab0fff508a3fbabf>:0
[...]

The stack trace is visible when CKAN is launched in a terminal using mono ckan.exe.

Unfortunately there is nothing one can do to fix this problem directly but the bug should be fixed in the next stable release of mono. In the mean time, one can either use the console UI which is not affected by this bug instead of the GUI or downgrade the mono package to version 6.10.0.104-1 or older.

Clone this wiki locally