Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Files being written as root user instead of using PGID and PUID variables #10

Open
robflate opened this issue Jul 1, 2022 · 1 comment

Comments

@robflate
Copy link

robflate commented Jul 1, 2022

I've set the env vars PGID and PUID to my local user but Bliss is saving cover art files as the root user.

How can I fix this? Thanks.

@FranLl
Copy link

FranLl commented Jul 7, 2023

@robflate The problem still exists today but I have managed to "make an arrangement" by changing one line of the script "/bliss/bliss-runner.sh". The user created with the PGID and PUID passed is the user "abc":

franll@server: ~$ cat docker-compose.yml
...
build: bliss
  environment:
   - PUID=1100
   - PGID=1101
...
franll@server: ~$ docker exec -it bliss sh
root@bliss:/bliss# id abc
uid=1100(abc) gid=1101(abc) groups=1101(abc),1000(users)
root@bliss:/bliss#

Then, in the script I have changed "sh /bliss/bin/bliss.sh" for "su -s /bin/sh abc -c /bliss/bin/bliss.sh"

root@bliss:/bliss# cat /bliss/bliss-runner.sh 
# Script to restart bliss after an update
# Only needed for the Docker build, to stop the container exiting after an update
#
if [ ! -d /config/.java ] || [ ! -L /root/.java ]
then
  mkdir /config/.java
  ln -s /config/.java /root/.java
fi
while [ true ]
do
    #Modified by me
    su -s /bin/sh abc -c /bliss/bin/bliss.sh

    if [ "$?" = "0" ]; then
        echo "bliss.sh exited, restarting..."
        sleep 2
    else
        echo "bliss.sh exited with a non-zero value, exiting..."
        exit 1
    fi
done

And then Bliss is executed with the user abc:

root@bliss:/bliss# ps -aux
USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root           1  0.0  0.0    204     4 ?        Ss   21:00   0:00 s6-svscan -t0 /var/run/s6/services
root          34  0.0  0.0    188     8 ?        S    21:00   0:00 foreground  if   /etc/s6/init/init-stage2-redirfd   foreground    if     if      s6-echo      -n      --      [s6-init] making user prov
root          35  0.0  0.0    204     4 ?        S    21:00   0:00 s6-supervise s6-fdholderd
root          46  0.0  0.0    184     4 ?        S    21:00   0:00 foreground  s6-setsid  -gq  --  with-contenv  backtick  -D  0  -n  S6_LOGGING   printcontenv   S6_LOGGING    importas  S6_LOGGING  S6_LO
root         258  0.0  0.0   1600     4 ?        S    21:00   0:00 ash /bliss/bliss-runner.sh
root         267  0.0  0.0   1104   836 ?        S    21:00   0:00 su -s /bin/sh abc -c /bliss/bin/bliss.sh
abc          268  2.9  2.3 2125444 383264 ?      Ssl  21:00   0:24 java -Dbliss_working_directory=/config -Xmx512M -splash:bliss-splash.png -XX:HeapDumpPath=/tmp -XX:+HeapDumpOnOutOfMemoryError -Djava.ut
root         315  0.0  0.0   1696  1136 pts/0    Ss+  21:01   0:00 sh
root         421  0.0  0.0   1668  1176 pts/1    Ss   21:10   0:00 sh
root         438  0.0  0.0   1708   876 pts/1    R+   21:15   0:00 ps -aux
root@bliss:/bliss#

The abc user can create the config directory and add and edit the files:

root@bliss:/bliss# ls -ld /config/
drwxr-xr-x 6 abc abc 4096 Jul  7 21:00 /config/
root@bliss:/bliss# ls -l /music/
total 12
drwxrwxr-x 2 nobody abc 12288 Jul  7 21:02 'Various Artists - Gym Music 2023'
root@bliss:/bliss# ls -l /music/Various\ Artists\ -\ Gym\ Music\ 2023/
total 323712
-rw-rw-r-- 1 nobody abc 21102872 Jul  7 20:18 '003 - Only If You Love Me.flac'
-rw-rw-r-- 1 nobody abc 18930471 Jul  7 20:18 '004 - My Heart Goes (La Di Da).flac'
-rw-rw-r-- 1 nobody abc 19924211 Jul  7 20:18 '005 - Rainfall (Praise You).flac'
-rw-rw-r-- 1 nobody abc 20890679 Jul  7 20:18 '006 - Finally.flac'
-rw-rw-r-- 1 nobody abc 30845213 Jul  7 20:19 '007 - Losing It.flac'
-rw-rw-rw- 1 nobody abc 27304526 Jul  7 20:22 '008 - Bad Blood (Panteros666 Remix).flac'
-rw-rw-rw- 1 nobody abc 37949983 Jul  7 20:22 '009 - You Know You Like It (Tchami Remix).flac'
-rw-rw-rw- 1 nobody abc 37656281 Apr 10 10:49 '010 - Lights (Bassnectar Remix).flac'
-rw-rw-rw- 1 nobody abc 29814398 Apr 10 10:50 '011 - Moth To A Flame.flac'
-rw-rw-rw- 1 nobody abc 24243810 Apr 10 10:50 '012 - Do You Know (Boom Boom).flac'
-rw-rw-rw- 1 nobody abc 24581685 Apr 10 10:50 '013 - Kind Of Love.flac'
-rw-rw-rw- 1 nobody abc 20005656 Apr 10 10:50 '014 - White Horses.flac'
-rw-rw-rw- 1 nobody abc 16763631 Apr 10 10:50 '015 - Wellerman (Sea Shanty _ 220 KID x Billen Ted Remix).flac'
-rw-r--r-- 1 abc    abc  1436085 Jul  7 21:02  cover.png
root@bliss:/bliss#

PD: Sorry if the answer is too long, I wanted to explain everything well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants