0% found this document useful (0 votes)
9 views15 pages

Ddsdhs

The document lists the top 50 Linux errors commonly encountered in MNC interviews, along with their root cause analysis (RCA) and solutions. Each error includes a brief explanation of the issue and step-by-step instructions to resolve it. The errors range from command not found to disk errors, providing a comprehensive guide for troubleshooting Linux systems.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views15 pages

Ddsdhs

The document lists the top 50 Linux errors commonly encountered in MNC interviews, along with their root cause analysis (RCA) and solutions. Each error includes a brief explanation of the issue and step-by-step instructions to resolve it. The errors range from command not found to disk errors, providing a comprehensive guide for troubleshooting Linux systems.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

DevOps Shack

Top 50 Linux Error, Solution RCA Asked In


MNC Interviews


1. Command Not Found (: command: command not found)

RCA: The command is either misspelled or not installed.

Solution:

●​ Check if the command is installed: which <command>


●​ Install missing package: sudo apt-get install <package>
(Debian-based) or sudo yum install <package> (RHEL-based)
●​ Check $PATH variable: echo $PATH

2. Permission Denied (: ./script.sh: Permission denied)

RCA: The script or file lacks execution permissions.

Solution:

●​ Grant execute permission: chmod +x script.sh


●​ Run as superuser: sudo ./script.sh

3. Disk Space Full (No space left on device)

RCA: The disk is full, preventing new files from being created.

Solution:​


●​ Check disk usage: df -h


●​ Remove unnecessary files: rm -rf /path/to/files
●​ Find large files: du -ah / | sort -rh | head -10

4. Process Already Running (Address already in use)

RCA: A process is already using the port.

Solution:

●​ Find process ID (PID): lsof -i :<port>


●​ Kill the process: kill -9 <PID>
●​ Restart the service: systemctl restart <service>

5. Segmentation Fault (Segmentation fault (core dumped))

RCA: Accessing invalid memory locations in a program.

Solution:

●​ Check logs: dmesg | tail -20


●​ Run with debugger: gdb ./program
●​ Recompile with debugging flags: gcc -g program.c -o program

6. Kernel Panic (Kernel panic - not syncing: Fatal exception)

RCA: Corrupt kernel, missing modules, or hardware failure.

Solution:

●​ Boot into recovery mode and check logs: journalctl -xb


●​ Update kernel: sudo apt-get update && sudo apt-get upgrade
●​ Rebuild initramfs: update-initramfs -u

7. Cannot SSH (Connection refused)

RCA: SSH service is not running or blocked by firewall.

Solution:

●​ Start SSH service: sudo systemctl start sshd


●​ Allow SSH in firewall: sudo ufw allow 22
●​ Check listening port: netstat -tulnp | grep ssh

8. Stale NFS File Handle (Stale NFS file handle)

RCA: The remote file system is unmounted or changed.

Solution:

●​ Remount NFS: sudo umount -f /mnt/nfs && sudo mount -a


●​ Restart NFS service: sudo systemctl restart nfs-kernel-server

9. High CPU Usage (Load average too high)

RCA: Process consuming too many resources.

Solution:

●​ Check processes: top or htop


●​ Kill high CPU process: kill -9 <PID>
●​ Optimize services or increase resources

10. Boot Issues (initramfs prompt or grub rescue> error)

RCA: Corrupt bootloader, missing kernel files.

Solution:​


●​ Reinstall GRUB: grub-install /dev/sda && update-grub


●​ Boot from live CD and repair system

11. Too Many Open Files (Too many open files)

RCA: The process exceeds the file descriptor limit.

Solution:

●​ Check limits: ulimit -n


●​ Increase limit temporarily: ulimit -n 100000
●​ Permanent change: Edit /etc/security/limits.conf

12. Broken Pipe (Write failed: Broken pipe)

RCA: Network connection closed unexpectedly.

Solution:

●​ Increase SSH timeout: echo "ClientAliveInterval 60" >>


/etc/ssh/sshd_config
●​ Use screen or tmux to persist sessions

13. Out of Memory (Out of memory: Kill process)

RCA: Insufficient RAM, process exceeds system limits.

Solution:

●​ Check memory usage: free -m


●​ Kill memory-intensive processes: kill -9 <PID>

Add swap space:​


sudo fallocate -l 2G /swapfile​


sudo chmod 600 /swapfile


sudo mkswap /swapfile
sudo swapon /swapfile

