Announcement

Collapse
No announcement yet.

Camper_Pi_Plex - Media Server

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Camper_Pi_Plex - Media Server

    This post is long overdue - but I had a power issue which caused linux kernel corruption leading me to start over on the software side.

    Thank you WRingling for your inspiration over at: https://gdrvowners.com/forum/operati...9-337rls/page2

    Run Plex Media Server
    Small
    Lightweight
    Low Power usage
    Use 2.5" hard drives (1 for OS and 1 for Data)
    Preferably - also able to take an external USB drive for additional content.

    The goal is to stream content from to our Google Chromecasts (over wifi) for rainy days and maybe even to tablets in the vehicle while travelling. I think anyone can do what I am working on below - but disclaimer - I have worked in Technology for 20 years....hopefully the writeup will help all.

    Parts list:

    Raspberry Pi 4 8 GB (includes slick power adapter with switch, micro hdmi to hdmi cable, fan, heatsinks and a case I won't be using.
    https://www.amazon.com/dp/B0897XZDF2...roduct_details

    Raspberry Pi Hat - UPS + Power Management Board x708 v1.2 - (The one with with the battery holder and U100-A1)
    https://geekworm.com/products/raspbe...th-cooling-fan

    Raspberry Pi 4 x829 Dual 2.5" SATA SSD/HDD Storage/Expansion board
    https://geekworm.com/products/for-ra...xpansion-board

    Was concerned this would be missing - so ordered a USB 3.0 adapter - this is garbage and does not work with the setup
    https://geekworm.com/products/usb3-0-connector

    I wanted to purchase the X829 C-1 (Kit) with a metal case. It was not available and they now have removed it from their website and amazon. I could not find anywhere on the web....only to find out it is now discontinued. I have the 3D project file....that could be converted into *.stl files to print it.....but would love to get this made in metal. Crushed I cannot purchase the case. Not sure if it would have changed what I purchased or not. Here is another case that supposedly won't fit my setup:
    https://geekworm.com/collections/ras...ch-cooling-fan

    Power button - since I couldn't get the kit...I bought a button later. Only the instant supposedly works with my power management UPS HAT.
    https://www.amazon.com/Geekworm-Latc.../dp/B086LFGDJF

    Purchased batteries here:
    https://www.18650batterystore.com/pr...=OrderlyEmails

    I saw down one evening with my little boy and had him help me assemble the PI with (2) 2.5" SSD drives I already had on hand. The assembly is the quick part....software setup will take longer.

    Click image for larger version  Name:	PXL_20210623_000453388.jpg Views:	30 Size:	130.0 KB ID:	58361Click image for larger version  Name:	PXL_20210623_000429711.jpg Views:	22 Size:	147.8 KB ID:	58362Click image for larger version  Name:	PXL_20210623_000457255.jpg Views:	22 Size:	142.9 KB ID:	58363Click image for larger version  Name:	PXL_20210623_000511683.jpg Views:	22 Size:	84.9 KB ID:	58364Click image for larger version  Name:	PXL_20210623_000436444.jpg Views:	22 Size:	135.3 KB ID:	58365
    Last edited by howson; 06-23-2021, 06:10 AM.
    2020 Imagine 2400BH
    2017 Ford F350 Platinum FX4/4x4 SuperCrew 6.7L V8 Diesel 9' Bed SRW, Leveled + Airbags

    Our Mods

  • #2
    Next step: Software.

    I wanted to run Ubuntu Server (headless - no desktop or GUI - just command line) to reserve all the power for media. At least for now. I can always install the desktop experience through the terminal/command line. Why ubuntu instead of Raspbian? It's significantly faster. We will also be booting off one of the SSD's over USB 3.0 - why? Again, it is significantly faster than the microsd card on the Pi.

    Downloaded Raspberry Pi Manager
    https://www.raspberrypi.org/software/

    Attached the 2.5" HD with an adapter (although the above board works too) and then selected the storage in the tool above and for the OS: "Other General Purpose OS", "Ubuntu", and finally "Ubuntu Server 20.04.2 LTS (RPi 3/4/400". I always go for LTS or Long Term Support options when I can. If you are following this and want a desktop version just choose desktop.

    I then used the tool to flash the 2.5" SSD hard drive. Both of my aforementioned drives are SSD's.

    At this point the Pi 4 is not bootable. I used a micro SD card that was already flashed with Raspbian (from another older Pi) and I stuck it in the new one and booted up. I ran all updates to firmware etc. on Raspbian. To do this we have to update the Pi's EEPROM. I did this from terminal despite the Raspbian GUI/desktop.

    Update Raspbain
    sudo apt update
    sudo apt upgrade
    May have run the above more than once.

    Note: Nano is my favorite text editor in ubuntu.


    Set and run eeprom updates
    sudo nano /etc/default/rpi-eeprom-update

    Change the line: "FIRMWARE_RELEASE_STATUS" from critical to stable.
    CTRL +X , yes and save.

    Next - run the updates

    sudo rpi-eeprom-update -a
    Allow update to finish.

    Update Firmware Files for Ubuntu drive
    I then updated firmware files on ubuntu (not sure this step was necessary).....but I think it was.
    download available here: https://github.com/raspberrypi/firmw...ee/master/boot
    Copied all *.dat and *.elf files to the ubuntu boot partition on the disk.

    Kernel Decompress
    Needed to decompress the kernel because pi won't boot a compressed kernel.
    zcat vmlinuz > vmlinux

    Set Kernel and other config
    Update a config file:
    sudo nano config.txt
    should look like this:

    [pi4]
    max framebuffers=2
    dtoverlay=vc4-fkms-v3d
    boot_delay
    kernel=vmlinux
    initramfs initrd.img followkernel

    Note: I fat fingered the above entry on the last line and had an imitd.img or something and it failed to boot....had to come back to raspian and fix.

    AutoDecompress Kernel- I found a page (and another) that has the above steps of sorts...but has an auto decompression script for the kernel. Make sure terminal is in the correct directory.
    sudo nano auto_decompress_kernel

    #!/bin/bash -e #Set Variables BTPATH=/boot/firmware CKPATH=$BTPATH/vmlinuz DKPATH=$BTPATH/vmlinux #Check if compression needs to be done. if [ -e $BTPATH/check.md5 ]; then if md5sum --status --ignore-missing -c $BTPATH/check.md5; then echo -e "\e[32mFiles have not changed, Decompression not needed\e[0m" exit 0 else echo -e "\e[31mHash failed, kernel will be compressed\e[0m" fi fi #Backup the old decompressed kernel mv $DKPATH $DKPATH.bak if [ ! $? == 0 ]; then echo -e "\e[31mDECOMPRESSED KERNEL BACKUP FAILED!\e[0m" exit 1 else echo -e "\e[32mDecompressed kernel backup was successful\e[0m" fi #Decompress the new kernel echo "Decompressing kernel: "$CKPATH".............." zcat $CKPATH > $DKPATH if [ ! $? == 0 ]; then echo -e "\e[31mKERNEL FAILED TO DECOMPRESS!\e[0m" exit 1 else echo -e "\e[32mKernel Decompressed Succesfully\e[0m" fi #Hash the new kernel for checking md5sum $CKPATH $DKPATH > $BTPATH/check.md5 if [ ! $? == 0 ]; then echo -e "\e[31mMD5 GENERATION FAILED!\e[0m" else echo -e "\e[32mMD5 generated Succesfully\e[0m" fi #Exit exit 0<br>
    Save and exit nano.

    Then 1 last script:
    sudo nano /etc/apt/apt.conf.d/999_decompress_rpi_kernel

    DPkg::Post-Invoke {"/bin/bash /boot/firmware/auto_decompress_kernel"; };<br> Then use chmod to make it executable: sudo chmod +x /etc/apt/apt.conf.d/999_decompress_rpi_kernel
    Save and exit nano. Last but not least - we need to actually set the Pi to boot from USB. sudo raspi-config Boot options Select Boot Rom Version...hit enter. Select Latest. Popup will ask to reset boot ROM to default - NO Select Boot order Select USB Boot. Hit OK. Hit No. Now I am ready to shut down the Pi (running Raspbian from micro SD) and boot off of USB 3.0 SSD drive running Ubuntu 20.04.2 LTS.
    Last edited by bellis; 06-22-2021, 09:22 PM.
    2020 Imagine 2400BH
    2017 Ford F350 Platinum FX4/4x4 SuperCrew 6.7L V8 Diesel 9' Bed SRW, Leveled + Airbags

    Our Mods

    Comment


    • #3
      Update ubuntu and test my auto decompile kernel scripts.

      sudo apt update
      sudo apt upgrade
      Yes
      Wait until update is finished. Should decompile kernel at the end if updates were needed that are related.

      sudo reboot 0

      Post reboot I probably ran through the update sequence again just for good measure.

      Installing plexmediaserver. This page will have the steps. I did not install the https transport and I did not need it...I think it was already installed.

      Plex Future Updates
      I wanted to add it to the repository so I could use apt for updates in the future. The 2 below commands assist with this.

      curl https://downloads.plex.tv/plex-keys/PlexSign.key | sudo apt-key add -

      echo deb https://downloads.plex.tv/repo/deb public main | sudo tee /etc/apt/sources.list.d/plexmediaserver.list

      Plex install
      I may have departed from here and used wget to download plexmediaserver and dpkg -i to install the package.

      I pulled the mac address off my firewall and set the DHCP server to always hand out a specific address to this box. That way I can take it home or to the camper and it will have the same IP (will have to do so at the camper as well).

      Hostname change.
      sudo nano /etc/hostname
      default is ubuntu. plex-pi or little-plex seems appropriate.
      Save and exit file.
      2020 Imagine 2400BH
      2017 Ford F350 Platinum FX4/4x4 SuperCrew 6.7L V8 Diesel 9' Bed SRW, Leveled + Airbags

      Our Mods

      Comment


      • #4
        Excellent write up so far! Subscribing to follow along, I have done some Pi work, and have toyed with a media server, but have never gone ahead with it.
        Forum moderators are not GD employees--we are volunteers and owners presumably just like yourself. Unless specifically mentioned otherwise, we have nothing to gain should you choose to purchase a product or engage a service we discuss on this forum.​

        Neil Citro
        2018 Reflection 28BH Pepwave
        2019 F350 6.7L Long Bed Crew Cab

        Comment


        • #5
          2nd Drive configure

          We added 2 USB drives via the hardware from geekworm. So, need to get the other up and running. I formatted ext4. But, need to automount it when it boots.

          sudo lsblk

          Get the UUID
          Create a directory to mount to: sudo mkdir /data

          Automount point:
          sudo nano /etc/fstab

          Add the following to the end:

          UUID=<Your UUID> /data auto nosuid,nodev,nofail,x-gvfs-show 0 0

          Create folders
          sudo mkdir /data/Movies
          sudo mkdir /data/TV_Shows

          Setup smb shares so I can move content easier.
          sudo apt-get install samba smbfs

          Update Again
          sudo apt update
          sudo apt upgrade

          Set Samba Shares
          sudo nano /etc/samba/smb.conf

          Change workgroup if desired
          Create shares at end of file:

          #Movie Share
          [Movies]
          comment = Plex Movies
          path = /data/Movies
          read only = no
          guest ok = no
          browseable = yes
          writeable = yes
          valid users = <your user>

          #TV Share
          [TV_Shows]
          comment = Plex TV Shows
          path = /data/TV_Shows
          read only = no
          guest ok = no
          browseable = yes
          writeable = yes
          valid users = <your user>

          Restart smb service
          sudo /etc/init.d/smbd restart

          Set Permissions on your folder
          sudo chmod 0777 </data/Movies> do again /data/TV_Shows

          Allow samba through firewall
          sudo ufw allow samba

          Create user for samba
          sudo useradd <your user>

          Set password for new user.
          sudo passwd <your user>

          Add user to samba password
          sudo smbpasswd -a <your user>


          Plex service already starts with the server so no need to check. SSH Server is already running; no need to install.

          Configure Plex. http://plex_server_IP:32400/web
          Sign in (I have a plexpass account).
          Add libraries and add content!
          2020 Imagine 2400BH
          2017 Ford F350 Platinum FX4/4x4 SuperCrew 6.7L V8 Diesel 9' Bed SRW, Leveled + Airbags

          Our Mods

          Comment


          • #6
            Originally posted by ncitro View Post
            Excellent write up so far! Subscribing to follow along, I have done some Pi work, and have toyed with a media server, but have never gone ahead with it.
            I thought about syncing libraries between home plex and camper plex....but it's just not worth it. I figured run both as separate boxes and don't bother with trying to sync the libraries...although it can be done. I think you are full time - Plexmediaserver will also run on some NAS boxes as well as windows, mac, etc. Client runs on tons of stuff....including phones and tablets as well as browsers and PC's.
            2020 Imagine 2400BH
            2017 Ford F350 Platinum FX4/4x4 SuperCrew 6.7L V8 Diesel 9' Bed SRW, Leveled + Airbags

            Our Mods

            Comment


            • #7
              Originally posted by bellis View Post

              I thought about syncing libraries between home plex and camper plex....but it's just not worth it. I figured run both as separate boxes and don't bother with trying to sync the libraries...although it can be done. I think you are full time - Plexmediaserver will also run on some NAS boxes as well as windows, mac, etc. Client runs on tons of stuff....including phones and tablets as well as browsers and PC's.
              Part time at best unfortunately. Couple months at a time out, but still have a house and office with a few server’s as well as a Netgear and Synology NAS.

              Forum moderators are not GD employees--we are volunteers and owners presumably just like yourself. Unless specifically mentioned otherwise, we have nothing to gain should you choose to purchase a product or engage a service we discuss on this forum.​

              Neil Citro
              2018 Reflection 28BH Pepwave
              2019 F350 6.7L Long Bed Crew Cab

              Comment


              • #8
                Great write up... curious, how do you transcode the videos? My understanding is the rpi won't be powerful enough to do that. Is that right?
                2021 Reflection 31MB
                2020 F-250 XLT 4x4 SD Crew Cab 8 ft. box
                Full-Time (Starting in Dec, 2021)

                Comment


                • #9
                  Originally posted by nateritter View Post
                  Great write up... curious, how do you transcode the videos? My understanding is the rpi won't be powerful enough to do that. Is that right?
                  Great question - I guess I am about to find out. On initial tests using Chrome browser - it transcodes down to SD quality. Pi connected via ethernet and laptop on wifi with chrome browser. So...I think it may be powerful enough? I could always overclock it as well - when I get to the case side of life I hope to add another fan. Here is praying this isn't a bust!
                  2020 Imagine 2400BH
                  2017 Ford F350 Platinum FX4/4x4 SuperCrew 6.7L V8 Diesel 9' Bed SRW, Leveled + Airbags

                  Our Mods

                  Comment


                  • #10
                    Originally posted by bellis View Post

                    Great question - I guess I am about to find out. On initial tests using Chrome browser - it transcodes down to SD quality. Pi connected via ethernet and laptop on wifi with chrome browser. So...I think it may be powerful enough? I could always overclock it as well - when I get to the case side of life I hope to add another fan. Here is praying this isn't a bust!
                    Cool. Please report back as I'd love to find a way to transcode using rpi's. I have an old one that isn't powerful enough to do it. I've heard people download on their laptops, transcode there, and then move it over to the rpi, but that seems like more of a headache to me. I'd prefer to do the downloading and transcoding at the same place, but I haven't tried a newer rpi yet to find out if it can do it.

                    Would love to know how your experience turns out.
                    2021 Reflection 31MB
                    2020 F-250 XLT 4x4 SD Crew Cab 8 ft. box
                    Full-Time (Starting in Dec, 2021)

                    Comment


                    • #11
                      Originally posted by nateritter View Post

                      Cool. Please report back as I'd love to find a way to transcode using rpi's. I have an old one that isn't powerful enough to do it. I've heard people download on their laptops, transcode there, and then move it over to the rpi, but that seems like more of a headache to me. I'd prefer to do the downloading and transcoding at the same place, but I haven't tried a newer rpi yet to find out if it can do it.

                      Would love to know how your experience turns out.
                      So far I have only tried in a browser over wireless and it worked....it kept dropping quality on me....not sure that is the best test. I need to do a wireless upgrade in the camper with the pi hardwired in to see what that looks like on the chromecasts....or worse case another pi with raspley or something. IE it would be great if I could avoid transcoding altogether and have it direct stream....

                      But, will keep you posted....I still have a lot more work to do on it.

                      Upcoming Work/Posts for it:

                      1. Wifi - have had some issues....not resolved ready to post yet.
                      2. Auto-mount external USB drive
                      3. UPS / power management hat config (button power off etc).
                      4. Build or get someone to make a case.
                      5. Another post - dream of peplink =)
                      2020 Imagine 2400BH
                      2017 Ford F350 Platinum FX4/4x4 SuperCrew 6.7L V8 Diesel 9' Bed SRW, Leveled + Airbags

                      Our Mods

                      Comment


                      • #12
                        Behind on my updates for this. While this is hopefully a headless device...I wanted to add a wireless keyboard just in case (for the road).

                        sudo apt install pi-bluetooth

                        sudo bluetoothctl
                        scan on

                        Should give Device with mac address in results.

                        pair <mac address>
                        Enter PIN code.
                        Connect <mac address>

                        I may have manually used the trust command as well.

                        exit

                        More to come!
                        2020 Imagine 2400BH
                        2017 Ford F350 Platinum FX4/4x4 SuperCrew 6.7L V8 Diesel 9' Bed SRW, Leveled + Airbags

                        Our Mods

                        Comment


                        • #13
                          Hey bellis ,

                          So I run Roku's and Plex at my home. (I ran Windows Media Center and xbox360's up till last year).

                          I've been taking the poor man's route for the last year with the camper. I Launch the plex app on my phone, which I've pre-downloaded the movies on before I left, and do a local screenshare from my phone to the Roku. It works great, and does not require ANY internet. (We dry-camp on the beach alot, and have no service there)

                          I'll be keeping an eye on this. I might have a new hobby when you get it all working. :-)
                          Mike
                          2017 Imagine 2800BH pushing a 2019 Ford F150 Platinum

                          Formerly: 2002 Rockwood Popup
                          Location: Massachusetts

                          Comment

                          Working...
                          X