I can't seem to get any commands in postrun to run after a restore is complete via kickstart. Am I doing something wrong; below is my kickstart append:
I'm experiencing the same problem using clonezilla-live-20151012-wily-amd64.
If -p poweroff or -p reboot, the postrun commands are just skipped and it proceeds directly to shutdown or reboot (see attached screenshots). It happens for both restoredisk and savedisk.
The only difference between the two runs is:
ocs_live_run="ocs-sr --nogui -j2 -e2 -g auto -e1 auto -r -p true restoredisk current-img-dn1 sda" \
and
ocs_live_run="ocs-sr --nogui -j2 -e2 -g auto -e1 auto -r -p poweroff restoredisk current-img-dn1 sda" \
My hack/workaround is to use the -p true, but insert: ocs_postrun?="sudo shutdown 5" \ as the last postrun command. It works but it's not pretty.
Yes, this is true. Not perfect, but it works. This is because the option "-p" for ocs-sr will be run after ocs-sr is done, while ocs_postrun is after ocs-sr is finished. Therefore your solution now is the best one.
Steven.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I don't know if this could somehow be noted in the documentation (under ocs_postrun). It took me a while before I stumbled on to this thread and figured out the workaround.
Brian
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
We run a system of disk cloning via PXE Boot using a serverTftpd32.
Some PC still run winXP, others Win8.1 or Win10.
Now I try to switch the system to use savedisk to safe images.
I use the the version clonezilla-live-2.7.1-15-i686.iso
The savedisk command works via PXE Boot, but I can't figure out why the postrun shell is not executed when savedisk is finished .
the postrun.sh should rename the clonezilla.log file according to the mac address of the PC and then send the file to the server.
the command line ocs_live_run="sudo /usr/sbin/ocs-sr -batch -q2 -c -j2 -z1p -i 4096 -sfsck -senc -p true savedisk autoname sda" works, but no postrun execution at all. See image in the attachment.
First, it's not necessary to run with "sudo" since all the ocs-related command will be run as root.
You put: ocs_postrun?="sudo shutdown 5" -> Why it's "?" not "2"?
BTW, please give the latest stable on a try, i.e., 2.7.1-22: https://clonezilla.org/downloads.php
Steven
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thank you for your fast reply and tips.
I have modified the code according your message and tried with the latest stable.
Still no postrun execution.
Any other suggestion to get it work?
Lars
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
After removing 2 hidden characters and slightly modify the APPEND command line it does the job via PXEBoot, executing the bash script and sending the log-file to the server and shuts down.
I can't seem to get any commands in postrun to run after a restore is complete via kickstart. Am I doing something wrong; below is my kickstart append:
My kickstart :
APPEND initrd=nbi_img/initrd.img boot=live config noswap nolocales edd=on nomodeset ocs_prerun1="dhclient -v eth0" ocs_prerun2="sleep 2" ocs_prerun3="mount 10.10.10.1:/home/partimg /home/partimag" ocs_prerun4="sleep 2" ocs_postrun="wget http://10.10.10.1/test.php" ocs_live_run="ocs-sr -g auto -e1 auto -e2 -batch -r -j2 -p reboot restoredisk 0025900bcd26-2014-10-02-1714-img sda" ocs_live_extra_param="" keyboard-layouts="NONE" ocs_live_batch="no" locales="en_US.UTF-8" vga=788 nosplash noprompt fetch=tftp://10.10.10.1/nbi_img/filesystem.squashfs
i am not sure how to further troubleshoot any ideas?
I have the same issue, however if I use the "-p true" option instead of "-p reboot" then the post run script is correctly executed.
Last edit: mms 2015-04-21
@mms,
Which version of Clonezilla live did you use?
Steven.
Did anybody find a solution for this?
I'm experiencing the same problem using clonezilla-live-20151012-wily-amd64.
If -p poweroff or -p reboot, the postrun commands are just skipped and it proceeds directly to shutdown or reboot (see attached screenshots). It happens for both restoredisk and savedisk.
The only difference between the two runs is:
ocs_live_run="ocs-sr --nogui -j2 -e2 -g auto -e1 auto -r -p true restoredisk current-img-dn1 sda" \
and
ocs_live_run="ocs-sr --nogui -j2 -e2 -g auto -e1 auto -r -p poweroff restoredisk current-img-dn1 sda" \
My hack/workaround is to use the -p true, but insert: ocs_postrun?="sudo shutdown 5" \ as the last postrun command. It works but it's not pretty.
Brian
Yes, this is true. Not perfect, but it works. This is because the option "-p" for ocs-sr will be run after ocs-sr is done, while ocs_postrun is after ocs-sr is finished. Therefore your solution now is the best one.
Steven.
Thanks for the answer.
I don't know if this could somehow be noted in the documentation (under ocs_postrun). It took me a while before I stumbled on to this thread and figured out the workaround.
Brian
Yes, a note was added on webpage:
http://clonezilla.org/fine-print-live-doc.php?path=./clonezilla-live/doc/99_Misc/00_live-boot-parameters.doc#00_live-boot-parameters.doc
Thanks.
Steven
-You can try it with an own script in /usr/local/sbin (look for the attachment).
-Have you ever tried anything with clonezilla 1-2-mdisk instead of kickstart ?
We run a system of disk cloning via PXE Boot using a serverTftpd32.
Some PC still run winXP, others Win8.1 or Win10.
Now I try to switch the system to use savedisk to safe images.
I use the the version clonezilla-live-2.7.1-15-i686.iso
The savedisk command works via PXE Boot, but I can't figure out why the postrun shell is not executed when savedisk is finished .
the postrun.sh should rename the clonezilla.log file according to the mac address of the PC and then send the file to the server.
the command line ocs_live_run="sudo /usr/sbin/ocs-sr -batch -q2 -c -j2 -z1p -i 4096 -sfsck -senc -p true savedisk autoname sda" works, but no postrun execution at all. See image in the attachment.
The isolinux.cfg contails the following:
default vesamenu.c32
timeout 10
prompt 0
noescape 1
label CloneZilla Live for XXX
MENU DEFAULT
MENU LABEL Custom CloneZilla by XXX
KERNEL /live/vmlinuz
APPEND initrd=/live/initrd.img vmalloc=448M boot=live union=overlay username=user config components quiet noswap edd=on nomodeset nodmraid noeject locales=de_DE.UTF-8 keyboard-layouts=none ocs_prerun1="sudo cp /lib/live/mount/medium/syslinux/postrun.sh ." ocs_prerun2="sudo chmod +x postrun.sh" ocs_prerun3="sudo mount -t ntfs-3g /dev/sdb1 /home/partimag" ocs_live_run="sudo /usr/sbin/ocs-sr -batch -q2 -c -j2 -z1p -i 4096 -sfsck -senc -p true savedisk autoname sda"
ocs_postrun1="sudo bash postrun.sh" ocs_postrun?="sudo shutdown 5"\ vga=788 ip=eth0:192.128.128.252:255.255.255.0:192.128.128.1:195.186.1.111 net.ifnames=0 nosplash i915.blacklist=yes radeonhd.blacklist=yes nouveau.blacklist=yes vmwgfx.enable_fbdev=1
The postrun file is in the attachment too.
Any suggestion how to solve this problem?
Lars
First, it's not necessary to run with "sudo" since all the ocs-related command will be run as root.
You put: ocs_postrun?="sudo shutdown 5" -> Why it's "?" not "2"?
BTW, please give the latest stable on a try, i.e., 2.7.1-22:
https://clonezilla.org/downloads.php
Steven
Thank you for your fast reply and tips.
I have modified the code according your message and tried with the latest stable.
Still no postrun execution.
Any other suggestion to get it work?
Lars
Did you put the following in ONE line?
What's the result if you run this command in the command line prompt after you boot Clonezilla live?
cat /proc/cmdline
Steven
After removing 2 hidden characters and slightly modify the APPEND command line it does the job via PXEBoot, executing the bash script and sending the log-file to the server and shuts down.
Thank you very much, Steven.
Lars
BTW, here the working isolinux.cfg:
default vesamenu.c32
timeout 10
prompt 0
noescape 1
label CloneZilla Live for XXX
MENU DEFAULT
MENU LABEL Custom CloneZilla by XXX
KERNEL /live/vmlinuz
APPEND initrd=/live/initrd.img vmalloc=448M boot=live union=overlay username=user config components quiet noswap edd=on nomodeset nodmraid noeject locales=de_DE.UTF-8 keyboard-layouts=none ocs_prerun1="cp /lib/live/mount/medium/syslinux/postrun.sh ." ocs_prerun2="chmod +x postrun.sh" ocs_prerun3="mount -t ntfs-3g /dev/sdb1 /home/partimag" ocs_live_run="/usr/sbin/ocs-sr -batch -q2 -c -j2 -z1p -i 4096 -sfsck -senc -p true savedisk autoname sda" ocs_postrun1="bash postrun.sh" ocs_postrun2="shutdown -h now" vga=788 ip=eth0:192.128.128.252:255.255.255.0:192.128.128.1:195.186.1.111 net.ifnames=0 nosplash i915.blacklist=yes radeonhd.blacklist=yes nouveau.blacklist=yes vmwgfx.enable_fbdev=1
Great. Thanks for sharing that.
Steven