Issues : Virtualbox

Error when installing/ running Ubuntu in VirtualBox

Solution:

Disabled hyper-v by doing the following.


  • Open 'Turn Windows features on or off'

(search for that in the start menu)

  • Untick hyper-v, Windows hypervisior platform and virtual machine platform.

  • Start the command prompt as an administrator.

(type cmd in the start menu, right click 'command prompt' and select 'run as administrator')

  • Run the following command

bcdedit /set hypervisorlaunchtype off


After a restart it seemed to install and work.


//--Enable hypervisor

bcdedit /set hypervisorlaunchtype auto

Issues : Docker

Error Permission denied /var/lib/dpkg/lock

Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)

E: Could not get lock /var/lib/dpkg/lock-frontend

E: Could not get lock /var/lib/dpkg/lock – open (11 Resource temporarily unavailable)

E: Unable to lock the administration directory (/var/lib/dpkg/) is another process using it?

# Solution solved

Check which other process is running the apt command (package manager for handling software)

ps -A | grep apt

ps aux | grep apt

ps afx|grep dpkg

Get the process ID of the process holding the lock files

sudo lsof /var/lib/dpkg/lock-frontend

sudo lsof /var/lib/dpkg/lock

sudo lsof /var/lib/apt/lists/lock

sudo lsof /var/cache/apt/archives/lock

Replace the <process_id> with the number you got in the output of previous command.

sudo kill -9 <pid>

sudo kill -SIGKILL <pid>

sudo killall dpkg

sudo killall apt apt-get

Remove the lock files

sudo rm /var/lib/dpkg/lock

sudo rm /var/lib/dpkg/lock-frontend

sudo rm /var/lib/apt/lists/lock

sudo rm /var/cache/apt/archives/lock

Reconfigure the packages

sudo dpkg --configure -a

# Run your process you want, if isn't work follow next step

apt --fix-broken install

clear Logs for Docker container

Clear the logs properly for a Docker container

sudo sh -c "truncate -s 0 /var/lib/docker/containers/*/*-json.log"

To get the size of the logs

sudo sh -c "du -ch /var/lib/docker/containers/*/*-json.log"

To only get the total of the size of the logs

sudo sh -c "du -ch /var/lib/docker/containers/*/*-json.log | grep total"

Issues : OS

Groups

# Create a new group

sudo groupadd <new_group>

# Delete a Group

sudo groupdel <group_name>

# Display groups for a user by specifying the username

groups <user_name>

# View a list of groups

getent group

# Add an Existing User to an Existing Group

sudo adduser <user_name> <new_group>

sudo useradd –G <new_group> <user_name>

sudo usermod –a –G <group_name> <user_name>

# Add a User to Multiple Groups at Once

sudo usermod –a –G <new_group>,<new_group2>,<new_group3> <user_name>

# Change a users primary group

sudo usermod –g <new_group> <user_name>

# Remove a User from a Group

sudo gpasswd –d <user_name> <group_name>

# Display the groups a user belongs to, including user ID (uid) and group ID (gid)

id <user_name>

User

# Create a new user

sudo adduser <user_name>

# Give this user administrative power

sudo usermod -aG sudo <user_name>

# Switch to our new user

sudo su - <user_name>

# Double-check user

sudo whoami

# Change a password for user name

sudo passwd <user_name>

# Change a password for root user

sudo passwd root

# Change your own password

passwd

# Delete user

sudo deluser <user_name>

# Remove user's home folder

sudo deluser --remove-home <user_name>

# Sync folder from user1 to user2

sudo rsync -va /home/<user_name1>/ /home/<user_name2>

sudo rsync -va /home/truongxuanc/ /home/truongcx263

# Show all user accounts on the system

less /etc/passwd

awk -F: '{ print $1}' /etc/passwd

Check System OS

# Check ubuntu version

lsb_release -a

# Check additional updates run

apt list --upgradable

# Check which user running which service

ps -eo pid,ppid,%mem,%cpu,cmd --sort=-%mem

ps -eouser,uid,pid,ppid,pcpu,pmem,cmd --sort=-pcpu

ps -ef

# check disk usage:

df -h --total

# To find the 10 biggest folders in current directory:

du -h | sort -hr | head -n 10

# To find the 10 biggest files and folders in current directory:

du -ah | sort -hr | head -n 10

Ping

# using Telnet -- sudo apt-get install telnet

telnet <IP/DNS> <PORT>

# Ctrl + ] then type "q/quit" to exit

# using netcat -- sudo apt-get install netcat

nc -vz <IP/DNS> <PORT>

# using nmap command -- sudo apt-get install nmap

nmap -Pn <PORT> <IP/DNS>

Uninstall

#List of all installed packages

dpkg --list

# Uninstall Software Using the Command Line in Linux

sudo apt-get --purge remove <packages_name>

"--purge" : uninstalls and deletes all the configuration files

Error == sudo: no tty present and no askpass program specified

Solution:

# Add your <user-name> to the sudoer group

sudo adduser <user-name> sudo

# Set no password required user

sudo sh -c "echo '<user-name> ALL=NOPASSWD: ALL' >> /etc/sudoers"

