Skip to content

czombos/AMDGPU-XMR-ETH-Mining-Ubuntu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AMD RX 480/570/580 Mining on Ubuntu Server 18.04 LTS

Install Ubuntu Server with the HWE kernel

Sudoers file, enable NOPASSWD for user, all commands

sudo visudo

Replace %sudo ALL=(ALL:ALL) ALL line to %sudo ALL=(ALL:ALL) NOPASSWD: ALL

Locale fix

sudo locale-gen en_US en_US.UTF-8 hu_HU hu_HU.UTF-8
sudo dpkg-reconfigure locales

Upgrade

sudo apt update && sudo apt upgrade

If you use default Kernel during installation to install Ubuntu Server. You need install Ubuntu HWE stack package.

https://help.ubuntu.com/community/AMDGPU-Driver https://wiki.ubuntu.com/Kernel/LTSEnablementStack

sudo apt update
sudo apt install --install-recommends linux-generic-hwe-18.04
sudo apt upgrade

Install packages (optional)

sudo apt install mc vim htop lshw

Disable screensaver, AMD tweaks, fall back to ethX network interface naming

Edit the grub configuration file:

sudo vi /etc/default/grub

Replace GRUB_CMDLINE_LINUX_DEFAULT and GRUB_CMDLINE_LINUX lines

GRUB_CMDLINE_LINUX_DEFAULT="text amdgpu.dc=0 amdgpu.ppfeaturemask=0xffffffff"
GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0"

amdgpu.ppfeaturemask=0xffffffff kernel boot option allows control of GPU power states (GPU / VRAM clocks and voltages)

Update grub configuration

sudo update-grub && sudo update-grub2 && sudo update-grub-legacy-ec2 && sudo update-initramfs -u -k all

Edit network configuration file:

sudo vi /etc/network/interfaces

Replace enpXsX to eth0

# The primary network interface
auto eth0
iface eth0 inet dhcp
sudo reboot

Install AMDGPU Driver + OpenCL + ROCm

https://www.amd.com/en/support/kb/release-notes/rn-rad-lin-19-50-unified

wget https://drivers.amd.com/drivers/linux/19.50/amdgpu-pro-19.50-967956-ubuntu-18.04.tar.xz --referer http://support.amd.com/en-us/kb-articles/Pages/Radeon-Software-for-Linux-Release-Notes.aspx
tar -Jxvf amdgpu-pro-19.50-967956-ubuntu-18.04.tar.xz
cd amdgpu-pro-19.50-967956-ubuntu-18.04
./amdgpu-pro-install -y --opencl=pal,legacy --headless
sudo apt install amdgpu-dkms libdrm-amdgpu-amdgpu1 libdrm2-amdgpu opencl-amdgpu-pro opencl-amdgpu-pro-dev

If dpkg: error processing archive /var/opt/amdgpu-pro-local

for amdgpupkg in $(dpkg --list | grep amdgpu-pro | awk '{print $2}'); do echo $amdgpupkg; sudo dpkg --purge --force-all $amdgpupkg; done
for amdgpupkg in $(dpkg --list | grep amdgpu | awk '{print $2}'); do echo $amdgpupkg; sudo dpkg --purge --force-all $amdgpupkg; done
sudo apt-get -f install
./amdgpu-pro-install -y --opencl=pal,legacy --headless

Add yourself to the video group

sudo usermod -a -G video $LOGNAME

Check your graphic card name and chipset

sudo update-pciids
lspci -nn | grep -E 'VGA|Display'

AMDGPU commands (clinfo ...)

Edit your .profile

vi ~/.profile

and add amdgpu-pro PATH to new line

PATH="/opt/amdgpu-pro/bin:$PATH"

Tuning

Save Bios

sudo ./atiflash -s 0 CARD-NAME.rom

How To Mod Bios 470/570/480/580/VEGA on windows

https://bitcointalk.org/index.php?topic=1954245.0

Download Polaris Bios Editor

https://github.com/jaschaknack/PolarisBiosEditor

One Click Timing Patch

Flash Bios Mod

sudo ./amdvbflash -p 0 CARD-NAME.rom

Get GDDR5 memory information and other information from AMD Radeon GPUs.

sudo apt install opencl-headers libpci-dev
git clone https://github.com/ystarnaud/amdmeminfo
cd amdmeminfo
make
sudo ./amdmeminfo -o -s

Hard reboot

https://askubuntu.com/questions/491146/terminal-commands-to-hard-shutdown-and-hard-restart?answertab=votes#tab-top
It would be safer to do a Alt+SysRq+(R,E,I,S,U,B or O) than force a hard reboot.

  • R Switch the keyboard from raw mode to XLATE mode
  • E SIGTERM everything except init
  • I SIGKILL everything except init
  • S Syncs the mounted filesystems
  • U Remounts the mounted filesystems in read-only mode
  • B Reboot the system, or O Turn off the system

You could just Alt+SysRq+B/O to reboot/halt if you really wanted to but you put your filesystems at risk by doing so. Doing all of the above is relatively safe and should work even when the rest of the system has broken down.

This is essentially the same method you're talking about in your commands but I'm not sure you could script the E and I (as they'll nuke your terminal access). But you could definitely handle the disk access and reboot or shutdown.

for i in s u b; do echo $i | sudo tee /proc/sysrq-trigger; sleep 5; done  # reboot
for i in s u o; do echo $i | sudo tee /proc/sysrq-trigger; sleep 5; done  # halt

You could still lose data from running applications but it shoudn't knacker your filesystem. If you have particularly huge disk write caches it might be best to increase the sleep value.

Install miners

Download mining.sh and replace user with your username

chmod +x mining.sh

Open crontab file crontab -e and add this line and change user to your username

@reboot /home/user/mining.sh

Mining start after boot

sudo reboot

Enter the tmux session

tmux a

Releases

No releases published

Packages

No packages published

Languages