You are not logged in.

#1 2016-12-02 00:09:50

WeeDram
Member
From: Vancouver, B.C., Canada
Registered: 2016-04-14
Posts: 89

[Solved] sudo genfstab ... permision denied

I'm doing a new install on a USB. I got to the point in the installation guide where the next step is to generate an fstab table. The results were:

[ross@Lenovo3Part ~]$ sudo genfstab -U /mnt >> /mnt/etc/fstab
bash: /mnt/etc/fstab: Permission denied

I futzed around a bit with no success and finally just did

[ross@Lenovo3Part ~]$ su root
Password: 
[root@Lenovo3Part ross]# genfstab -U /mnt >> /mnt/etc/fstab
[root@Lenovo3Part ross]# exit

Which did the trick, I think. I mean I now have a fstab on /mnt/etc/ and it looks as though all the UUIDs are correct etc. but I would like to know went wrong (or what I was doing wrong) in the first instance. I'm going to take a break in the installation process just in case whatever caused this will have other effects later.

Last edited by WeeDram (2016-12-02 00:52:50)

Offline

#2 2016-12-02 00:23:52

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 27,305
Website

Re: [Solved] sudo genfstab ... permision denied

You need root access to write to that file or create it in that directory.  The first time you ran it, you were not writing as root.  You ran genfstab as root (which technically probably isn't really necessary) but attempted to write the file as a normal user.

This is a commonly misunderstood caveat of shell redirection.  To run this command from a normal user shell you would need to use tee:

$ genfstab -U /mnt | sudo tee /mnt/etc/fstab

See also: wiki


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2016-12-02 00:52:03

WeeDram
Member
From: Vancouver, B.C., Canada
Registered: 2016-04-14
Posts: 89

Re: [Solved] sudo genfstab ... permision denied

Wow!  You are so quick I didn't have enough time to take that break. Thank you very much. I can see how that is the case. I used the command as presented in the installation guide and, I guess, just assumed the sudo (implied by the #) carried right through the whole command. Learned something today.
Thanks again.

Offline

#4 2016-12-02 00:57:43

2ManyDogs
Forum Moderator
Registered: 2012-01-15
Posts: 4,143

Re: [Solved] sudo genfstab ... permision denied

WeeDram wrote:

just assumed the sudo (implied by the #)

No, the # indicates that you are running the command as root, not using sudo; there is a difference, as you have learned.


How to post. A sincere effort to use modest and proper language and grammar is a sign of respect toward the community.

Offline

#5 2016-12-02 01:26:42

WeeDram
Member
From: Vancouver, B.C., Canada
Registered: 2016-04-14
Posts: 89

Re: [Solved] sudo genfstab ... permision denied

More clarification! Thank you.

Offline

#6 2016-12-02 01:38:27

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [Solved] sudo genfstab ... permision denied

And if for some strange reason tee just rubs you the wrong way wink then you can always run the whole command as posted in the wiki using sudo. But the proper way to do that would be:

sudo bash -c 'genfstab -U /mnt > /mnt/etc/fstab'

Since the whole thing, redirection and all, is taking place in a bash subshell running as root, the bash redirection is of course powered by root and succeeds.


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#7 2020-04-30 04:19:43

chibo
Member
Registered: 2018-04-27
Posts: 73

Re: [Solved] sudo genfstab ... permision denied

that should be in official install guide wiki

you just can't image how it's frustrating when guide is crap and simply not working.....

Offline

#8 2020-04-30 04:27:50

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,200
Website

Re: [Solved] sudo genfstab ... permision denied

chibo wrote:

that should be in official install guide wiki

you just can't image how it's frustrating when guide is crap and simply not working.....

Not nearly as frustrating as a four year necrobump with nothing but a petulant whine: https://wiki.archlinux.org/index.php/Co … bumping.22


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#9 2020-04-30 07:05:49

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 17,138

Re: [Solved] sudo genfstab ... permision denied

Also for the most part the installation guide assumes you are root, and as shown in this thread is actually indicated.

Closing.

Online

Board footer

Powered by FluxBB