Version Control seems not to be working

Moderator: BarryK

Post Reply
TerryH
Posts: 637
Joined: Mon Jun 15, 2020 2:08 am
Has thanked: 158 times
Been thanked: 160 times

Version Control seems not to be working

Post by TerryH »

Following on from this thread regarding freeing up USB space, viewtopic.php?p=102952#p102952. In my case it's not about freeing space on a USB drive, but about using Easy Version Control to remove prior versions from my internal NVME drive.

A couple of months ago I moved several of my goto installs to a partition on my internal drive. I still use a USB flash drive to boot. When Easy 5.5 was released I started with a new frugal install. Yesterday I decided to remove some of the earlier 5.5.x releases using Easy Version control. I had 5 releases in the directory. I first changed Depth to 3, cancelled out of EVC and rebooted. On reboot no messages displayed, 5 release directories still exist. Following several more attempts with Depth of 4,3 or 2, no early releases were removed. I don't want to try with depth of 1, as I want to keep at least 1 level.

I have manually deleted the early release directories and corresponding sfs versions. I will be able to retest following the next release. I also no longer have any prior Easy (5.4 or earlier) releases on my drive as I deleted the prior EasyOS directory.

Edit: I had previously used Easy Version Control successfully on USB drives

Last edited by TerryH on Fri Nov 10, 2023 11:03 pm, edited 1 time in total.

New Laptop - ASUS ZenBook Ryzen 7 5800H Vega 7 iGPU / 16 GB RAM

Caramel
Posts: 476
Joined: Sun Oct 02, 2022 6:25 pm
Location: France
Has thanked: 100 times
Been thanked: 78 times

Re: Versionot Control seems not to be working

Post by Caramel »

(Easy 5.5.5)

In /usr/local/easy_version/easy-version-control the variable DEPTH_MAX that stores the choice of depth is not initialized at the launch of the program.
It's the value of this variable that is written in /var/local/version-history-depth when Easy Version Control is closed.

So if you open Easy Version Control and close it without having recording a depth (via the Rollback button (in French, bouton Restaurer)), the file version-history-depth becomes empty

To avoid this problem, you can add the line (line 104 of /usr/local/easy_version/easy-version-control)

Code: Select all

DEPTH_MAX=$DEPTH_DEF
butiliero
Posts: 13
Joined: Thu Jun 29, 2023 11:12 am

Re: Versionot Control seems not to be working

Post by butiliero »

Thanks Caramel. I tried your suggestion and it may work but I manually deleted all previous snapshots except 5.5.4. I have max depth set to 2, so couldn't directly test it. Tried to manually create a new snapshot, but upon reboot I still have the attached situation: 2 snapshots of 5.5.5 and 1 snapshot of 5.5.4. Maybe max depth only considers EASYOS version changes, that is I could take 10 snapshots of the same version and they will all be still there.

Maybe the simplest solution would be to add an "erase" button in the "rollback" section of easy-version-control that would erase the ticked snapshot (upon a warning + ok/cancel message).

Ironically, at first I thought this to be a windows-like feature :lol:

Attachments
easy-version-contorl.jpg
easy-version-contorl.jpg (131.11 KiB) Viewed 929 times
TerryH
Posts: 637
Joined: Mon Jun 15, 2020 2:08 am
Has thanked: 158 times
Been thanked: 160 times

Re: Versionot Control seems not to be working

Post by TerryH »

Caramel wrote: Fri Nov 10, 2023 7:39 am

(Easy 5.5.5)

In /usr/local/easy_version/easy-version-control the variable DEPTH_MAX that stores the choice of depth is not initialized at the launch of the program.
It's the value of this variable that is written in /var/local/version-history-depth when Easy Version Control is closed.

So if you open Easy Version Control and close it without having recording a depth (via the Rollback button (in French, bouton Restaurer)), the file version-history-depth becomes empty

To avoid this problem, you can add the line (line 104 of /usr/local/easy_version/easy-version-control)

Code: Select all

DEPTH_MAX=$DEPTH_DEF

This is not the problem I am having. In my situation I am only attempting to use the Version Control to remove older versions and the value of /var/local/version-history-depth is being set correctly:

Code: Select all

# cat /var/local/version-history-depth 
2 
#

The problem is it is some how being ignored on booting. I've looked at the code in the init section for version control regarding limit on history, nothing jumps out to me as being the cause.

