Common problem for Ubuntu/Debian-based system

The error message you’re encountering:

Failed to restart sshd.service: Unit sshd.service not found.

indicates that the sshd.service unit is not recognized by your system’s service manager. This is common in certain Linux distributions, such as Ubuntu, where the SSH service is managed under a different name.

Solution:

On Ubuntu and Debian-based systems, the SSH service is typically managed as ssh instead of sshd. To restart the SSH service after making configuration changes, use the following command:

sudo systemctl restart ssh

Explanation:

  • systemctl: The command to interact with the system’s service manager.
  • restart: Tells the service manager to stop and then start the specified service.
  • ssh: The name of the SSH service unit on Ubuntu systems.

This command will restart the SSH service, applying any changes you’ve made to its configuration.

Additional Information:

The naming convention for the SSH service can vary between different Linux distributions:

  • Ubuntu/Debian: The service is typically named ssh.
  • CentOS/Fedora/RHEL: The service is usually named sshd.

This difference in naming can lead to confusion when managing services across different systems. Always ensure you’re using the correct service name for your specific distribution.

For more detailed information, you can refer to discussions on this topic, such as this Reddit thread:

(reddit.com)

By using the appropriate service name, you should be able to restart the SSH service without encountering the “Unit not found” error.

Setting up dev env

  1. Install Git
sudo apt install git

1.1 Test connection to Github

azureuser@davidgaovm:~$ ping github.com
PING github.com  56(84) bytes of data.
64 bytes from lb-140-82-112-4-iad.github.com : icmp_seq=1 ttl=49 time=3.21 ms
64 bytes from lb-140-82-112-4-iad.github.com : icmp_seq=2 ttl=49 time=1.43 ms
64 bytes from lb-140-82-112-4-iad.github.com : icmp_seq=3 ttl=49 time=1.54 ms
64 bytes from lb-140-82-112-4-iad.github.com : icmp_seq=4 ttl=49 time=1.35 ms
^C
--- github.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 1.347/1.879/3.206/0.768 ms

nice, now I can get my neovim config

  1. neovim

2.1 get neobim config

git clone git@github.com:davidgao7/nvim-config.git

2.2 install neovim

get common software

azureuser@davidgaovm:~$ sudo apt-get install software-properties-common
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
software-properties-common is already the newest version (0.99.49.1).
software-properties-common set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

get neovim apt-repo

sudo add-apt-repository ppa:neovim-ppa/stable
PPA publishes dbgsym, you may need to include 'main/debug' component
Repository: 'Types: deb
URIs: https://ppa.launchpadcontent.net/neovim-ppa/stable/ubuntu/
Suites: noble
Components: main
'
Description:
Neovim releases backported from Debian.

