Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Plex Media Server [SOLVED]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
Linx_
n00b
n00b


Joined: 01 Jul 2018
Posts: 40

PostPosted: Sun Sep 20, 2020 9:43 pm    Post subject: Plex Media Server [SOLVED] Reply with quote

So when I synced up this morning I got the message that Plex has been masked and scheduled for removal. I get it, I understand why, and I half expected it. But....

Plex is currently being updated to remove all python code, but in the meantime I need to keep it until that gets done. Plex is one of my core apps that I use every day, and if my wife and I have nothing to watch in bed at night our marriage is in jeopardy. :lol:

So.... I unmerged it and did a --depclean to remove all remnants of it from ::gentoo, then added it to my local repo using ebuilds and files from this overlay. But when I try to emerge from the localrepo I get this error:

Code:
emerge: there are no ebuilds to satisfy "dev-python/virtualenv[python_targets_python2_7(-)]".
(dependency required by "media-tv/plex-media-server-1.20.1::localrepo[python_single_target_python2_7]" [ebuild])
(dependency required by "plex-media-server" [argument])


I'm really not up on all this python train wreck, so what's the correct way to tell portage that I want to use 2.7 to build this one package?
_________________
I occasionally post sober.


Last edited by Linx_ on Mon Sep 28, 2020 2:41 am; edited 1 time in total
Back to top
View user's profile Send private message
Ionen
Veteran
Veteran


Joined: 06 Dec 2018
Posts: 1438

PostPosted: Sun Sep 20, 2020 10:00 pm    Post subject: Reply with quote

It could've stayed longer if it was more independent but it was preventing the py2 support removal in its dependencies, which well, now lost support (see this commit for virtualenv earlier today, so unmasking or copying the ebuild alone won't allow it to merge).

Also, don't think to just copy the older virtualenv ebuild, this caused a cascade of py2 removal in virtualenv's deps as well. Afraid I don't have a easy solution to offer, maybe someone else will.

Edit: I think upstream bundle its own python, so maybe could be made to work without. There's also virtualenv -p /usr/bin/python2.7 that should be usable. Not that I ever used this package to really know how to make it work.
Back to top
View user's profile Send private message
Linx_
n00b
n00b


Joined: 01 Jul 2018
Posts: 40

PostPosted: Sun Sep 20, 2020 10:42 pm    Post subject: Reply with quote

I saw the upstream, but that seems to come in .deb and .rpm only. I've never tried, so is there a practical way to install those packages on Gentoo?

Also, I'm not sure how virtualenv might be applied to this situation. I did a little googling, but I'm still a little lost as to how Plex would be installed from an overlay using it.
_________________
I occasionally post sober.
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 16219

PostPosted: Mon Sep 21, 2020 4:44 pm    Post subject: Reply with quote

Linx_ wrote:
So.... I unmerged it and did a --depclean to remove all remnants of it from ::gentoo
While my advice comes too late since you did this before posting, I think you did the wrong thing here. Portage was warning you that the package was masked and would be removed in the future. You responded by removing it now, so you immediately lost use of it. Since you consider it core for your use case, and you expect that upstream will resolve this in due time, your best course of action would have been to ignore the mask and continue to use Plex until such time as either (a) upstream released a Python3 version or (b) something actually broke. Given the mask and the deprecation plan, (b) could have happened at any time and would not merit a bug report. However, until it did happen, you would have had use of Plex.

On the other hand, Plex appears not to have a Free license, so perhaps this is a good opportunity for you to find something else to use for your media requirements.
Back to top
View user's profile Send private message
axl
Veteran
Veteran


Joined: 11 Oct 2002
Posts: 1072
Location: Romania

PostPosted: Tue Sep 22, 2020 1:35 am    Post subject: Reply with quote

Quote:
# Michał Górny <mgorny@gentoo.org> (2020-09-20)
# Bundles vulnerable version of Python 2.7, also boost and other
# libraries in undetermined versions. Simultaneously blocks removal
# of Python 2.7 packages.
# Removal in 30 days. Bug #735396.
media-tv/plex-media-server

--
Best regards,
Michał Górny


This was sent over gentoo-dev mailing list today. I would look for alternatives.
Back to top
View user's profile Send private message
icaruslnx
n00b
n00b


Joined: 14 Apr 2009
Posts: 14

PostPosted: Tue Sep 22, 2020 12:48 pm    Post subject: Reply with quote

What other options are really available? Plex has huge market share and the player is available on almost every platform. All the options I've looked into are either extremely clunky or require specific platforms. I use Plex on Linux, Windows, PS4 and Android which all work great with very little hassle.

The majority of options do not even have streaming options and are more for local media only, I've messed with Kodi and was really really not impressed, it was easier to put media on a USB and plug into the TV to play.
Plex is a personal Netflix, that's my requirements

