Linux popular distributions common problems and solutions
In this article I discuss some of Linux popular distributions common problems and solutions that I've found when working with them.
- For ALL
- For CentOS
loaded plugins: fastestmirror
- Enable root account
- Install ftppro
- Mount hard drive
- Enable networking in Rescue Mode
- Secure your CentOS
- User not in sudoers file
- For Ubuntu
- Ubuntu privilege access
- Ubuntu issues
Disable the "beep" for VM Workstation
If you're running Linux VMs on your VMware Workstation application, like I do, go ahead and disable the yelling beep so save you stress; add this line to the .vmx file of the VM:
mks.noBeep = "TRUE"
These are some of the problems I found while dealing with Linux
couldn't mount as ext3 due to feature incompatibilities. Ext4-fs (sda6): couldn't mount as ext2 due to feature incompatibilities.
After an upgrade or a reboot you might find the above error message, to fix it edit the /etc/fstab and change the affected drive from "ex3" to "ex4"
To break a computer disk partitioning, do this to override the boot partition, then see if you can fix it!
dd if=/dev/zero of-/dev/sda1 bs=1M count=20
Apps that are recommend to install on an Ubuntu machine:
sudo apt-get install tree sudo apt-get install vim sudo apt-get install openssh-server sudo apt-get net-tools #gives you the ifconfig commmand sudo apt-get install screen #type 'screen' to start a new session, then 'screen -dr' to retake that session if the console is closed sudo apt install systat iotop #also use 'iostat' to check the system #text editors sudo apt install kate sudo apt install plume apt-get moo #that's is a funny one #mail sudo apt install postfix mailutils #miscellaneous sudo apt-get install gnome-tweak-tool
Find out how to do a mirror of your Ubuntu machine, so that you copy all the repos to your VM, follow this guide: https://help.ubuntu.com/community/rsynmirrow
After you remove a package using 'sudo apt remove apache2' for example, always run 'sudo apt autoremove' to get rid as well of the dependencies that were installed
PPA (Personal Package Archive) ;sometimes it happens that applications have been releases on PPA repositories, and you need to install that repository on your Ubuntu machine. For example, to install the latest version of Mumble on your machine, do as follows using the add-apt-repository, adding the latest repo first
sudo add-apt-repository ppa:mumble/release sudo apt-get update
Ubuntu privilege access
If you are a bit tired or forget to put the 'sudo' in front of every command while working in Debian/Ubuntu, you can temporarily use the system as root by typing:
sudo su -
If you get the error message "E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?" when trying to install an app, it is most likely that a previous installation did not finished successfully. to clear the process to as follows:
sudo lsof /var/lib/dpkg/lock #this will show you the PID of the process sudo kill -9 <PID> #kill the affected process
To install SSH on an Ubuntu server:
sudo apt-get install openssh-server
If you get the error "E: Unable to locate package openssh-server", run these two commands: sudo apt-get upgrade .Applications that I always install on my Linux systems: tree, synaptic,
Install the development tools to compile a new kernel
sudo yum groupinstall "Development Tools"
To install Tiger-VNC on your CentOS
yum install tigervnc-server #visit /usr/lib/systemd/system, then do: cp vncserver@.service yourusername@.service #this is becuase we need a single configuration file per user vncpasswd #set the vnc password for the current logon user vim /usr/lib/systemd/system/
Remember that if you are going to use display 2 (username@:2.service) you'd need to open port 5902 on the firewall. If you can't connect, look for *.lock files in /tmp and in /tmp/.X11-unix ; when using the client to connect, under VNC Server user IP-address:portnumber (192.168.0.21:5901)
If you install XRDP on your linux box, ensure to apply the SELinux security context
Install "serverauditor" on your IOS device if you'd like to access Linux CLI remotely, for your adroid toy use "Connectbot"
To 'recall' the good old Tux icon linux, on an old distribution visit /usr/src/linux/Documentation/logo.gif
Old Linux commands
On kerles 2.6 and below you can run these commands:
fgconsole #tells you on which virtual console number you're logon
If during the installation of a package you get the error message "
loaded plugins: fastestmirror", edit the following file and change enabled=1 to enabled=0 to disable the fastestmirror plugin
sudo -i passwd #Then edit this file and ensure this line exit /etc/ssh/sshd_config PermitRootLogin yes #If you change the SSH config file, reload it using this: systemctl restart sshd
yum install epel-release yum install proftpd proftpd-utils systemctl start proftpd systemctl enable proftpd firewall-cmd --zone=trusted --add-service=ftp --permanent firewall-cmd --reload
Mount hard drive
These are useful command that will help you evaluate what you have attached to your linux box
lsblk udisksctl mount -b /dev/sdb3 ls /dev/sd* df -h sudo fdisk -l lsv lshw -class disk -shortsfdf pvscan vgscan cat /etc/fstab
Enable networking in Rescue Mode
Do these commands to have Internet access on Rescue Mode
ip link #identify the nic name ip link set dev eth0 up ip link #to verify ip addr add 192.168.136.21 dev eth0 ipa a #to verify ip route add default via 192.168.136.1 ip route #to verify
Secure your CentOS
To limit the number of connections/sessions that root that use to the machine, leave only "console" on the file /etc/securetty
User not in sudoers file
If you keep getting the error "User not in sudoers file. This incident will be reported" when trying to run a command with "sudo" at the front, thus borrowing root access in CentOS, open the sudoers file by typing:
And then make an entry for the user, similar to the one of the root already there:
#the below allows user to run in ALL hosts, ALL commands user ALL=(ALL) ALL #the below allows user2 to run in ALL hosts but only ls, without password user2 ALL=(ALL) NOPASSWD: /bin/ls