Homepage: https://neovim.io
Source/Issues: https://github.com/neovim/neovim
Documentation: https://neovim.io/doc
User Manual: https://neovim.io/doc/user
Neovim features: https://neovim.io/doc/user/nvim.html
Packaging: https://launchpad.net/neovim-ppa
More info: https://launchpad.net/~neovim-ppa/+archive/ubuntu/stable
Adding repository.
Press [ENTER] to continue or Ctrl-c to cancel.
Hit:1 http://azure.archive.ubuntu.com/ubuntu noble InRelease
Get:2 http://azure.archive.ubuntu.com/ubuntu noble-updates InRelease [126 kB]
Get:3 http://azure.archive.ubuntu.com/ubuntu noble-backports InRelease [126 kB]
Get:4 http://azure.archive.ubuntu.com/ubuntu noble-security InRelease [126 kB]
Get:5 http://azure.archive.ubuntu.com/ubuntu noble/universe amd64 Packages [15.0 MB]
Get:6 https://ppa.launchpadcontent.net/neovim-ppa/stable/ubuntu noble InRelease [24.3 kB]
Get:7 https://ppa.launchpadcontent.net/neovim-ppa/stable/ubuntu noble/main amd64 Packages [844 B]
Get:8 http://azure.archive.ubuntu.com/ubuntu noble/universe Translation-en [5982 kB]
Get:9 https://ppa.launchpadcontent.net/neovim-ppa/stable/ubuntu noble/main Translation-en [668 B]
Get:10 http://azure.archive.ubuntu.com/ubuntu noble/universe amd64 Components [3871 kB]
Get:11 http://azure.archive.ubuntu.com/ubuntu noble/universe amd64 c-n-f Metadata [301 kB]
Get:12 http://azure.archive.ubuntu.com/ubuntu noble/multiverse amd64 Packages [269 kB]
Get:13 http://azure.archive.ubuntu.com/ubuntu noble/multiverse Translation-en [118 kB]
Get:14 http://azure.archive.ubuntu.com/ubuntu noble/multiverse amd64 Components [35.0 kB]
Get:15 http://azure.archive.ubuntu.com/ubuntu noble/multiverse amd64 c-n-f Metadata [8328 B]
Get:16 http://azure.archive.ubuntu.com/ubuntu noble-updates/main amd64 Packages [837 kB]
Get:17 http://azure.archive.ubuntu.com/ubuntu noble-updates/main Translation-en [190 kB]
Get:18 http://azure.archive.ubuntu.com/ubuntu noble-updates/main amd64 Components [151 kB]
Get:19 http://azure.archive.ubuntu.com/ubuntu noble-updates/universe amd64 Packages [1002 kB]
Get:20 http://azure.archive.ubuntu.com/ubuntu noble-updates/universe Translation-en [250 kB]
Get:21 http://azure.archive.ubuntu.com/ubuntu noble-updates/universe amd64 Components [315 kB]
Get:22 http://azure.archive.ubuntu.com/ubuntu noble-updates/universe amd64 c-n-f Metadata [19.9 kB]
Get:23 http://azure.archive.ubuntu.com/ubuntu noble-updates/restricted amd64 Packages [631 kB]
Get:24 http://azure.archive.ubuntu.com/ubuntu noble-updates/restricted Translation-en [121 kB]
Get:25 http://azure.archive.ubuntu.com/ubuntu noble-updates/restricted amd64 Components [212 B]
Get:26 http://azure.archive.ubuntu.com/ubuntu noble-updates/multiverse amd64 Packages [16.3 kB]
Get:27 http://azure.archive.ubuntu.com/ubuntu noble-updates/multiverse Translation-en [3944 B]
Get:28 http://azure.archive.ubuntu.com/ubuntu noble-updates/multiverse amd64 Components [940 B]
Get:29 http://azure.archive.ubuntu.com/ubuntu noble-updates/multiverse amd64 c-n-f Metadata [552 B]
Get:30 http://azure.archive.ubuntu.com/ubuntu noble-backports/main amd64 Components [208 B]
Get:31 http://azure.archive.ubuntu.com/ubuntu noble-backports/main amd64 c-n-f Metadata [112 B]
Get:32 http://azure.archive.ubuntu.com/ubuntu noble-backports/universe amd64 Packages [13.4 kB]
Get:33 http://azure.archive.ubuntu.com/ubuntu noble-backports/universe Translation-en [11.4 kB]
Get:34 http://azure.archive.ubuntu.com/ubuntu noble-backports/universe amd64 Components [17.7 kB]
Get:35 http://azure.archive.ubuntu.com/ubuntu noble-backports/universe amd64 c-n-f Metadata [1104 B]
Get:36 http://azure.archive.ubuntu.com/ubuntu noble-backports/restricted amd64 Components [212 B]
Get:37 http://azure.archive.ubuntu.com/ubuntu noble-backports/restricted amd64 c-n-f Metadata [116 B]
Get:38 http://azure.archive.ubuntu.com/ubuntu noble-backports/multiverse amd64 Components [212 B]
Get:39 http://azure.archive.ubuntu.com/ubuntu noble-backports/multiverse amd64 c-n-f Metadata [116 B]
Get:40 http://azure.archive.ubuntu.com/ubuntu noble-security/main amd64 Packages [615 kB]
Get:41 http://azure.archive.ubuntu.com/ubuntu noble-security/main Translation-en [118 kB]
Get:42 http://azure.archive.ubuntu.com/ubuntu noble-security/main amd64 Components [8988 B]
Get:43 http://azure.archive.ubuntu.com/ubuntu noble-security/universe amd64 Packages [803 kB]
Get:44 http://azure.archive.ubuntu.com/ubuntu noble-security/universe Translation-en [171 kB]
Get:45 http://azure.archive.ubuntu.com/ubuntu noble-security/universe amd64 Components [52.0 kB]
Get:46 http://azure.archive.ubuntu.com/ubuntu noble-security/universe amd64 c-n-f Metadata [13.5 kB]
Get:47 http://azure.archive.ubuntu.com/ubuntu noble-security/restricted amd64 Packages [620 kB]
Get:48 http://azure.archive.ubuntu.com/ubuntu noble-security/restricted Translation-en [119 kB]
Get:49 http://azure.archive.ubuntu.com/ubuntu noble-security/restricted amd64 Components [208 B]
Get:50 http://azure.archive.ubuntu.com/ubuntu noble-security/multiverse amd64 Packages [12.4 kB]
Get:51 http://azure.archive.ubuntu.com/ubuntu noble-security/multiverse Translation-en [2940 B]
Get:52 http://azure.archive.ubuntu.com/ubuntu noble-security/multiverse amd64 Components [208 B]
Get:53 http://azure.archive.ubuntu.com/ubuntu noble-security/multiverse amd64 c-n-f Metadata [356 B]
Fetched 32.1 MB in 6s (5260 kB/s)
Reading package lists... Done