I do disapprove of their data mining and have been looking for a replacement for years but nothing comes close to Plex's player support. :(
Back to top
View user's profile Send private message
Linx_
n00b
n00b


Joined: 01 Jul 2018
Posts: 40

PostPosted: Tue Sep 22, 2020 4:46 pm    Post subject: Reply with quote

Right, an alternative is not really an option due to my needs and some unique features of Plex like Plexpass.

I thought it would be simple to unmerge it and re-merge it from an overlay, but apparently that's not the case. So I'm thinking at this point my best bet is to manually unmask some stuff in ::gentoo and emerge it as if I hadn't synced. Anybody know what I need to unmask to do this?
_________________
I occasionally post sober.
Back to top
View user's profile Send private message
Ionen
Veteran
Veteran


Joined: 06 Dec 2018
Posts: 1438

PostPosted: Tue Sep 22, 2020 5:12 pm    Post subject: Reply with quote

Never used plex media server but I tried to update the ebuild anyway. Feels more like a dirty hack than anything proper and is a security hazard (notably given it seems to use its own vulnerable bundled python) but it installs on current ::gentoo, I'm honestly not sure if it works (looks like it starts).

I have no intention to maintain / bump it, so do what you will with it. Someone who actually use this package could likely do a better job and keep it maintained in an overlay for as long as it can be.

Unmask it if needed, copy old files from /var/db/repos/gentoo/media-tv/plex-media-server to a local overlay (will later need licenses/Plex, and acct-{user,group}/plex too when gentoo remove them after last rite), and add plex-media-server-1.19.5-r1.ebuild:
Code:
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

inherit eutils systemd unpacker pax-utils

MINOR_VERSION="3112-b23ab3896"

_APPNAME="plexmediaserver"
_USERNAME="plex"
_SHORTNAME="${_USERNAME}"
_FULL_VERSION="${PV}.${MINOR_VERSION}"

URI="https://downloads.plex.tv/plex-media-server-new"

DESCRIPTION="A free media library that is intended for use with a plex client"
HOMEPAGE="https://www.plex.tv/"
SRC_URI="
   amd64? ( ${URI}/${_FULL_VERSION}/debian/plexmediaserver_${_FULL_VERSION}_amd64.deb )
   x86? ( ${URI}/${_FULL_VERSION}/debian/plexmediaserver_${_FULL_VERSION}_i386.deb )
"
SLOT="0"
LICENSE="Plex"
RESTRICT="bindist strip"
KEYWORDS="-* ~amd64 ~x86"

DEPEND="
   dev-python/virtualenv
"
BDEPEND="
   dev-util/patchelf
   dev-lang/python:2.7
"

RDEPEND="
   acct-group/plex
   acct-user/plex
   net-dns/avahi"

QA_DESKTOP_FILE="usr/share/applications/plexmediamanager.desktop"
QA_PREBUILT="*"
QA_MULTILIB_PATHS=(
   "usr/lib/${_APPNAME}/.*"
   "usr/lib/${_APPNAME}/Resources/Python/lib/python2.7/.*"
)

BINS_TO_PAX_MARK=(
   "${ED}/usr/lib/plexmediaserver/Plex Script Host"
   "${ED}/usr/lib/plexmediaserver/Plex Media Scanner"
)

S="${WORKDIR}"
PATCHES=(
   "${FILESDIR}/plexmediamanager.desktop.new.patch"
   "${FILESDIR}/plexmediaserver.service.patch"
)

src_unpack() {
   unpack_deb ${A}
}

