Ubuntu 22.04 Packaging - development & preview

I switched from intel-media-va-driver to intel-media-va-driver-non-free and launched these commands (from Can Jasper Lake N6005 use hardware transcoding? - #31 by realEthanZou) :
echo "options i915 enable_guc=2" > /etc/modprobe.d/i915.conf
update-initramfs -u

Now hardware transcoding is working :slight_smile:

1 Like

Thank you!

I will report that immediately!

1 Like

Will this package be updated to be compatible with other Debian/Ubuntu versions as well? The preinst script just fails silently on Ubuntu 20.04 right now.

I was hoping to use it to identify the configuration for hardware accelerated HDR transcoding on Intel graphics, but I ended up tracking down the 21.49.21786 igc/opencl packages instead.

Fails silently?

Show me please. (including console output from your terminal session)
Also please show me the contents of /tmp/plexinstaller.log

This is the error I get:

Preparing to unpack plexmediaserver_1.27.0.5878-8f821a871_amd64.deb ...
PlexMediaServer install: Pre-installation Validation.
dpkg: error processing archive plexmediaserver_1.27.0.5878-8f821a871_amd64.deb (--install):
 new plexmediaserver package pre-installation script subprocess returned error exit status 1
dpkg: error while cleaning up:
 installed plexmediaserver package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 plexmediaserver_1.27.0.5878-8f821a871_amd64.deb

No /tmp/plexinstaller.log was created.

If I run sudo bash -x /var/lib/dpkg/info/plexmediaserver.preinst (from the existing Plex Pass package of 1.27.0.5878-8f821a871 that is installed), that does succeed.

whose 1.27.0 did you use???

you show invoking preinstall on the already installed PMS version.
This is of no benefit ???

The failing plexmediaserver_1.27.0.5878-8f821a871_amd64.deb is the one from your Google Drive link. I was just stating that the preinst for the Plex Pass package for the same version works fine.

Your reported failure isn’t a failure.

You must install as ‘root’. That’s how DPKG works.

There is no need to run just the preinst anymore.

All changes have passed QA testing and have been submitted to Engineering for inclusion.

I am running dpkg -i as root. Your preinst is failing. I was just using the other one for comparison, I am aware it doesn’t help with the current package. I used to be a Debian package maintainer.

[trisk@menchi]% sudo dpkg -i plexmediaserver_1.27.0.5878-8f821a871_amd64.deb                                                                                     ~
(Reading database ... 113464 files and directories currently installed.)
Preparing to unpack plexmediaserver_1.27.0.5878-8f821a871_amd64.deb ...
PlexMediaServer install: Pre-installation Validation.
dpkg: error processing archive plexmediaserver_1.27.0.5878-8f821a871_amd64.deb (--install):
 new plexmediaserver package pre-installation script subprocess returned error exit status 1
dpkg: error while cleaning up:
 installed plexmediaserver package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 plexmediaserver_1.27.0.5878-8f821a871_amd64.deb

@iscaela

Are you using Debian or Ubuntu?
Are you installing in any type of container?

I’ve tested on Debian 10 & 11, Ubuntu 18->22

What do the system logs show?

This is Ubuntu 20.04 on bare metal. I ran your preinst manually with bash -x just now, and this is the end of the output where the script terminates early with exit code 1.

[trisk@menchi]% dpkg -e plexmediaserver_1.27.0.5878-8f821a871_amd64.deb .
[trisk@menchi]% sudo bash ./preinst; echo $?                                                                                                      
PlexMediaServer install: Pre-installation Validation.
1
[trisk@menchi]% sudo bash -x ./preinst 2>&1 | tail -20
+ '[' 5905 = '' ']'
++ grep '^ID=' /etc/os-release
++ sed -e 's/^.*=//'
+ DistroName=ubuntu
++ grep '^VERSION_ID=' /etc/os-release
++ tr -d '".'
++ sed -e 's/^.*=//'
+ DistroVersion=2004
+ '[' 1 -gt 0 ']'
+ '[' ubuntu = ubuntu ']'
+ '[' 2004 -lt 2100 ']'
+ BeignetAvailable=1
+ '[' ubuntu = debian ']'
+ '[' 0 -gt 0 ']'
+ '[' 0 -gt 0 ']'
+ '[' 1 -gt 0 ']'
++ echo G5905
++ grep -E 'N5|N6|N7'
++ cut -c 1-2
+ HaveIntelN=

The last executed line is 623:

        HaveIntelN="$(echo $Processor | cut -c 1-2 | grep -E 'N5|N6|N7')"                                                                                                                                                                                                            

The model name of my CPU is Intel(R) Celeron(R) G5905 CPU @ 3.50GHz so $Processor is G5905. I think the set -e at the top of the script is causing it to exit when the grep in the subshell returns 1.

That is bizarre.

You have a G5905 CPU ?

This CPU is Comet Lake so it should be treated the same as Core 10* and Pentium G6* products.

Let me go look.

BRB

Feel like making a change and testing?

Cover your ears while I share my thoughts about Intel naming please :hear_no_evil:
LOL

    620       # JasperLake and above N-series or G-series
    621       if [ $HaveIntelCeleron -gt 0 ]; then
    622 
    623         HaveIntelN="$(echo $Processor | cut -c 1-2 | grep -E 'N5|N6|N7|G5|G6|G7|G8')"
    624         [ "$HaveIntelN" != "" ] && NeedBeignet=0 && NeedOpenCL=0 && NeedIntelCompute=1 && NeedIntelOpenCL=1
    625       fi
    626 
    627       # Intel Xeons with QSV capability
    628       # https://ark.intel.com/content/www/us/en/ark/products/codename/90354/comet-lake.html
    629 

Apply the above to your preinst and run it again.

It will call it an N-series in the code but set the more-important flags for Intel Compute Runtime

I’ll make the note to fix it all properly when the next family of CPUs comes out.
(no idea what those letter codes will be)

Code execution is string based.
All variables are double qouted so execution does not fail.

Without the change, HaveIntelN is null.

The following statement checks to make sure “$HaveIntelN” != “” (not null)
[ "$HaveIntelN" != "" ] && NeedBeignet=0 && NeedOpenCL=0 && NeedIntelCompute=1 && NeedIntelOpenCL=1

If not null then we have a N or G series and set the ICR flags.

This fixes my immediate issue, but problem is the "$HaveIntelN" != "" check is never executed if the grep does not match because the script exits immediately.

If I replace it with:

    620       # JasperLake and above N-series or G-series
    621       if [ $HaveIntelCeleron -gt 0 ]; then
    622 
    623         HaveIntelN="$(echo $Processor | cut -c 1-2 | grep -E 'N5|N6|N7|G5|G6|G7|G8' || true)"
    624         [ "$HaveIntelN" != "" ] && NeedBeignet=0 && NeedOpenCL=0 && NeedIntelCompute=1 && NeedIntelOpenCL=1
    625       fi

This does also work when $Processor is outside of those prefixes, but I think a better option would be to use a switch statement here.

The statement must execute.
As you can see, there are no syntax errors.

open a terminal window and construct the case:

# Processor info
Model="$(cat /proc/cpuinfo | grep 'model name' | uniq | awk -F': ' '{print $2}')"
Processor="$(cat /proc/cpuinfo | grep 'model name' | uniq | awk -F ': ' '{print $2}' | awk '{print $3}')"

if [ "$(echo "$Model" | grep -c Intel)" -gt 0 ]; then

  # Have an Intel CPU
  HaveIntel=1

  [ "$(echo $Model | grep -c Core)"    -gt 0 ] && HaveIntelCore=1
  [ "$(echo $Model | grep -c Xeon)"    -gt 0 ] && HaveIntelXeon=1
  [ "$(echo $Model | grep -c Celeron)" -gt 0 ] && HaveIntelCeleron=1

  # Is there an Intel i915 present (possible QSV capability)
  [ "$(echo /sys/module/i915/drivers/pci:i915/*:*:*.*)" != "/sys/module/i915/drivers/pci:i915/*:*:*.*" ] && Havei915=1
fi

    # Attempt to determine QSV level based on CPU family (SKL, KBL, etc / selected Xeons)
    CPUSKU="$(echo $Processor | sed -e 's/[^-]*-//' | sed -e 's/ .*$//' | tr -d '[A-Za-z]')"

Now we have Model and Processor defined.

Next we run the detector

      # Beignet? - (KabyLake, GeminiLake, and CoffeeLake)
      [ $HaveIntelCore -gt 0 ] && [ $CPUSKU -ge 7000 ] && [ $CPUSKU -lt 10000 ] && NeedBeignet=1 && NeedOpenCL=1

      # Intel Compute Runtime? - (CometLake, TigerLake, AlderLake, and above)
      [ $HaveIntelCore -gt 0 ] && [ $CPUSKU -ge 10000 ] && NeedIntelCompute=1

      # JasperLake and above N-series or G-series
      if [ $HaveIntelCeleron -gt 0 ]; then

        HaveIntelN="$(echo $Processor | cut -c 1-2 | grep -E 'N5|N6|N7|G5|G6|G7|G8')"
        [ "$HaveIntelN" != "" ] && NeedBeignet=0 && NeedOpenCL=0 && NeedIntelCompute=1 && NeedIntelOpenCL=1
      fi

The variables should be defined and there should be no errors.

The problem is the execution would end at line 623 because of the set -e causes the script to exit with failure whenever any command returns a non-zero exit status. When grep does not match, line 624 onwards was never executed because of the non-zero exit status from grep. Now the grep succeeds for my CPU with the new pattern, but the script will still fail in the same way for a processor that does not match the pattern instead of just not assigning HaveIntelN.

So you either need to mask the exit status of grep on line 623 or use grep -c like elsewhere, which will always exit with status 0.

This can also be avoided by not using external commands like grep at all, which is also cleaner:

      # JasperLake and above N-series                                                                                                                              
      if [ $HaveIntelCeleron -gt 0 ] || [ $HaveIntelPentium -gt 0 ]; then                                                                                          
        case "$Processor" in                                                                                                                                       
          N[5-7]*)                                                                                                                                                 
            HaveIntelN=1                                                                                                                                           
            ;;                                                                                                                                                     
          G[5-8]*)                                                                                                                                                 
            HaveIntelN=1                                                                                                                                           
            ;;                                                                                                                                                     
        esac 

