From fbcfaa15adb6ea456eed8b302d66ae4252c7f6c5 Mon Sep 17 00:00:00 2001 From: lnxd <48756329+lnxd@users.noreply.github.com> Date: Mon, 10 May 2021 20:05:19 +1000 Subject: [PATCH 1/9] Stripped latencytest code as it will be moved to a different repo --- latencytest.Dockerfile | 31 ---------- latencytest.sh | 132 ----------------------------------------- test.sh | 10 ---- unraidTI.sh | 13 ---- 4 files changed, 186 deletions(-) delete mode 100644 latencytest.Dockerfile delete mode 100644 latencytest.sh delete mode 100644 test.sh delete mode 100644 unraidTI.sh diff --git a/latencytest.Dockerfile b/latencytest.Dockerfile deleted file mode 100644 index 8d6fd1a..0000000 --- a/latencytest.Dockerfile +++ /dev/null @@ -1,31 +0,0 @@ -FROM golang:1.16.3-buster AS stratum-ping-builder - -ENV DEBIAN_FRONTEND=noninteractive \ - DEBCONF_NONINTERACTIVE_SEEN=true \ - LC_ALL=C.UTF-8 \ - LANG=C.UTF-8 - -RUN mkdir -p /home/docker; \ - cd /home/docker; \ - git clone https://github.com/2miners/stratum-ping --depth 1; \ - cd stratum-ping; \ - go build main.go; - -FROM debian:latest - -ENV DEBIAN_FRONTEND=noninteractive \ - DEBCONF_NONINTERACTIVE_SEEN=true \ - LC_ALL=C.UTF-8 \ - LANG=C.UTF-8 - -COPY --from=stratum-ping-builder /home/docker/stratum-ping/main /home/docker/stratum-ping -COPY start.sh /home/docker/start.sh -COPY latencytest.sh /home/docker/latencytest.sh -RUN sed -i -e "s/mine.sh/latencytest.sh/" /home/docker/start.sh; \ - chmod +x /home/docker/start.sh /home/docker/latencytest.sh ; \ - apt-get update && apt-get install -y curl coreutils jq && apt-get clean all; - -WORKDIR /home/docker - -CMD ["./start.sh"] - diff --git a/latencytest.sh b/latencytest.sh deleted file mode 100644 index 5692a0e..0000000 --- a/latencytest.sh +++ /dev/null @@ -1,132 +0,0 @@ -#!/bin/bash -echo "Running tests, this should take somewhere between 4:02-11:37 minutes to complete during which there will be no output." - -COUNT=10 -TIMEOUT=30 - -# List of all pool addresses tested by this script -EA1=us1.ethermine.org -EA2=us2.ethermine.org -EA3=asia1.ethermine.org -EA4=eu1.ethermine.org -NA1=eth-us-east1.nanopool.org -NA2=eth-us-west1.nanopool.org -NA3=eth-eu1.nanopool.org -NA4=eth-eu2.nanopool.org -NA5=eth-asia1.nanopool.org -NA6=eth-jp1.nanopool.org -NA7=eth-au1.nanopool.org -TA1=eth.2miners.com -TA2=us-eth.2miners.com -TA3=asia-eth.2miners.com -FA1=eth-us-east.flexpool.io -FA2=eth-us-west.flexpool.io -FA3=eth-de.flexpool.io -FA4=eth-se.flexpool.io -FA5=eth-sg.flexpool.io -FA6=eth-au.flexpool.io -FA7=eth-br.flexpool.io -HA1=eth.ethashpool.com - -# Get IP used for mining -EI1=$(timeout ${TIMEOUT} ./stratum-ping -c 1 ${EA1}:4444 | grep PING | sed -e "s/).*//" | sed -e "s/.*(//") -EI2=$(timeout ${TIMEOUT} ./stratum-ping -c 1 ${EA2}:4444 | grep PING | sed -e "s/).*//" | sed -e "s/.*(//") -EI3=$(timeout ${TIMEOUT} ./stratum-ping -c 1 ${EA3}:4444 | grep PING | sed -e "s/).*//" | sed -e "s/.*(//") -EI4=$(timeout ${TIMEOUT} ./stratum-ping -c 1 ${EA4}:4444 | grep PING | sed -e "s/).*//" | sed -e "s/.*(//") -NI1=$(timeout ${TIMEOUT} ./stratum-ping -c 1 ${NA1}:9999 | grep PING | sed -e "s/).*//" | sed -e "s/.*(//") -NI2=$(timeout ${TIMEOUT} ./stratum-ping -c 1 ${NA2}:9999 | grep PING | sed -e "s/).*//" | sed -e "s/.*(//") -NI3=$(timeout ${TIMEOUT} ./stratum-ping -c 1 ${NA3}:9999 | grep PING | sed -e "s/).*//" | sed -e "s/.*(//") -NI4=$(timeout ${TIMEOUT} ./stratum-ping -c 1 ${NA4}:9999 | grep PING | sed -e "s/).*//" | sed -e "s/.*(//") -NI5=$(timeout ${TIMEOUT} ./stratum-ping -c 1 ${NA5}:9999 | grep PING | sed -e "s/).*//" | sed -e "s/.*(//") -NI6=$(timeout ${TIMEOUT} ./stratum-ping -c 1 ${NA6}:9999 | grep PING | sed -e "s/).*//" | sed -e "s/.*(//") -NI7=$(timeout ${TIMEOUT} ./stratum-ping -c 1 ${NA7}:9999 | grep PING | sed -e "s/).*//" | sed -e "s/.*(//") -TI1=$(timeout ${TIMEOUT} ./stratum-ping -c 1 ${TA1}:2020 | grep PING | sed -e "s/).*//" | sed -e "s/.*(//") -TI2=$(timeout ${TIMEOUT} ./stratum-ping -c 1 ${TA2}:2020 | grep PING | sed -e "s/).*//" | sed -e "s/.*(//") -TI3=$(timeout ${TIMEOUT} ./stratum-ping -c 1 ${TA3}:2020 | grep PING | sed -e "s/).*//" | sed -e "s/.*(//") -FI1=$(timeout ${TIMEOUT} ./stratum-ping -c 1 ${FA1}:4444 | grep PING | sed -e "s/).*//" | sed -e "s/.*(//") -FI2=$(timeout ${TIMEOUT} ./stratum-ping -c 1 ${FA2}:4444 | grep PING | sed -e "s/).*//" | sed -e "s/.*(//") -FI3=$(timeout ${TIMEOUT} ./stratum-ping -c 1 ${FA3}:4444 | grep PING | sed -e "s/).*//" | sed -e "s/.*(//") -FI4=$(timeout ${TIMEOUT} ./stratum-ping -c 1 ${FA4}:4444 | grep PING | sed -e "s/).*//" | sed -e "s/.*(//") -FI5=$(timeout ${TIMEOUT} ./stratum-ping -c 1 ${FA5}:4444 | grep PING | sed -e "s/).*//" | sed -e "s/.*(//") -FI6=$(timeout ${TIMEOUT} ./stratum-ping -c 1 ${FA6}:4444 | grep PING | sed -e "s/).*//" | sed -e "s/.*(//") -FI7=$(timeout ${TIMEOUT} ./stratum-ping -c 1 ${FA7}:4444 | grep PING | sed -e "s/).*//" | sed -e "s/.*(//") -HI1=$(timeout ${TIMEOUT} ./stratum-ping -c 1 ${HA1}:3939 | grep PING | sed -e "s/).*//" | sed -e "s/.*(//") - -# Get geolocation of IP, https not available for free with this API -EC1=$(curl -s http://ip-api.com/json/${EI1}?fields=country | jq -r '.country') -EC2=$(curl -s http://ip-api.com/json/${EI2}?fields=country | jq -r '.country') -EC3=$(curl -s http://ip-api.com/json/${EI3}?fields=country | jq -r '.country') -EC4=$(curl -s http://ip-api.com/json/${EI4}?fields=country | jq -r '.country') -NC1=$(curl -s http://ip-api.com/json/${NI1}?fields=country | jq -r '.country') -NC2=$(curl -s http://ip-api.com/json/${NI2}?fields=country | jq -r '.country') -NC3=$(curl -s http://ip-api.com/json/${NI3}?fields=country | jq -r '.country') -NC4=$(curl -s http://ip-api.com/json/${NI4}?fields=country | jq -r '.country') -NC5=$(curl -s http://ip-api.com/json/${NI5}?fields=country | jq -r '.country') -NC6=$(curl -s http://ip-api.com/json/${NI6}?fields=country | jq -r '.country') -NC7=$(curl -s http://ip-api.com/json/${NI7}?fields=country | jq -r '.country') -TC1=$(curl -s http://ip-api.com/json/${TI1}?fields=country | jq -r '.country') -TC2=$(curl -s http://ip-api.com/json/${TI2}?fields=country | jq -r '.country') -TC3=$(curl -s http://ip-api.com/json/${TI3}?fields=country | jq -r '.country') -FC1=$(curl -s http://ip-api.com/json/${FI1}?fields=country | jq -r '.country') -FC2=$(curl -s http://ip-api.com/json/${FI2}?fields=country | jq -r '.country') -FC3=$(curl -s http://ip-api.com/json/${FI3}?fields=country | jq -r '.country') -FC4=$(curl -s http://ip-api.com/json/${FI4}?fields=country | jq -r '.country') -FC5=$(curl -s http://ip-api.com/json/${FI5}?fields=country | jq -r '.country') -FC6=$(curl -s http://ip-api.com/json/${FI6}?fields=country | jq -r '.country') -FC7=$(curl -s http://ip-api.com/json/${FI7}?fields=country | jq -r '.country') -HC1=$(curl -s http://ip-api.com/json/${HI1}?fields=country | jq -r '.country') - -# Calculate mining ping using 2miners/stratum-ping -ER1=$(timeout ${TIMEOUT} ./stratum-ping -c ${COUNT} ${EI1}:4444 | tail -1 | awk '{print $4}') -ER2=$(timeout ${TIMEOUT} ./stratum-ping -c ${COUNT} ${EI2}:4444 | tail -1 | awk '{print $4}') -ER3=$(timeout ${TIMEOUT} ./stratum-ping -c ${COUNT} ${EI3}:4444 | tail -1 | awk '{print $4}') -ER4=$(timeout ${TIMEOUT} ./stratum-ping -c ${COUNT} ${EI4}:4444 | tail -1 | awk '{print $4}') -NR1=$(timeout ${TIMEOUT} ./stratum-ping -c ${COUNT} ${NI1}:9999 | tail -1 | awk '{print $4}') -NR2=$(timeout ${TIMEOUT} ./stratum-ping -c ${COUNT} ${NI2}:9999 | tail -1 | awk '{print $4}') -NR3=$(timeout ${TIMEOUT} ./stratum-ping -c ${COUNT} ${NI3}:9999 | tail -1 | awk '{print $4}') -NR4=$(timeout ${TIMEOUT} ./stratum-ping -c ${COUNT} ${NI4}:9999 | tail -1 | awk '{print $4}') -NR5=$(timeout ${TIMEOUT} ./stratum-ping -c ${COUNT} ${NI5}:9999 | tail -1 | awk '{print $4}') -NR6=$(timeout ${TIMEOUT} ./stratum-ping -c ${COUNT} ${NI6}:9999 | tail -1 | awk '{print $4}') -NR7=$(timeout ${TIMEOUT} ./stratum-ping -c ${COUNT} ${NI7}:9999 | tail -1 | awk '{print $4}') -TR1=$(timeout ${TIMEOUT} ./stratum-ping -c ${COUNT} ${TI1}:2020 | tail -1 | awk '{print $4}') -TR2=$(timeout ${TIMEOUT} ./stratum-ping -c ${COUNT} ${TI2}:2020 | tail -1 | awk '{print $4}') -TR3=$(timeout ${TIMEOUT} ./stratum-ping -c ${COUNT} ${TI3}:2020 | tail -1 | awk '{print $4}') -FR1=$(timeout ${TIMEOUT} ./stratum-ping -c ${COUNT} ${FI1}:4444 | tail -1 | awk '{print $4}') -FR2=$(timeout ${TIMEOUT} ./stratum-ping -c ${COUNT} ${FI2}:4444 | tail -1 | awk '{print $4}') -FR3=$(timeout ${TIMEOUT} ./stratum-ping -c ${COUNT} ${FI3}:4444 | tail -1 | awk '{print $4}') -FR4=$(timeout ${TIMEOUT} ./stratum-ping -c ${COUNT} ${FI4}:4444 | tail -1 | awk '{print $4}') -FR5=$(timeout ${TIMEOUT} ./stratum-ping -c ${COUNT} ${FI5}:4444 | tail -1 | awk '{print $4}') -FR6=$(timeout ${TIMEOUT} ./stratum-ping -c ${COUNT} ${FI6}:4444 | tail -1 | awk '{print $4}') -FR7=$(timeout ${TIMEOUT} ./stratum-ping -c ${COUNT} ${FI7}:4444 | tail -1 | awk '{print $4}') -HR1=$(timeout ${TIMEOUT} ./stratum-ping -c ${COUNT} ${HI1}:3939 | tail -1 | awk '{print $4}') - -# Echo results in table -echo "" -printf "%-12s %-15s %-15s %-18s %-30s\n" "Pool" "Geo" "Latency" "IP" "Address" -POOL=Ethermine -printf "%-12s %-15s %-15s %-18s %-30s\n" "${POOL}" "${EC1}" "${ER1%?}" "${EI1}" "${EA1}" -printf "%-12s %-15s %-15s %-18s %-30s\n" "${POOL}" "${EC2}" "${ER2%?}" "${EI2}" "${EA2}" -printf "%-12s %-15s %-15s %-18s %-30s\n" "${POOL}" "${EC3}" "${ER3%?}" "${EI3}" "${EA3}" -printf "%-12s %-15s %-15s %-18s %-30s\n" "${POOL}" "${EC4}" "${ER4%?}" "${EI4}" "${EA4}" -POOL=Nanopool -printf "%-12s %-15s %-15s %-18s %-30s\n" "${POOL}" "${NC1}" "${NR1%?}" "${NI1}" "${NA1}" -printf "%-12s %-15s %-15s %-18s %-30s\n" "${POOL}" "${NC2}" "${NR2%?}" "${NI2}" "${NA2}" -printf "%-12s %-15s %-15s %-18s %-30s\n" "${POOL}" "${NC3}" "${NR3%?}" "${NI3}" "${NA3}" -printf "%-12s %-15s %-15s %-18s %-30s\n" "${POOL}" "${NC4}" "${NR4%?}" "${NI4}" "${NA4}" -printf "%-12s %-15s %-15s %-18s %-30s\n" "${POOL}" "${NC5}" "${NR5%?}" "${NI5}" "${NA5}" -printf "%-12s %-15s %-15s %-18s %-30s\n" "${POOL}" "${NC6}" "${NR6%?}" "${NI6}" "${NA6}" -printf "%-12s %-15s %-15s %-18s %-30s\n" "${POOL}" "${NC7}" "${NR7%?}" "${NI7}" "${NA7}" -POOL=2Miners -printf "%-12s %-15s %-15s %-18s %-30s\n" "${POOL}" "${TC1}" "${TR1%?}" "${TI1}" "${TA1}" -printf "%-12s %-15s %-15s %-18s %-30s\n" "${POOL}" "${TC2}" "${TR2%?}" "${TI2}" "${TA2}" -printf "%-12s %-15s %-15s %-18s %-30s\n" "${POOL}" "${TC3}" "${TR3%?}" "${TI3}" "${TA3}" -POOL=Flexpool -printf "%-12s %-15s %-15s %-18s %-30s\n" "${POOL}" "${FC1}" "${FR1%?}" "${FI1}" "${FA1}" -printf "%-12s %-15s %-15s %-18s %-30s\n" "${POOL}" "${FC2}" "${FR2%?}" "${FI2}" "${FA2}" -printf "%-12s %-15s %-15s %-18s %-30s\n" "${POOL}" "${FC3}" "${FR3%?}" "${FI3}" "${FA3}" -printf "%-12s %-15s %-15s %-18s %-30s\n" "${POOL}" "${FC4}" "${FR4%?}" "${FI4}" "${FA4}" -printf "%-12s %-15s %-15s %-18s %-30s\n" "${POOL}" "${FC5}" "${FR5%?}" "${FI5}" "${FA5}" -printf "%-12s %-15s %-15s %-18s %-30s\n" "${POOL}" "${FC6}" "${FR6%?}" "${FI6}" "${FA6}" -printf "%-12s %-15s %-15s %-18s %-30s\n" "${POOL}" "${FC7}" "${FR7%?}" "${FI7}" "${FA7}" -POOL=Ethashpool -printf "%-12s %-15s %-15s %-18s %-30s\n" "${POOL}" "${HC1}" "${HR1%?}" "${HI1}" "${HA1}" diff --git a/test.sh b/test.sh deleted file mode 100644 index 68cfd68..0000000 --- a/test.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -docker stop phoenixminer -docker rm phoenixminer -docker build -f nvidia.Dockerfile . -t phoenixminer -#docker build -f amdgpu-pro-18.20.Dockerfile . -t phoenixminer -#docker build -f amdgpu-pro-20.20.Dockerfile . -t phoenixminer -#docker build -f amdgpu-pro-20.45.Dockerfile . -t phoenixminer -docker run -d -e TZ="Australia/Melbourne" -p 5450:5450/tcp --name="phoenixminer" phoenixminer -docker logs phoenixminer -f diff --git a/unraidTI.sh b/unraidTI.sh deleted file mode 100644 index 3128a42..0000000 --- a/unraidTI.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -echo "Pulling https://hub.docker/r/assaflavie/runlike" -docker pull --quiet assaflavie/runlike -echo "Running runlike to get run command generated by Unraid dockerMan" -RUN=$(docker run --rm -v/var/run/docker.sock:/var/run/docker.sock assaflavie/runlike PhoenixMiner) -echo "Cleaning up" -docker rmi --force assaflavie/runlike -echo "Modifying command to make it interactive" -RUN=$(echo "$RUN" | sed -e "s/ --detach=true / --interactive --tty /") -docker stop PhoenixMiner -docker rm PhoenixMiner -echo $RUN From 83f0ac17578c573906162d9bf5f2398dec7308af Mon Sep 17 00:00:00 2001 From: lnxd <48756329+lnxd@users.noreply.github.com> Date: Mon, 10 May 2021 20:12:47 +1000 Subject: [PATCH 2/9] Testing custom mine script courtesy of ich777 --- Dockerfile | 3 +-- custom-mine.sh | 23 +++++++++++++++++ install-driver.sh | 66 +++++++++++++++++++++++++++++++++++++++++++++++ mine.sh | 66 +---------------------------------------------- start.sh | 6 ++++- 5 files changed, 96 insertions(+), 68 deletions(-) create mode 100644 custom-mine.sh create mode 100644 install-driver.sh diff --git a/Dockerfile b/Dockerfile index 59bee47..65b23f4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -44,8 +44,7 @@ RUN curl "https://github.com/PhoenixMinerDevTeam/PhoenixMiner/releases/download/ sudo chmod +x /home/docker/phoenixminer/PhoenixMiner; # Copy latest scripts -COPY start.sh /home/docker/start.sh -COPY mine.sh /home/docker/mine.sh +COPY start.sh install-driver.sh mine.sh custom-mine.sh /home/docker RUN sudo chmod +x /home/docker/start.sh; \ sudo chmod +x /home/docker/mine.sh; diff --git a/custom-mine.sh b/custom-mine.sh new file mode 100644 index 0000000..539e5c1 --- /dev/null +++ b/custom-mine.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +sh /home/docker/install-driver.sh + +echo "Project: PhoenixMiner $MINERV" +echo "Author: lnxd" +echo "Base: $BASE" +echo "Driver: $INSTALLED_DRIVERV" +echo "Target: Unraid 6.9.0 - 6.9.2" +echo +echo "+---- WARNING ---- WARNING ---- WARNING ---- WARNING ---- WARNING ----" +echo "| You are running PhoenixMiner in custom mode!" +echo "| Please make sure that you entered all necessary values correctly and" +echo "| that you have set a temperature limit for your graphics card!" +echo "+---- WARNING ---- WARNING ---- WARNING ---- WARNING ---- WARNING ----" +echo +echo "Custom command: $ADDITONAL" +echo +echo "Starting PhoenixMiner $MINERV as $(id) with the following arguments:" +echo "$ADDITIONAL" +echo +cd /home/docker/phoenixminer +./PhoenixMiner $ADDITIONAL diff --git a/install-driver.sh b/install-driver.sh new file mode 100644 index 0000000..fc77de6 --- /dev/null +++ b/install-driver.sh @@ -0,0 +1,66 @@ +#!/bin/bash +uninstall_amd_driver() { + echo "Uninstalling driver" + echo 'APT::Get::Assume-Yes "true";' >>/etc/apt/apt.conf.d/90assumeyes + /usr/bin/amdgpu-uninstall + rm /etc/apt/apt.conf.d/90assumeyes + echo "Done!" +} + +install_amd_driver() { + AMD_DRIVER=$1 + AMD_DRIVER_URL=$2 + FLAGS=$3 + echo "Installing driver" + echo "Downloading driver from "$AMD_DRIVER_URL/$AMD_DRIVER + echo 'APT::Get::Assume-Yes "true";' >>/etc/apt/apt.conf.d/90assumeyes + mkdir -p /tmp/opencl-driver-amd + cd /tmp/opencl-driver-amd + echo AMD_DRIVER is $AMD_DRIVER + curl --referer $AMD_DRIVER_URL -O $AMD_DRIVER_URL/$AMD_DRIVER + tar -Jxvf $AMD_DRIVER + rm $AMD_DRIVER + cd amdgpu-pro-* + ./amdgpu-install $FLAGS + rm -rf /tmp/opencl-driver-amd + echo "" + echo "Driver installation finished." + INSTALLED_DRIVERV=$(cd /home/docker/phoenixminer && ./PhoenixMiner -list | grep -m 1 "OpenCL driver version" | sed 's/OpenCL driver version: //g' | cut -c1-5) + rm /etc/apt/apt.conf.d/90assumeyes +} + +INSTALLED_DRIVERV=$(cd /home/docker/phoenixminer && ./PhoenixMiner -list | grep -m 1 "OpenCL driver version" | sed 's/OpenCL driver version: //g' | cut -c1-5) +if [[ "${INSTALLED_DRIVERV}" != "${DRIVERV}" ]]; then + echo "Installed driver version (${INSTALLED_DRIVERV}) does not match wanted driver version (${DRIVERV})" + echo "Installing AMD drivers v${DRIVERV}:" + echo "" + + case $DRIVERV in + + 0) + uninstall_amd_driver + echo "Skipping installation" + ;; + + 18.20) + uninstall_amd_driver + install_amd_driver "amdgpu-pro-18.20-621984.tar.xz" "https://drivers.amd.com/drivers/linux/ubuntu-18-04" "--opencl=legacy,pal --headless" + ;; + + 20.20) + uninstall_amd_driver + install_amd_driver "amdgpu-pro-20.20-1098277-ubuntu-20.04.tar.xz" "https://drivers.amd.com/drivers/linux" "--opencl=legacy,pal --headless --no-dkms" + ;; + + 20.45) + uninstall_amd_driver + install_amd_driver "amdgpu-pro-20.45-1188099-ubuntu-20.04.tar.xz" "https://drivers.amd.com/drivers/linux" "--opencl=legacy,pal --headless --no-dkms" + ;; + + 20.50) + uninstall_amd_driver + install_amd_driver "amdgpu-pro-20.50-1234664-ubuntu-20.04.tar.xz" "https://drivers.amd.com/drivers/linux" "--opencl=legacy,rocr --headless --no-dkms" + ;; + esac + +fi diff --git a/mine.sh b/mine.sh index cf0377f..a157f12 100644 --- a/mine.sh +++ b/mine.sh @@ -1,69 +1,5 @@ #!/bin/bash -uninstall_amd_driver() { - echo "Uninstalling driver" - echo 'APT::Get::Assume-Yes "true";' >>/etc/apt/apt.conf.d/90assumeyes - /usr/bin/amdgpu-uninstall - rm /etc/apt/apt.conf.d/90assumeyes - echo "Done!" -} - -install_amd_driver() { - AMD_DRIVER=$1 - AMD_DRIVER_URL=$2 - FLAGS=$3 - echo "Installing driver" - echo "Downloading driver from "$AMD_DRIVER_URL/$AMD_DRIVER - echo 'APT::Get::Assume-Yes "true";' >>/etc/apt/apt.conf.d/90assumeyes - mkdir -p /tmp/opencl-driver-amd - cd /tmp/opencl-driver-amd - echo AMD_DRIVER is $AMD_DRIVER - curl --referer $AMD_DRIVER_URL -O $AMD_DRIVER_URL/$AMD_DRIVER - tar -Jxvf $AMD_DRIVER - rm $AMD_DRIVER - cd amdgpu-pro-* - ./amdgpu-install $FLAGS - rm -rf /tmp/opencl-driver-amd - echo "" - echo "Driver installation finished." - INSTALLED_DRIVERV=$(cd /home/docker/phoenixminer && ./PhoenixMiner -list | grep -m 1 "OpenCL driver version" | sed 's/OpenCL driver version: //g' | cut -c1-5) - rm /etc/apt/apt.conf.d/90assumeyes -} - -INSTALLED_DRIVERV=$(cd /home/docker/phoenixminer && ./PhoenixMiner -list | grep -m 1 "OpenCL driver version" | sed 's/OpenCL driver version: //g' | cut -c1-5) -if [[ "${INSTALLED_DRIVERV}" != "${DRIVERV}" ]]; then - echo "Installed driver version (${INSTALLED_DRIVERV}) does not match wanted driver version (${DRIVERV})" - echo "Installing AMD drivers v${DRIVERV}:" - echo "" - - case $DRIVERV in - - 0) - uninstall_amd_driver - echo "Skipping installation" - ;; - - 18.20) - uninstall_amd_driver - install_amd_driver "amdgpu-pro-18.20-621984.tar.xz" "https://drivers.amd.com/drivers/linux/ubuntu-18-04" "--opencl=legacy,pal --headless" - ;; - - 20.20) - uninstall_amd_driver - install_amd_driver "amdgpu-pro-20.20-1098277-ubuntu-20.04.tar.xz" "https://drivers.amd.com/drivers/linux" "--opencl=legacy,pal --headless --no-dkms" - ;; - - 20.45) - uninstall_amd_driver - install_amd_driver "amdgpu-pro-20.45-1188099-ubuntu-20.04.tar.xz" "https://drivers.amd.com/drivers/linux" "--opencl=legacy,pal --headless --no-dkms" - ;; - - 20.50) - uninstall_amd_driver - install_amd_driver "amdgpu-pro-20.50-1234664-ubuntu-20.04.tar.xz" "https://drivers.amd.com/drivers/linux" "--opencl=legacy,rocr --headless --no-dkms" - ;; - esac - -fi +sh /home/docker/install-driver.sh echo "Project: PhoenixMiner $MINERV" echo "Author: lnxd" diff --git a/start.sh b/start.sh index db3db31..7dc481f 100644 --- a/start.sh +++ b/start.sh @@ -7,7 +7,11 @@ term_handler() { } trap 'kill ${!}; term_handler' SIGTERM -su ${USER} -c "/home/docker/mine.sh" & +if [ "${CUSTOM}" == "true" ]; then + /home/docker/custom-mine.sh & +else + /home/docker/mine.sh & +fi killpid="$!" while true; do wait $killpid From 1e870901548e312172c2241eac71f56d82cf1de1 Mon Sep 17 00:00:00 2001 From: lnxd <48756329+lnxd@users.noreply.github.com> Date: Mon, 10 May 2021 20:17:33 +1000 Subject: [PATCH 3/9] Added CUSTOM variable default --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 65b23f4..daedaf9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -60,6 +60,7 @@ ENV TT="56" ENV TSTOP="85" ENV TSTART="80" ENV ADDITIONAL=" " +ENV CUSTOM="" # Define working directory. WORKDIR /home/docker/ From da1015c1a31b17647a6a10cdb2076bfa0bd1c1b1 Mon Sep 17 00:00:00 2001 From: lnxd <48756329+lnxd@users.noreply.github.com> Date: Mon, 10 May 2021 20:18:50 +1000 Subject: [PATCH 4/9] Corrected typo --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index daedaf9..db3ff19 100644 --- a/Dockerfile +++ b/Dockerfile @@ -44,7 +44,7 @@ RUN curl "https://github.com/PhoenixMinerDevTeam/PhoenixMiner/releases/download/ sudo chmod +x /home/docker/phoenixminer/PhoenixMiner; # Copy latest scripts -COPY start.sh install-driver.sh mine.sh custom-mine.sh /home/docker +COPY start.sh install-driver.sh mine.sh custom-mine.sh /home/docker/ RUN sudo chmod +x /home/docker/start.sh; \ sudo chmod +x /home/docker/mine.sh; From 251d7298a755b8c84d305fb476fa07f3f7186d6e Mon Sep 17 00:00:00 2001 From: lnxd <48756329+lnxd@users.noreply.github.com> Date: Mon, 10 May 2021 20:30:41 +1000 Subject: [PATCH 5/9] Corrected permissions on copied scripts --- Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index db3ff19..2acb6f2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -46,7 +46,9 @@ RUN curl "https://github.com/PhoenixMinerDevTeam/PhoenixMiner/releases/download/ # Copy latest scripts COPY start.sh install-driver.sh mine.sh custom-mine.sh /home/docker/ RUN sudo chmod +x /home/docker/start.sh; \ - sudo chmod +x /home/docker/mine.sh; + sudo chmod +x /home/docker/install-driver.sh; \ + sudo chmod +x /home/docker/mine.sh; \ + sudo chmod +x /home/docker/custom-mine.sh; # Set environment variables. ENV BASE="Ubuntu 20.04" From 40e3f707c75a6d8ff973e416fbf9424f2ac6fe25 Mon Sep 17 00:00:00 2001 From: lnxd <48756329+lnxd@users.noreply.github.com> Date: Mon, 10 May 2021 20:39:44 +1000 Subject: [PATCH 6/9] Added driver installation to both scripts temporarily --- Dockerfile | 3 +-- custom-mine.sh | 65 +++++++++++++++++++++++++++++++++++++++++++++- install-driver.sh | 66 ----------------------------------------------- mine.sh | 66 ++++++++++++++++++++++++++++++++++++++++++++++- 4 files changed, 130 insertions(+), 70 deletions(-) delete mode 100644 install-driver.sh diff --git a/Dockerfile b/Dockerfile index 2acb6f2..5d29df2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -44,9 +44,8 @@ RUN curl "https://github.com/PhoenixMinerDevTeam/PhoenixMiner/releases/download/ sudo chmod +x /home/docker/phoenixminer/PhoenixMiner; # Copy latest scripts -COPY start.sh install-driver.sh mine.sh custom-mine.sh /home/docker/ +COPY start.sh mine.sh custom-mine.sh /home/docker/ RUN sudo chmod +x /home/docker/start.sh; \ - sudo chmod +x /home/docker/install-driver.sh; \ sudo chmod +x /home/docker/mine.sh; \ sudo chmod +x /home/docker/custom-mine.sh; diff --git a/custom-mine.sh b/custom-mine.sh index 539e5c1..868142f 100644 --- a/custom-mine.sh +++ b/custom-mine.sh @@ -1,6 +1,69 @@ #!/bin/bash +uninstall_amd_driver() { + echo "Uninstalling driver" + echo 'APT::Get::Assume-Yes "true";' >>/etc/apt/apt.conf.d/90assumeyes + /usr/bin/amdgpu-uninstall + rm /etc/apt/apt.conf.d/90assumeyes + echo "Done!" +} -sh /home/docker/install-driver.sh +install_amd_driver() { + AMD_DRIVER=$1 + AMD_DRIVER_URL=$2 + FLAGS=$3 + echo "Installing driver" + echo "Downloading driver from "$AMD_DRIVER_URL/$AMD_DRIVER + echo 'APT::Get::Assume-Yes "true";' >>/etc/apt/apt.conf.d/90assumeyes + mkdir -p /tmp/opencl-driver-amd + cd /tmp/opencl-driver-amd + echo AMD_DRIVER is $AMD_DRIVER + curl --referer $AMD_DRIVER_URL -O $AMD_DRIVER_URL/$AMD_DRIVER + tar -Jxvf $AMD_DRIVER + rm $AMD_DRIVER + cd amdgpu-pro-* + ./amdgpu-install $FLAGS + rm -rf /tmp/opencl-driver-amd + echo "" + echo "Driver installation finished." + INSTALLED_DRIVERV=$(cd /home/docker/phoenixminer && ./PhoenixMiner -list | grep -m 1 "OpenCL driver version" | sed 's/OpenCL driver version: //g' | cut -c1-5) + rm /etc/apt/apt.conf.d/90assumeyes +} + +INSTALLED_DRIVERV=$(cd /home/docker/phoenixminer && ./PhoenixMiner -list | grep -m 1 "OpenCL driver version" | sed 's/OpenCL driver version: //g' | cut -c1-5) +if [[ "${INSTALLED_DRIVERV}" != "${DRIVERV}" ]]; then + echo "Installed driver version (${INSTALLED_DRIVERV}) does not match wanted driver version (${DRIVERV})" + echo "Installing AMD drivers v${DRIVERV}:" + echo "" + + case $DRIVERV in + + 0) + uninstall_amd_driver + echo "Skipping installation" + ;; + + 18.20) + uninstall_amd_driver + install_amd_driver "amdgpu-pro-18.20-621984.tar.xz" "https://drivers.amd.com/drivers/linux/ubuntu-18-04" "--opencl=legacy,pal --headless" + ;; + + 20.20) + uninstall_amd_driver + install_amd_driver "amdgpu-pro-20.20-1098277-ubuntu-20.04.tar.xz" "https://drivers.amd.com/drivers/linux" "--opencl=legacy,pal --headless --no-dkms" + ;; + + 20.45) + uninstall_amd_driver + install_amd_driver "amdgpu-pro-20.45-1188099-ubuntu-20.04.tar.xz" "https://drivers.amd.com/drivers/linux" "--opencl=legacy,pal --headless --no-dkms" + ;; + + 20.50) + uninstall_amd_driver + install_amd_driver "amdgpu-pro-20.50-1234664-ubuntu-20.04.tar.xz" "https://drivers.amd.com/drivers/linux" "--opencl=legacy,rocr --headless --no-dkms" + ;; + esac + +fi echo "Project: PhoenixMiner $MINERV" echo "Author: lnxd" diff --git a/install-driver.sh b/install-driver.sh deleted file mode 100644 index fc77de6..0000000 --- a/install-driver.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/bash -uninstall_amd_driver() { - echo "Uninstalling driver" - echo 'APT::Get::Assume-Yes "true";' >>/etc/apt/apt.conf.d/90assumeyes - /usr/bin/amdgpu-uninstall - rm /etc/apt/apt.conf.d/90assumeyes - echo "Done!" -} - -install_amd_driver() { - AMD_DRIVER=$1 - AMD_DRIVER_URL=$2 - FLAGS=$3 - echo "Installing driver" - echo "Downloading driver from "$AMD_DRIVER_URL/$AMD_DRIVER - echo 'APT::Get::Assume-Yes "true";' >>/etc/apt/apt.conf.d/90assumeyes - mkdir -p /tmp/opencl-driver-amd - cd /tmp/opencl-driver-amd - echo AMD_DRIVER is $AMD_DRIVER - curl --referer $AMD_DRIVER_URL -O $AMD_DRIVER_URL/$AMD_DRIVER - tar -Jxvf $AMD_DRIVER - rm $AMD_DRIVER - cd amdgpu-pro-* - ./amdgpu-install $FLAGS - rm -rf /tmp/opencl-driver-amd - echo "" - echo "Driver installation finished." - INSTALLED_DRIVERV=$(cd /home/docker/phoenixminer && ./PhoenixMiner -list | grep -m 1 "OpenCL driver version" | sed 's/OpenCL driver version: //g' | cut -c1-5) - rm /etc/apt/apt.conf.d/90assumeyes -} - -INSTALLED_DRIVERV=$(cd /home/docker/phoenixminer && ./PhoenixMiner -list | grep -m 1 "OpenCL driver version" | sed 's/OpenCL driver version: //g' | cut -c1-5) -if [[ "${INSTALLED_DRIVERV}" != "${DRIVERV}" ]]; then - echo "Installed driver version (${INSTALLED_DRIVERV}) does not match wanted driver version (${DRIVERV})" - echo "Installing AMD drivers v${DRIVERV}:" - echo "" - - case $DRIVERV in - - 0) - uninstall_amd_driver - echo "Skipping installation" - ;; - - 18.20) - uninstall_amd_driver - install_amd_driver "amdgpu-pro-18.20-621984.tar.xz" "https://drivers.amd.com/drivers/linux/ubuntu-18-04" "--opencl=legacy,pal --headless" - ;; - - 20.20) - uninstall_amd_driver - install_amd_driver "amdgpu-pro-20.20-1098277-ubuntu-20.04.tar.xz" "https://drivers.amd.com/drivers/linux" "--opencl=legacy,pal --headless --no-dkms" - ;; - - 20.45) - uninstall_amd_driver - install_amd_driver "amdgpu-pro-20.45-1188099-ubuntu-20.04.tar.xz" "https://drivers.amd.com/drivers/linux" "--opencl=legacy,pal --headless --no-dkms" - ;; - - 20.50) - uninstall_amd_driver - install_amd_driver "amdgpu-pro-20.50-1234664-ubuntu-20.04.tar.xz" "https://drivers.amd.com/drivers/linux" "--opencl=legacy,rocr --headless --no-dkms" - ;; - esac - -fi diff --git a/mine.sh b/mine.sh index a157f12..cf0377f 100644 --- a/mine.sh +++ b/mine.sh @@ -1,5 +1,69 @@ #!/bin/bash -sh /home/docker/install-driver.sh +uninstall_amd_driver() { + echo "Uninstalling driver" + echo 'APT::Get::Assume-Yes "true";' >>/etc/apt/apt.conf.d/90assumeyes + /usr/bin/amdgpu-uninstall + rm /etc/apt/apt.conf.d/90assumeyes + echo "Done!" +} + +install_amd_driver() { + AMD_DRIVER=$1 + AMD_DRIVER_URL=$2 + FLAGS=$3 + echo "Installing driver" + echo "Downloading driver from "$AMD_DRIVER_URL/$AMD_DRIVER + echo 'APT::Get::Assume-Yes "true";' >>/etc/apt/apt.conf.d/90assumeyes + mkdir -p /tmp/opencl-driver-amd + cd /tmp/opencl-driver-amd + echo AMD_DRIVER is $AMD_DRIVER + curl --referer $AMD_DRIVER_URL -O $AMD_DRIVER_URL/$AMD_DRIVER + tar -Jxvf $AMD_DRIVER + rm $AMD_DRIVER + cd amdgpu-pro-* + ./amdgpu-install $FLAGS + rm -rf /tmp/opencl-driver-amd + echo "" + echo "Driver installation finished." + INSTALLED_DRIVERV=$(cd /home/docker/phoenixminer && ./PhoenixMiner -list | grep -m 1 "OpenCL driver version" | sed 's/OpenCL driver version: //g' | cut -c1-5) + rm /etc/apt/apt.conf.d/90assumeyes +} + +INSTALLED_DRIVERV=$(cd /home/docker/phoenixminer && ./PhoenixMiner -list | grep -m 1 "OpenCL driver version" | sed 's/OpenCL driver version: //g' | cut -c1-5) +if [[ "${INSTALLED_DRIVERV}" != "${DRIVERV}" ]]; then + echo "Installed driver version (${INSTALLED_DRIVERV}) does not match wanted driver version (${DRIVERV})" + echo "Installing AMD drivers v${DRIVERV}:" + echo "" + + case $DRIVERV in + + 0) + uninstall_amd_driver + echo "Skipping installation" + ;; + + 18.20) + uninstall_amd_driver + install_amd_driver "amdgpu-pro-18.20-621984.tar.xz" "https://drivers.amd.com/drivers/linux/ubuntu-18-04" "--opencl=legacy,pal --headless" + ;; + + 20.20) + uninstall_amd_driver + install_amd_driver "amdgpu-pro-20.20-1098277-ubuntu-20.04.tar.xz" "https://drivers.amd.com/drivers/linux" "--opencl=legacy,pal --headless --no-dkms" + ;; + + 20.45) + uninstall_amd_driver + install_amd_driver "amdgpu-pro-20.45-1188099-ubuntu-20.04.tar.xz" "https://drivers.amd.com/drivers/linux" "--opencl=legacy,pal --headless --no-dkms" + ;; + + 20.50) + uninstall_amd_driver + install_amd_driver "amdgpu-pro-20.50-1234664-ubuntu-20.04.tar.xz" "https://drivers.amd.com/drivers/linux" "--opencl=legacy,rocr --headless --no-dkms" + ;; + esac + +fi echo "Project: PhoenixMiner $MINERV" echo "Author: lnxd" From ef8ddc478942e15479679b898fa7954b6f52c61d Mon Sep 17 00:00:00 2001 From: lnxd <48756329+lnxd@users.noreply.github.com> Date: Mon, 10 May 2021 21:48:04 +1000 Subject: [PATCH 7/9] Updated readme to reflect 5.6c update --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 341656c..03d5685 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # PhoenixMiner Docker Container for Unraid -PhoenixMiner binary source for this container is currently version 5.5c from [Github](https://github.com/PhoenixMinerDevTeam/PhoenixMiner/). +PhoenixMiner binary source for this container is currently version 5.6c from [Github](https://github.com/PhoenixMinerDevTeam/PhoenixMiner/). It contains version 20.20 of the AMDGPU Pro Drivers direct from [AMD](https://www.amd.com/en/support/kb/release-notes/rn-amdgpu-unified-linux-20-20) From a08961a7013fc0832768dc34ebf786ca43bb2b95 Mon Sep 17 00:00:00 2001 From: lnxd <48756329+lnxd@users.noreply.github.com> Date: Mon, 10 May 2021 21:48:58 +1000 Subject: [PATCH 8/9] Updated hardcoded ARG to 5.6c --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 5d29df2..5469318 100644 --- a/Dockerfile +++ b/Dockerfile @@ -36,7 +36,7 @@ RUN echo 'APT::Get::Assume-Yes "true";'>> /etc/apt/apt.conf.d/90assumeyes; \ rm /etc/apt/apt.conf.d/90assumeyes; # Get Phoenix Miner -ARG MINERV=5.5c +ARG MINERV=5.6c ENV MINERV=$MINERV RUN curl "https://github.com/PhoenixMinerDevTeam/PhoenixMiner/releases/download/${MINERV}/PhoenixMiner_${MINERV}_Linux.tar.gz" -L -o "PhoenixMiner_${MINERV}_Linux.tar.gz"; \ tar xvzf PhoenixMiner_${MINERV}_Linux.tar.gz -C /home/docker; \ From 375895ae624674673e7de6d48979c30bef9bb7e6 Mon Sep 17 00:00:00 2001 From: lnxd <48756329+lnxd@users.noreply.github.com> Date: Mon, 10 May 2021 21:54:40 +1000 Subject: [PATCH 9/9] Updated readme to reflect 5.6c arguments --- README.md | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 03d5685..dca0efd 100644 --- a/README.md +++ b/README.md @@ -141,7 +141,7 @@ Also keep in mind you are unlikely to be able to profit from mining with a card ​ ## Additional PhoenixMiner Arguments ``` -Phoenix Miner 5.5c Linux/gcc - Release build +Phoenix Miner 5.6c Linux/gcc - Release build -------------------------------------------- Usage: PhonixMiner [OPTIONS] @@ -198,7 +198,6 @@ Pool options (normal mode): -dworker Dual mining worker name -dcoin blake2s Dual mining algorithm (currently only blake2s) -dstales Submit stales to dual mining pool: 1 - yes (default), 0 - no - General pool options: -fret Switch to next pool afer N retries (default: 3) -ftimeout Reconnect if no new ethash job is receved for n seconds @@ -219,7 +218,6 @@ Remote control options: (default 3333) -cdmpass Set the CDM remote monitoring password -cdmrs Reload the settings if config.txt is edited/uploaded remotely - Mining options: -amd Use only AMD cards -acm Turn on AMD compute mode (requires administrative rights) @@ -274,15 +272,20 @@ Mining options: -timeout Restart miner according to -rmode after n minutes -pauseat hh:mm Pause the miner at hh::mm (24 hours time) -resumeat hh::mm Resume the miner at hh::mm (24 hours time) - Hardware control options: -hwm Hardware monitoring frequency (the default is 1): 0 - no HW monitoring on all cards, 1 - normal monitoring, 2 to 5 - less frequent monitoring -tt Set fan control target temperature (special values: 0 - no fan control, negative - fixed fan speed at n%) + -ttj Set fan control target junction temperature (can be used + only on GPUs that report the junction temperature) + -ttmem Set fan control target video memory temperature (can be used + only on GPUs that report the VRAM temperature) -fanmin Set fan control min speed in % (-1 for default) -fanmax Set fan control max speed in % (-1 for default) + -fanstop If disabled (0, the default) the miner will not allow the fans + to stop if fixed fan speed (e.g. -tt -40), or -fanmin is used -fcm Set fan control mode (0 - auto, 1 - normal, 2 - alt; default: 0) -fpwm Fan PWM mode (0 - auto, 1 - direct, 2 - Polaris, 3 - Vega, 4 - Radeon VII, Navi; default: 0) @@ -305,6 +308,10 @@ Hardware control options: -mt Memory timing level (0 - VBIOS/default), AMD only -leavemt Do not reset memory timing level to 0 when closing -ttli Lower GPU usage when temp is >= n deg C (0 for default) + -tmaxj Lower GPU usage when junction temp is >= n deg C (0 for default; + can be used only on GPUs that report the junction temperature) + -tmaxmem Lower GPU usage when VRAM temp is >= n deg C (0 for default; + can be used only on GPUs that report the VRAM temperature) -hstats HW stats mode (0: temp and fan speed only, 1: temp, fan speed and power, 2: full; default: 1) -pidle Idle power usage in W (will be added to GPU power) @@ -321,7 +328,6 @@ Hardware control options: -cudaBlockSize Set the CUDA block size (advanced) -cudaGridMultiplier Set the CUDA grid size (advanced; will be multiplied by the number of computing units) - General Options: -v,-version Show the version and exit -h,-help Show this help message and exit