New Laptop - ASUS ZenBook Ryzen 7 5800H Vega 7 iGPU / 16 GB RAM

Caramel
Posts: 476
Joined: Sun Oct 02, 2022 6:25 pm
Location: France
Has thanked: 100 times
Been thanked: 78 times

Re: Versionot Control seems not to be working

Post by Caramel »

butiliero wrote: Fri Nov 10, 2023 8:38 am

Maybe max depth only considers EASYOS version changes, that is I could take 10 snapshots of the same version and they will all be still there.

Yes, the depth refers to the easyos versions.

TerryH wrote: Fri Nov 10, 2023 4:08 pm

This is not the problem I am having. In my situation I am only attempting to use the Version Control to remove older versions and the value of /var/local/version-history-depth is being set correctly:

Code: Select all

# cat /var/local/version-history-depth 
2 
#

The problem is it is some how being ignored on booting. I've looked at the code in the init section for version control regarding limit on history, nothing jumps out to me as being the cause.

I have created fake release folder and easy sfs to test. And effectively they are not deleted at reboot. I will make others test.

Caramel
Posts: 476
Joined: Sun Oct 02, 2022 6:25 pm
Location: France
Has thanked: 100 times
Been thanked: 78 times

Re: Versionot Control seems not to be working

Post by Caramel »

Lines 1488 to 1517 of the init script (EasyOs 5.5.5) :

Code: Select all

 #170816 there is a limit on history...
 if [ -s /mnt/${WKG_DEV}/${WKG_DIR}.session/var/local/version-history-depth ];then
  DEPTH_MAX="$(cat /mnt/${WKG_DEV}/${WKG_DIR}.session/var/local/version-history-depth)"
  VERS="$(ls -l -d /mnt/${WKG_DEV}/${WKG_DIR}releases/easy-* | rev | cut -f 1 -d '-' | rev)" #181218 fix.
  sortedVERS="$(echo "$VERS" | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n)" #lowest to highest.
  for ADEL in `echo "$sortedVERS" | head -n -${DEPTH_MAX} | tr '\n' ' '`
  do
   if [ -d /mnt/${WKG_DEV}/${WKG_DIR}releases/easy-${ADEL} ];then
    MSGdel="${S173}"
    echo -e "  \\033[1;31m${MSGdel} easy-${ADEL}\\033[0;39m" #red
    #181205 remove sfs files symlinked to sfs folder...
    #20230231 however, not if sfs in use in a container...
    realpath /mnt/${WKG_DEV}/${WKG_DIR}containers/*/*.sfs 2>/dev/null >/sfss-in-use
    for aSL in `realpath /mnt/${WKG_DEV}/${WKG_DIR}releases/easy-${ADEL}/*.sfs | tr '\n' ' '`
    do
     if [ -s /sfss-in-use ];then #20230131
      echo -n "$aSL" >/sfs-want-del
      grep -qFx -f /sfss-in-use /sfs-want-del
      if [ $? -eq 0 ];then
       continue
      fi
     fi
     aMAIN="${aSL/.sfs/}"
     rm -f ${aSL}
     [ -f ${aMAIN}.specs ] && rm -f ${aMAIN}.specs
    done
    rm -rf /mnt/${WKG_DEV}/${WKG_DIR}releases/easy-${ADEL}
   fi
  done
 fi

I tested the script :

Code: Select all

 #!/bin/sh
 WKG_DEV=sda2
 WKG_DIR=easyos/
 echo /mnt/${WKG_DEV}/${WKG_DIR}.session/var/local/version-history-depth
 if [ -s /mnt/${WKG_DEV}/${WKG_DIR}.session/var/local/version-history-depth ];then
  DEPTH_MAX="$(cat /mnt/${WKG_DEV}/${WKG_DIR}.session/var/local/version-history-depth)"
  echo $DEEPTH_MAX
  VERS="$(ls -l -d /mnt/${WKG_DEV}/${WKG_DIR}releases/easy-* | rev | cut -f 1 -d '-' | rev)" #181218 fix.
  echo $VERS
  sortedVERS="$(echo "$VERS" | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n)" #lowest to highest.
  echo $sortedVERS
  for ADEL in `echo "$sortedVERS" | head -n -${DEPTH_MAX} | tr '\n' ' '`
  do
   echo $ADEL
   if [ -d /mnt/${WKG_DEV}/${WKG_DIR}releases/easy-${ADEL} ];then
    #MSGdel="${S173}"
    #echo -e "  \\033[1;31m${MSGdel} easy-${ADEL}\\033[0;39m" #red
    #181205 remove sfs files symlinked to sfs folder...
    #20230231 however, not if sfs in use in a container...
    realpath /mnt/${WKG_DEV}/${WKG_DIR}containers/*/*.sfs 2>/dev/null >/sfss-in-use
    for aSL in `realpath /mnt/${WKG_DEV}/${WKG_DIR}releases/easy-${ADEL}/*.sfs | tr '\n' ' '`
    do
     if [ -s /sfss-in-use ];then #20230131
      echo -n "$aSL" >/sfs-want-del
      grep -qFx -f /sfss-in-use /sfs-want-del
      if [ $? -eq 0 ];then
       continue
      fi
     fi
     echo $aSL
     aMAIN="${aSL/.sfs/}"
     echo $aMAIN
     rm -f ${aSL}
     [ -f ${aMAIN}.specs ] && rm -f ${aMAIN}.specs
    done
    rm -rf /mnt/${WKG_DEV}/${WKG_DIR}releases/easy-${ADEL}
   fi
  done
 fi

