SQLite Error 1: 'mod_spatialite.so: cannot open shared object file: No such file or directory'.
It seems to be missing in all non-windows runtimes.
Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 1: 'mod_spatialite.so: cannot open shared object file: No such file or directory'.
at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)
at Microsoft.Data.Sqlite.SqliteDataReader.NextResult()
at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader()
at Microsoft.Data.Sqlite.SqliteCommand.ExecuteNonQuery()
at Microsoft.Data.Sqlite.SqliteConnectionExtensions.ExecuteNonQuery(SqliteConnection connection, String commandText, SqliteParameter[] parameters)
at Microsoft.Data.Sqlite.SqliteConnection.LoadExtensionCore(String file, String proc)
at Microsoft.Data.Sqlite.SqliteConnection.Open()
at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenDbConnection(Boolean errorsExpected)
at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.Open(Boolean errorsExpected)
at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteScalar(RelationalCommandParameterObject parameterObject)
at Microsoft.EntityFrameworkCore.Migrations.HistoryRepository.Exists()
at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.Migrate(String targetMigration)
at Microsoft.EntityFrameworkCore.Design.Internal.MigrationsOperations.UpdateDatabase(String targetMigration, String contextType)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.UpdateDatabaseImpl(String targetMigration, String contextType)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.UpdateDatabase.<>c__DisplayClass0_0.<.ctor>b__0()
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)

Sampe project:
https://github.com/KreativJos/efcore_sqlite_spatial
Tried on Ubuntu 18.04.
Reproduce with dotnet ef database update, or just by running the project.
EF Core version: 3.1.6 (& 3.1.3)
Database provider: Microsoft.EntityFrameworkCore.Sqlite / Microsoft.EntityFrameworkCore.Sqlite.NetTopologySuite
Target framework: .NET Core 3.1
Operating system: WSL Ubuntu 18.04
IDE: Commandline / VSCode
You need to manually install it outside of Windows:
# Ubuntu
apt-get install libsqlite3-mod-spatialite
# macOS
brew install libspatialite
Note, you might also start hitting segfaults due to relatively recent changes in PROJ. The easiest workaround is use the system version of SQLite:
dotnet add package SQLitePCLRaw.provider.sqlite3
SQLitePCL.raw.SetProvider(new SQLitePCL.SQLite3Provider_sqlite3());
Most helpful comment
You need to manually install it outside of Windows:
Note, you might also start hitting segfaults due to relatively recent changes in PROJ. The easiest workaround is use the system version of SQLite: