Brendon Costa
2016-Oct-07 04:24 UTC
[syslinux] Alternating boot default entry every reboot
Hi, I am currently using isolinux (syslinux-6.03) in a clonezilla setup. It boots fine, however I want to have a setup where the default boot selection alternates every boot. * First boot : Default is menu item 0 * Second boot : Default is menu item 1 * Third boot : Default is menu item 0 ... The idea is that when it is booted into clonezilla the clonezilla script checks if the system needs to be restored by mounting NFS and checking for existence of a file. After clonezilla has restored it will reboot and then the isolinux will boot the native file system (Windows, OSX or Linux). Once the native OS has restarted, then isolinux will again boot clonezilla and the cycle continues every time you reboot. I have this clonezilla + isolinux installed on a bootable USB. I know this is possible with GRUB: http://unix.stackexchange.com/a/110539 however from what I understand GRUB will not work correctly from the bootable USB on all hardware, which is why we use isolinux. 1) Is there any way I can achieve this currently in isolinux that I did not see looking at the docs? 2) If not, is this possible (obviously not possible for read-only CD, but bootable USB I imagine yes) and would a patch be welcome to support such a feature? Thanks, Brendon.
Not sure iso/syslinux directly has a way to do this, but I did find a way to have a system act like you're saying. I don't want it to automatically alternate, I want to have a command to run that will change the default. (Remote system.) ====#!/bin/bash sudo bash -c "sed -i '0,/^DEFAULT .*$/{s/^DEFAULT .*/DEFAULT terra-snapper/}' /boot/syslinux/syslinux.cfg" sudo systemctl reboot ==== (Note that's 3 lines, the second line wraps to two lines in this email.) If clonezilla (not even sure what that is) uses systemd, it would be easy to modify this into a systemd .service file which would auto-run after boot. You wouldn't need sudo anymore, and you wouldn't want the reboot command or it would auto reboot during the boot process. On Fri, Oct 7, 2016 at 12:24 AM, Brendon Costa via Syslinux <syslinux at zytor.com> wrote:> Hi, > > I am currently using isolinux (syslinux-6.03) in a clonezilla setup. It > boots fine, however I want to have a setup where the default boot selection > alternates every boot. > > * First boot : Default is menu item 0 > * Second boot : Default is menu item 1 > * Third boot : Default is menu item 0 > ... > > The idea is that when it is booted into clonezilla the clonezilla script > checks if the system needs to be restored by mounting NFS and checking for > existence of a file. After clonezilla has restored it will reboot and then > the isolinux will boot the native file system (Windows, OSX or Linux). Once > the native OS has restarted, then isolinux will again boot clonezilla and > the cycle continues every time you reboot. > > I have this clonezilla + isolinux installed on a bootable USB. > > I know this is possible with GRUB: > http://unix.stackexchange.com/a/110539 > > however from what I understand GRUB will not work correctly from the > bootable USB on all hardware, which is why we use isolinux. > > 1) Is there any way I can achieve this currently in isolinux that I did not > see looking at the docs? > > 2) If not, is this possible (obviously not possible for read-only CD, but > bootable USB I imagine yes) and would a patch be welcome to support such a > feature? > > > Thanks, > Brendon. > _______________________________________________ > Syslinux mailing list > Submissions to Syslinux at zytor.com > Unsubscribe or set options at: > http://www.zytor.com/mailman/listinfo/syslinux
Brendon Costa
2016-Oct-07 04:54 UTC
[syslinux] Alternating boot default entry every reboot
On 7 October 2016 at 15:41, james harvey <jamespharvey20 at gmail.com> wrote:> y this into a systemd .service file which would auto-run > after boot. You wouldn't need sudo anymore, and you wouldn't want the > reboot command or it would auto reboot during the boot >Thanks for the quick reply! My understanding of that script above is that it will edit the cfg file permanently until modified a second time. Unfortunately this wont work for me. It will work when I boot into clonezilla which uses Linux as it can modify the script, but when the second menu entry boots it will boot windows which cant easily make this change :-( which is why i need syslinux to make the change for me. The other option I am looking into right now is using syslinux to always chainboot to grub on the USB and see if that will work.
Michael D. Setzer II
2016-Oct-07 06:34 UTC
[syslinux] Alternating boot default entry every reboot
On 7 Oct 2016 at 15:24, Brendon Costa via Syslinux wrote: Date sent: Fri, 7 Oct 2016 15:24:08 +1100 To: syslinux at zytor.com Subject: [syslinux] Alternating boot default entry every reboot From: Brendon Costa via Syslinux <syslinux at zytor.com> Send reply to: Brendon Costa <brendon.j.costa at gmail.com>> Hi, > > I am currently using isolinux (syslinux-6.03) in a clonezilla setup. It > boots fine, however I want to have a setup where the default boot selection > alternates every boot. > > * First boot : Default is menu item 0 > * Second boot : Default is menu item 1 > * Third boot : Default is menu item 0 > ... > > The idea is that when it is booted into clonezilla the clonezilla script > checks if the system needs to be restored by mounting NFS and checking for > existence of a file. After clonezilla has restored it will reboot and then > the isolinux will boot the native file system (Windows, OSX or Linux). Once > the native OS has restarted, then isolinux will again boot clonezilla and > the cycle continues every time you reboot. > > I have this clonezilla + isolinux installed on a bootable USB.Don't fully understand the reason behind the process here? So you always want it to boot from the usb, and the one option reimages the machine, and the other has it then boot from the hard disk? Any OS should be able to reset the boot flag for the USB. Wondering if just changing the boot flag on the usb might be able to do it. If the usb is bootable it loads the usb and runs the reimage, it not, it would go on to next boot option, which would be hard disk? Years ago, had two labs in which we did something similar. We put image file on a 2nd partition, and machine would boot in morning via WOL, and would detect if it was first boot of day, and if so reimage the 1st partition, and then boot normally thruout the day. (Long ago with DOS and Ghost before Symantec bought it). In my current classroom, I store image files on partition 8, and have an option on the grub menu to allow for reimaging the windows partition on machine, thou Linux is the default boot OS. Also, have linux patition images, but didn't add option to allow for auto reimage of linux partitions. I've maintained the G4L project since 2004, and it uses syslinux for the cd boot, but I've also used it directly from grub menu, and via grub4dos on windows systems. So, lots of options. I like having the images on the disk, since it cuts down network traffic. In classroom, create new images and then use udpcast to broadcast to all other machines one time, and then any imaging is local. Do note that booting for USB does have issues on machines, same usb works great on many machines, but others either don't have the boot from USB option, or don't work with some setups. Hopefully, something works. Note: With grub2 booting from harddisk, it includes an option to just change the next boot, so I can set next boot for windows, but then the restart puts it back to the original default boot of linux. Good Luck.> > I know this is possible with GRUB: > http://unix.stackexchange.com/a/110539 > > however from what I understand GRUB will not work correctly from the > bootable USB on all hardware, which is why we use isolinux. > > 1) Is there any way I can achieve this currently in isolinux that I did not > see looking at the docs? > > 2) If not, is this possible (obviously not possible for read-only CD, but > bootable USB I imagine yes) and would a patch be welcome to support such a > feature? > > > Thanks, > Brendon. > _______________________________________________ > Syslinux mailing list > Submissions to Syslinux at zytor.com > Unsubscribe or set options at: > http://www.zytor.com/mailman/listinfo/syslinux+----------------------------------------------------------+ Michael D. Setzer II - Computer Science Instructor Guam Community College Computer Center mailto:mikes at kuentos.guam.net mailto:msetzerii at gmail.com Guam - Where America's Day Begins G4L Disk Imaging Project maintainer http://sourceforge.net/projects/g4l/ +----------------------------------------------------------+ http://setiathome.berkeley.edu (Original) Number of Seti Units Returned: 19,471 Processing time: 32 years, 290 days, 12 hours, 58 minutes (Total Hours: 287,489) BOINC at HOME CREDITS ABC 16613838.513356 | EINSTEIN 115111861.288695 ROSETTA 49762810.869403 | SETI 93224796.947871
> Hi, > > I am currently using isolinux (syslinux-6.03) in a clonezilla setup. It > boots fine, however I want to have a setup where the default boot selection > alternates every boot. > > * First boot : Default is menu item 0 > * Second boot : Default is menu item 1 > * Third boot : Default is menu item 0 > ... > > The idea is that when it is booted into clonezilla the clonezilla script > checks if the system needs to be restored by mounting NFS and checking for > existence of a file. After clonezilla has restored it will reboot and then > the isolinux will boot the native file system (Windows, OSX or Linux). Once > the native OS has restarted, then isolinux will again boot clonezilla and > the cycle continues every time you reboot. > > I have this clonezilla + isolinux installed on a bootable USB. > > I know this is possible with GRUB: > http://unix.stackexchange.com/a/110539 > > however from what I understand GRUB will not work correctly from the > bootable USB on all hardware, which is why we use isolinux. > > 1) Is there any way I can achieve this currently in isolinux that I did not > see looking at the docs? > > 2) If not, is this possible (obviously not possible for read-only CD, but > bootable USB I imagine yes) and would a patch be welcome to support such a > feature? > > > Thanks, > Brendon.I guess that when you want to boot "normal" OS, you are selecting some "localboot" (or equivalent) option. It is not completely clear (to me) whether we are talking about multiple systems and/or remote locations, or instead we are talking about a single system and/or with physical access and/or one location. In the simpler "personal" cases, changing the BIOS' boot priority to boot first the USB (if present) and then the HDD might be suitable. This method might not be adequate / recommended in some cases, for several reasons. There is (at least) one potential possibility so as to get the desired behavior, by using "--once" with the extlinux command on the USB's syslinux.cfg. The "normal" default LABEL would be to boot Clonezilla on the USB. Before shutdown (from Clonezilla), a (scripted) command would execute the extlinux command with "--once", changing the next boot (and only this one boot) of the USB to the alternative "localboot" LABEL. Leaving the USB connected to the same system, the next boot of the USB would actually end up choosing the "localboot" LABEL. The "normal" DEFAULT in syslinux.cfg would remain as it was before, so the next reboot from the USB would be "back" to normal. There could be other alternatives, such as using the special keys while booting Syslinux, so as to select an alternative LABEL. Please be aware that at least some of these options might not be available in 6.03, unless relevant patches are applied. 6.04-pre1 is available for tests. Regards, Ady. PS: Please avoid top-posting.> _______________________________________________ > Syslinux mailing list > Submissions to Syslinux at zytor.com > Unsubscribe or set options at: > http://www.zytor.com/mailman/listinfo/syslinux