in /root and made executable. (Here WKG_DEV=sda2 / WKG_DIR=easyos/)

There is a problem with the line :

for aSL in `realpath /mnt/${WKG_DEV}/${WKG_DIR}releases/easy-${ADEL}/*.sfs | tr '\n' ' '`

In my test aSL=/mnt/sda2/easyos/releases/easy-5.5.0/*.sfs

EDIT :

Code: Select all

for aSL in $(realpath /mnt/${WKG_DEV}/${WKG_DIR}releases/easy-${ADEL}/*.sfs | tr '\n' ' ')

instead of

for aSL in `realpath /mnt/${WKG_DEV}/${WKG_DIR}releases/easy-${ADEL}/*.sfs | tr '\n' ' '`

seems to work

TerryH
Posts: 637
Joined: Mon Jun 15, 2020 2:08 am
Has thanked: 158 times
Been thanked: 160 times

Re: Versionot Control seems not to be working

Post by TerryH »

Caramel wrote: Fri Nov 10, 2023 6:56 pm

.
.
.

There is a problem with the line :

for aSL in `realpath /mnt/${WKG_DEV}/${WKG_DIR}releases/easy-${ADEL}/*.sfs | tr '\n' ' '`

In my test aSL=/mnt/sda2/easyos/releases/easy-5.5.0/*.sfs

EDIT :

Code: Select all

for aSL in $(realpath /mnt/${WKG_DEV}/${WKG_DIR}releases/easy-${ADEL}/*.sfs | tr '\n' ' ')

instead of

for aSL in `realpath /mnt/${WKG_DEV}/${WKG_DIR}releases/easy-${ADEL}/*.sfs | tr '\n' ' '`

seems to work

Thanks for looking into this. To test I expanded the initrd and changed the line of code as above. I created a dummy third release and sfs components for 5.5.3. I recompressed the initrd, checked that the depth was still 2. On reboot the additional 3rd release was still present. So, I still have an issue with deleting old versions.

New Laptop - ASUS ZenBook Ryzen 7 5800H Vega 7 iGPU / 16 GB RAM

Caramel
Posts: 476
Joined: Sun Oct 02, 2022 6:25 pm
Location: France
Has thanked: 100 times
Been thanked: 78 times

Re: Versionot Control seems not to be working

Post by Caramel »

TerryH wrote: Fri Nov 10, 2023 7:52 pm

To test I expanded the initrd and changed the line of code as above. I created a dummy third release and sfs components for 5.5.3. I recompressed the initrd, checked that the depth was still 2. On reboot the additional 3rd release was still present. So, I still have an issue with deleting old versions.

Have you made a symbolic link to the easy*sfs in the release folder? It's necessary for deleting the easy*.sfs

You could also test my script (with the modified line) by adapting WKG_DEV and WKG_DIR .

It's the same code as in the init script with several echo command.

TerryH
Posts: 637
Joined: Mon Jun 15, 2020 2:08 am
Has thanked: 158 times
Been thanked: 160 times

Re: Versionot Control seems not to be working

Post by TerryH »

Caramel wrote: Fri Nov 10, 2023 7:56 pm
TerryH wrote: Fri Nov 10, 2023 7:52 pm

To test I expanded the initrd and changed the line of code as above. I created a dummy third release and sfs components for 5.5.3. I recompressed the initrd, checked that the depth was still 2. On reboot the additional 3rd release was still present. So, I still have an issue with deleting old versions.

Have you made a symbolic link to the easy*sfs in the release folder? It's necessary for deleting the easy*.sfs

You could also test my script (with the modified line) by adapting WKG_DEV and WKG_DIR .

It's the same code as in the init script with several echo command.

OK, I changed the parameters to match my installation and ran your script. This worked correctly, older version was deleted as expected. Thank you.

New Laptop - ASUS ZenBook Ryzen 7 5800H Vega 7 iGPU / 16 GB RAM

User avatar
BarryK
Posts: 2692
Joined: Tue Dec 24, 2019 1:04 pm
Has thanked: 132 times
Been thanked: 738 times

Re: Version Control seems not to be working

Post by BarryK »

Thanks for the analysis guys.

I tested changing the back-ticks to $(...) but it made no difference.

However, I did something else, see blog post:

https://bkhome.org/news/202311/fix-for- ... ction.html

TerryH
Posts: 637
Joined: Mon Jun 15, 2020 2:08 am
Has thanked: 158 times
Been thanked: 160 times

Re: Version Control seems not to be working

Post by TerryH »

BarryK wrote: Sat Nov 11, 2023 10:02 am

Thanks for the analysis guys.

I tested changing the back-ticks to $(...) but it made no difference.

However, I did something else, see blog post:

https://bkhome.org/news/202311/fix-for- ... ction.html

I currently have 4 release levels, including a manually created version for 5.5.3 containing a valid symlink to the easy_5.5.3_amd64.sfs. I set the depth to 3. I still have 4 levels on booting. The code @Caramel posted worked for me in deleting old versions.

New Laptop - ASUS ZenBook Ryzen 7 5800H Vega 7 iGPU / 16 GB RAM

User avatar
BarryK
Posts: 2692
Joined: Tue Dec 24, 2019 1:04 pm
Has thanked: 132 times
Been thanked: 738 times

Re: Version Control seems not to be working

Post by BarryK »

I have just done an update on my Lenovo PC, 5.6.1 to 5.6.2, and the old 5.5.3 release got deleted, that is /mnt/wkg/releases/easy-5.5.3 folder, as well as easy_5.5.3_amd64.sfs and devx_5.5.3_amd64.sfs in the /mnt/wkg/sfs/easyos/oe/kirkstone folder.
So it is working for me.

TerryH
Posts: 637
Joined: Mon Jun 15, 2020 2:08 am
Has thanked: 158 times
Been thanked: 160 times

Re: Version Control seems not to be working

Post by TerryH »

BarryK wrote: Sun Nov 12, 2023 12:53 am

I have just done an update on my Lenovo PC, 5.6.1 to 5.6.2, and the old 5.5.3 release got deleted, that is /mnt/wkg/releases/easy-5.5.3 folder, as well as easy_5.5.3_amd64.sfs and devx_5.5.3_amd64.sfs in the /mnt/wkg/sfs/easyos/oe/kirkstone folder.
So it is working for me.

Thanks for looking into this. I have the script caramel wrote, or resort to deleting manually when I feel I no longer want to keep a version. So, there are options.

New Laptop - ASUS ZenBook Ryzen 7 5800H Vega 7 iGPU / 16 GB RAM

User avatar
BarryK
Posts: 2692
Joined: Tue Dec 24, 2019 1:04 pm
Has thanked: 132 times
Been thanked: 738 times

Re: Version Control seems not to be working

Post by BarryK »

I have feedback email from Alfons, that version control is working. He updated to 5.6.2 and the old easy-* folders and easy/devx sfs's got deleted.

butiliero
Posts: 13
Joined: Thu Jun 29, 2023 11:12 am

Re: Version Control seems not to be working

Post by butiliero »

I can confirm that it works for me as well. After updating from 5.5.5 to 5.6.1, and having the "depth" parameter set to 2 in Easy Version Control, upon reboot the 5.5.4 snapshot has gone. I still have 2 fake snapshots of 5.5.5 hanging there. They will either go with the next update or removed manually by deleting their folders. Would be nice to being able to remove them from within Easy Version Control, but it's no showstopper. Works well enough now.

Post Reply

Return to “EasyOS”