Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initrock via rockstor-pre fails on non-existent /etc/issue #2335

Closed
phillxnet opened this issue Dec 29, 2021 · 5 comments · Fixed by #2336
Closed

initrock via rockstor-pre fails on non-existent /etc/issue #2335

phillxnet opened this issue Dec 29, 2021 · 5 comments · Fixed by #2336
Assignees

Comments

@phillxnet
Copy link
Member

Under some circumstances a system can end up with no /etc/issue. Initrock, run by rockstor-pre.service can then fail trivially via:

Dec 29 11:32:08 installer initrock[671]: 2021-12-29 11:32:08,190: Done
Dec 29 11:32:08 installer initrock[671]: 2021-12-29 11:32:08,190: stopping firewalld...
Dec 29 11:32:08 installer systemd[1]: Reloading.
Dec 29 11:32:08 installer initrock[671]: 2021-12-29 11:32:08,445: firewalld stopped and disabled
Dec 29 11:32:08 installer initrock[671]: Traceback (most recent call last):
Dec 29 11:32:08 installer initrock[671]:   File "/opt/rockstor/bin/initrock", line 41, in <module>
Dec 29 11:32:08 installer initrock[671]:     sys.exit(scripts.initrock.main())
Dec 29 11:32:08 installer initrock[671]:   File "/opt/rockstor/src/rockstor/scripts/initrock.py", line 510, in main
Dec 29 11:32:08 installer initrock[671]:     shutil.copyfile("/etc/issue", "/etc/issue.rockstor")
Dec 29 11:32:08 installer initrock[671]:   File "/usr/lib64/python2.7/shutil.py", line 96, in copyfile
Dec 29 11:32:08 installer initrock[671]:     with open(src, 'rb') as fsrc:
Dec 29 11:32:08 installer initrock[671]: IOError: [Errno 2] No such file or directory: '/etc/issue'
Dec 29 11:32:08 installer systemd[1]: rockstor-pre.service: Main process exited, code=exited, status=1/FAILURE
░░ Subject: Unit process exited

Which in-turn fails rockstor.service & consequently rockstor-bootstrap.service vai a dependency chain.

The default upstream contents of /etc/issue is, in our new upstream of openSUSE, determined initially by:

rleap15-3:~ # cat /usr/lib/issue.d/10-openSUSE.conf 
Welcome to \S - Kernel \r (\l).
@phillxnet
Copy link
Member Author

rleap15-3:~ # rpm -qf /usr/lib/issue.d/10-openSUSE.conf 
openSUSE-release-15.3-lp1532.157.1.x86_64

And the associated systemd service:

zypper info issue-generator
...
Information for package issue-generator:
----------------------------------------
Repository     : Leap_15_3
Name           : issue-generator
Version        : 1.7-1.17
Arch           : noarch
Vendor         : SUSE LLC <https://www.suse.com/>
Installed Size : 25.9 KiB
Installed      : No
Status         : not installed
Source package : issue-generator-1.7-1.17.src
Summary        : Generates an issue files from different snippets
Description    : 
    issue-generator is a tool to create an issue file dynamically.

@phillxnet
Copy link
Member Author

phillxnet commented Dec 29, 2021

Our more recent treatment of /etc/issues:
#940 (initrock)
with quick follow-up regression fix:
#962 (initrock)
and later:
#1702 (initrock)

We also have an older mechanism resourcing osi.py:
9e0740c
as part of:
#367
where src/rockstor/storageadmin/views/network.py uses osi.py update_issue() to re-assert /etc/issue from /etc/issue.rockstor and then append contents to it.

@phillxnet phillxnet self-assigned this Dec 29, 2021
@phillxnet
Copy link
Member Author

It is proposed that we postpone any major changes to our existing outdated treatment of /etc/issue and for the time being fix our simple failure to back-up a file that does not exist, for whatever reason.

Later, maybe in our next testing channel run-up to our subsequent stable release, post 4.1.0-0, we can move over to using the issue-generator systemd service and simply drop our desired content into new within proposed content directories managed by this service.

But for now we have basic failure to address to ensure we are more robust to whatever has caused this anomalous missing /etc/issue file situation.

@phillxnet
Copy link
Member Author

phillxnet commented Dec 29, 2021

From the following it looks like we have some dead code here also:

grep -R "update_issue" *
src/rockstor/system/osi.py:def update_issue(ipaddr):
src/rockstor/scripts/initrock.py:def init_update_issue(logger):
src/rockstor/scripts/initrock.py:    init_update_issue(logging)

So system/osi.py: update_issue() is no longer used.

And we appear to no longer use issue.rockstor as we once did in src/rockstor/storageadmin/views/network.py
here: 9e0740c

grep -R "issue.rockstor" *
src/rockstor/scripts/initrock.py:    shutil.copyfile("/etc/issue", "/etc/issue.rockstor")

Which in this case is our initial failure point.

I.e. we attempt to copy /etc/issue to /etc/issue.rockstor as we used to then copy this back over to /etc/issue in src/rockstor/storageadmin/views/network.py but no longer do this.

@phillxnet phillxnet added this to the First 4 Stable (ISO) milestone Dec 29, 2021
@phillxnet
Copy link
Member Author

I am working on a pull request for this issue.

phillxnet added a commit to phillxnet/rockstor-core that referenced this issue Dec 29, 2021


We previously assumed the existence of /etc/issue, avoid rockstor
service failures in this case by creating during the open process if
required.

Includes:
- Remove the now defunct /etc/issue.rockstor copy from /etc/issue.
- Remove dead code previously used to update /etc/issue - osi.py:
update_issue()
@phillxnet phillxnet changed the title initrock via rockstor-pre fails on no /etc/issue initrock via rockstor-pre fails on non-existent /etc/issue Dec 29, 2021
phillxnet added a commit that referenced this issue Dec 29, 2021
…e_fails_on_no_/etc/issue

initrock via rockstor-pre fails on non-existent /etc/issue #2335
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant