LXD will not start after upgrade to Ubuntu 18.04

LXD fails to start because of a duplicate column in the db

“Failed to start the daemon: Error creating database: failed to apply update 32: duplicate column name: last_use_date”

How can I fix this?


LXD keeps the configuration in a SQLite database, and you can run SQL queries using the following command,

$ lxd sql
  Execute a SQL query against the LXD local or global database

  The local database is specific to the LXD cluster member you target the
  command to, and contains member-specific data (such as the member network

  The global database is common to all LXD members in the cluster, and contains
  cluster-specific data (such as profiles, containers, etc).

  If you are running a non-clustered LXD instance, the same applies, as that
  instance is effectively a single-member cluster.

  If <query> is the special value "-", then the query is read from
  standard input.

  If <query> is the special value ".dump", the the command returns a SQL text
  dump of the given database.

  If <query> is the special value ".schema", the the command returns the SQL
  text schema of the given database.

  This internal command is mostly useful for debugging and disaster
  recovery. The LXD team will occasionally provide hotfixes to users as a
  set of database queries to fix some data inconsistency.

  This command targets the global LXD database and works in both local
  and cluster mode.

  lxd sql <local|global> <query> [flags]

Global Flags:
  -d, --debug     Show all debug messages
  -h, --help      Print help
      --logfile   Path to the log file
      --syslog    Log to syslog
      --trace     Log tracing targets
  -v, --verbose   Show all information messages
      --version   Print version number

There have been similar posts about needing to touch up the database configuration. See, for example, Lxc cluster list show all 5 servers DATABASE NO

Can you post your LXD versions (previous, and current) so that when a developer sees this, can help you out?


What version of LXD are you upgrading from?
Are you running LXD as a snap or apt package?