Upgrade Failure "duplicate column name: DebugPreference"

Upgrade Failure "duplicate column name: DebugPreference"

avatar

I am attempting to upgrade PSU from v5.5.0 to v26.2.3.0, both initial install and upgrade are being done via MSI. The v26 MSI upgrade process itself completes successfully without error. However, post upgrade when first trying to start the PSU service the below error throws and the service will not start. I don't recall ever doing anything unique/special with this PSU installation, but as of now I am unable to get past it. Are there intermediate version(s) I need to step through instead of a straight jump to 26.2.3.0?

[FTL] Fatal error starting PowerShell Universal as a Windows service.
Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 1: 'duplicate column name: DebugPreference'.
   at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)
   at Microsoft.Data.Sqlite.SqliteCommand.PrepareAndEnumerateStatements()+MoveNext()
   at Microsoft.Data.Sqlite.SqliteCommand.GetStatements()+MoveNext()
   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.EntityFrameworkCore.Storage.RelationalCommand.ExecuteNonQuery(RelationalCommandParameterObject parameterObject)
   at Microsoft.EntityFrameworkCore.Migrations.MigrationCommand.ExecuteNonQuery(IRelationalConnection connection, IReadOnlyDictionary2 parameterValues)    at Microsoft.EntityFrameworkCore.Migrations.Internal.MigrationCommandExecutor.Execute(IReadOnlyList1 migrationCommands, IRelationalConnection connection, MigrationExecutionState executionState, Boolean beginTransaction, Boolean commitTransaction, Nullable1 isolationLevel)    at Microsoft.EntityFrameworkCore.Migrations.Internal.MigrationCommandExecutor.<>c.<ExecuteNonQuery>b__3_1(DbContext _, ValueTuple6 s)
   at Microsoft.EntityFrameworkCore.Storage.NonRetryingExecutionStrategy.ExecuteTState,TResult
   at Microsoft.EntityFrameworkCore.Migrations.Internal.MigrationCommandExecutor.ExecuteNonQuery(IReadOnlyList1 migrationCommands, IRelationalConnection connection, MigrationExecutionState executionState, Boolean commitTransaction, Nullable1 isolationLevel)
   at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.MigrateImplementation(DbContext context, String targetMigration, MigrationExecutionState state, Boolean useTransaction)
   at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.<>c.<Migrate>b__20_1(DbContext c, ValueTuple4 s)    at Microsoft.EntityFrameworkCore.Storage.NonRetryingExecutionStrategy.Execute[TState,TResult](TState state, Func3 operation, Func3 verifySucceeded)    at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.Migrate(String targetMigration)    at Microsoft.EntityFrameworkCore.RelationalDatabaseFacadeExtensions.Migrate(DatabaseFacade databaseFacade)    at PowerShellUniversal.SQLite.DatabaseFeature.InitializeDatabase(IConfiguration configuration, ILogger logger) in D:\a\powershell-universal\powershell-universal\src\PowerShellUniversal.SQLite\Plugin.cs:line 72    at Universal.Server.Services.SystemPluginService.InitializeDatabase(IConfiguration configuration) in D:\a\powershell-universal\powershell-universal\src\Universal.Server\Services\SystemPluginService.cs:line 58    at Universal.Server.Startup.InitializeDatabase(ISystemPluginService systemPluginService) in D:\a\powershell-universal\powershell-universal\src\Universal.Server\Startup.cs:line 340    at Universal.Server.Startup.ConfigureServices(IServiceCollection services) in D:\a\powershell-universal\powershell-universal\src\Universal.Server\Startup.cs:line 82    at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)    at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span1 copyOfArgs, BindingFlags invokeAttr)
   at System.Reflection.MethodBaseInvoker.InvokeWithOneArg(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.InvokeCore(Object instance, IServiceCollection services)
   at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.UseStartup(Type startupType, HostBuilderContext context, IServiceCollection services, Object instance)
   at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass7_0.<UseStartup>b__0(HostBuilderContext context, IServiceCollection services)
   at Microsoft.Extensions.Hosting.HostBuilder.InitializeServiceProvider()
   at Microsoft.Extensions.Hosting.HostBuilder.Build()
   at Universal.Server.PowerShellUniversalWindowsService.StartHostAsync(CancellationToken cancellationToken) in D:\a\powershell-universal\powershell-universal\src\Universal.Server\PowerShellUniversalWindowsService.cs:line 61

All Comments (2)

avatar

Hello geofforlebeck,

Thank you for providing the upgrade details and complete stack trace.

The MSI installation appears to have completed, but the PSU service is failing during the SQLite schema migration. The error indicates that the migration is attempting to create the `DebugPreference` column when it is already present in the database.

I did not find an official requirement to install intermediate PSU versions before upgrading. For now, please do not manually delete the column or modify the `__EFMigrationsHistory` table, as this could leave the database in an unsupported state.

Could you please confirm the following?

* Is this a production, test, or development instance?
* Was PSU 5.5.0 starting successfully immediately before the upgrade?
* Do you have a backup of the SQLite database, repository, and configuration from before the upgrade?
* Were there any previous upgrade attempts or database restorations on this installation?
* Are you using the default SQLite database location or a custom path?

Please preserve a copy of the current database before attempting any rollback or additional upgrade.

Because this is a public forum, please sanitize all evidence before posting. Remove credentials, tokens, license keys, cookies, private keys, full connection strings, email addresses, usernames, customer data, tenant or account identifiers, internal domains, hostnames, IP addresses, and private URLs. Please do not upload unredacted HAR files, memory dumps, database backups, or complete configuration files to this public thread.

Best regards,
Ruben Tapia

avatar

To answer your questions:

  • This is a production instance (uses free license as I'm using solely as a job scheduler)
  • PSU 5.5.0 is running fine and is running okay prior the upgrade attempt
  • Yes, I have backups of everything. This is a VM so I've been using VM snapshots to restore back to v5.5.0 when upgrade fails
  • I believe there was one or two version upgrades, but cannot say with 100% certainty.
  • Default SQLite ("C:\ProgramData\UniversalAutomation\database.db")