Bitcoin Forum
December 13, 2024, 07:20:31 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Warning: One or more bitcointalk.org users have reported that they strongly believe that the creator of this topic is a scammer. (Login to see the detailed trust ratings.) While the bitcointalk.org administration does not verify such claims, you should proceed with extreme caution.
Pages: [1]
  Print  
Author Topic: UBUNTU 16.04 Help  (Read 281 times)
sundownz (OP)
Hero Member
*****
Offline Offline

Activity: 714
Merit: 512


View Profile WWW
April 14, 2018, 12:13:41 PM
 #1

I am running several Dell R815 servers to mine Monero.

I have installed UBUNTU Linux 16.04 on these machines.

I have XMR-STAK running no problem at all -- works great... get ~2kH per system.

BUT I have not been able to successfully get XMR-STAK or any program, for that matter, to start up with the OS.

There is a GUI section in UBUNTU that you can add Startup programs... or so it says... but it doesn't work.

For security, your account has been locked. Email acctcomp15@theymos.e4ward.com
bobben2
Full Member
***
Offline Offline

Activity: 279
Merit: 104


View Profile
April 14, 2018, 12:26:09 PM
 #2

Have a look at this

https://askubuntu.com/questions/814/how-to-run-scripts-on-start-up

As you can see there are several methods.

Fellow miners, get your thens and thans in order and help other forum readers understand what you are writing. Remember the grammar basics:  B larger THAN A (comparator operator). If something THEN ....
sundownz (OP)
Hero Member
*****
Offline Offline

Activity: 714
Merit: 512


View Profile WWW
April 14, 2018, 12:50:52 PM
 #3

Thanks I'll try some of those methods. Running these servers is my first Linux experience.

For security, your account has been locked. Email acctcomp15@theymos.e4ward.com
Overdrive5
Member
**
Offline Offline

Activity: 113
Merit: 10


View Profile
April 14, 2018, 02:24:53 PM
 #4

Hello ~

1st post on this forum. Have been a long time lurker and finally found a question I felt I could contribute and give back to the community.

Sundownz, copy,edit and save the example script below in /etc/init/ as something like StartStak.sh

After you saved it, chmod it to 755 . This will allow it to be executable.



Code:
#!/bin/bash

# leave the line above untouched, it is needed for any bash scripts
# The # starting any lines below means it is a commented line, so don't execute

# You *must* edit the line below to change directory to your directory of your xmr-stak executable

cd /home/xmr/xmr-stak/bin

# Assuming a fresh reboot, Wait 60 seconds for internet to become available. edit as needed.
sleep 60

# do a loop to run xmr-stak and log any crashes.

while :
do

# My Puppy Linux Xenial Ubuntu derivative uses urxvt terminal program. Not sure if your O/S has it. Edit as needed.

urxvt -title XMR -e ./xmr-stak

# I use the below line to log Miner Restarts to monitor for any crashes

echo $(date) XMR Miner restart >>~/MinerRestart.log
done 



PS. When you get a chance, check out puppy linux. It's a nice sub 1GB flashdrive loadable linux that I have been using for over 12 years. I have always liked their philosophy of compact speedy root linux's. They come in several tasty flavors such as Ubuntu, Slackware and many others.

Hope this is helpful.... Smiley

OverDrive5

sundownz (OP)
Hero Member
*****
Offline Offline

Activity: 714
Merit: 512


View Profile WWW
April 14, 2018, 03:41:34 PM
 #5

Thanks for the help! =)

For security, your account has been locked. Email acctcomp15@theymos.e4ward.com
Overdrive5
Member
**
Offline Offline

Activity: 113
Merit: 10


View Profile
April 17, 2018, 02:39:45 AM
 #6

A few more details about the above instructions....

1. This presumes you *are* logging in as root
2. I just remembered I run my script *after* starting X-windows. If you do the same, then save StartStak.sh to your directory that that runs programs after loading X (for me it is /root/Startup)
3. If you want to run from the command prompt instead then replace the line:

Code:
urxvt -title XMR -e ./xmr-stak

with

Code:
./xmr-stak


