AWE-MAZE

My adventure in the MAZE of Tech, Life and Thought

Home Server

Installation

Ubuntu Server

Tutorials

https://ubuntu.com/server/docs/install/step-by-step

Insight

Boot issue

After installing the Ubuntu boot server, I reboot as instructed. But the computer kept going back to the UEFI BIOS page. It appears there is no bootable system. The problem was Grub2 was broken. I used custom configuration during the “Storage” step. The fix was to choose the whole disk to install.

LVM (Logical Volumes Management)

This is one of the questions asked during the installation. I found a good reference. Basically, LVM enabled the virtualization of harddisks. It can combine multiple harddisks into one volume. This helps later on, when we try to resize the disks. 

Issue:

Ubuntu 20.04 seems to have the same issue as 18.04. It allocates 4G in LV. This space is used up so quickly. It need to allocate all free spaces. Here is a good explanation on PV, VG, LV: https://www.tecmint.com/extend-and-reduce-lvms-in-linux/ 

  • Physical Volume (PV) => The physical space on a drive.
  • Volume Group (VG) => An abstracted amount of drive space that can be split between multiple drives/devices.
  • Logical Volume (LV) => The space that ubuntu “sees”

Setup Remote Access

Netgear setup:

https://kb.netgear.com/25389/Enabling-VPN-service-on-a-NETGEAR-router-using-a-MAC-OS-computer

After enabling VPN Service, Mac uses SmartPhone OVPN, instead of nonwindows one. Double clicking smartphone.ovpn launches tunnelblick. After adding the configuration file, it requires a restart of the mac before it can connect. 

Don’t use OpenVPN Connect client! The configuration from from Netgear is doesn’t work with the latest OpenVPN Connect V3. 

Reserve IP for Server

https://kb.netgear.com/25722/How-do-I-reserve-an-IP-address-on-my-NETGEAR-router

wakeonlan 

https://www.techrepublic.com/article/how-to-enable-wake-on-lan-in-ubuntu-server-18-04/

I found Ubuntu service sleeps sometimes during the night. So when I tried to log in in the morning, ssh failed. This setup enables the wake up

  • Suspend system: sudo systemctl suspend
  • Wake up system: wakeonlan MAC

Sleep

Use the following command to disable sleep:

sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target

Use the following command to enable sleep:

sudo systemctl unmask sleep.target suspend.target hibernate.target hybrid-sleep.target

Hibernate

Hibernate requires a swap partition. Here is a tutorial to create a swap file: https://linuxize.com/post/how-to-add-swap-space-on-ubuntu-20-04/

We also need to setup Resume with the Swap UUID: (Not working)

https://askubuntu.com/questions/196364/i-have-enabled-hibernate-but-it-isnt-working-what-can-i-do/196365#196365

VNC

Tutorials

https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-vnc-on-ubuntu-20-04

Insight

Root Login

Ubuntu doesn’t have root login. However, there seems to be a way to use the ssh key to login as root. Reference: https://coderwall.com/p/dqtq1a/enable-remote-root-login-on-ubuntu-safely

Setup Firewall

We can use ufw to only allow OpenSSH to access. Reference: https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-20-04 

Using SSH to connect VNC

In the tutorial, there is a section that talks about a secure way of connecting to VNC, which I found very interesting. As we have set up the FireWall to only allow OpenSSH to connect, regular VNC connection on port 5901 is not going to work. Therefore we need to create a proxy that helps tunnel the SSH connection to VNC.  

  • On the Server, we use vncserver -localhost
  • On the local machine, we use ssh -L 59000:localhost:5901 -C -N -l <username> <your_server_ip> to create a ssh connection. 
  • In VNC Viewer, we can type localhost:59000 to connect to the server
  • Remember to set picture quality to high to see better graphics

Display Manager

To change display manger, we can edit /etc/X11/default-display-manager 

Vim

Packages

Issues

File System Read-only Issue

This problem happens when the server is disconnected from power during sleep. After power reconnects, the server can no longer be woken by network packet. Physical power up is required. However, the server would go into a file system “lock-down”, where it becomes Read-only. 

Fix

The fix is straight forward, but requires physical access to the machine (may not? I haven’t tried). With access to the machine, follow the following steps:

  1. Launch server with recovery mode by go to BIOS and select boot drive to force grub to kick off. 
  2. Go to root terminal. 
  3. Use df -Th to check where OS is installed
  4. Use sudo fsck.ext4 -f /dev/sda1, which /dev/sda1 replaced with the filesystem from step 3
  5. system reboot. 

References:

https://www.tecmint.com/find-linux-filesystem-type/
https://askubuntu.com/questions/197459/how-to-fix-sudo-unable-to-open-read-only-file-system

Vivado

Issues:

Vivado Launch issue

application-specific initialization failed: couldn’t load file “librdi_commontasks.so”: libtinfo.so.5: cannot open shared object file: No such file or directory.

Resolution:

sudo apt update 

sudo apt install libtinfo-dev 

sudo ln -s /lib/x86_64-linux-gnu/libtinfo.so.6 /lib/x86_64-linux-gnu/libtinfo.so.5

Simulation Run issue

ERROR: [XSIM 43-4307] Invalid entry in the project file, expecting a file name but specified path ‘../../../../<project_name>_project.ip_user_files/ipstatic/hdl’ represents a directory name.

Resolution:

https://forums.xilinx.com/t5/Simulation-and-Verification/2018-3-XSIM-43-4307-Invalid-entry-in-the-project-file/td-p/949723

Change file Library property to xil_defaultlib

Simulation failure Failed t ocompile generated C file xsim.dir…

Resolution:

This post has some good information on how to debug the issue:

https://forums.xilinx.com/t5/Simulation-and-Verification/One-solution-to-error-quot-Failed-to-compile-generated-C-file/td-p/865415

Petalinux

-> sudo apt-get install iproute2 gawk make net-tools libncurses5-dev tftpd libssl-dev flex bison libselinux1 gnupg wget diffstat chrpath socat xterm autoconf libtool tar unzip texinfo zlib1g-dev gcc-multilib build-essential screen pax gzip python

-> sudo dpkg –add-architecture i386

-> sudo apt-get update 

-> sudo apt-get install zlib1g:i386

Issues:

Running petalinux installer failed

environment: line 301: ((: 10#30+ > 10#24: syntax error: operand expected (error token is “> 10#24”)

environment: line 305: ((: 10#30+ < 10#24: syntax error: operand expected (error token is “< 10#24”)

GPU – CUDA Installation

GPU Driver:

https://askubuntu.com/questions/1247220/ubuntu-20-04-installing-nvidia-drivers

Issues

Failed to load GPU

2021-03-01 05:36:05.304116: W tensorflow/stream_executor/platform/default/dso_loader.cc:60] Could not load dynamic library ‘libcudart.so.11.0’; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory

2021-03-01 05:36:05.304137: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.

Solution

https://stackoverflow.com/questions/48957195/how-to-fix-docker-got-permission-denied-issue

$ sudo usermod -aG docker $USER

$ newgrp docker

$ docker run hello-world

$ reboot

CUDA ToolKit:

https://www.tensorflow.org/install/gpu#install_cuda_with_apt

$ wget -O /etc/apt/preferences.d/cuda-repository-pin-600 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin

$ sudo apt-key adv –fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub

$ sudo add-apt-repository “deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/ /”

$ sudo apt install cuda

$ echo ‘export PATH=/usr/local/cuda/bin${PATH:+:${PATH}}’ >> ~/.bashrc

$ nvcc –version

Leave a Reply

Your email address will not be published. Required fields are marked *