npaisnel
Posts: 86
Joined: Sun Aug 05, 2018 4:23 pm

Nano File smb.conf is unwritable

Wed Apr 14, 2021 8:34 pm

Been having a few issues with a headless Pi not working correctly to run the home control system.

I cloned the card and the issue continued. I thought it was perhaps a corrupt card issue
Cloned from a 2gb card to a 8 gb card.
used advanced options and expand files system.

Some of th write errors "no space left on device" errors went away.

But i go to edit my /etc/samba/smb.conf file and I get

File 'smb.conf' is unwriteable

tha is if I do a straight nano smb.conf

if I do a "sudo nano smb.conf"

Error reading lock file ./.smb.conf.swp: Not enough data read


Any one give me clues as to what is happening here.

What to try

User avatar
kerry_s
Posts: 2026
Joined: Thu Jan 30, 2020 7:14 pm

Re: Nano File smb.conf is unwritable

Wed Apr 14, 2021 9:54 pm

Code: Select all

sudo rm /etc/samba/.smb.conf.swp
some how you didn't exit the text editor properly, so it left the previously edited copy behind.

npaisnel
Posts: 86
Joined: Sun Aug 05, 2018 4:23 pm

Re: Nano File smb.conf is unwritable

Thu Apr 15, 2021 2:40 am

Ah
That will be the smb.conf.ucf-dist file, i guess ?

So how do I go about fixing that ?

I just tried renaming that ucf-dist file to something else and editing again, but no joy, Nano still fails to edit it

npaisnel
Posts: 86
Joined: Sun Aug 05, 2018 4:23 pm

Re: Nano File smb.conf is unwritable

Thu Apr 15, 2021 2:45 am

Here are the files in the /etc/samba dir

Code: Select all

pi@x10:/etc/samba $ ls -l
total 36
-rw-r--r-- 1 root root    8 Mar  5  2018 gdbcommands
-rw-r--r-- 1 root root 9231 Jun 27  2018 smb.bak
-rw-r--r-- 1 root root 1609 Jan 11 20:26 smb.conf
-rw-r--r-- 1 root root 9226 Sep 24  2018 smb.conf.ucf-dist
drwxr-xr-x 2 root root

User avatar
kerry_s
Posts: 2026
Joined: Thu Jan 30, 2020 7:14 pm

Re: Nano File smb.conf is unwritable

Thu Apr 15, 2021 3:58 am

no thats a normal file.
backups are always hidden.
use:

Code: Select all

ls -a
to see all files including hidden
or
just run the command i put there

npaisnel
Posts: 86
Joined: Sun Aug 05, 2018 4:23 pm

Re: Nano File smb.conf is unwritable

Thu Apr 15, 2021 6:32 am

Ah sorry
I missed the command you first gave... that comes from reading this on an iphone 5SE At three in the morning when I just woke !

Yes that worked thanks
ls -a of course....I used ls -l

Yes that worked, there was a hidden swap file.

I do this SSH /CMD line stuff so I frequently
Thanks

A further question.., suppose I should Google first or post a new question, but I will push my luck

I know the Apple Mac has a system protection / file checker tool / utility.

I have used diskutil and a system file check utility before on the Pi. I am sure .

Is there one all encompassing tool I can use here... give the SD card a ‘spring clean’
Something that checks system file permissions / repairs etc.. may deletes old temp system files too ?

This little Pi sits headless in the attic and runs 24 hour. Last time it got turned off /on was about 3 months ago... until this random failure ... due full SD card... only running a 2GB. It is a Home Control -Alexa to X10 System ‘translator’

User avatar
kerry_s
Posts: 2026
Joined: Thu Jan 30, 2020 7:14 pm

Re: Nano File smb.conf is unwritable

Thu Apr 15, 2021 6:49 am

not really needed, linux is pretty good about managing itself.
all my pi's stay on all the time.

rpi400 = my desktop pi, currently running rapberry lite + gnome-core
rpi4 4gb = headless pihole + extra duty's via ssh or vnc
rpi0w = this i sftp file/folder backups. i use to run samba, but sftp is just so much simpler, no need to install anything.
Attachments
Screenshot from 2021-04-14 20-46-29.resized.png
Screenshot from 2021-04-14 20-46-29.resized.png (220.08 KiB) Viewed 146 times

npaisnel
Posts: 86
Joined: Sun Aug 05, 2018 4:23 pm

Re: Nano File smb.conf is unwritable

Thu Apr 15, 2021 7:04 am

Ok thanks

I’ll just clone the SD card today while I have the attic open !

