Plexmediaserver Auto-Refresh hangs

So yesterday it came a update for the Plex Media Server snap that seeme to have broken the snap. At least for me!

I did a

$ sudo snap changes    
And can see that it's apparently working on the update. 
ID   Status  Spawn               Ready               Summary
13   Doing   today at 06:44 CET  -                   Auto-refresh snap "plexmediaserver"
$ snap tasks 13
Status  Spawn               Ready               Summary
Done    today at 06:44 CET  today at 06:44 CET  Ensure prerequisites for "plexmediaserver" are available
Done    today at 06:44 CET  today at 06:44 CET  Download snap "plexmediaserver" (184) from channel "latest/stable"
Done    today at 06:44 CET  today at 06:44 CET  Fetch and check assertions for snap "plexmediaserver" (184)
Done    today at 06:44 CET  today at 06:44 CET  Mount snap "plexmediaserver" (184)
Done    today at 06:44 CET  today at 06:44 CET  Run pre-refresh hook of "plexmediaserver" snap if present
Done    today at 06:44 CET  today at 06:44 CET  Stop snap "plexmediaserver" services
Done    today at 06:44 CET  today at 06:44 CET  Remove aliases for snap "plexmediaserver"
Done    today at 06:44 CET  today at 06:44 CET  Make current revision for snap "plexmediaserver" unavailable
Doing   today at 06:44 CET  -                   Copy snap "plexmediaserver" data
Do      today at 06:44 CET  -                   Setup snap "plexmediaserver" (184) security profiles
Do      today at 06:44 CET  -                   Make snap "plexmediaserver" (184) available to the system
Do      today at 06:44 CET  -                   Automatically connect eligible plugs and slots of snap "plexmediaserver"
Do      today at 06:44 CET  -                   Set automatic aliases for snap "plexmediaserver"
Do      today at 06:44 CET  -                   Setup snap "plexmediaserver" aliases
Do      today at 06:44 CET  -                   Run post-refresh hook of "plexmediaserver" snap if present
Do      today at 06:44 CET  -                   Start snap "plexmediaserver" (184) services
Do      today at 06:44 CET  -                   Remove data for snap "plexmediaserver" (175)
Do      today at 06:44 CET  -                   Remove snap "plexmediaserver" (175) from the system
Do      today at 06:44 CET  -                   Clean up "plexmediaserver" (184) install
Do      today at 06:44 CET  -                   Run configure hook of "plexmediaserver" snap if present
Do      today at 06:44 CET  -                   Run health check of "plexmediaserver" snap
Doing   today at 06:44 CET  -                   Consider re-refresh of "plexmediaserver"

So it seems to get stuck on this one: Doing today at 06:44 CET - Copy snap "plexmediaserver" data for about 5 hours now.
And it happend last night also, but after a couple of hours I did a “snap abort” as to make Plex usable again for the time being.
But why is this happening? I’m not that familiar with Snap, so I’m not sure what the next logical step is now.

tl;dr, plex probably is taking a lot of disk space in /var/snap/plexmediaserver and upgrading causes it to be duplicated. That’s the “Copy” bit, and is why it takes a while.

Ok, to explain what’s happening. Each snap has a bit of disk space per “revision”. When you snap refresh you’re (simplistically) moving from one revision of the snap to another. The data may be common to any revision or it may be versioned. The versioned data is in (in this case) /var/snap/plexmediaserver/175 and is being copied to /var/snap/plexmediaserver/184. The stuff in /var/snap/plexmediaserver/common is not copied, so not a factor in this problem here.

Perhaps there’s some “cleanup” that can be done in plex? Maybe you can manually nuke files in there, or maybe just wait and let it happen. Up to you. You could feed back to the plex devs that it eats space and maybe it could be more frugal with your disk, I don’t know.

Running ncdu /var/snap/plexmediaserver on my server at home is taking a long time, longer than it takes me to type this entire reply to you. Granted it’s a slow, old server, but that suggests there’s a ton of files in there. :smiley:

Edit 10 mins later: Seems my theory may be wrong. I have tons of data in common and none in the versioned folders.

1 Like

Thanks for your input. Much appreciated!

I too have tons of data in common and none in the versioned folders.
Screenshot from 2021-02-26 12-47-35

is the /current symlink really not there in your setup or is this just an omission in the ncdu screenshot ?

Guessing that’s because Plex is disabled while trying to update? Not sure though…

Done today at 06:44 CET today at 06:44 CET Remove aliases for snap “plexmediaserver”
Done today at 06:44 CET today at 06:44 CET Make current revision for snap “plexmediaserver” unavailable

I think it must have been there, as this have been working flawlessly until that update yesterday.

The “/current” symlink came back when after 4,5 hours of aborting.
Actually it never enden aborting, but after a restart of snapd and a snap restart plexmediaserver everything is back working, although still not updated so it’s just a few hours until next time this will happen again.

i wonder if there are any symlinks out of /var/snap/plexmediaserver/$version into /var/snap/plexmediaserver/common that would cause it to copy things around needlessly …

That might be, although I really don’t see where they could come from. This is a close to fresh install on a dedicated Ubuntu server just used for Plex, and it have not been a problem prior to this latest update. Absolutely no manual edition of files or paths have been done at all.

But - I’ll try to dive in and look.

The thing is - wouldn’t this have to be several hundreds of gigabytes to take this long? Bear in mind I keept it running for close to 6 hours. Normally I would expect be able to copy at least a 1TB of data in that time with time to spare with these SSD’s.

yeah, i’m not saying this is correct behaviour at all, just trying to track down the cause of it :wink:

Well, I don’t know what the problem was - but it seems doing a forced reboot on the server solved it.
I checked and it was still idling on copying (high cpu/no disk activity) , so I did a reboot. When I checked as soon as the server was done booting everything was updated and working as expected.
Screenshot from 2021-02-26 19-49-02
Not much of a solution though and definitely not how I would like to solve it, but i’ll take it.