Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

FSTAB problems [Solved]

Linux Kernel, Network, and Services configuration.
Post Reply
Message
Author
User avatar
awachens
Posts: 68
Joined: 2016-03-06 11:28

FSTAB problems [Solved]

#1 Post by awachens »

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
debiman
Posts: 3063
Joined: 2013-03-12 07:18

Re: FSTAB problems

#2 Post by debiman »

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
awachens
Posts: 68
Joined: 2016-03-06 11:28

Re: FSTAB problems

#3 Post by awachens »

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
bw123
Posts: 4015
Joined: 2011-05-09 06:02
Has thanked: 1 time
Been thanked: 28 times

Re: FSTAB problems

#4 Post by bw123 »

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
resigned by AI ChatGPT

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

Re: FSTAB problems

#5 Post by awachens »

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
bw123
Posts: 4015
Joined: 2011-05-09 06:02
Has thanked: 1 time
Been thanked: 28 times

Re: FSTAB problems

#6 Post by bw123 »

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
resigned by AI ChatGPT

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

Re: FSTAB problems

#7 Post by awachens »

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]

#8 Post by awachens »

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 !

peter_irich
Posts: 1405
Joined: 2009-09-10 20:15
Location: Saint-Petersburg, Russian Federation
Been thanked: 11 times

Re: FSTAB problems [Solved]

#9 Post by peter_irich »

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.

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

Re: FSTAB problems [Solved]

#10 Post by awachens »

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 ;)

peter_irich
Posts: 1405
Joined: 2009-09-10 20:15
Location: Saint-Petersburg, Russian Federation
Been thanked: 11 times

Re: FSTAB problems [Solved]

#11 Post by peter_irich »

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.

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

Re: FSTAB problems [Solved]

#12 Post by awachens »

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 !

peter_irich
Posts: 1405
Joined: 2009-09-10 20:15
Location: Saint-Petersburg, Russian Federation
Been thanked: 11 times

Re: FSTAB problems [Solved]

#13 Post by peter_irich »

"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.

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

Re: FSTAB problems [Solved]

#14 Post by awachens »

Ok! I check it. nobody user exist.

Thx i understand now ;)

Regards !

User avatar
debiman
Posts: 3063
Joined: 2013-03-12 07:18

Re: FSTAB problems [Solved]

#15 Post by debiman »

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
awachens
Posts: 68
Joined: 2016-03-06 11:28

Re: FSTAB problems [Solved]

#16 Post by awachens »

Good morning. Yes I don’t know why my solutions are very complex jajaja
I have debian 9 xfce4 on hp stream 11.
This usb is for copy sig archives of apt-offline. I think I should write about apt-offline because never work (in new thread).

Yes I know I should become root to edit some archives .. for example with sudo sometimes I can’t edit, before I think sudo and root are the same but it seems that no...

What is wrong ?

Regards and thx for be patient!

Post Reply