src_install() {
   # Install base config file
   insinto "/etc/plex/"
   newins "${FILESDIR}/etc-plexmediaserver" "plexmediaserver"

   # Remove Debian apt repo files
   rm -r "etc/apt" || die

   # Remove Debian specific files
   rm -r "usr/share/doc" || die

   # Copy main files over to image and preserve permissions so it is portable
   cp -rp usr/ "${ED}"/ || die

   # Make sure the logging directory is created
   local logging_dir="/var/log/pms"
   dodir "${logging_dir}"
   fowners "${_USERNAME}":"${_USERNAME}" "${logging_dir}"
   keepdir "${logging_dir}"

   # Create default library folder with correct permissions
   local default_library_dir="/var/lib/${_APPNAME}"
   dodir "${default_library_dir}"
   fowners "${_USERNAME}":"${_USERNAME}" "${default_library_dir}"
   keepdir "${default_library_dir}"

   # Install the OpenRC init/conf files
   doinitd "${FILESDIR}/init.d/${PN}"
   doconfd "${FILESDIR}/conf.d/${PN}"

   # Mask Plex libraries so that revdep-rebuild doesn't try to rebuild them.
   # Plex has its own precompiled libraries.
   _mask_plex_libraries_revdep

   # Fix RPATH
   patchelf --force-rpath --set-rpath '$ORIGIN:$ORIGIN/../../../../../../lib' "${ED}"/usr/lib/plexmediaserver/Resources/Python/lib/python2.7/lib-dynload/_codecs_kr.so || die

   # Install systemd service file
   systemd_newunit "${FILESDIR}/systemd/${PN}.service" "${PN}.service"

   # Add pax markings to some binaries so that they work on hardened setup
   for f in "${BINS_TO_PAX_MARK[@]}"; do
      pax-mark m "${f}"
   done

   # Install start_pms script
   into /usr
   dosbin "${FILESDIR}/start_pms"

   einfo "Configuring virtualenv"
   virtualenv -v -p /usr/bin/python2.7 --no-pip --no-setuptools --no-wheel "${ED}"/usr/lib/plexmediaserver/Resources/Python || die
   pushd "${ED}"/usr/lib/plexmediaserver/Resources/Python &>/dev/null || die
   find . -type f -exec sed -i -e "s#${D}##g" {} + || die
   popd &>/dev/null || die
}

pkg_postinst() {
   elog "Plex Media Server is now installed. Please check the configuration"
   elog "file in /etc/${_SHORTNAME}/${_APPNAME}"
   elog "to verify the default settings."
   elog "To start the Plex Server, run 'rc-config start plex-media-server',"
   elog "you will then be able to access your library at"
   elog "http://<ip>:32400/web/"
}

# Adds the precompiled plex libraries to the revdep-rebuild's mask list
# so it doesn't try to rebuild libraries that can't be rebuilt.
_mask_plex_libraries_revdep() {
   dodir /etc/revdep-rebuild/

   # Bug: 659702. The upstream plex binary installs its precompiled package to /usr/lib.
   # Due to profile 17.1 splitting /usr/lib and /usr/lib64, we can no longer rely
   # on the implicit symlink automatically satisfying our revdep requirement when we use $(get_libdir).
   # Thus we will match upstream's directory automatically. If upstream switches their location,
   # then so should we.
   echo "SEARCH_DIRS_MASK=\"${EPREFIX}/usr/lib/plexmediaserver\"" > "${ED}"/etc/revdep-rebuild/80plexmediaserver
}
Edit: Note that ebuild still depend on python:2.7, but no longer need 2.7's virtualenv nor python eclasses. While it'll happen eventually I doubt interpreter itself is getting removed from gentoo anytime soon. This requirement can probably be removed by relying on the bundled python but given I don't know this package (nor python/virtualenv much) I kept it more as-is hoping nothing breaks.
Back to top
View user's profile Send private message
Linx_
n00b
n00b


Joined: 01 Jul 2018
Posts: 40

PostPosted: Mon Sep 28, 2020 12:10 am    Post subject: Reply with quote

Oh fantastic, thank you. I'll give this a try and let you know how it works.
_________________
I occasionally post sober.
Back to top
View user's profile Send private message
Linx_
n00b
n00b


Joined: 01 Jul 2018
Posts: 40

PostPosted: Mon Sep 28, 2020 2:40 am    Post subject: Reply with quote

The ebuild worked like a champ. I tweaked it just a little to update to the newest version (1.20.2) and everything works.

Thanks a million!
_________________
I occasionally post sober.
Back to top
View user's profile Send private message
Ionen
Veteran
Veteran


Joined: 06 Dec 2018
Posts: 1438

PostPosted: Mon Sep 28, 2020 2:54 am    Post subject: Reply with quote

Good to hear :)
Back to top
View user's profile Send private message
Ionen
Veteran
Veteran


Joined: 06 Dec 2018
Posts: 1438

PostPosted: Mon Sep 28, 2020 2:39 pm    Post subject: Reply with quote

It's not merged yet but the plex-overlay also has this pull request which removes both the "system" py:2.7 and virtualenv dep (had a 2nd look at bug #735396 for updates and saw it mentioned in comment #10).

Reading its description it may not be fully ready for use yet but may get properly maintained there once sorted out. For ::gentoo not sure if it'll be allowed to come back with its bundled modified py2 libraries, so "could" be overlay-only for a very long time.
Back to top
View user's profile Send private message
Bigun
Advocate
Advocate


Joined: 21 Sep 2003
Posts: 2165

PostPosted: Tue Nov 03, 2020 10:27 am    Post subject: Reply with quote

Avid Plex user here.

I think we're banging on the wrong door.

https://forums.plex.tv/t/when-will-plex-media-server-shift-to-python-3/600689/41

Make some noise.
_________________
"It's ok, they might have guns but we have flowers." - Perpetual Victim
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum