Plex Media Scanner - no such column: library_sections.content_changed_at

Server Version#: 1.18.7.2457-77cb9455c (64Bit Ubuntu)
Player Version#: N/A

I recently installed on a new server Ubuntu 18.04 and noticed that automatic scanning was not working, I put this down to my filesystem setup so was planning on creating a script to use Plex Media Scanner to update when a file is added to the library.

However, performing a --list action results in this error:

~ /usr/lib/plexmediaserver/Plex\ Media\ Scanner -l

terminate called after throwing an instance of 'soci::soci_error'
  what():  sqlite3_statement_backend::prepare: no such column: library_sections.content_changed_at for SQL: select library_sections.id as 'library_sections_id', library_sections.library_id as 'library_sections_library_id', library_sections.name as 'library_sections_name', library_sections.name_sort as 'library_sections_name_sort', library_sections.section_type as 'library_sections_section_type', library_sections.language as 'library_sections_language', library_sections.agent as 'library_sections_agent', library_sections.scanner as 'library_sections_scanner', library_sections.user_thumb_url as 'library_sections_user_thumb_url', library_sections.user_art_url as 'library_sections_user_art_url', library_sections.user_theme_music_url as 'library_sections_user_theme_music_url', library_sections.created_at as 'library_sections_created_at', library_sections.updated_at as 'library_sections_updated_at', library_sections.scanned_at as 'library_sections_scanned_at', library_sections.user_fields as 'library_sections_user_fields', library_sections.query_xml as 'library_sections_query_xml', library_sections.query_type as 'library_sections_query_type', library_sections.uuid as 'library_sections_uuid', library_sections.changed_at as 'library_sections_changed_at', library_sections.content_changed_at as 'library_sections_content_changed_at' from library_sections
  • I tried the instructions to repair a corrupted database, still the same error.
  • I then tried adding the column to the table manually, to which I get an SQL error as the column apparently already exists.

I’m now assuming that this might be the reason that auto scanning isn’t happening, but even if not I’d like to solve it so that I can run a script to trigger a scan.

Triggering a scan via the web app does work.

There is a crash report with the above error but will not post until/if it is required, will generate a new one.

Any help would be much appreciated.

2 Likes

Server is the latest version running on Ubuntu 18.04

I am also experiencing this error. While the metadata scanning works from the web interface, I cannot run Plex Media Scanner from the command line. ā€˜what(): sqlite3_statement_backend::prepare: no such column: library_sections.content_changed_at for SQL’

I performed a complete repair on the database using this article -> https://support.plex.tv/articles/201100678-repair-a-corrupt-database/

I still get this error when using the command line. I would have thought the importing of the SQL would have completely repaired the database, but that doesn’t seem to be the case. Is this missing column something I can add manually? Or is this pointing to a bigger issue somewhere?

I am not sure what to do next. I’ve ignored the error because the scanning does work as long as I initiate through the web interface. Other than this message appearing at the command line, I don’t seem to have any problems in the database. All my sections and all of the associated media works fine and it updates nightly.

I can confirm that the media scanning is working. I’ve added and removed plenty of test files, the media scanner made all of the changes correctly. Oddly, I still get this error when using the command line. I’ve tried running the command as a regular user as well as an admin user and it fails for both accounts, same error.

Using the latest Ubuntu and the latest PMS, can anyone confirm that running the ā€˜Plex Media Scanner’ --list option from the command line actually works? Or does this fail for everyone using PMS on Ubuntu? Perhaps this is related to the underlying OS? If you are able to run the scanner from the CLI, can you check to see if your database has this column? Maybe the column is missing because I missed an update somewhere?

I’m seeing the same issue. On PMS 1.19.3.2831. Trying to run most commands gives this error. I tried generating new thumbnails and it crashed this way. On QNAP 4.4.1.1101.

Then, after this crash I always get this output from an async process:

Error in command line:the argument for option '--serverUuid' should follow immediately after the equal sign
Crash Uploader options (all are required):
  --directory arg       Directory to scan for crash reports
  --serverUuid arg      UUID of the server that crashed
  --userId arg          User that owns this product
  --platform arg        Platform string
  --platformVersion arg Platform version string
  --vendor arg          Vendor string
  --device arg          Device string
  --model arg           Device model string
  --sentryUrl arg       Sentry URL to upload to
  --sentryKey arg       Sentry Key for the project
  --version arg         Version of the product

Yes, I also see that message in my logs.

Error in command line:the argument for option '--serverUuid' should follow immediately after the equal sign

I still am not sure whether my database has a problem, or if not, as this error still appears when using the command line with the latest version 1.19.4.2935. Shouldn’t I be able to use the command line successfully? Or is the command line no longer supported?

I have the same issue on 1.19.4.2935 running on Raspberry Pi OS.
Tried to perform a --list and --scan command, but no luck.

  1. Running as user plex (or your customized username) ?
  2. PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR ?

This is 1.19.4 on QNAP (also Linux)

[/share/CACHEDEV2_DATA/.qpkg/PlexMediaServer] # ./Plex\ Media\ Scanner --list
 12: uhd7
 13: uhd8
 14: uhd88
 15: uhd89
[/share/CACHEDEV2_DATA/.qpkg/PlexMediaServer] # 

(apologies for the goofy library sections. this is my development system)

In my case, I am running as plex. However, this server started as an Ubuntu 12.04 LTS in 2012. It has gone through numerous upgrades to now be running Ubuntu 18.04.4 LTS with PMS 1.19.4.2935. Of course, plex has also gone through hundreds of updates in the last 8 years. I tend to think that some, or all, of the oddities I experience are from the years of upgrades.

I think what may be best at this point is to do a clean install of Ubuntu 20.04 LTS. Then do a clean/fresh install of PMS followed by copying over the preferences.xml and the database. I would also reinstall Tautulli and restore its database too. I’ll take any/all advice the community can offer up. I really dont want to screw things up. :slight_smile: :slight_smile:

Please confirm:

  1. Ubuntu 12.x, upgraded each year , to 18.04.4
  2. Original PMS database?

If so, you very likely missed an update / database migration where columns were added.

I can tell you that DPKG will misbehave for you at some point. I’ve see it several times now.

I suggest it is time to export your watched status data and start fresh. After recreating, you can import your watch history

Yes on #1 and #2. Note though that the database has been ā€˜repaired’ several times following the instructions that I linked in one of the previous messages.

I am not an expert, but I can my way around SQL. Would I be wasting time if I tried to repair the SQL before it is imported during a recovery? I use a brand new fresh SQL script to create the new database so that the schema is correct. Then adjust the data SQL to do an *update" on existing/matching columns. I don’t mind spending some quality time with the database if it will avoid losing 8 years of organizing efforts.

I built a brand new Ubuntu 20.04.4 LTS and installed PMS 1.19.4.2935… I then added 2 small libraries, each with 10 items, one called Movies, one called Shows. I then let them refresh the metadata until both libraries were done scanning. Running Plex Media Scanner from the command line generates nearly the same message, shown below, I’m already experiencing.

I took the new database and dumped it to SQL… Inspecting the line that would create the missing column shows a mix of double-quotes and single-quotes as well as assigning a string ā€˜0’ to an integer field. I edited that line by changing this part ā€˜content_changed_at’ integer(8) default ā€˜0’ to be ā€œcontent_changed_atā€ integer(8) default 0. I performed the repair a corrupted database steps, deleting the db and then rebuilding the db with the modified SQL. This had the same result, crashing on the missing column when running the scanner from the cli.

Opening the db with sqlite3, I performed: select changed_at from library_sections; and received the expected response. But the following fails with no such column: select content_changed_at from library_sections; When I look at the db tables there is a column named ā€˜content_changed_at’ and is defined as integer. See the attached picture.

I thought a brand new server with a completely clean install would not see any errors at all.

plex.library_section.table

CREATE TABLE IF NOT EXISTS "library_sections" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "library_id" integer, "name" varchar(255), "name_sort" varchar(255) COLLATE NOCASE, "section_type" integer, "language" varchar(255), "agent" varchar(255), "scanner" varchar(255), "user_thumb_url" varchar(255), "user_art_url" varchar(255), "user_theme_music_url" varchar(255), "public" boolean, "created_at" datetime, "updated_at" datetime, "scanned_at" datetime, "display_secondary_level" boolean, "user_fields" varchar(255), "query_xml" text, "query_type" integer, "uuid" varchar(255), "changed_at" integer(8) DEFAULT 0, 'content_changed_at' integer(8) default '0');
terminate called after throwing an instance of 'soci::soci_error' what(): sqlite3_statement_backend::prepare: no such column: library_sections.changed_at for SQL: select library_sections.id as 'library_sections_id', library_sections.library_id as 'library_sections_library_id', library_sections.name as 'library_sections_name', library_sections.name_sort as 'library_sections_name_sort', library_sections.section_type as 'library_sections_section_type', library_sections.language as 'library_sections_language', library_sections.agent as 'library_sections_agent', library_sections.scanner as 'library_sections_scanner', library_sections.user_thumb_url as 'library_sections_user_thumb_url', library_sections.user_art_url as 'library_sections_user_art_url', library_sections.user_theme_music_url as 'library_sections_user_theme_music_url', library_sections.created_at as 'library_sections_created_at', library_sections.updated_at as 'library_sections_updated_at', library_sections.scanned_at as 'library_sections_scanned_at', library_sections.user_fields as 'library_sections_user_fields', library_sections.query_xml as 'library_sections_query_xml', library_sections.query_type as 'library_sections_query_type', library_sections.uuid as 'library_sections_uuid', library_sections.changed_at as 'library_sections_changed_at' from library_sections

I am also using 1.19.4.2935.

[/share/CACHEDEV2_DATA/.qpkg/PlexMediaServer/Library/Plex Media Server] # ls
Cache/	 Crash Reports/  Logs/	 Metadata/	      Plug-ins/		Preferences.xml
Codecs/  Diagnostics/	 Media/  plexmediaserver.pid  Plug-in Support/
[/share/CACHEDEV2_DATA/.qpkg/PlexMediaServer/Library/Plex Media Server] # cd ..
<MediaServer/Library] # export PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR=`pwd`                 
[/share/CACHEDEV2_DATA/.qpkg/PlexMediaServer/Library] # cd ..
[/share/CACHEDEV2_DATA/.qpkg/PlexMediaServer] # ls
CrashUploader*		  Plex DLNA Server*	     Plex Relay*	Plex Tuner Service*
lib/			  Plex Media Fingerprinter*  Plex Script Host*	Resources/
Library/		  Plex Media Scanner*	     plex.sh*
Plex Commercial Skipper*  Plex Media Server*	     Plex Transcoder*
[/share/CACHEDEV2_DATA/.qpkg/PlexMediaServer] # ./Plex\ Media\ Scanner --list
 17: QA TV
[/share/CACHEDEV2_DATA/.qpkg/PlexMediaServer] # ./Plex\ Media\ Scanner --scan
[/share/CACHEDEV2_DATA/.qpkg/PlexMediaServer] # 

This DB is 2 days old.

In my case, I’m running as root. su plex prompts me for password.

Systemd unit file:

[Unit]
Description=Plex Media Server
After=network.target network-online.target

[Service]
Environment="PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR=/var/lib/plexmediaserver/Library/Application Support"
Environment=PLEX_MEDIA_SERVER_HOME=/usr/lib/plexmediaserver
Environment=PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS=6
Environment=PLEX_MEDIA_SERVER_TMPDIR=/tmp
ExecStartPre=/bin/sh -c '/usr/bin/test -d "${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR}" || /bin/mkdir -p "${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR}"'
ExecStart=/bin/sh -c '\
export PLEX_MEDIA_SERVER_INFO_VENDOR="$(grep ^NAME= /etc/os-release | awk -F= "{print \\$2}" | tr -d \\" )"; \
export PLEX_MEDIA_SERVER_INFO_DEVICE="PC"; \
export PLEX_MEDIA_SERVER_INFO_MODEL="$(uname -m)"; \
export PLEX_MEDIA_SERVER_INFO_PLATFORM_VERSION="$(grep ^VERSION= /etc/os-release | awk -F= "{print \\$2}" | tr -d \\" )"; \
export LD_LIBRARY_PATH=/usr/lib/plexmediaserver/lib; \
exec "/usr/lib/plexmediaserver/Plex Media Server"'
Type=simple
User=plex
Group=plex
Restart=on-failure
RestartSec=5
StartLimitInterval=60s
StartLimitBurst=3
SyslogIdentifier=Plex Media Server
StandardOutput=journal
StandardError=journal

[Install]
WantedBy=multi-user.target

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.