FSTAB problems [Solved]

Kernels & Hardware, configuring network, installing services

FSTAB problems [Solved]

Postby awachens » 2018-01-04 18:19

Hi good night, i have problems with FSTAB (i think..)

I was doing tests with mount/umount USB, write access etc...

Then i try to mount at reboot the USB drive with RW permissions... With echo /etc/fstab bla bla bla ...

When i reboot to try, X doesn't work... Only i can access to Desktop using: mount -o remount,rw /
or editing the boot options line: linux= .... changing ro for rw and adding at end 'single'
Then i can load normally.

When i try to edit fstab i can't do nothing... I get error message saying something like: is only read archive...
And FSTAB only have my echo lane and nothing more...

What can i do ?

PD: Sorry for my english id you don't understand something.
Last edited by awachens on 2018-01-05 05:50, edited 1 time in total.
User avatar
awachens
 
Posts: 68
Joined: 2016-03-06 11:28

Re: FSTAB problems

Postby debiman » 2018-01-04 18:37

i really didn't understand very much.
did you use google translate?

anyhow, i think it's better you show us the exact commands that led up to this situation, and their output.
please use code tags for code.
User avatar
debiman
 
Posts: 2900
Joined: 2013-03-12 07:18

Re: FSTAB problems

Postby awachens » 2018-01-04 19:21

I'm sorry xD NO!! I don't use google translation. I can't write exactly output... Because my laptop haven't internet connection.

I use:
Code: Select all
echo /etc/fstab /dev/sda1 /media/usb/ ntfs rw,nobo,noauto 0 0

With this command i wanna try to moung automatically mount the USB drive with RW permission.

When i reboot my laptop X server (graphic desktop) doesn't load.

I search in google and i try this in console (single user):

Code: Select all
mount -o remount,rw /

Then graphic desktop load normally...

Now i wanna return normal FSTAB or load graphic desktop normally like always...

When i try to edit /etc/fstab
Code: Select all
vi /etc/fstab


Debian say's: W10: Warning: Changing a readonly file
E303: Unable to open swap file for "/etc/fstab", recovery impossible
Code: Select all
:q

E37: No write since last change (add ! to override)

----------------------------------------------------> This is my first tried

I try to edit boot sequence with "e" when debian is loading (charging)
In the line starting with linux=, I switched the 'ro' to 'rw' and added the word 'single' at the very end of the line.
Then i press f10 to boot.
once it booted, as root, I did:
Code: Select all
mount -o remount,rw /


Try again :
Code: Select all
vi /etc/fstab


Debian say's: W10: Warning: Changing a readonly file
E303: Unable to open swap file for "/etc/fstab", recovery impossible
Code: Select all
:q

E37: No write since last change (add ! to override)

---------------------------------------------------------------------> Second tried

What can i do ?
User avatar
awachens
 
Posts: 68
Joined: 2016-03-06 11:28

Re: FSTAB problems

Postby bw123 » 2018-01-04 19:53

It's not easy if you are new to linux and accidentally deleted your fstab, but it can be fixed. If you are new it will take you awhile to understand, so maybe a reinstall is going to be quicker and easier for you.

if you use something simple like this
Code: Select all
cat /etc/fstab


and you get either a blank, or an error that file doesn't exist, then you deleted it.

https://duckduckgo.com/html/?q=deleted+fstab
User avatar
bw123
 
Posts: 3389
Joined: 2011-05-09 06:02
Location: TN_USA

Re: FSTAB problems

Postby awachens » 2018-01-04 20:13

Hi, thx for the quick answer.
I'm a "little" new. I'm not 100% new but... A little be.. xD

I only use this command:
Code: Select all
echo /etc/fstab /dev/sda1 /media/usb/ ntfs rw,nobo,noauto 0 0

I think this doesn't overwrite fstab, no ?

Then i reboot and charge with shell...

I will read this tomorrow.

Thx again !

EDIT: Ah! I forgot. I will not reinstall debian, i wanna learn it.
User avatar
awachens
 
Posts: 68
Joined: 2016-03-06 11:28

Re: FSTAB problems

Postby bw123 » 2018-01-04 20:39

awachens wrote:
I only use this command:
Code: Select all
echo /etc/fstab /dev/sda1 /media/usb/ ntfs rw,nobo,noauto 0 0

I think this doesn't overwrite fstab, no ?

that command won't overwrite it, but one little character like '>' in the wrong place and it's botched. Here's an example:

Code: Select all
$ cat fstab
UUID=9871468756187356138975163 /  ext4 defaults,discard,noatime,errors=remount-ro 0 1
UUID=987146875684715687936187356138975163 none swap defaults 0 2
UUID=34756138795613577356138975163 /media/whatever fs defaults,noauto 0 0
$ echo  fstab /dev/sda1 /media/usb/ ntfs rw,nobo,noauto 0 0
fstab /dev/sda1 /media/usb/ ntfs rw,nobo,noauto 0 0
$ echo > fstab /dev/sda1 /media/usb/ ntfs rw,nobo,noauto 0 0
$ cat fstab
/dev/sda1 /media/usb/ ntfs rw,nobo,noauto 0 0
User avatar
bw123
 
Posts: 3389
Joined: 2011-05-09 06:02
Location: TN_USA

Re: FSTAB problems

Postby awachens » 2018-01-04 23:40

Hi! I think I don’t use these character ... so i dint know what can. be happen

Good night !!
User avatar
awachens
 
Posts: 68
Joined: 2016-03-06 11:28

Re: FSTAB problems [Solved]

Postby awachens » 2018-01-05 12:35

Hi! I solved it with your link thank you.
But now I can’t write in my usb.. I use chmod 777 /media/usb
But I have only read permission ...

What can I do ?

Regards !
User avatar
awachens
 
Posts: 68
Joined: 2016-03-06 11:28

Re: FSTAB problems [Solved]

Postby peter_irich » 2018-01-05 17:11

awachens wrote:But now I can’t write in my usb.. I use chmod 777 /media/usb

It is an extra action. Create on this usb-flash the directory with any name, for example, nobody by commands as root:
Code: Select all
cd /media/usb
mkdir -p nobody
chown nobody:nogroup nobody
chmod 775 nobody
usermod -a -G nogroup <user>

But I never use "usermod", I edit /etc/group.
Then after next logging this <user > and any user in nogroup will be able to write in nobody/.

Peter.
peter_irich
 
Posts: 1233
Joined: 2009-09-10 20:15
Location: Saint-Petersburg, Russian Federation

Re: FSTAB problems [Solved]

Postby awachens » 2018-01-05 19:07

Good night.

Ok, i make directory with write permissions ... drwxrwxr-x 2 nobo nobo

But... When i mount the USB on this patch... Permissions change to:
dr-x------ 1 root root

Don't understand.

Regards !

EDIT: I tried
Code: Select all
 sudo mount -o rw /dev/sdXY usb
too.

EDIT2: Ok, i format my USB and now works fine ;)
User avatar
awachens
 
Posts: 68
Joined: 2016-03-06 11:28

Re: FSTAB problems [Solved]

Postby peter_irich » 2018-01-05 19:52

Excuse me, perhaps, I not exactly said.
Directory "nobody" must be on usb-flash. I had mean that it already mounted in /media/usb.
Insert it, if it will has been mounted in /media/usb/, execute these commands, otherwise mount it as root:
Code: Select all
mount /dev/sdx1 /media/usb

x - your disk.
After these commands user belong "nogroup" will be able to write in nobody/ on usb-flash.

Peter.
peter_irich
 
Posts: 1233
Joined: 2009-09-10 20:15
Location: Saint-Petersburg, Russian Federation

Re: FSTAB problems [Solved]

Postby awachens » 2018-01-06 06:44

Hi, i have a question... nobody is treated like a group ? recognized on debian ? Because i haven'y any nobody group :S

Afetr format, i mount USB normally and works.. Maybe the error is on MBR ?

Regards !
User avatar
awachens
 
Posts: 68
Joined: 2016-03-06 11:28

Re: FSTAB problems [Solved]

Postby peter_irich » 2018-01-06 06:55

"nobody" is a user nobody and it is in the group "nogroup".
From /etc/passwd:
Code: Select all
nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin

From /etc/group:
Code: Select all
nogroup:x:65534:peter,_apt

Directory "nobody" and these commands are needed if usb-flash is formatted in extended FS.
For the file systems without Unix permissions it is not needed.

Peter.
peter_irich
 
Posts: 1233
Joined: 2009-09-10 20:15
Location: Saint-Petersburg, Russian Federation

Re: FSTAB problems [Solved]

Postby awachens » 2018-01-06 07:01

Ok! I check it. nobody user exist.

Thx i understand now ;)

Regards !
User avatar
awachens
 
Posts: 68
Joined: 2016-03-06 11:28

Re: FSTAB problems [Solved]

Postby debiman » 2018-01-08 06:06

awachens, have you installed debian to that usb drive?

is your intention to use debian with the default (or any) desktop environment?

i have the feeling that your solutions are overly complex, unsuited for a desktop environment, and brittle.
i also have the feeling that you don't understand that you have to become root to edit certain files. hence permission denied / read only errors.
User avatar
debiman
 
Posts: 2900
Joined: 2013-03-12 07:18

Next

Return to System configuration

Who is online

Users browsing this forum: arochester and 8 guests

fashionable