Error == crontab : cronjob : Pam_unix (sudo:auth) : conversation failed

Solution:

# Run cmd

sudo nano /etc/pam.d/sudo

# Added was auth sufficient pam_permit.so line to /etc/pam.d/sudo file

auth sufficient pam_permit.so

Error == crontab : cronjob : No MTA installed, discarding output)” error in the syslog

Solution1:

Linux uses mail for sending notifications to the user.

Most Linux distributions have a mail service including an MTA (Mail Transfer Agent) installed.

Ubuntu doesn't though.

You can install a mail service, postfix for example, to solve this problem.

sudo apt-get install postfix

Solution2:

Discard it at the crontab to prevent cron from trying to send an e-mail.

sudo crontab -e

-- At the top of the file, add

MAILTO=""


-- Or add >/dev/null 2>&1 to every job:

* * * * * yourCommand >/dev/null 2>&1

Error == chmod : FILE has “other” file permissions. Please remove all “other” file permissions.

Solution

# Run cmd

chmod 400 /filelocation/file

Error == chown : Permiss Denied

Solution

# Run cmd

sudo chown -R <user_name>:sudo /PATH

sudo chown -R <user_name>:<group_name> /PATH

Error == chown : /opt/cardano/cnode/db: Permission denied

Solution

# Run cmd

sudo chmod -R 777 db

Error == chmod : Failed to start node_exporter.service: Unit node_exporter.service is masked.

Solution

# Run cmd

sudo chmod 700 node_exporter.service

Explain : firewall rule { iptables ; ufw ; gufw ; fail2ban }

  • iptables is the main firewall. It talks to the kernel. It's more complicated.

  • ufw wants to make it "uncomplicated" ("ufw" stands for "uncomplicated firewall"). It talks to iptables. It's a command line tool.

  • The G in Gufw must stand for "graphical", which should provide a click-click interface for ufw. It talks to ufw. It's a GUI.

  • Fail2ban scans log files and bans IPs that show the malicious signs -- too many password failures, seeking for exploits, etc.

See more: firewall | ufw | ufw syntax | UncomplicatedFirewall | Iptables | Gufw | fail2ban | Official Fail2ban


Issues : CardanoNode

solving the Cardano node huge memory usage

Link: https://forum.cardano.org/t/solving-the-cardano-node-huge-memory-usage-done/67032

Solved relays and producer memory usage problem:

-- some of relays would end up using all of their RAM

-- and start swapping

-- and suffering from IO delays until restarted


Get the default RTS parameters the node is compiled with using the following command:

cardano-node +RTS --info


So the default parameters are:

-T -I0 -A16m -N2 --disable-delayed-os-memory-return


RTS parameters that will save you a large amount of server’s RAM

+RTS -N2 --disable-delayed-os-memory-return -I0.3 -Iw600 -A16m -F1.5 -H2500M -T -S -RTS

+RTS -N4 --disable-delayed-os-memory-return -I0.3 -Iw300 -A16m -F1.5 -H3G -T -S -n4m -RTS


To use these parameters, you need to launch the node like this:

cardano-node +RTS \

-N2 --disable-delayed-os-memory-return \

-I0.3 -Iw600 \

-A16m -F1.5 -H2500M -T -S \

-RTS run \

--your-usual-parameters


Parameters explain:

-N2 tells the RTS to dispatch the programs threads on 2 cpus (using -N without a number will make it use all the CPUs available)

--disable-delayed-os-memory-return tells the RTS to use a different and less optimized way to release memory so that GNU/Linux performance tools such as top and htop report the correct amount of resident memory being used (mostly useless as explained above)

-I0.3 tells the RTS to perform a major GC if the node has been idle for 0.3s

-Iw600 tells the RTS to perform the above major GC only if the last one happened more than 10 minutes ago.

-A16m is the size of the new block allocated in the hot zone, it should be adapted according to the number of cpu you configured with the -N parameter

-F1.5 roughly tells the RTS to keep allocated 1.5 times more than the amount of live data it found when it started its last major GC.

-H2500M forces the RTS to allocate 2.5GB of RAM at startup and keep this minimum allocated. (the node’s live data is usually around 2GB, so this seems appropriate)

-T makes the RTS statistics available programmatically.

-S makes the node print various garbage collection statistics on the standard error output


fix Daedalus “connecting to network” and syncing issue

Detail link: https://forum.cardano.org/t/workaround-to-fix-daedalus-connecting-to-network-and-syncing-issue/59780

Daedalus is unable to sync with the blockchain because the time on your machine

The solution for Windows 10 ->

Go to

Date & Time Settings

Additional date,time & regional Settings

Set the time and date

Internet Time

Change Settings

Server: time.google.com 226

Update Now


Restart Daedalus and your good to go

Error: cardano-cli: Network.Socket.connect: <socket: 11>: does not exist (No such file or directory).

Solution

# Run cmd

echo export CARDANO_NODE_SOCKET_PATH="$CNODE_HOME/sockets/node0.socket" >> $HOME/.bashrc

Error: Leaderlogs already calculated for epoch 242, skipping!

Solution

# Run cmd

./cncli.sh leaderlog force

