Sudo fstab permission denied

After issues with corrupted GRUB, I reinstalled the latest Manjaro (24.0.1).
After completed installation, the swap will not stay activated.
I have to activate it with GParted after every start.
In terminal I tried the command:
sudo bash -c “echo /dev/sda2 none swap defaults 0 0 >> /etc/fstab”
but the permission was denied.
Then I tried:
chmod 644 /etc/fstab
but still the permission was denied.
I have used the command:
sudo bash -c “echo /dev/sda2 none swap defaults 0 0 >> /etc/fstab”
in previous installations of earlier Manjaro distros, without any permission issues.
Why is permission denied and how can I fix it?

/ Hans Gatu

It’s unwise to change the permissions on root owned files. However those are the permissions it should have anyway, so in this case it shouldn’t matter.

Though they look ok, the quotes are wrong. I changed them and it worked.

Why not just sudo nano /etc/fstab and type the entry in?

3 Likes

I didn’t realize that the quotes were wrong.
I changed them and it worked.
Thank you @dmt !

/ Hans Gatu

1 Like

You’re welcome. :slight_smile:

This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.