My main machine is a Mac Pro 5.1 Tower 12 core 3.2 Ghz machine...Only bought it a few months back as an upgrade on the older Mac 3.1 that I had since 2008.

Though the way technology improves... the performance of your Pi 4 is probably as good / fast !

User avatar
kerry_s
Posts: 2026
Joined: Thu Jan 30, 2020 7:14 pm

Re: Nano File smb.conf is unwritable

Thu Apr 15, 2021 7:20 am

the main reason i'm on the rpi's, is some months back my dog took out my laptop, i had it charging on the table & the dog ran through the powercord when i stepped out, it scared him so he attacked it.
came back to a very happy dog sitting on top of the evil laptop he conquered. :lol:

i'm still trying to save up for something normal, it's just not in the budget right now. :D

npaisnel
Posts: 86
Joined: Sun Aug 05, 2018 4:23 pm

Re: Nano File smb.conf is unwritable

Thu Apr 15, 2021 7:44 am

Wise dog ..think how happy we could all be if we did the same and stopped having to pull our hair out when random shit like the shappens.

My system had been working fine for 6 months or more...after previous Alexa update screwed the Device discovery ...

npaisnel
Posts: 86
Joined: Sun Aug 05, 2018 4:23 pm

Re: Nano File smb.conf is unwritable

Thu Apr 15, 2021 8:54 am

This is what I was thinking of

apt-get clean

Running out of space

When running sudo apt full-upgrade, it will show how much data will be downloaded and how much space it will take up on the SD card. It's worth checking with df -h that you have enough free disk space, as unfortunately apt will not do this for you. Also be aware that downloaded package files (.deb files) are kept in /var/cache/apt/archives. You can remove these in order to free up space with sudo apt clean (sudo apt-get clean in older releases of apt).

Will do an update too then clone..give myself a new 'baseline image'...maybe best i do another clone first !

User avatar
kerry_s
Posts: 2026
Joined: Thu Jan 30, 2020 7:14 pm

Re: Nano File smb.conf is unwritable

Thu Apr 15, 2021 9:10 am

sorry i use a .bash_aliases file, so don't even think about it. i type "upd" to do all that.

my current, use what you want & discard the rest:

Code: Select all

export EDITOR=nano

# alias shortcuts
alias raspi="sudo raspi-config"
alias clr="clear"
alias clrh="history -c -w ~/.bash_history"
alias hg="history | grep"
alias rpi0w="ssh pi@rpi0w.local"
alias rpi4="ssh pi@rpi4.local"
alias ll="ranger"
alias x="exit"

# apt aliases
alias upd="sudo apt update && sudo apt -y full-upgrade && sudo apt -y autoremove && sudo apt clean"
alias ins="sudo apt install"
alias del="sudo apt purge -y --autoremove"
alias srch="apt search"
alias lst="apt list | grep"
alias show="apt show"

npaisnel
Posts: 86
Joined: Sun Aug 05, 2018 4:23 pm

Re: Nano File smb.conf is unwritable

Thu Apr 15, 2021 9:24 am

Thanks

handy

Ii can make my way around the cmd lien ..and have been doing so for years..am 53 now and have been tinkering with this sort of stuff since the Research Machine days of early computing at school. I only know enough to be dangerous!

last tiem I did anything was probably when I had a broken leg back in 2018..when I set up this system to run the X-10 home control stuff and a SDR radio receiver. most of that was done via following online tutorials ..rahter than any real knowledge...a permanent newbie really

User avatar
kerry_s
Posts: 2026
Joined: Thu Jan 30, 2020 7:14 pm

Re: Nano File smb.conf is unwritable

Thu Apr 15, 2021 9:28 am

npaisnel wrote:
Thu Apr 15, 2021 9:24 am
Thanks

handy

Ii can make my way around the cmd lien ..and have been doing so for years..am 53 now and have been tinkering with this sort of stuff since the Research Machine days of early computing at school. I only know enough to be dangerous!

last tiem I did anything was probably when I had a broken leg back in 2018..when I set up this system to run the X-10 home control stuff and a SDR radio receiver. most of that was done via following online tutorials ..rahter than any real knowledge...a permanent newbie really
your 3 years older than me. :lol:

npaisnel
Posts: 86
Joined: Sun Aug 05, 2018 4:23 pm

Re: Nano File smb.conf is unwritable

Thu Apr 15, 2021 9:46 am

my play tines over....the blokes that pay my salary have jsut phoned me..want me to go in and do some work...they expect that sort of thing... :(

Return to “Troubleshooting”