Page 1 of 1

can't create temp file - read-only file system

Posted: Thu Apr 09, 2020 10:08 am
by azaher75
Hello

i'm using Nagios Core, i have created hosts normally and verify my work by restart service by sudo service nagios and /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg normally, in some day and before i start the work i did the same verifying commands but i found the following:

nagios@nagios-srv:/usr/local/nagios/etc/objects$ sudo service nagios start
Job for nagios.service failed because the control process exited with error code.
See "systemctl status nagios.service" and "journalctl -xe" for details.
nagios@nagios-srv:/usr/local/nagios/etc/objects$
nagios@nagios-srv:/usr/local/nagios/etc/objects$
nagios@nagios-srv:/usr/local/nagios/etc/objects$
nagios@nagios-srv:/usr/local/nagios/etc/objects$ /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Nagios Core 4.4.5
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 2019-08-20
License: GPL

Website: https://www.nagios.org
Reading configuration data...
Read main config file okay...
Read object config files okay...

Running pre-flight check on configuration data...

Checking objects...
Checked 174 services.
Checked 153 hosts.
Checked 6 host groups.
Checked 0 service groups.
Checked 1 contacts.
Checked 1 contact groups.
Checked 24 commands.
Checked 5 time periods.
Checked 0 host escalations.
Checked 0 service escalations.
Checking for circular paths...
Checked 153 hosts
Checked 0 service dependencies
Checked 0 host dependencies
Checked 5 timeperiods
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...
Error: Unable to write to temp_path ('/tmp') - Read-only file system
Error: Unable to write to check_result_path ('/usr/local/nagios/var/spool/checkresults') - Read-only file system

Total Warnings: 0
Total Errors: 2

***> One or more problems was encountered while running the pre-flight check...

Check your configuration file(s) to ensure that they contain valid
directives and data definitions. If you are upgrading from a previous
version of Nagios, you should be aware that some variables/definitions
may have been removed or modified in this version. Make sure to read
the HTML documentation regarding the config files, as well as the
'Whats New' section to find out what has changed.

nagios@nagios-srv:/usr/local/nagios/etc/objects$

anyone can help me on that issue?
Thanks

Re: can't create temp file - read-only file system

Posted: Fri Apr 10, 2020 12:30 pm
by jdunitz
It looks like at least one of your filesystems got mounted read-only.
Did that machine get rebooted recently? If so, something may have gone wrong during the boot process.

Can you post the output of the "mount" command? That will show you which filesystems are mounted ro (read-only) and which are rw (read-write). Your /tmp filesystem should most definitely be mounted rw, and if it's not, there's a problem somewhere.

Let us know what you find!

--Jeffrey

Re: can't create temp file - read-only file system

Posted: Sat Apr 11, 2020 4:45 am
by azaher75
Hi Jeffrey
Thanks for your response

the rebooting has done but the issue is same.

please find the mount command output at following:

nagios@nagios-srv:~$ mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,nosuid,relatime,size=1976984k,nr_inodes=494246,mo de=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=401568k,mode=755)
/dev/sda2 on / type ext4 (ro,relatime,data=ordered)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755)
cgroup on /sys/fs/cgroup/unified type cgroup2 (rw,nosuid,nodev,noexec,relatime)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xa ttr,name=systemd)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,pids)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,mem ory)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatim e,cpu,cpuacct)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime ,perf_event)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,re latime,net_cls,net_prio)
cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,hu getlb)
cgroup on /sys/fs/cgroup/rdma type cgroup (rw,nosuid,nodev,noexec,relatime,rdma)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blki o)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpu set)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,fr eezer)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,de vices)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,pagesize=2M)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=39,pgrp=1,time out=0,minproto=5,maxproto=5,direct,pipe_ino=20526)
mqueue on /dev/mqueue type mqueue (rw,relatime)
configfs on /sys/kernel/config type configfs (rw,relatime)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
/var/lib/snapd/snaps/core_8592.snap on /snap/core/8592 type squashfs (ro,nodev,r elatime,x-gdu.hide)
/var/lib/snapd/snaps/core_8689.snap on /snap/core/8689 type squashfs (ro,nodev,r elatime,x-gdu.hide)
lxcfs on /var/lib/lxcfs type fuse.lxcfs (rw,nosuid,nodev,relatime,user_id=0,grou p_id=0,allow_other)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=401564k,mode=7 00,uid=1000,gid=1000)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,relatime)
tracefs on /sys/kernel/debug/tracing type tracefs (rw,relatime)
nagios@nagios-srv:~$

Re: can't create temp file - read-only file system

Posted: Mon Apr 13, 2020 11:03 am
by jdunitz
Can you also post the contents of your /etc/fstab file?

Thanks!

Re: can't create temp file - read-only file system

Posted: Mon Apr 13, 2020 11:50 am
by azaher75
Dear Jeffrey

please find the fstab file content at following :

nagios@nagios-srv:/etc$ nano fstab
GNU nano 2.9.3 fstab

UUID=8f36df65-22e9-4e83-b41d-870cba341295 / ext4 defaults 0 0
/swap.img none swap sw 0 0

Re: can't create temp file - read-only file system

Posted: Mon Apr 13, 2020 4:55 pm
by ssax
/dev/sda2 on / type ext4 (ro,relatime,data=ordered

/dev/sda2 is read-only, try this:

Code: Select all

sudo mount -o remount,rw /dev/sda2 /
Do you see any errors in /var/log/messages? This could be a storage issue.

What does this output?

Code: Select all

dmesg

Re: can't create temp file - read-only file system

Posted: Mon Apr 13, 2020 5:25 pm
by azaher75
output14042020.txt
(102.18 KiB) Downloaded 197 times
Dear ssax

please find the required output at attached file

Thanks

Re: can't create temp file - read-only file system

Posted: Tue Apr 14, 2020 12:19 pm
by ssax

Code: Select all

[553947.381760] EXT4-fs (sda2): initial error at time 1585072430: ext4_evict_inode:257
[553947.381766] EXT4-fs (sda2): last error at time 1585072437: ext4_orphan_add:2817
[559343.265902] EXT4-fs (sda2): Couldn't remount RDWR because of unprocessed orphan inode list.  Please umount/remount instead
Try rebooting again, does it ask you to do an fsck? Do it if it does.

You need to repair the filesystem on /dev/sda2.

The easiest way would probably be this:

https://www.cyberciti.biz/faq/linux-for ... -sequence/

See here if that doesn't work for you:

http://bitsofmymind.com/2014/03/14/how- ... -on-linux/

Let us know if you have any questions.

Re: can't create temp file - read-only file system

Posted: Wed Apr 15, 2020 8:26 am
by azaher75
Dear All

i'd like to inform the problem has resolved after i made rebooting then choose advanced option (Recovery Mode) - then choose Shell option from maintenance mode - then enter command # fsck /dev/sda2
then choose Yes for every question to fix all currapted files system.

i just wonder what was cause this issue to avoid it in future? i noticed there is like auto update during the booting, do you advice to turn off the auto update ? if so how we can do that ?

Thanks for your support

Re: can't create temp file - read-only file system

Posted: Wed Apr 15, 2020 4:28 pm
by ssax
That entirely depends on how you enabled auto-updating, it's likely specific to your distro or someone set it up that way.

What specifically is updating? You're gonna have to give a lot more details.

What OS is this?

Code: Select all

uname -a
cat /etc/*release
Generally I only see this if you non-gracefully shutdown the system or if it's a VM if something happens on the VM host with the storage/filesystem, etc.

See here for that specific error:

https://unix.stackexchange.com/question ... aned-inode