14. Read-only File System (Read-only file system error)

RCA: Disk corruption, remounted in read-only mode.

Solution:

●​ Remount filesystem: mount -o remount,rw /


●​ Check disk: fsck -y /dev/sdaX

15. Network Unreachable (Network is unreachable)

RCA: Incorrect network configuration or cable issue.

Solution:

●​ Restart network service: systemctl restart networking


●​ Check IP configuration: ip addr show
●​ Restart interface: ifconfig eth0 down && ifconfig eth0 up

16. Connection Reset by Peer (ssh_exchange_identification:


Connection reset by peer)

RCA: SSH daemon rejects the connection.

Solution:

●​ Check fail2ban or firewall: iptables -L


●​ Restart SSH service: systemctl restart sshd

17. Dependency Issues (Dependency hell: Package conflicts)

RCA: Conflicting or missing package dependencies.

Solution:

●​ Use dependency resolver: sudo apt-get -f install


●​ For RHEL: sudo yum clean all && yum update

18. Cron Job Not Running (Cron job not executing)

RCA: Incorrect cron syntax, no execution permission.

Solution:

●​ Check cron logs: cat /var/log/syslog | grep CRON


●​ Verify permissions: chmod +x script.sh
●​ Restart cron service: systemctl restart cron

19. No Route to Host (No route to host)

RCA: Network misconfiguration, firewall blocking connection.

Solution:

●​ Check routing table: route -n


●​ Disable firewall: sudo iptables -F
●​ Verify connectivity: ping <remote_host>

20. 502 Bad Gateway (Nginx/Apache)

RCA: Backend service is down or misconfigured.​





Solution:

●​ Restart backend service: systemctl restart php-fpm


●​ Check logs: tail -f /var/log/nginx/error.log

21. High I/O Wait (iowait too high)

RCA: Disk is overloaded, slow I/O operations.

Solution:

●​ Check I/O wait: iostat -x 1 10


●​ Find heavy disk usage: iotop
●​ Optimize storage or use SSD

22. Invalid Date (date: cannot set date: Operation not permitted)

RCA: Incorrect timezone, user lacks permission.

Solution:

●​ Sync time: sudo timedatectl set-ntp on


●​ Change timezone: sudo timedatectl set-timezone UTC

23. 404 Not Found (Web Server Error)

RCA: Missing document root or misconfigured server.

Solution:

●​ Check web server config: cat /etc/nginx/sites-enabled/default


●​ Restart service: systemctl restart nginx

24. Firewall Blocking Port (Connection timed out)​



RCA: Firewall blocking the service port.

Solution:

●​ Allow port in firewall: sudo ufw allow 8080


●​ Restart firewall: systemctl restart firewalld

25. Process Hung (D state processes)

RCA: Process stuck due to I/O or deadlock.

Solution:

●​ Find stuck processes: ps aux | grep D


●​ Kill process: kill -9 <PID>

26. Package Not Found (E: Unable to locate package)

RCA: Repository issue or incorrect package name.

Solution:

●​ Update package list: sudo apt-get update


●​ Search package: apt-cache search <package>

27. Kernel Module Not Loading (modprobe: ERROR)

RCA: Missing or incorrect kernel module.

Solution:

●​ Load module manually: modprobe <module_name>


●​ Check logs: dmesg | tail -20

28. SSH Key Permission Denied​



RCA: Incorrect permissions on SSH private key.

Solution:

●​ Set correct permissions: chmod 600 ~/.ssh/id_rsa


●​ Restart SSH: systemctl restart sshd

29. Log File Too Large (/var/log/messages is too large)

RCA: Logs growing too fast.

Solution:

●​ Rotate logs: logrotate -f /etc/logrotate.conf


●​ Compress old logs: gzip /var/log/syslog

30. Zombie Process (defunct process)

RCA: Parent process not cleaning up child processes.

Solution:

●​ Find parent PID: ps -aux | grep defunct


●​ Kill parent process: kill -9 <PPID>

31. systemctl: command not found

RCA: Older system using SysVinit instead of systemd.

Solution:

●​ Use older service command: service <service_name> start


●​ Upgrade to systemd if necessary.

32. Too many authentication failures (SSH)

RCA: Repeated failed logins cause SSH lockout.

Solution:

Increase authentication attempts:​




echo "MaxAuthTries 10" >> /etc/ssh/sshd_config
systemctl restart sshd

