mounting fs with errors, running e2fsck is recommended - linux

I am using CentOS 5.10 version with 64 bit, unfortunately when remove particular file under root directory the below error was strange :
**EXT3-fs warning: mounting fs with errors, running e2fsck is recommended,rm: cannot remove `/var/lock/subsys/xinetd': Read-only file system**
it has changed to read-only file system, how to fix it ???

If / is in read-only mode, first try remounting it with:
mount -o remount,rw /
You'll still need to check the partition for errors. If you have physical access to server or a KVM
-boot it in single mode
-unmount all the partitions and run fsck
If you dont have a physical access, try
touch /forcefsck
This will force File System Check on the next reboot.

Related

WSL2 "read-only" file system while building chromium

I'm attempting to build chromium on WSL2 according to this guide.
When I get to the fetch --nohooks chromium everything is loading and then I get the following error:
OSError: [Errno 30] Read-only file system: '/home/ghadar/chromium/src/third_party/libprotobuf-mutator/_gclient_src_0ve3yqhz'
I've looked everywhere and couldn't find any explanation to this error.
I'm running WSL2 on Windows 11 with Ubuntu 20.04 as the Linux distribution.
A few possibilities that I can think of:
Filesystem corruption (it happens)
Out of disk space on the host Windows drive
For the first one, see #6220 on the WSL Github. Recommended solution is (and it might be a good idea to backup any critical files first):
# Identify the correct drive:
mount | grep ext4
# Take the drive returned (e.g. /dev/sdd) and:
sudo e2fsck /dev/sdd -p
It could also be a disk-space issue. The Chromium source is pretty large at around 57GB. Is it possible that you are out of disk space on the Windows drive? If so, then WSL still thinks it has space remaining, because it is on a sparse virtual disk that can grow up to (250GB/1TB depending on the WSL release), but once space on the host drive is gone, WSL probably set the device read-only.
If that's the case, and you have a larger drive (SSD/NVMe recommended for performance, of course), you can "move" the virtual disk if you'd like -- See my Super User answer on the topic.
Or you might try fetching without the full repo history, as suggested in the docs, with the --no-history flag.

sudo su command not working in OEL 7

I want to install glibc-2.17-105.el7.i686
But I'm not able to do sudo yum install.
sudo yum install glibc-2.17-105.el7.i686 , gives error
-bash: /usr/local/bin/sudo: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory
bash: /usr/local/bin/sudo: /lib/ld-linux.so.2: bad ELF interpreter
This means:
You have a 32-bit /usr/local/bin/sudo binary and
You do not have 32-bit runtime libraries installed.
If you are lucky, you have a 64-bit /usr/bin/sudo (/usr/local/bin is not the default location for sudo). If so, you should be able to do this:
/usr/bin/sudo rm /usr/local/bin/sudo
after which "normal" 64-bit sudo (which would now be /usr/bin/sudo) will just work.
If you are unlucky, but your system allows root login (and you know root password), then simply login as root, and:
# should make 32-bit /usr/local/bin/sudo work
root#host# yum install glibc-2.17-105.el7.i686
If you have no root password, and no working sudo, not all is lost: with physical access to the system, you could boot off the recovery disk, mount your root filesystem, and fix root password. You may as well copy a working sudo to /usr/bin at the same time.
From my experience you are in a bad situation. It's very bad that you have lib errors, I believe because of this error you will have problems running most of your executables on your system and that makes debugging and fixing much harder.
It's most likely a filesystem corruption but I'm not sure if it can be fixed.
I would try to go to single user mode, remount / as read only, then do a fsck on it(depending on your filesystem it may be e2fsck or other).
If it doesn't work, another path would be to boot from a rescue disk and do fsck or try other methods of fixing.
You may have to backup any data and reinstall. Please backup ASAP!
Good luck!

How to rescue the Linux system from erroneous insmod in rc.local in Fedora Core?

I have placed a faulty kernel object in the rc.local. Because of this faulty kernel object,the system crashes on bootup. Now, my aim is to remove that faulty ko insmod from rc.user. However, I cannot access rc.user as my system crashes on bootup. How can I fix this issue?
If you are getting the grub screen then you can
go to runlevel 1 and change the file.
On grub screen you will have to
press a after selecting the Fedora kernel with which you want to boot.
APPEND single after space in that line and press enter
press b to boot in single user mode
You can edit any file in this mode.
The safest & easiest approach when I get into such troubles is to mount the HD (contaning the faulty kernel) as an external hard drive to another linux machine and manually edit the files causing trouble.
Do a fdisk -l with your HD plugged in (thorugh USB). Take notice of the </dev/sd*#>.
mount /media /dev/<sd*#>
Now, you can access your boot or root partition to access the files.

Accidentally deleted symlink libc.so.6 in CentOS 6.4. How to get sudo privilege to re-create it?

I accidentally deleted the symbol link /lib64/libc.so.6 -> /lib64/libc-2.12.so with
$ sudo rm libc.so.6
Then I can not use anything including ls command. The error appears for any command I type
ls: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
I've tried
$ export LD_PRELOAD=/lib64/libc-2.12.so
After this I can use ls and ln ..., but still can not use sudo ln ... or sudo -E ln .... I always get this err
sudo: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
It's a remote server so I can not use a live CD. I now have a ssh bash session alive but can not establish new ones. I have sudo privilege, but don't have root password.
So currently my problem is I need to run sudo sln -s libc-2.12.so libc.so.6 to re-create the symlink libc.so.6, but I can not run sudo without libc.so.6.
How can I fix it? Thanks~
I resolved the issue by using a statically linked version of "ln" that was already in the server's /sbin.
E.g., this restored it for my configuration:
/sbin/sln /lib64/libc-2.5.so /lib64/libc.so.6
A bit embarrassing :) but it happened to me as well on Ubuntu 12.04.3 (which is not CentOS 6.4 but I thought this could still help maybe).
Because my Ubuntu wouldn't start I used a liveUSB to boot up and then mounted my hard drive and created the symlink (I did have the file itself libc-2.15.so) and that did it.
Just a few specific details:
I asked a good friend to use his computer for half an hour
I Downloaded my exact Ubuntu iso (12.04.3, if you're on;y missing the symlink, it could be any version so much that it can mount drives) from here: link
I made sure his Ubuntu has usb-creator-gtk ($ sudo apt-get install usb-gtk-creator, I'm sure Windows has an equivalent usb boot creator)
Created the liveUSB using usb-creator-gtk
Booted my computer with it (you'll probably need to change your BIOS settings to allow external USB to be booted first)
Once I booted from the live USB I figured where my hard drive partition by running the Ubuntu partition tool (the live USB has one) - mine was of type ext4 and in /dev/sdb1
I mounted it by doing $ mkdir /home/ubuntu/mnt and then $ sudo mount-t ext4 /dev/sdb1 /home/ubuntu/mnt
I then proceeded to that folder $ cd /home/ubuntu/mnt
From that location I then created the symlink by $ sudo ln -s lib/x86_64-linux-gnu/libc-2.15.so lib/x86_64-linux-gnu/libc.so.6
After a reboot I was good.
Hope it helps you (or someone..)
I would add some thing more to #wilfo answer as same also happened with me [accidentally deleting lib.so.6 and was getting /sbin/init missing libc.so.6 on boot up] .
After creating liveUSB in windows (using UNetbootin etc [http://unetbootin.sourceforge.net/]) or in ubuntu as #wilfo suggested.
Booting from liveUSB, I selected "experience ubuntu without installing it" and was happy applying wilfo's method until step 6 and then i couldn't find my hard drive partition of type ext3/4. All were nftf/fat/extended stuff.
So i recovered previous ubuntu (the one with missing libc.so...) by following this link
https://help.ubuntu.com/community/Boot-Repair
make sure to follow all necessary steps and take a backup of your ubuntu partition.
you can see your previous ubuntu files inside /mnt/boot-sav/wubi1/home
take a backup from here to your windows partations /mnt/boot-sav/sda...
and follow remaining procedure here https://help.ubuntu.com/community/Boot-Repair

Workaround for FSCK "UNEXPECTED INCONSISTANCY; Run fsck manually

I have a Linux System based LFS (Linux from Scrach). Linux kernel version 2.6.29.6 #1 SMP PREEMPT. This system uses Extlinux bootloader and boots from SSD (Micron USB Solid State Device). There is also a seconday harddrive in this system but not meant for booting. We changed the booting from HDD to SSD as we found SSD is fast and reliable over HDD.
Whenever there is a power outage, the unit reboots, the power Outage causes the SSD corruption. After reboot, the Fsck command is run by the script checkfs. The system halts with the Error message ""UNEXPECTED INCONSISTANCY; Run fsck manually error and unit halts and fails to reboot until we manually reboot.
I checked the checkfs script and found that, in this condition, the fsck -a -A -C -T is run and returns error value > 3 and < 16 for which the action is to halt the system and reboot using CD and run fsck manually and fix the issue.
I tried changing the checkfs script and used fsck -y which fixed all the errors and the unit booted normally but while fixing the issues, many files were deleted. Secondly if i ignore the fsck error and instead of system halt, if i go ahead with normal boot, it works but since it doesnt fix the filesystem issues, the unit may not work properly.
At this point i would like to know if there are any work arounds to resolve this issue and still boot the system normally and fix the filesystem issues? can i do something like if fsck fails then umount root file system from SSD and mount it from HDD and boot normally, then after boot recover SSD filesystem? if yes any pointers to do this? Please suggest.
You can append 'fastboot' as a kernel argument (in grub) to skip fsck.

Resources