We have moved at community.getvera.com

Author Topic: Vera extroot  (Read 5538 times)

Offline rafale77

  • Community Beta
  • Hero Member
  • ******
  • Posts: 1749
  • Karma: +101/-27
  • HA ≠ IoT as a blue sky is cloudless.
Re: Vera extroot
« Reply #15 on: September 01, 2018, 03:32:32 am »
My alternate solution:

Also works, of course, but does not preserve a number of other system logs stored higher up in /tmp across reboots.

Well this did not work. changing the fstab to have the sda1 mounted on /tmp makes it fail to boot.
openLuup (79 devices, 141 scenes, 19 apps) master to VeraPlus (142 zwave nodes, 8 Zigbee nodes, 221 devices,  20 scenes , 2 apps) +  Hubitat (15 Zigbee nodes) + Home-Assistant (API Integrations). Bridged to Siri and Alexa. Homewave. VeraPlus ExtRooted and mios server independent.

Offline rigpapa

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1121
  • Karma: +187/-3
Re: Vera extroot
« Reply #16 on: September 01, 2018, 10:43:07 am »
My alternate solution:

Also works, of course, but does not preserve a number of other system logs stored higher up in /tmp across reboots.

Well this did not work. changing the fstab to have the sda1 mounted on /tmp makes it fail to boot.

The OpenWrt startup scripts (in /etc/init.d and /etc/rc.d) expect that volume to be mounted, and that's usually done by preinit. The tmp filesystem is explicitly created and mounted by /lib/preinit/10essential_fs. Commenting out the tmpfs mount and adding an explicit mount of sda1 there may be sufficient.
Author of Reactor, DelayLight, SiteSensor, Rachio, Deus Ex Machina II, Intesis WMP Gateway, Auto Virtual Thermostat and VirtualSensor plugins. Vera Plus w/100+ Z-wave devices. Vera3, Lite. Hassio, Slapdash.

Offline rafale77

  • Community Beta
  • Hero Member
  • ******
  • Posts: 1749
  • Karma: +101/-27
  • HA ≠ IoT as a blue sky is cloudless.
Re: Vera extroot
« Reply #17 on: September 01, 2018, 11:59:32 am »
I've been digging and this file does not exist on my vera.

The only place where I see something similar is in /lib/functions/preinit.sh

Code: [Select]
pivot() { # <new_root> <old_root>
        /bin/mount -o noatime,move /proc $1/proc && \
        pivot_root $1 $1$2 && {
                /bin/mount -o noatime,move $2/dev /dev
                /bin/mount -o noatime,move $2/tmp /tmp
                /bin/mount -o noatime,move $2/sys /sys 2>&-
                /bin/mount -o noatime,move $2/overlay /overlay 2>&-
                return 0
        }
}

where something is mounted to the /tmp folder but it is a pivot root.
openLuup (79 devices, 141 scenes, 19 apps) master to VeraPlus (142 zwave nodes, 8 Zigbee nodes, 221 devices,  20 scenes , 2 apps) +  Hubitat (15 Zigbee nodes) + Home-Assistant (API Integrations). Bridged to Siri and Alexa. Homewave. VeraPlus ExtRooted and mios server independent.

Offline rigpapa

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1121
  • Karma: +187/-3
Re: Vera extroot
« Reply #18 on: September 01, 2018, 12:47:21 pm »
I've been digging and this file does not exist on my vera.

The only place where I see something similar is in /lib/functions/preinit.sh

Code: [Select]
pivot() { # <new_root> <old_root>
        /bin/mount -o noatime,move /proc $1/proc && \
        pivot_root $1 $1$2 && {
                /bin/mount -o noatime,move $2/dev /dev
                /bin/mount -o noatime,move $2/tmp /tmp
                /bin/mount -o noatime,move $2/sys /sys 2>&-
                /bin/mount -o noatime,move $2/overlay /overlay 2>&-
                return 0
        }
}

where something is mounted to the /tmp folder but it is a pivot root.

Interesting. So my previous rec was based on 1040 on a Vera3 (7.0.27, the latest).

On 3232 (7.0.23 on Plus), the tmpfs is created in the function ramoverlay() in /lib/functions/preinit.sh, and then is later "pivoted" to the root by a call to pivot() in that same file. My inclination would be to comment out the mount in ramoverlay() and put your sda1 mount there. This is preferable to changing the pivot() function's remount because that would leave the ramfs created by ramoverlay() unused and thus consuming memory that could be well-used elsewhere. Better still, rather than commenting out the tmpfs mount, make it the error condition if sda1 can't be mounted (e.g. /bin/mount -t ext4 -o mode=755 /dev/sda1 /tmp/root || /bin/mount -t tmpfs ...etc...).

On 963 (7.0.22 on Lite), the oldest of the firmware I have running, the 10_essential_fs file is again used. That's interesting. I would have expected that older firmware to be closer to 7.0.23 than 7.0.27.

7.0.22 (963) - kernel 2.6.37.1, OpenWrt 10.03 backfire release
7.0.23 (3232) - kernel unknown (identifies as MiOs 3.10.14), OpenWrt 14.something in the "barrier breaker" release path
7.0.27 (1040) - kernel 2.6.37.1, OpenWrt 10.03 backfire
Author of Reactor, DelayLight, SiteSensor, Rachio, Deus Ex Machina II, Intesis WMP Gateway, Auto Virtual Thermostat and VirtualSensor plugins. Vera Plus w/100+ Z-wave devices. Vera3, Lite. Hassio, Slapdash.

Offline rigpapa

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1121
  • Karma: +187/-3
Re: Vera extroot
« Reply #19 on: September 01, 2018, 01:41:10 pm »
On 3232 (7.0.23 on Plus), the tmpfs is created in the function ramoverlay() in /lib/functions/preinit.sh, and then is later "pivoted" to the root by a call to pivot() in that same file. My inclination would be to comment out the mount in ramoverlay() and put your sda1 mount there. This is preferable to changing the pivot() function's remount because that would leave the ramfs created by ramoverlay() unused and thus consuming memory that could be well-used elsewhere. Better still, rather than commenting out the tmpfs mount, make it the error condition if sda1 can't be mounted (e.g. /bin/mount -t ext4 -o mode=755 /dev/sda1 /tmp/root || /bin/mount -t tmpfs ...etc...).

No, wait. I'm off there, I think. That's part of failsafe. Need more research.

« Last Edit: September 01, 2018, 03:04:43 pm by rigpapa »
Author of Reactor, DelayLight, SiteSensor, Rachio, Deus Ex Machina II, Intesis WMP Gateway, Auto Virtual Thermostat and VirtualSensor plugins. Vera Plus w/100+ Z-wave devices. Vera3, Lite. Hassio, Slapdash.

Offline rigpapa

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1121
  • Karma: +187/-3
Re: Vera extroot
« Reply #20 on: September 01, 2018, 03:12:58 pm »
On 3232 (7.0.23 on Plus), the tmpfs is created in the function ramoverlay() in /lib/functions/preinit.sh, and then is later "pivoted" to the root by a call to pivot() in that same file. My inclination would be to comment out the mount in ramoverlay() and put your sda1 mount there. This is preferable to changing the pivot() function's remount because that would leave the ramfs created by ramoverlay() unused and thus consuming memory that could be well-used elsewhere. Better still, rather than commenting out the tmpfs mount, make it the error condition if sda1 can't be mounted (e.g. /bin/mount -t ext4 -o mode=755 /dev/sda1 /tmp/root || /bin/mount -t tmpfs ...etc...).

No, wait. I'm off there, I think. That's part of failsafe. Need more research.

Yeah, bummer. I see why this won't work, at least not easily. At the point where the tmpfs is created, it's running from the "rom" root (squashfs) directly. Attempting to edit the preinit files prior to the pivot/overlay doesn't modify the squashfs, it modifies the overlay, and that's not yet mounted/overlayed at that state of preinit. Wahhh wahh wahh wahh. There's harder way to get it done (cloning /tmp, force unmounting, remounting), but that won't really fly either, as every process with a file open on /tmp will break and it will certainly wreak havoc. So, I think despite its possible merits for preserving the other/non-LuaUpnp logs, it's a non-starter, at least for us on MiOS.
Author of Reactor, DelayLight, SiteSensor, Rachio, Deus Ex Machina II, Intesis WMP Gateway, Auto Virtual Thermostat and VirtualSensor plugins. Vera Plus w/100+ Z-wave devices. Vera3, Lite. Hassio, Slapdash.

Offline rigpapa

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1121
  • Karma: +187/-3
Re: Vera extroot
« Reply #21 on: September 01, 2018, 04:15:58 pm »
7.0.22 (963) - kernel 2.6.37.1, OpenWrt 10.03 backfire release
7.0.23 (3232) - kernel unknown (identifies as MiOs 3.10.14), OpenWrt 14.something in the "barrier breaker" release path
7.0.27 (1040) - kernel 2.6.37.1, OpenWrt 10.03 backfire

Another note on extroot in general: it appears to work fine on my Plus, which is OpenWrt "Breaker Barrier". I cannot get it work on either my Vera3 or Lite, which are "Backfire" (older release of OpenWrt). It just won't mount the volume during boot, at root or even just /mnt. I may spend more time pursuing this later, since I have the hardware, and the 3's and Lites really need the extra space. It seems Vera may have removed some necessary tools and scripts from the distribution.
Author of Reactor, DelayLight, SiteSensor, Rachio, Deus Ex Machina II, Intesis WMP Gateway, Auto Virtual Thermostat and VirtualSensor plugins. Vera Plus w/100+ Z-wave devices. Vera3, Lite. Hassio, Slapdash.

Offline rafale77

  • Community Beta
  • Hero Member
  • ******
  • Posts: 1749
  • Karma: +101/-27
  • HA ≠ IoT as a blue sky is cloudless.
Re: Vera extroot
« Reply #22 on: September 01, 2018, 04:34:53 pm »
7.0.22 (963) - kernel 2.6.37.1, OpenWrt 10.03 backfire release
7.0.23 (3232) - kernel unknown (identifies as MiOs 3.10.14), OpenWrt 14.something in the "barrier breaker" release path
7.0.27 (1040) - kernel 2.6.37.1, OpenWrt 10.03 backfire

Another note on extroot in general: it appears to work fine on my Plus, which is OpenWrt "Breaker Barrier". I cannot get it work on either my Vera3 or Lite, which are "Backfire" (older release of OpenWrt). It just won't mount the volume during boot, at root or even just /mnt. I may spend more time pursuing this later, since I have the hardware, and the 3's and Lites really need the extra space. It seems Vera may have removed some necessary tools and scripts from the distribution.

On Barrier Breaker I used brute force and pivoted the entire drive. I think on Backfire you would be better off only pivoting the overlay partition. When I looked at the openWRT documentation, it was the first method proposed. Basically in the the fstab, change the target to "/overlay" instead of "/" if I remember correctly.
openLuup (79 devices, 141 scenes, 19 apps) master to VeraPlus (142 zwave nodes, 8 Zigbee nodes, 221 devices,  20 scenes , 2 apps) +  Hubitat (15 Zigbee nodes) + Home-Assistant (API Integrations). Bridged to Siri and Alexa. Homewave. VeraPlus ExtRooted and mios server independent.

Offline rigpapa

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1121
  • Karma: +187/-3
Re: Vera extroot
« Reply #23 on: September 01, 2018, 05:05:27 pm »
7.0.22 (963) - kernel 2.6.37.1, OpenWrt 10.03 backfire release
7.0.23 (3232) - kernel unknown (identifies as MiOs 3.10.14), OpenWrt 14.something in the "barrier breaker" release path
7.0.27 (1040) - kernel 2.6.37.1, OpenWrt 10.03 backfire

Another note on extroot in general: it appears to work fine on my Plus, which is OpenWrt "Breaker Barrier". I cannot get it work on either my Vera3 or Lite, which are "Backfire" (older release of OpenWrt). It just won't mount the volume during boot, at root or even just /mnt. I may spend more time pursuing this later, since I have the hardware, and the 3's and Lites really need the extra space. It seems Vera may have removed some necessary tools and scripts from the distribution.

On Barrier Breaker I used brute force and pivoted the entire drive. I think on Backfire you would be better off only pivoting the overlay partition. When I looked at the openWRT documentation, it was the first method proposed. Basically in the the fstab, change the target to "/overlay" instead of "/" if I remember correctly.

Did that. Tried it both ways. The problem is more basic, at least at the first level. It refuses to mount the volume at boot. Volume is clean. I did as the OpenWrt wiki suggested and tried setting it to mount at /mnt, and it doesn't mount there either. I can immediately mount it manually, of course. The Wiki suggests reinstalling the block-extroot and block-mount packages, but that fails, because Vera has removed all of the sources other than their own from /etc/opkg.conf. The /etc/init.d/fstab script is also missing, also referenced by the Wiki. I've got other things I need to be looking at today, so I have to stop, but I'll try to repair these things tomorrow and see if I can get it going.
Author of Reactor, DelayLight, SiteSensor, Rachio, Deus Ex Machina II, Intesis WMP Gateway, Auto Virtual Thermostat and VirtualSensor plugins. Vera Plus w/100+ Z-wave devices. Vera3, Lite. Hassio, Slapdash.

Offline sebby

  • Sr. Member
  • ****
  • Posts: 306
  • Karma: +15/-3
Re: Vera extroot
« Reply #24 on: October 31, 2018, 07:47:06 am »
did you guys ever finalize this?  i have a spare 32GB SSD laying around and interested in potentially doing this to my plus.

Offline rafale77

  • Community Beta
  • Hero Member
  • ******
  • Posts: 1749
  • Karma: +101/-27
  • HA ≠ IoT as a blue sky is cloudless.
Re: Vera extroot
« Reply #25 on: October 31, 2018, 08:56:20 am »
It works fine on the plus with the more recent firmwares(at least 7.0.25). I have further tweaked the script and can post an update in a couple of days. I tried it on the edge which has some severe bad sectors and couldn't make it work. Even though it uses the same build of OpenWrt, the package set seems to be even older than the plus.
« Last Edit: November 03, 2018, 12:02:49 pm by rafale77 »
openLuup (79 devices, 141 scenes, 19 apps) master to VeraPlus (142 zwave nodes, 8 Zigbee nodes, 221 devices,  20 scenes , 2 apps) +  Hubitat (15 Zigbee nodes) + Home-Assistant (API Integrations). Bridged to Siri and Alexa. Homewave. VeraPlus ExtRooted and mios server independent.

Offline Catman

  • Sr. Member
  • ****
  • Posts: 338
  • Karma: +10/-0
Re: Vera extroot
« Reply #26 on: January 04, 2019, 03:57:32 pm »
It works fine on the plus with the more recent firmwares(at least 7.0.25). I have further tweaked the script and can post an update in a couple of days. I tried it on the edge which has some severe bad sectors and couldn't make it work. Even though it uses the same build of OpenWrt, the package set seems to be even older than the plus.

Very tempted to try this!

C

Offline rafale77

  • Community Beta
  • Hero Member
  • ******
  • Posts: 1749
  • Karma: +101/-27
  • HA ≠ IoT as a blue sky is cloudless.
Re: Vera extroot
« Reply #27 on: January 04, 2019, 04:32:27 pm »
Here you go. I basically added installation of nano and deleted not needed mount points.
If you want to access the rootfs on the vera drive run
Code: [Select]
block mount
and it will be in /mnt/mtdblock7/

I now use the vera internal NAND drive as.a backup... 😝 by running a script to write my user-data.json and dongle dump back on the vera flash memory while the vera is running off of the SSD.
« Last Edit: January 22, 2019, 10:06:49 pm by rafale77 »
openLuup (79 devices, 141 scenes, 19 apps) master to VeraPlus (142 zwave nodes, 8 Zigbee nodes, 221 devices,  20 scenes , 2 apps) +  Hubitat (15 Zigbee nodes) + Home-Assistant (API Integrations). Bridged to Siri and Alexa. Homewave. VeraPlus ExtRooted and mios server independent.

Offline rafale77

  • Community Beta
  • Hero Member
  • ******
  • Posts: 1749
  • Karma: +101/-27
  • HA ≠ IoT as a blue sky is cloudless.
Re: Vera extroot
« Reply #28 on: January 14, 2019, 05:33:02 pm »
For those for whom this did not work, I have discovered a situation for which the mounting of the external partition for logs took a little too long and therefore prevented the vera from pivoting to the external drive.
To address this problem I used the trick of mounting the rootfs partition first to be sure that it is ready for the kernel pivot and then it can take its time to load the log partition which is needed only later. I changed the script slightly to do that.

Maybe those for whom it has failed to pivot before can try this. It has worked for me.
« Last Edit: January 22, 2019, 10:06:59 pm by rafale77 »
openLuup (79 devices, 141 scenes, 19 apps) master to VeraPlus (142 zwave nodes, 8 Zigbee nodes, 221 devices,  20 scenes , 2 apps) +  Hubitat (15 Zigbee nodes) + Home-Assistant (API Integrations). Bridged to Siri and Alexa. Homewave. VeraPlus ExtRooted and mios server independent.

Offline Warnerkew

  • Newbie
  • *
  • Posts: 5
  • Karma: +0/-0
Vera extroot
« Reply #29 on: January 17, 2019, 06:16:50 am »
Hi there

I have had Vera email alerts on various devices which have been working well for the last couple of years. Lately they have been very delayed ie by hours and sometimes even doubling up.

Any suggestions?