nars Posted June 20, 2013 Author Share Posted June 20, 2013 +1 exactly why initially I suggested it as simple as possible. And again manually turning off safemode may even be useful in some cases. However WeeboTech: plugin for disabing safemode it's not viable, only to enable it, you see why... Anyway... I guess one way or the other any user should be able to easily turn it on/off manually... else user would not even be able to get unraid working, plugins, etc... Link to comment
RobJ Posted June 20, 2013 Share Posted June 20, 2013 The flag file can be made persistent by just flagging it ReadOnly (or whatever is appropriate in Linux). If Tom always does a simple file deletion of the flag file, nothing forced or even checked, then the simple creation of the file becomes a one-time safe mode boot, but if flagged R/O, then it becomes a persistent flag, forcing continual safe mode boots, until it's manually deleted (or flagged as deletable). Link to comment
RobJ Posted June 20, 2013 Share Posted June 20, 2013 I created a simple script to manage the default safe mode option, but it has largely been superseded by the coming flag file feature, which I only now discovered. I'll post it anyway here, just in case it's useful to anyone. It works by swapping syslinux.cfg files (renaming them), switching between your own one and an included copy of the stock syslinux.cfg that has been slightly modified to default to booting in safe mode. It's designed to be as low impact as possible. The attached safemode.zip contains 2 files, safemode and syslinux.cfg.safemode, which you unpack to your flash drive. 'safemode on' switches to the included syslinux.cfg file, which defaults to the safemode option on subsequent boots. 'safemode off' restores your own syslinux.cfg. 'safemode' by itself reports the current status. The flag file will clearly be more useful to most people, as it forces booting to safe mode on the next boot. This safemode script is different in that it does not force a safemode boot, it simply sets what the default option will be on subsequent boots, perhaps only a technical difference. For headless servers, there is no difference, but for monitored servers, you can still choose a normal boot from the menu, even though the default may be set to boot in safe mode. Since I'm not an expert bash programmer, I welcome any critiquing or improvements. It's not bullet-proof, but should be safe, and I've tested it fairly well. safemode.zip Link to comment
WeeboTech Posted June 20, 2013 Share Posted June 20, 2013 We've been guiding people for years with telnet & installpkg. We can guide them with updating syslinux.cfg. We can guide them with rm If the flash share is visible from the network, we can guide them with placing and removing the flag. I don't think readonly on a FAT drive will work if you are root. We might be over thinking this. Just as I did, nars had a nice simple approach. I really love the idea of the checkbox by the reboot option. When time permits. Link to comment
limetech Posted July 4, 2013 Share Posted July 4, 2013 I do have a few questions: 1) I use the 'enable_ahci' script in my 'go' file to ensure that one of my SATA interfaces is recognised. I presume (but haven't tried) that safe mode will fail to enable the interface and, therefore, some of my drives will be missing in safe mde. Is it possible to have this functionality added to the 'standard' release? The logic for 'unraidsafemode' has been changed a bit to accommodate this. Here is the code: # If "unraidsafemode" present on kernel command line, skip all add-ons if grep -wq unraidsafemode /proc/cmdline ; then echo "unRAID Safe Mode (unraidsafemode) has been set" else # Install any extra packages if [ -d /boot/extra ]; then ( cd /boot/extra ; find -maxdepth 1 -type f -exec installpkg {} \; ) fi # Install system plugins if [ -d /boot/plugins ]; then for Plugin in /boot/plugins/*.plg ; do /usr/local/sbin/installplg $Plugin | logger done fi # Install user plugins if [ -d /boot/config/plugins ]; then for Plugin in /boot/config/plugins/*.plg ; do /usr/local/sbin/installplg $Plugin | logger done fi fi # Invoke the 'go' script if [ -f /boot/config/go ]; then fromdos </boot/config/go >/var/tmp/go chmod +x /var/tmp/go /var/tmp/go fi The idea is that the 'go' script is still invoked in 'safe mode' where you might have added commands that are vital to the basic functioning of your server such as the 'enable_ahci' script or perhaps drivers you might need. You can always put a similar test for existence of 'unraidsafemode' flag on command line as above in your custom 'go' file. Link to comment
theone Posted July 4, 2013 Share Posted July 4, 2013 Tom, Didn't you add the option of safemode file option? test -f /boot/unraidsafemode Link to comment
nars Posted July 4, 2013 Author Share Posted July 4, 2013 and you forgot to delete 'go-safe' file then Edit: Unless it is there just for reference of a clean go file so that user may easily swap/rename it... in this case then I said nothing (I was thinking it would be called on safemode) Link to comment
Joe L. Posted July 4, 2013 Share Posted July 4, 2013 Looks like the flag file feature that was discussed was not implemented. ( Tom changed his mind ) By always running the config/go file it will make it more difficult for users to quickly test a stock only boot in safe-mode unless logic in the config/go files also checks for the boot parameter. I think it would have been better, if when in safe mode, that an alternate config/safe_go file would be invoked (if it exists) instead of the config/go file, or logic similar to this included in the supplied config/go file #!/bin/bash /usr/local/sbin/emhttp & if grep -wq unraidsafemode /proc/cmdline ; then # put critical extra commands here that must be invoked in safe mode echo "unRAID Safe Mode (unraidsafemode) has been set" else #put add-on commands to be invoked when not in safe mode here echo "unRAID Normal Mode" fi Then it can be a simple matter for users to run only what they want in "safe mode". Joe L. Link to comment
S80_UK Posted July 4, 2013 Share Posted July 4, 2013 ...or logic similar to this included in the supplied config/go file #!/bin/bash /usr/local/sbin/emhttp & if grep -wq unraidsafemode /proc/cmdline ; then # put critical extra commands here that must be invoked in safe mode echo "unRAID Safe Mode (unraidsafemode) has been set" else #put add-on commands to be invoked when not in safe mode here echo "unRAID Normal Mode" fi Then it can be a simple matter for users to run only what they want in "safe mode". Joe L. Very much my own thoughts, but I'm in the middle of a long preclear so could not try it, and I'm not savvy enough to post without. Link to comment
limetech Posted July 4, 2013 Share Posted July 4, 2013 Looks like the flag file feature that was discussed was not implemented. ( Tom changed his mind ) By always running the config/go file it will make it more difficult for users to quickly test a stock only boot in safe-mode unless logic in the config/go files also checks for the boot parameter. I think it would have been better, if when in safe mode, that an alternate config/safe_go file would be invoked (if it exists) instead of the config/go file, or logic similar to this included in the supplied config/go file #!/bin/bash /usr/local/sbin/emhttp & if grep -wq unraidsafemode /proc/cmdline ; then # put critical extra commands here that must be invoked in safe mode echo "unRAID Safe Mode (unraidsafemode) has been set" else #put add-on commands to be invoked when not in safe mode here echo "unRAID Normal Mode" fi Then it can be a simple matter for users to run only what they want in "safe mode". Joe L. I had that exact code in there except I called it go-safe Right, I re-thunk the whole concept and decided to not add more complexity. The idea of 'safe-mode', currently, is simply to prevent installation of packages and plugins. We can probably think of many more things it can or should do. The s/w is heading to a plugin architecture where any additional features of safe mode can be implemented as long as the basic hooks are there. Link to comment
ChrisPlak Posted January 12, 2014 Share Posted January 12, 2014 Maybe this has been resolved but 'm not finding it. In a headless setup, short of modifying syslinux.cfg, is there a way to boot in safe mode? Link to comment
Joe L. Posted January 12, 2014 Share Posted January 12, 2014 Maybe this has been resolved but 'm not finding it. In a headless setup, short of modifying syslinux.cfg, is there a way to boot in safe mode? in a headless setup, no Link to comment
WeeboTech Posted January 13, 2014 Share Posted January 13, 2014 Rename the /boot/extra directory so it is not found by the normal application path. Link to comment
Recommended Posts