1

How should i do to undo this? I tried running fsck to solve my "Read only filesystem" before but it didn't help me much. It only solve the situation for a while and then it comes back again. So, i did this after reading a post.

Meanwhile, i am getting thousands of lines like this:

chown: changing group of '/usr/share/doc/distro-info-data': Read-only file system
chown: changing group of '/usr/share/doc/software-properties-common/copyright': Read-only file system
chown: changing group of '/usr/share/doc/software-properties-common/changelog.gz': Read-only file system
chown: changing group of '/usr/share/doc/software-properties-common': Read-only file system
chown: changing group of '/usr/share/doc/nmap/3rd-party-licenses.txt.gz': Read-only file system
chown: changing group of '/usr/share/doc/nmap/leet-nmap-ascii-art.txt': Read-only file system
chown: changing group of '/usr/share/doc/nmap/nmap.usage.txt.gz': Read-only file system
chown: changing group of '/usr/share/doc/nmap/device-types.txt.gz': Read-only file system
chown: changing group of '/usr/share/doc/nmap/committers.txt.gz': Read-only file system
chown: changing group of '/usr/share/doc/nmap/nmap_gpgkeys.txt.gz': Read-only file system
chown: changing group of '/usr/share/doc/nmap/style/lua-format.lua.gz': Read-only file system
chown: changing group of '/usr/share/doc/nmap/style/README': Read-only file system

marked as duplicate by karel, Elder Geek, guiverc, Community Jul 22 at 10:09

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • A read-only file system is usually the result of a problem (such as file-system error where a fsck is the fix), so I don't know why you mentioned sudo chown .. as it would create other problems though wouldn't change anything on a read-only file system anyway. Look at your logs to see why the file system was mounted or remounted read-only, and go from there. – guiverc Jul 21 at 9:10
  • But first, what should i do to undo this "sudo chown $pranav.pranav -R /" and then only filesystem error can be process. Because this can create big issues later. @guiverc – Prabesh bhattarai Jul 21 at 9:14
  • 2
    @PrabeshBhattarai as the file system is read only, no changes are made. The fact that you're getting these error messages means that the file system is read only. Press Control-C to abort the running process. – vidarlo Jul 21 at 9:39
  • @vidarlo thanks for that confirmation. Now my pc "seems" to be not in read-only state, can I check that for sure? Some commands to check will be very helpfull. – user889789 Jul 21 at 9:42
  • run mount | grep "/dev/" and check that the filesystems is indeed in ro mode, not rw. – vidarlo Jul 21 at 9:43
0

In case it's your main filesystem ran as part of the kernel parameter using grub you should change the command line from (example):

linux   /boot/vmlinuz-5.2-x86_64 root=<uuid> ro  quiet

To:

linux   /boot/vmlinuz-5.2-x86_64 root=<uuid> rw  quiet

And reboot.

If this partition is being mounted after reboot or it's not the root partition you can remount it with rw, like this:

sudo mount -o remount,rw /dev/sdX

Replace sdX with the appropriate partition that matches your case.

  • 1
    your answer worked but I will probably run into this problem in the future again. If there is a permanent solution, I would be a big help. – user889789 Jul 21 at 9:44
  • 1
    If your system is frequently going read-only, then you should do additional investigation to find out why. Ubuntu is not designed to run on dying or faulty hardware, and cannot fix those for you. – user535733 Jul 21 at 11:19
  • Change /etc/fstab to mount it the way you want it. – Yaron Jul 21 at 12:44
  • In over 35 years of using Unix systems, it has never happened to me that a system filesystem changed by itself to r/o. You need to not issue commands in sudo without first understanding exactly what they will do and why you need to do what you are doing. It only takes one simple command as root to destroy a system - don't take such commands lightly. – jpezz Jul 21 at 14:44
  • @Yaron 1 last question before i execute this if this repeat again in future, the command u said, "sudo mount -o remount,rw /dev/sdX" , the sdX should be a home or root partition? – Prabesh bhattarai Jul 22 at 5:02
0

The easiest way to solve this? The hard way: reinstall your system. All of it.

The root / should be owned by # root, not by a user (pranav). Your command meant changing all the files in your system to the group pranav. This is messy.

Don't worry, I did things worse than this (e.g. dd on my system's drive). But it's a good way to learn things the Linux way. :-)

  • 3
    Since it was a read-only file system, the OP's unwise command did nothing. Had this been a writable file system, the OP's unwise command would have wrought tremendous damage, and this would be the best answer. – user535733 Jul 21 at 11:15

Not the answer you're looking for? Browse other questions tagged or ask your own question.