Q.) One RHEL 8.8 VM is unable to boot and it is unable to find any root filesystem :
mount: special device /dev/mapper/vg1/data does not exist.
On rescue mode prompt, it is showing this :
#lvs
-bash: lvs: command not found
# lvdisplay
-bash: lvdisplay: command not found
How will you tackle this situation ?
Q.) Suppose somebody has removed the package responsible for /bin/cat and you are unable to use the cat command - how will you figure out which package provides the cat utility and install it ?
Q.) Below is the output of "yum history" command :
[root@workstation ~]$ yum history
Loaded plugins: fastestmirror, priorities, universal-hooks
ID | Command line | Date and time | Action(s) | Altered
----------------------------------------------------------------------
17 | install vim-go | 2024-10-23 04:18 | Install | 5
16 | install vim | 2024-10-23 04:16 | Install | 1
15 | --assumeyes --config /et | 2024-10-22 14:09 | I, U | 84
What will happen if I run “ yum history rollback 15 ” ?
Bonus Q.) What will happen in the above scenario if I run “ yum history undo 16 ”
Level L2 and above
I'll be posting a series of Linux-related questions covering various skill levels. Feel free to share your insights and expertise. Your contributions will benefit learners at all stages, from those in current roles to those preparing for Linux interviews.
Q.) Suppose somebody has removed the package responsible for /bin/cat and you are unable to use the cat command - how will you figure out which package provides the cat utility and install it ?
Solution:
What I always do is the following:
# yum provides /bin/cat
The output from this command will provide me, among other things, the
name of the rpm package: coreutils-single.
I'll then take that package name, and use it in the following command:
# yum install coreutils-single
This will restore the /bin/cat command, and I can go take an early/exntended
lunch!!!
Q. One RHEL 8.8 VM is unable to boot and it is unable to find any root filesystem.
How will you tackle this situation ?
Solution:
Those "command not found" messages suggest to me that the VM doesn't
know where its root directory is. So, in rescue mode, I"m going to set things
up with the following commands:
# mount -o remount,rw /sysroot
# chroot /sysroot
Now, if this eradicates the "command not found" issue, I can now move on to
looking into the /etc/fstab file, to verify the correct information exists for the
file systems to be mounted during bootup. It would be ashame to spend time
probing other things, when a simple typo of something in the /etc/fstab is causing
the issue.
The primary issue is does not likely involve the /etc/fstab file, but instead the logical
volume, that is to be mounted, not being activated. Logical volumes that are not active
produce the message
mount: special device /dev/mapper/some_name does not exist
when trying to mount the device. So, use the lvchange command to activate
the logical volume.
After activating the logical volume, use the lvdisplay command to check the
"LV Status" in the output - this MUST appear "Available" inorder for the logical
volume to be mounted.
The first thing that must be done in rescue mode, so that the lvdisplay command
can be accesed, is to perform those mount and chroot commands!
As always, before rebooting, cross fingers
@Trevor it still does not work and System fails/refuses to activate few/all volume groups and lands to dracut.
no LVM commands are working so you are also unable to activate any LVM using lvm commands.
same error in the output :
-bash: lvs: command not found
Okay, some actual research is informing that this situation is usually
associated with a problem on the partition that contains the OS.
The issue on the partition is potentially due to one of the following:
- corrupted partition
- incorrect configuration in the bootloader (GRUB)
- a missing or damaged root partition on the disk
In the case of a corrupted filesystem, in rescue mode, run the fsck
command on the suspect root partition. If this does produce
information that suggest that the filesystem is corrupted, it may be
possible to repair the filesystem using that same fsck command.
While I'm having a look at the filesystem with the fsck command,
I may as well let the badblocks tool have a look at the integrity
of the device that is housing the root partition.
If the fsck command gives the filesystem on the root partition a
clean bill of health, then it's time verify GRUB settings. What
should be done here is to simply access the GRUB bootloader,
and check to see if the correct partition is set as the root
filesystem. If necessary re-install GRUB to update the boot
configuration.
If all is well with the GRUB configuration, and the filesystem
on the root partition, then the partition table should be checked
to ensure that the partition containing the root filesystem is
marked as active.
A final something to examing is the health of the disk itself.
There's a tool, smartctl, in the smartmontools rpm package,
that can be used to interrogate the health of the disk.
With GRUB being what I would consider low-hanging fruit, in
the grand scheme of troubleshooting this issue, I would start
with examining my GRUB settings.
@Trevor before doing all this, my recommendation is to just check / validate the lvm package integrity and if it seems corrupted , reinstall it and lvm commands will work.
Being wrong never felt so good
Thanks Chetan for guiding me on this issue!!!
@Trevor You've got the skills of a tech wizard, but the heart of a humble learner.
And you Mr. Chetan, in addition to a superlative technical prowess,
have the communication skills of the quintessential leader!!!!
How could I not be humble in my learning, with the likes of one,
Chetan_Tiwary_ , in this community!!!
The moment I begin to ascend to a level of arrogance, my learning
will begin to suffer. As a life-long learner, that would be the equivalent
of shooting myself in the foot. I refuse to be responsible for any
self-inflicted wounds
One of my favorite quotes is:
"Humility is the solid foundation of all virtues."
As always, thank you for your extremely kind and supportive words!
Be assured that they serve as an inspirational and motivational
source!!!
Q.) Suppose somebody has removed the package responsible for /bin/cat and you are unable to use the cat command - how will you figure out which package provides the cat utility and install it ?
Solution:
What I always do is the following:
# yum provides /bin/cat
The output from this command will provide me, among other things, the
name of the rpm package: coreutils-single.
I'll then take that package name, and use it in the following command:
# yum install coreutils-single
This will restore the /bin/cat command, and I can go take an early/exntended
lunch!!!
Red Hat
Learning Community
A collaborative learning environment, enabling open source skill development.