And for the chunk above around line 573:

if [ "$Model" = "Intel"* ]; then                                                                                                              
                                                                                                                                                                   
  # Have an Intel CPU                                                                                                                                              
  HaveIntel=1                                                                                                                                                      
                                                                                                                                                                   
  case "$Model" in                                                                                                                                                 
    *Core*)                                                                                                                                                        
      HaveIntelCore=1                                                                                                                                              
      ;;                                                                                                                                                           
    *Xeon*)                                                                                                                                                        
      HaveIntelXeon=1                                                                                                                                              
      ;;                                                                                                                                                           
    *Celeron*)                                                                                                                                                     
      HaveIntelCeleron=1                                                                                                                                           
      ;;                                                                                                                                                           
    *Pentium*)                                                                                                                                                     
      HaveIntelPentium=1                                                                                                                                           
      ;;                                                                                                                                                           
  esac                                                                                                                                                             
                                                                                                                                                                   
  # Is there an Intel i915 present (possible QSV capability)                                                                                                       
  [ "$(echo /sys/module/i915/drivers/pci:i915/*:*:*.*)" != "/sys/module/i915/drivers/pci:i915/*:*:*.*" ] && Havei915=1                                             
fi

OH… Now I see what you’re showing me.

How about this?

[chuck@lizum Lucy (2014).2025]$ echo $Processor
G5905
[chuck@lizum Lucy (2014).2026]$ HaveIntelN="$(echo $Processor | cut -c 1-2 | grep -o '[NG][5-8]')"
[chuck@lizum Lucy (2014).2027]$ echo $?
0
[chuck@lizum Lucy (2014).2028]$ echo $HaveIntelN
G5
[chuck@lizum Lucy (2014).2029]$

In the main shell:

[chuck@lizum Lucy (2014).2029]$ echo $Processor | cut -c 1-2 | grep -o '[NG][5-8]'
G5
[chuck@lizum Lucy (2014).2030]$ echo $?
0
[chuck@lizum Lucy (2014).2031]$

This isn’t going to work either… Working further.

[chuck@lizum ~.2035]$ 
[chuck@lizum ~.2035]$ Processor=123
[chuck@lizum ~.2036]$ echo $Processor | cut -c 1-2 | grep -o '[NG][5-8]'
[chuck@lizum ~.2037]$ echo $?
1
[chuck@lizum ~.2038]$ 

I’m trying to avoid a very messy set of case statements which will snowball in the future

      # JasperLake and above N-series                                                                                                                              
      if [ $HaveIntelCeleron -gt 0 ] || [ $HaveIntelPentium -gt 0 ]; then                                                                                          
        case "$Processor" in                                                                                                                                       
          N[5-7]*)                                                                                                                                                 
            HaveIntelN=1                                                                                                                                           
            ;;                                                                                                                                                     
          G[5-8]*)                                                                                                                                                 
            HaveIntelN=1                                                                                                                                           
            ;;                                                                                                                                                     
        esac 

This really looks like the cleanest way to run through it.