install neovim, symbol link with keywork vim

wget https://github.com/neovim/neovim/releases/download/v0.10.3/nvim-linux64.tar.gz
tar xzvf nvim-linux64.tar.gz
sudo ln -s ~/nvim-linux64/bin/nvim /usr/local/bin/vim

now deal with nvim plugin problem

Error detected while processing /home/azureuser/.config/nvim/init.lua:
Failed to load `plugins.restful`

/home/azureuser/.config/nvim/lua/plugins/restful.lua:33: module 'kulala.parser.jsonpath' not found:

[mason-lspconfig.nvim] installing pyright
[mason-lspconfig.nvim] installing tailwindcss
[mason-lspconfig.nvim] installing clangd
[mason-lspconfig.nvim] installing gopls
[mason-nvim-dap] automatically installing codelldb
No C compiler found! "cc", "gcc", "clang", "cl", "zig" are not executable.
No C compiler found! "cc", "gcc", "clang", "cl", "zig" are not executable.
No C compiler found! "cc", "gcc", "clang", "cl", "zig" are not executable.
No C compiler found! "cc", "gcc", "clang", "cl", "zig" are not executable.
No C compiler found! "cc", "gcc", "clang", "cl", "zig" are not executable.
No C compiler found! "cc", "gcc", "clang", "cl", "zig" are not executable.
No C compiler found! "cc", "gcc", "clang", "cl", "zig" are not executable.
No C compiler found! "cc", "gcc", "clang", "cl", "zig" are not executable.
No C compiler found! "cc", "gcc", "clang", "cl", "zig" are not executable.
No C compiler found! "cc", "gcc", "clang", "cl", "zig" are not executable.
No C compiler found! "cc", "gcc", "clang", "cl", "zig" are not executable.
No C compiler found! "cc", "gcc", "clang", "cl", "zig" are not executable.
No C compiler found! "cc", "gcc", "clang", "cl", "zig" are not executable.
No C compiler found! "cc", "gcc", "clang", "cl", "zig" are not executable.
No C compiler found! "cc", "gcc", "clang", "cl", "zig" are not executable.
No C compiler found! "cc", "gcc", "clang", "cl", "zig" are not executable.
No C compiler found! "cc", "gcc", "clang", "cl", "zig" are not executable.
No C compiler found! "cc", "gcc", "clang", "cl", "zig" are not executable.
No C compiler found! "cc", "gcc", "clang", "cl", "zig" are not executable.
No C compiler found! "cc", "gcc", "clang", "cl", "zig" are not executable.
No C compiler found! "cc", "gcc", "clang", "cl", "zig" are not executable.
No C compiler found! "cc", "gcc", "clang", "cl", "zig" are not executable.
No C compiler found! "cc", "gcc", "clang", "cl", "zig" are not executable.
No C compiler found! "cc", "gcc", "clang", "cl", "zig" are not executable.
No C compiler found! "cc", "gcc", "clang", "cl", "zig" are not executable.
Press ENTER or type command to continue
  • deal with C compiler problem: To set up a comprehensive C development environment on your Linux system, enabling the execution of commands like cc, gcc, clang, cl, and zig, follow these steps:

1. Install GCC (GNU Compiler Collection):

GCC is a widely-used compiler for C and C++ languages.

  • For Debian/Ubuntu-based systems:

    sudo apt update
    sudo apt install build-essential
    

    The build-essential package includes gcc, g++, make, and other essential development tools.

  • For Fedora:

    sudo dnf groupinstall "Development Tools"
    
  • For Arch Linux:

    sudo pacman -S base-devel
    

2. Install Clang:

Clang is an alternative compiler front end for the C, C++, and Objective-C languages.

  • For Debian/Ubuntu-based systems:

    sudo apt install clang
    
  • For Fedora:

    sudo dnf install clang
    
  • For Arch Linux:

    sudo pacman -S clang
    

3. Install Zig:

Zig is a general-purpose programming language and toolchain that can also serve as a C compiler.

  • Download and Install:

    Visit the Zig download page to get the latest version for your system.

    Alternatively, for Debian/Ubuntu-based systems:

    snap install zig --classic --beta  
    

    For other distributions, refer to their respective package managers or build from source.


4. Configure cc and cl Commands:

  • cc:

    The cc command is typically a symbolic link to the system’s default C compiler.

    To ensure cc points to GCC:

    sudo ln -sf /usr/bin/gcc /usr/bin/cc
    

    Or to point cc to Clang:

    sudo ln -sf /usr/bin/clang /usr/bin/cc
    
  • cl:

    The cl command is traditionally associated with Microsoft’s C/C++ compiler. On Linux, you can set up an alias to use Clang as cl:

    echo 'alias cl="clang"' >> ~/.bashrc
    source ~/.bashrc
    

    This alias allows you to invoke Clang using the cl command.


5. Verify Installations:

After installation, confirm that each compiler is accessible:

  • GCC:

    gcc --version
    
  • Clang:

    clang --version
    
  • Zig:

    zig version
    
  • cc:

    cc --version
    
  • cl:

    cl --version
    

  • deal with kulala.nvim problem
/home/azureuser/.config/nvim/lua/plugins/restful.lua:33: module 'kulala.parser.jsonpath' not found:
^Ino field package.preload['kulala.parser.jsonpath']
cache_loader: module kulala.parser.jsonpath not found
cache_loader_lib: module kulala.parser.jsonpath not found
^Ino file './kulala/parser/jsonpath.lua'
^Ino file '/home/runner/work/neovim/neovim/.deps/usr/share/luajit-2.1/kulala/parser/jsonpath.lua'
^Ino file '/usr/local/share/lua/5.1/kulala/parser/jsonpath.lua'
^Ino file '/usr/local/share/lua/5.1/kulala/parser/jsonpath/init.lua'
^Ino file '/home/runner/work/neovim/neovim/.deps/usr/share/lua/5.1/kulala/parser/jsonpath.lua'
^Ino file '/home/runner/work/neovim/neovim/.deps/usr/share/lua/5.1/kulala/parser/jsonpath/init.lua'
^Ino file './kulala/parser/jsonpath.so'
^Ino file '/usr/local/lib/lua/5.1/kulala/parser/jsonpath.so'
^Ino file '/home/runner/work/neovim/neovim/.deps/usr/lib/lua/5.1/kulala/parser/jsonpath.so'
^Ino file '/usr/local/lib/lua/5.1/loadall.so'
^Ino file './kulala.so'
^Ino file '/usr/local/lib/lua/5.1/kulala.so'
^Ino file '/home/runner/work/neovim/neovim/.deps/usr/lib/lua/5.1/kulala.so'
^Ino file '/usr/local/lib/lua/5.1/loadall.so'

