Page MenuHomeVyOS Platform

Commit-confirm restarts the server even after commit
Closed, ResolvedPublicBUG

Description

How to reproduce a bug:

# conf
# set system time-zone Europe/Amsterdam
# commit-confirm
# y
# commit
# run show reboot
No reboot currently scheduled
# exit
# sudo -i
# atd -l => get no output

but

# ls -al /boot/wr/var/spool/cron/atjobs/
show new task (datetime = commit-confirm) :
-rwx--------- 1 daemon daemon a0000501874311

and after N minutes we have rebooted VyOS by cron atd.

The second situation.
If the server is restarted manually after executing commit-confirm, the task from the atd queue is not deleted and the server is restarted again.

Details

Difficulty level
Unknown (require assessment)
Version
VyOS 1.2.0-rolling+201810021217
Why the issue appeared?
Will be filled on close

Event Timeline

syncer triaged this task as High priority.Oct 6 2018, 11:22 PM
syncer edited projects, added VyOS 1.2 Crux (VyOS 1.2.0-rc1); removed VyOS 1.2 Crux.

That was never working as far as I see in the code. Did it work in any 1.2 version?

@hagbard I do not know, we have not tried other versions 1.2.

I found multiple issues with the old scripts, but I should get it working since at is only used for that particular reboot job.

I suppose we can simply delete all those jobs at boot time. Since nothing else uses atd, and old jobs likely should not survive reboots, I think it's the simplest solution.

It creates a /var/run/confirm.job field which contains the atd ID. So I was more thinking I extend the at command they have in their script. It creates a rollback of the config, applies it then I would just executed the job deletion and reboot. I didn't find any other atd reference, but not sure if there is one hidden somewhere.

Hmm.. i think some things is missing here... the "reboot" and "poweroff" commands is using the new /usr/libexec/vyos/op_mode/powerctrl.py script to schedule reboots, but "show reboot" and "show poweroff"

runarb@runar-gw:~$ cat /opt/vyatta/share/vyatta-op/templates/reboot/node.def
help: Reboot the system
run: sudo ${vyos_op_scripts_dir}/powerctrl.py --reboot

runarb@runar-gw:~$ cat /opt/vyatta/share/vyatta-op/templates/show/reboot/node.def
help: Show scheduled reboot
run: sudo /opt/vyatta/bin/sudo-users/vyatta-reboot.pl --action show_reboot

The new script uses systemd-shutdownd to schedule a reboot so it doesn't use atd and thouse wount detect a scheduled reboot, the same with
Then show reboot won't detect a scheduled reboot.

i think all scripts need to be changed to use the systemd-shutdownd daemon to be in pair with the normal shutdown script. actually i dont remember why show reboot wasn't updated when i updated "reboot"

That function more broken than I thought. I have the fix for acting correctly when it reboots, however I found that it is supposed to accept a time after commit-confirm as well, not only y. Also if commit is called after commit-confirm, it does not remove the at reboot job. Looking into that next.

@runar not your fault buddy, it was never supposed to work like that, at least what I see in the scripts. The actual real broken thing is, that after a reboot the at job wasn't removed, everything else works as expected. The show reboot would be a feature request, I may implement it as well, but I'm not sure if we should leave it with atd. I would rather see in powerctrl.py.

@oliko

  1. conf
  2. set system time-zone Europe/Amsterdam
  3. commit-confirm
  4. y
  5. commit <-- wrong command you need to call confirm not commit
  6. run show reboot <-- that would be a feature request
  1. sudo -i
  2. atd -l => get no output

That would be at -l not atd -l.

So far only the show command is not working, the at job removal is working correctly.

@hagbard, the powerctrl.py script allready have everything needed, --check to check for scheduled reboot. :)

If you also get the commit-confirm script to call powerctrl.py wity -r #, (# is number im minites) you could easely implememt minutes til reboot. The confirm command also only needs to execute powerctrl.py --cancel to abort the reboot

@runar Yeah, but it doesn't know about the reboot scheduled via at when you call commit-confirm. I have a look today, it's the last missing piece, I patched already the vyatta portion yesterday. I will leave a comment in th code with the task number, once these vyatta scripts are supposed to go away, it's easy to remove the code.
I was about not to cross call scripts, each script should be able to run for its own with no dependency to other op-mode/conf-mode scripts.