in the StartStak.sh file.

4. Also, if you want to run from the command prompt instead and your linux does not have /etc/init, then it may have /etc/init.d or etc/rc.d they will also run scripts on startup as well.

I personally prefer the Puppy Linux way of doing things, automatically starting as root and loading X as it is similar to windows. So it allows me to automatically load my miner program after a reboot without me ever touching the keyboard. I am sure other linux's can setup the same way. I just found this as the path of least resistance for me.

HTH

Overdrive5
sundownz (OP)
Hero Member
*****
Offline Offline

Activity: 714
Merit: 512


View Profile WWW
April 18, 2018, 12:39:15 PM
 #7

Alrighty... so I made the script inside "init" -- and it doesn't start at login.

I am trying "init.d" here in just a minute.

The script itself works if I execute it with "sudo"... but the problem may be that I don't seem to be ROOT on the system. And I honestly don't see an option to assign that to my user.

For security, your account has been locked. Email acctcomp15@theymos.e4ward.com
sundownz (OP)
Hero Member
*****
Offline Offline

Activity: 714
Merit: 512


View Profile WWW
April 18, 2018, 12:50:45 PM
 #8

Alrighty... so I made the script inside "init" -- and it doesn't start at login.

I am trying "init.d" here in just a minute.

The script itself works if I execute it with "sudo"... but the problem may be that I don't seem to be ROOT on the system. And I honestly don't see an option to assign that to my user.

Also no go in the "init.d" folder.

That being said... it APPEARS that for the "root" login to work on UBUNTU you have to type in the password every time at login. Based on what Google has shown me so far... I guess I will try it out and see -- it won't save me alot of headache unless the system just logs back in on it's own after a power loss event. If I need to type in a password I'll STILL have to go to each system one-by-one.

For security, your account has been locked. Email acctcomp15@theymos.e4ward.com
sundownz (OP)
Hero Member
*****
Offline Offline

Activity: 714
Merit: 512


View Profile WWW
April 18, 2018, 01:06:00 PM
 #9

Well... I can get into the ROOT from my terminal but cannot get the system to login as root from the get-go.

*ugh*

For security, your account has been locked. Email acctcomp15@theymos.e4ward.com
Overdrive5
Member
**
Offline Offline

Activity: 113
Merit: 10


View Profile
April 18, 2018, 01:13:52 PM
 #10

Try /etc/rc.d also if you have it.

Unfortunately, I have zero experience with "user" based linux. All my experience is with root based linux via puppy linux.  The version I am using is Xenialpup 64.

Not sure if the link below will work but here goes:

http://murga-linux.com/puppy/viewtopic.php?t=109476

It is based on Ubuntu Xenial 64 but "puppy trained" to load up as root. The iso is only 330 meg. If you want to compile any apps then you will need the 198 meg "Devx" sfs also. If you can't figure out how to start Ubuntu as root, maybe give it a whirl?
sundownz (OP)
Hero Member
*****
Offline Offline

Activity: 714
Merit: 512


View Profile WWW
April 18, 2018, 01:16:05 PM
 #11

Try /etc/rc.d also if you have it.

Unfortunately, I have zero experience with "user" based linux. All my experience is with root based linux via puppy linux.  The version I am using is Xenialpup 64.

Not sure if the link below will work but here goes:

http://murga-linux.com/puppy/viewtopic.php?t=109476

It is based on Ubuntu Xenial 64 but "puppy trained" to load up as root. The iso is only 330 meg. If you want to compile any apps then you will need the 198 meg "Devx" sfs also. If you can't figure out how to start Ubuntu as root, maybe give it a whirl?

I may have to... Unbuntu is making me crazy with trying to make this work.

Unfortunately that means re-installing Linux on 25 machines, hah.

For security, your account has been locked. Email acctcomp15@theymos.e4ward.com
Overdrive5
Member
**
Offline Offline

Activity: 113
Merit: 10


View Profile
April 18, 2018, 01:28:27 PM
 #12

I just PM'd you my number.

I have all my rigs set to boot from flash drives. None of them have or need hard drives.

