Linux System Administrator Q&A

·

5 min read

  1. How do you get the kernel version / Command to list OS version in Linux?

    • To check the kernel version: uname -r

    • To list the OS version: cat /etc/os-release or lsb_release -a (if available).

  2. How do you identify if you are working on a physical server or VM?

    • Run virt-what (if installed) to detect virtualization.

    • Alternatively, check dmesg | grep -i hypervisor or lscpu for signs of a hypervisor (e.g., VMware, KVM).

    • You can also use dmidecode -s system-manufacturer or dmidecode -t system to see hardware details—physical servers often show real vendor names (e.g., Dell, HP), while VMs show virtualized names (e.g., VMware, QEMU).

  3. How do you set kernel parameters / Where can I find the file with active parameters?

    • Active kernel parameters are stored in /proc/sys/. You can view them with sysctl -a.

    • To set a parameter temporarily: sysctl <parameter>=<value> (e.g., sysctl net.ipv4.ip_forward=1).

  4. How do you set kernel parameters permanently?

    • Edit /etc/sysctl.conf or a file in /etc/sysctl.d/ and add the parameter (e.g., net.ipv4.ip_forward=1).

    • Apply changes with sysctl -p (reloads settings from /etc/sysctl.conf) or sysctl -w <parameter>=<value> for a temporary change.

  5. How to load modules in Linux / Command to list loaded modules?

    • Load a module: modprobe <module_name> (e.g., modprobe nfs).

    • List loaded modules: lsmod.

  6. How do you check if a filesystem is read-only?

    • Run mount | grep <mount_point> and look for ro (read-only) or rw (read-write).

    • Alternatively, use cat /proc/mounts to check the mount options.

  7. How do you force a filesystem check during boot or repair it?

    • Force a check on next reboot: touch /forcefsck or shutdown -r -F now.

    • To repair manually: Boot into single-user mode, then run fsck /dev/<partition> (e.g., fsck /dev/sda1). Use -y to auto-fix issues.

  8. How do you check CPU power performance in a CFM server?

    • Assuming "CFM" is a typo or specific context, to check CPU performance generally: Use lscpu for specs, top or htop for usage, or cat /proc/cpuinfo for detailed info.

    • For power/performance tuning, check cpufreq-info (if cpufrequtils is installed).

  9. How to check and fix disk space issues in a volume?

    • Check space: df -h (human-readable sizes).

    • Find large files: du -h /path | sort -rh | head.

    • Fix: Delete unnecessary files, expand the volume (e.g., lvextend for LVM), or resize the filesystem (e.g., resize2fs).

  10. Commands to monitor server performance (CPU, memory, disk)?

    • top or htop: Real-time CPU and memory usage.

    • vmstat 1: CPU, memory, and I/O stats every second.

    • iostat: Disk I/O performance (requires sysstat package).

  11. How to check processes and ports?

    • Processes: ps aux or top.

    • Ports: ss -tuln (listening ports) or netstat -tuln (if installed).

  12. How do you check/set max open files for a specific user?

    • Check current limit: ulimit -n (for the current session) or cat /proc/<pid>/limits for a process.

    • Set for a user: Edit /etc/security/limits.conf, add <username> soft nofile <value> and <username> hard nofile <value>, then relog.

  13. How to limit the number of files open by a user?

    • Edit /etc/security/limits.conf as above (e.g., <username> hard nofile 1024), then apply with sysctl -p or relog the user.
  14. Server not reachable—how to troubleshoot?

    • Check if it’s up: ping <server_ip>.

    • Try SSH: ssh <user>@<server_ip>—if it fails, check the console (e.g., via ILO/VMware).

    • Verify network: ip route (default gateway), ip link (interface status).

  15. Server rebooted but not available after maintenance/OS upgrade?

    • Check console for boot messages (stuck at grub, kernel panic?).

    • Boot into single-user mode (edit grub with systemd.unit=rescue.target) and review logs (journalctl or /var/log/boot.log).

  16. Filesystem inconsistencies after reboot, goes read-only—how to fix?

    • Boot into single-user mode, run fsck /dev/<partition> to repair.

    • Remount as read-write: mount -o remount,rw /.

    • Check logs (dmesg or journalctl) for root cause.

  17. User can’t create files/folders—what to check?

    • Permissions: ls -ld <path> (write access?).

    • Inodes: df -i (inodes exhausted?).

    • Quota: quota <username> (if quotas are enabled).

  18. Passwordless auth enabled but still prompts for password—how to fix?

    • Check ~/.ssh/authorized_keys permissions (600) and directory (700).

    • Verify /etc/ssh/sshd_config: PubkeyAuthentication yes, PasswordAuthentication no.

    • Restart SSH: systemctl restart sshd.

  19. How to disable a service in Linux?

    • Disable at boot: systemctl disable <service>.

    • Stop immediately: systemctl stop <service>.

  20. Kernel messages?

    • View with dmesg or journalctl -k.
  21. Kernel panic—how to fix?

    • Boot into single-user mode (grub: add single or systemd.unit=rescue.target).

    • Recreate initrd: mkinitrd or dracut -f (depends on distro), then reboot.

  22. VM is hung, not reachable—how to troubleshoot?

    • Check console via hypervisor (e.g., VMware vSphere).

    • Restart VM if needed. Review logs (journalctl, dmesg) after recovery.

  23. How to upgrade the kernel version?

    • Install new kernel: yum update kernel (RHEL) or apt install linux-image-<version> (Debian).

    • Update grub: grub2-mkconfig -o /boot/grub2/grub.cfg (RHEL) or update-grub (Debian), then reboot.

  24. VMware VMs in read-only state due to storage issues—how to fix?

    • Check affected VMs: esxcli vm process list or vSphere UI.

    • Verify storage: df -h on each VM, fix with fsck if needed, then remount (mount -o remount,rw).

  25. Server in maintenance mode—how to perform filesystem check?

    • From console, run fsck /dev/<partition> (unmount first if possible).

    • Exit maintenance: reboot or systemctl default.

  26. Backup issue in HANA DB with I/O wait—how to check?

    • Check I/O: iostat -x 1 (high %iowait?).

    • Review HANA logs and OS logs (journalctl).

    • Verify disk space (df -h) and performance in Azure portal (if applicable).

  27. SPC procedure for OS upgrade—how to find backup FS layout in TIC?

    • Assuming TIC is a specific system/context, generally: Check /etc/fstab for FS layout.

    • Backup layout: lsblk or fdisk -l before upgrade. (Clarify "TIC" for a precise answer.)

Let me know if you need further clarification!