33. Device or resource busy (Unmounting Issue)

RCA: Process using the device.

Solution:

●​ Find using processes: lsof | grep /mnt/device


●​ Kill the process: kill -9 <PID>
●​ Force unmount: umount -l /mnt/device

34. Mounting Failed (mount: unknown filesystem type)

RCA: Unsupported or missing filesystem type.

Solution:

●​ Check available filesystems: cat /proc/filesystems

Install missing filesystem support:​








sudo apt-get install xfsprogs # For XFS
sudo apt-get install nfs-common # For NFS

●​ Mount with correct type: mount -t ext4 /dev/sda1 /mnt

35. User Locked Out (Account locked due to too many failed logins)

RCA: Security settings locked the account.

Solution:

●​ Unlock user: sudo passwd -u <username>


●​ Reset failed login attempts: faillock --user <username> --reset

36. Symbolic Link Broken (ln: failed to create symbolic link)

RCA: Target file doesn’t exist or incorrect path.

Solution:

●​ Verify target exists: ls -l <target>


●​ Correct the link: ln -s /correct/path /symlink

37. File Descriptor Limit Exceeded (Too many open files)

RCA: Application exceeded open file limit.

Solution:

Increase limits:​

echo "fs.file-max = 100000" >> /etc/sysctl.conf
sysctl -p
ulimit -n 100000

38. chown Permission Denied (Operation not permitted)

RCA: Attempt to change ownership of a root-owned file as a non-root user.

Solution:

●​ Use sudo: sudo chown user:user file.txt


●​ Check immutable flag: lsattr file.txt

39. Software Package Signature Error (GPG error: NO_PUBKEY)

RCA: Missing GPG key for the package repository.

Solution:

Add missing key:​




sudo apt-key adv --keyserver keyserver.ubuntu.com
--recv-keys <KEY>

40. USB Device Not Detected (dmesg | grep USB shows no output)

RCA: USB subsystem failure or hardware issue.

Solution:

●​ Restart USB service: modprobe -r usb_storage && modprobe


usb_storage
●​ Check logs: dmesg | tail -50

41. NTP Sync Not Working (timedatectl shows time out of sync)​



RCA: NTP service not running or firewall blocking NTP.

Solution:

●​ Start NTP: systemctl restart systemd-timesyncd


●​ Check firewall: sudo ufw allow 123/udp

42. Kernel Update Failed (grub menu missing new kernel)

RCA: Bootloader not updated after kernel install.

Solution:

Update GRUB:​

sudo update-grub
sudo grub-install /dev/sda

43. Service Not Starting (Failed to start <service>)

RCA: Configuration errors, missing dependencies.

Solution:

●​ Check logs: journalctl -xe


●​ Fix missing dependencies: sudo apt-get -f install

44. Swap Not Enabled (swapon: /swapfile: swapon failed)

RCA: Swapfile not created or mounted.

Solution:

Create and enable swap:​







sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile

45. scp Transfer Slow (scp takes too long to transfer files)

RCA: Compression disabled, high latency.

Solution:

●​ Enable compression: scp -C file user@host:/path

Use rsync:​


rsync -avz file user@host:/path

46. ping Works, But curl Fails (curl: (7) Failed to connect)

RCA: Firewall blocking the port.

Solution:

●​ Check firewall rules: iptables -L -n


●​ Allow traffic: sudo ufw allow 80

47. System Logs Not Rotating (Log files keep growing)

RCA: Logrotate misconfigured or service issue.

Solution:​


●​ Manually rotate logs: logrotate -f /etc/logrotate.conf


●​ Restart log service: systemctl restart rsyslog

48. Stuck at Grub> Prompt (grub rescue>)

RCA: GRUB bootloader corrupted.

Solution:

Boot into live CD and reinstall GRUB:​



sudo mount /dev/sda1 /mnt
sudo grub-install --root-directory=/mnt /dev/sda

49. Cron Job Runs But Doesn't Work (Crontab entry exists but doesn't
execute correctly)

RCA: Environment variables missing.

Solution:

●​ Specify full paths: /usr/bin/python3 /path/to/script.py

Log cron output:​


* * * * * /path/to/script.sh >> /var/log/myscript.log 2>&1

50. Disk Errors (I/O error on device)

RCA: Failing disk, filesystem corruption.

Solution:

●​ Check disk health: smartctl -a /dev/sda


●​ Repair filesystem: fsck -y /dev/sda1

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy