Score:-1

Is screen capable of displaying a root process?

km flag

I am trying to run XMRig at boot on Ubuntu Server 22.04.1 and my basic knowledge is not enough to solve this issue.

I am following this procedure which uses a systemd service to launch a shell script which, in turn, launches XMRig within a named screen so I am able to view the console (if needed). As it is, it works, but XMRig needs to run as root so hugepages can be utilized for a performance gain.

If I change the 'user' key in the service file to 'root', XMRig runs as root, but when I try to view the log using screen -r, I get a message that states 'There is no screen to be resumed.'

I am hoping there is a simple change that would allow both screen -r and user=root to work together.

/etc/systemd/system/xmrig.service:

[Unit]
Description=XMRig Service

[Service]
LimitMEMLOCK=infinity
Type=forking
RemainAfterExit=yes
User=<user>
WorkingDirectory=/home/<user>
ExecStart=/home/<user>/StartXMRig
KillMode=none

[Install]
WantedBy=multi-user.target

/home/user/StartXMRig:

#!/bin/sh
screen -dmS xmrig /home/<user>/XMRig/xmrig

binary permissions (~/XMRig/xmrig:

-rwxr-xr-x 1 root    root    7022816 Oct 23 03:57 xmrig

Score:0
cn flag

You only need root to change a system wide variable.

Enable Hugepages

This will increase your hashing performance:

Edit the file /etc/sysctl.conf using your preferred editor, use sudo to elevate your permissions, adding the following to the end of the file:

vm.nr_hugepages=1024

You do this with the following commands

 sudo -i
 nano /etc/sysctl.conf  

scroll to the end and add

 vm.nr_hugepages=1024

save and exit. Exit the root prompt.

Is screen capabel of displaying a root process?

Yes but screens only connect if the user is the user of the screen.

In Ubuntu there is never a need to run software as "root". NOWHERE in the instruction is stated you need to run this as root. Part of the instruction states:

The user being used is named miner, so throughout the instructions, amend user if yours is different !

So your admin user is good enough but that is not as secure as a dedicated user for a software that is a server.

From a security point it would be advised to create a user "miner" and use that. It will 100% match the instructions and if the creator of the miner has ill intent he will not have your admin password and can only mess up /home/miner/.

Powerkey avatar
km flag
Thank you. The user info about screen was helpful. I had already done the other steps but it still wasn't working. I spent some time with it and discovered that the vm value was simply not large enough for the application. Changing it to 2560 allowed the application to run at optimal performance under a regular user.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.