I use sandisk 32gb drives. I get them on ebay for ~$13 each.

Updating becomes pretty easy peasy after that. Cloning is done in minutes also. But you will have edit /ect/hostname before you boot up the new cloned system so you don't conflict with the existing system.
Overdrive5
Member
**
Offline Offline

Activity: 113
Merit: 10


View Profile
April 18, 2018, 02:05:35 PM
 #13

Also, FWIW, The easiest method to try it out is to download the ISO and the burn the ISO image on to a CD (not copy).

Boot from the CD and then try it out. If you like it then use "Puppy Installer" to install it to a USB flash drive.

I recommend re-partitioning the flash drive as ext4 before you install it though. It is a much more durable filesystem for rigs that can crash regularly and often. I also recommend you use USB3 flash drives. They are speedier, even in USB2 ports.
Vann
Hero Member
*****
Offline Offline

Activity: 1036
Merit: 606



View Profile
April 18, 2018, 03:55:14 PM
Last edit: April 18, 2018, 06:49:13 PM by Vann
 #14

You do not need root access to run a program at startup.

1/. Login under your user account, create a text file with gedit and add:

Code:
#!/bin/sh
xterm -hold -e "cd /home/<YOURUSERNAME>/<PATH_TO_THE_XMR-STAK_EXECUTABLE_FOLDER> && ./xmr-stak --<YOUR_CONFIGURATION_OPTIONS>"

2/. Save the file as xmr-stak_Launch.sh in the root of your home directory.

3/. Open terminal and make the script executable by your user:

Code:
chmod +x /home/<YOURUSERNAME>/xmr-stak_Launch.sh

4/. Open the Ubuntu Dash, search for "Startup Applications" and click on it.

5/. In the "Add Startup Application" window add:

Name: XMR-STAK
Command: Browse to the xmr-stak_Launch.sh file in the root of your home directory and click 'Add'

XMR-STAK  should now launch after your login to Ubuntu. If you want to add a delay before starting the application, open the starutp file located in:

Code:
~/.conf/autostart/XMR-STAK.sh.desktop

with gedit  and add a delay to the file:

Code:
[Desktop Entry]
Type=Application
Exec=/home/<YOURUSERNAME>/xmr-stak_Launch.sh
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
X-GNOME-Autostart-Delay=<DELAY_IN_SECONDS>
Name[en_US]=XMR-STAK
Name=XMR-STAK
Comment[en_US]=
Comment=



NameTaken
Hero Member
*****
Offline Offline

Activity: 630
Merit: 502


View Profile
April 18, 2018, 04:01:10 PM
 #15

Ubuntu as well as all major Linux distributions have adopted Systemd as the init system for service and log management. The proper way to start a service (miner) on boot is to create a service file in /etc/systemd/system/ then enable it.
cod3gen
Member
**
Offline Offline

Activity: 311
Merit: 69

PowerMining.pw


View Profile WWW
April 18, 2018, 04:09:53 PM
 #16

Use screen and systemctl/systemd - works perfectly on my Ubuntu`s.

https://www.powermining.pw ⮚ Hit us with your power while mining for over 30 listed coinz in various algorithms! Get in touch on Discord: https://discord.gg/qSV6b9d
theodrim
Newbie
*
Offline Offline

Activity: 78
Merit: 0


View Profile
April 18, 2018, 04:14:59 PM
 #17

What NameTaken said is proper way to do it, except user services will be inside ~/.config/systemd/user/service.name. example (change user/group for your username, unless you need to xmr-stak running as root then place it inside /etc/systemd and don't specify any)
Code:
$vim ~/.config/systemd/user/xmr.service

[Unit]
Description=xmr-stak
After=network.target

[Service]
User=user
Group=user
Type=simple
RemainAfterExit=yes
ExecStart=/path/to/your/xmr-stak -c /path/to/config

[Install]
WantedBy=default.target

$systemctl --user enable xmr.service

ps: you can add tmux/screen if you need it -
Code:
ExecStart=/usr/bin/tmux new-session -d -s xmr /path/to/your/xmr-stak -c /path/to/config
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!