Issuses : Stake pool is not shown in Daedalus

Issuses : cnode not run when update new KES

Solution

# Run cmd

chmod 400 vrf.skey


Issuses : cnode not run when update new db

Solution

# Run cmd

sudo rm -rf $CNODE_HOME/db

sudo unzip ~/tmp/db.zip -d $CNODE_HOME/

sudo rm -rf ~/tmp/db.zip

sudo chmod -R a+rwx $CNODE_HOME/db


Issuses : Check Block Producer/ Core is ready to create Block

# Check with gLiveView

cd $CNODE_HOME/scripts

./gLiveView.sh


## Important informations:

-- Cardano Node - (Core - Mainnet) - mean that the node runs as a BP

-- Processed TX - mean that the node is processing TX

-- Peers - show how many Relays your BP is connected (for more informations about peers press “p”)

-- KES informations - show the KEYS are still valid, the date when will gone expire

-- BLOCKS - THE MOST IMPORTANT information - show that the node is ready to create BLOCKS

Update : json configuration files

# Getting configuration files : IOHK source --

https://hydra.iohk.io/job/Cardano/cardano-node/cardano-deployment/latest-finished/download/1/index.html


wget -O config.json https://hydra.iohk.io/job/Cardano/cardano-node/cardano-deployment/latest-finished/download/1/mainnet-config.json


wget -O byron-genesis.json https://hydra.iohk.io/job/Cardano/cardano-node/cardano-deployment/latest-finished/download/1/mainnet-byron-genesis.json


wget -O genesis.json https://hydra.iohk.io/job/Cardano/cardano-node/cardano-deployment/latest-finished/download/1/mainnet-shelley-genesis.json


wget -O topology.json https://hydra.iohk.io/job/Cardano/cardano-node/cardano-deployment/latest-finished/download/1/mainnet-topology.json


# Getting configuration files : Cardano community source --

https://github.com/cardano-community/guild-operators/tree/master/files


wget -O config.json https://raw.githubusercontent.com/cardano-community/guild-operators/master/files/config-mainnet.json


wget -O dbsync.json https://raw.githubusercontent.com/cardano-community/guild-operators/master/files/dbsync.json


wget -O genesis.json https://raw.githubusercontent.com/cardano-community/guild-operators/master/files/genesis.json


wget -O topology.json https://raw.githubusercontent.com/cardano-community/guild-operators/master/files/topology.json


wget -O byron-genesis.json https://raw.githubusercontent.com/cardano-community/guild-operators/master/files/byron-genesis.json

Update : scripts files

#CNTOOLS Scripts

https://github.com/cardano-community/guild-operators/tree/master/scripts/cnode-helper-scripts

cd $CNODE_HOME/scripts

#-- cncli.sh

curl -s -o cncli.sh https://raw.githubusercontent.com/cardano-community/guild-operators/master/scripts/cnode-helper-scripts/cncli.sh

chmod +x cncli.sh

#-- env

curl -s -o env https://raw.githubusercontent.com/cardano-community/guild-operators/master/scripts/cnode-helper-scripts/env

#-- cnode.sh

curl -s -o cnode.sh https://raw.githubusercontent.com/cardano-community/guild-operators/master/scripts/cnode-helper-scripts/cnode.sh

chmod +x cnode.sh

#-- cntools.sh

curl -s -o cntools.sh https://raw.githubusercontent.com/cardano-community/guild-operators/master/scripts/cnode-helper-scripts/cntools.sh

chmod +x cntools.sh

#-- topologyUpdater.sh

curl -s -o topologyUpdater.sh https://raw.githubusercontent.com/cardano-community/guild-operators/master/scripts/cnode-helper-scripts/topologyUpdater.sh

chmod 750 topologyUpdater.sh

#-- deploy-as-systemd.sh

curl -s -o deploy-as-systemd.sh https://raw.githubusercontent.com/cardano-community/guild-operators/master/scripts/cnode-helper-scripts/deploy-as-systemd.sh

chmod 750 deploy-as-systemd.sh


# PoolTool Scripts

https://github.com/papacarp/pooltool.io

#-- sendmytip.sh

curl -s -o sendmytip.sh https://raw.githubusercontent.com/papacarp/pooltool.io/master/sendmytip/shell/sendmytip.sh

chmod 750 sendmytip.sh


# Update Pool Scripts

curl -s -o pool_upgrade.sh https://raw.githubusercontent.com/Alexd1985/node_software_upgrade_script/main/software_upgrade.sh

chmod 750 pool_upgrade.sh

Explain : Density is an overall network metric and not metric for node performs.

[5 day/Epoch]: Each Epoch duration for 5 days

60 x 60 x 24 x 5 = 432,000 second/epoch


[1 block/20 seconds]: 1 Block is produced for every 20 second

Blockchain Density = 1/20 = 5%

432,000 x Density = 432,000 x 5% = 21,600 block/epoch


The density measures the actual block production rate.

Example: Density = 4.872%

4.872% / 5% = 97.44 % of blocks are actually produced

Explain : adapools - parameters

Pledge bar :: pledge versus global average pledge size

Pledge Leverage = real pledge / live_stake * 100