# stacktrace:
  - lua/plugins/restful.lua:33 _in_ **load**
  - lua/config/lazy.lua:25
  - init.lua:1

for this error, opts should be loaded as table first, then call setup()

[ERROR Sun Feb  2 12:38:47 2025] ...l/share/nvim/lazy/mason.nvim/lua/mason-registry/init.lua:79: Cannot find package "\"codelldb\""    .¬
 11 [ERROR Sun Feb  2 12:38:47 2025] ...l/share/nvim/lazy/mason.nvim/lua/mason-registry/init.lua:79: Cannot find package "\"debugpy\"".    ¬
 10 [ERROR Sun Feb  2 12:38:47 2025] ...l/share/nvim/lazy/mason.nvim/lua/mason-registry/init.lua:79: Cannot find package "\"jdtls\"".¬
  9 [ERROR Sun Feb  2 12:38:47 2025] ...l/share/nvim/lazy/mason.nvim/lua/mason-registry/init.lua:79: Cannot find package "\"tailwindcss    -language-server\"".¬
  8 [ERROR Sun Feb  2 12:38:47 2025] ...l/share/nvim/lazy/mason.nvim/lua/mason-registry/init.lua:79: Cannot find package "\"gopls\"".¬
  7 [ERROR Sun Feb  2 12:38:47 2025] ...l/share/nvim/lazy/mason.nvim/lua/mason-registry/init.lua:79: Cannot find package "\"pyright\"".    ¬
  6 [ERROR Sun Feb  2 12:38:47 2025] ...l/share/nvim/lazy/mason.nvim/lua/mason-registry/init.lua:79: Cannot find package "\"clangd\"".¬
  5 [ERROR Sun Feb  2 12:38:47 2025] ...l/share/nvim/lazy/mason.nvim/lua/mason-registry/init.lua:79: Cannot find package "\"lua-languag    e-server\"".¬
  4 [ERROR Sun Feb  2 12:38:47 2025] ...l/share/nvim/lazy/mason.nvim/lua/mason-registry/init.lua:79: Cannot find package "\"codelldb\""    .¬
  3 [ERROR Sun Feb  2 12:40:43 2025] ...l/share/nvim/lazy/mason.nvim/lua/mason-registry/init.lua:79: Cannot find package "\"delve\"".¬
  2 [ERROR Sun Feb  2 12:40:43 2025] ...l/share/nvim/lazy/mason.nvim/lua/mason-registry/init.lua:79: Cannot find package "\"cpptools\""    .¬
  1 [ERROR Sun Feb  2 12:40:43 2025] ...l/share/nvim/lazy/mason.nvim/lua/mason-registry/init.lua:79: Cannot find package "\"java-debug-    adapter\"".¬
  0 [ERROR Sun Feb  2 12:40:43 2025] ...l/share/nvim/lazy/mason.nvim/lua/mason-registry/init.lua:79: Cannot find package "\"codelldb\""    .

😞mason cloudn’t find anything

Failed to run `config` for nvim-dap-python

...l/share/nvim/lazy/mason.nvim/lua/mason-registry/init.lua:80: Cannot find package "debugpy".

# stacktrace:
  - /mason.nvim/lua/mason-registry/init.lua:80 _in_ **get_package**
  - debugging.lua:226 _in_ **config**
  - ~/.config/nvim/lua/config/lazy.lua:25
  - ~/.config/nvim/init.lua:1

need to install virtual-env

for error like this when install python using pyenv, install lzma

