Added more debugging to systemd journald

This commit is contained in:
Anton Hvornum 2019-12-26 00:53:43 +00:00
parent 00d0a29c49
commit 33f107255e
1 changed files with 9 additions and 0 deletions

View File

@ -1050,6 +1050,7 @@ def run_post_install_steps(*positionals, **kwargs):
rerun = args['ignore-rerun']
for title in conf:
log(f'Running post installation step {title}', level=4, origin='run_post_install_steps')
if args['rerun'] and args['rerun'] != title and not rerun:
continue
else:
@ -1058,6 +1059,7 @@ def run_post_install_steps(*positionals, **kwargs):
print('[N] Network Deploy: {}'.format(title))
if type(conf[title]) == str:
print('[N] Loading {} configuration'.format(conf[title]))
log(f'Loading {conf[title]} configuration', level=4, origin='run_post_install_steps')
conf[title] = get_application_instructions(conf[title])
for command in conf[title]:
@ -1091,8 +1093,10 @@ def run_post_install_steps(*positionals, **kwargs):
## Either skipping mounting /run and using traditional chroot is an option, but using
## `systemd-nspawn -D /mnt --machine temporary` might be a more flexible solution in case of file structure changes.
if 'no-chroot' in opts and opts['no-chroot']:
log(f'Executing {command} as simple command from live-cd.', level=4, origin='run_post_install_steps')
o = simple_command(command, opts)
elif 'chroot' in opts and opts['chroot']:
log(f'Executing {command} in chroot.', level=4, origin='run_post_install_steps')
## Run in a manually set up version of arch-chroot (arch-chroot will break namespaces).
## This is a bit risky in case the file systems changes over the years, but we'll probably be safe adding this as an option.
## **> Prefer if possible to use 'no-chroot' instead which "live boots" the OS and runs the command.
@ -1107,6 +1111,7 @@ def run_post_install_steps(*positionals, **kwargs):
o = simple_command("cd /mnt; umount -R proc")
else:
if 'boot' in opts and opts['boot']:
log(f'Executing {command} in boot mode.', level=4, origin='run_post_install_steps')
## So, if we're going to boot this maddafakker up, we'll need to
## be able to login. The quickest way is to just add automatic login.. so lessgo!
@ -1136,11 +1141,15 @@ def run_post_install_steps(*positionals, **kwargs):
## Not needed anymore: And cleanup after out selves.. Don't want to leave any residue..
# os.remove('/mnt/etc/systemd/system/console-getty.service.d/override.conf')
else:
log(f'Executing {command} in with systemd-nspawn without boot.', level=4, origin='run_post_install_steps')
o = b''.join(sys_command('/usr/bin/systemd-nspawn -D /mnt --machine temporary {c}'.format(c=command), **opts))
if type(conf[title][raw_command]) == bytes and len(conf[title][raw_command]) and not conf[title][raw_command] in o:
log(f'{command} failed: {o.decode("UTF-8")}', level=4, origin='run_post_install_steps')
print('[W] Post install command failed: {}'.format(o.decode('UTF-8')))
#print(o)
return True
if __name__ == '__main__':
## Setup some defaults
# (in case no command-line parameters or netdeploy-params were given)