azureuser@davidgaovm:~/homelab$ pyenv install 3.13.1
Downloading Python-3.13.1.tar.xz...
-> https://www.python.org/ftp/python/3.13.1/Python-3.13.1.tar.xz
Installing Python-3.13.1...
Traceback (most recent call last):
  File "<string>", line 1, in <module>
    import bz2
  File "/home/azureuser/.pyenv/versions/3.13.1/lib/python3.13/bz2.py", line 17, in <module>
    from _bz2 import BZ2Compressor, BZ2Decompressor
ModuleNotFoundError: No module named '_bz2'
WARNING: The Python bz2 extension was not compiled. Missing the bzip2 lib?
Traceback (most recent call last):
  File "<string>", line 1, in <module>
    import readline
ModuleNotFoundError: No module named 'readline'
WARNING: The Python readline extension was not compiled. Missing the GNU readline lib?
Traceback (most recent call last):
  File "<string>", line 1, in <module>
    import sqlite3
  File "/home/azureuser/.pyenv/versions/3.13.1/lib/python3.13/sqlite3/__init__.py", line 57, in <module>
    from sqlite3.dbapi2 import *
  File "/home/azureuser/.pyenv/versions/3.13.1/lib/python3.13/sqlite3/dbapi2.py", line 27, in <module>
    from _sqlite3 import *
ModuleNotFoundError: No module named '_sqlite3'
WARNING: The Python sqlite3 extension was not compiled. Missing the SQLite3 lib?
Traceback (most recent call last):
  File "<string>", line 1, in <module>
    import lzma
  File "/home/azureuser/.pyenv/versions/3.13.1/lib/python3.13/lzma.py", line 27, in <module>
    from _lzma import *
ModuleNotFoundError: No module named '_lzma'
WARNING: The Python lzma extension was not compiled. Missing the lzma lib?
Installed Python-3.13.1 to /home/azureuser/.pyenv/versions/3.13.1

Install Container Orchestration Tools

  • will use a k8s distribution: k3s, a lightweight kubernetes
  • k3s documentation can be found in this link
  • use install script to install k3s
curl -sfL https://get.k3s.io | sh -

[INFO]  Finding release for channel stable
[INFO]  Using v1.31.5+k3s1 as release
[INFO]  Downloading hash https://github.com/k3s-io/k3s/releases/download/v1.31.5+k3s1/sha256sum-amd64.txt
[INFO]  Downloading binary https://github.com/k3s-io/k3s/releases/download/v1.31.5+k3s1/k3s
[INFO]  Verifying binary download
[INFO]  Installing k3s to /usr/local/bin/k3s
[INFO]  Skipping installation of SELinux RPM
[INFO]  Creating /usr/local/bin/kubectl symlink to k3s
[INFO]  Creating /usr/local/bin/crictl symlink to k3s
[INFO]  Creating /usr/local/bin/ctr symlink to k3s
[INFO]  Creating killall script /usr/local/bin/k3s-killall.sh
[INFO]  Creating uninstall script /usr/local/bin/k3s-uninstall.sh
[INFO]  env: Creating environment file /etc/systemd/system/k3s.service.env
[INFO]  systemd: Creating service file /etc/systemd/system/k3s.service
[INFO]  systemd: Enabling k3s unit
Created symlink /etc/systemd/system/multi-user.target.wants/k3s.service → /etc/systemd/system/k3s.service.
[INFO]  systemd: Starting k3s

check command

➜  homelab git:(master) ✗ sudo kubectl get nodes  # need to execute as root
NAME         STATUS   ROLES                  AGE   VERSION
davidgaovm   Ready    control-plane,master   96s   v1.31.5+k3s1
  • install k9s

Install & Configure Monitoring and Logging

Loki+Grafana vs Prometheus+Grafana

Install & Configure Networking & Security:

  • Possible Choices
    • MetalLB
    • Istio
    • Cilium

Setup CI/CD Pipelines:

  • Possible Choices
    • ArgoCD
    • Jenkins
    • GitLab CI/CD

Setup Storage & Databases:

  • Possible Choices
    • MinIO
    • PostgreSQL
    • Ceph