FOG 1.5.6: Auto resize is unpredictable
-
This is really good information. I suppose it could be useful especially with the speed of NVMe usurping so many other disk access things, maybe udev is the issue the whole time in regards to “sporadic access” and usability?
Thank you all for the debugging and communication.
-
Two 4 stations multicasts. No resize problems. Below diff is only change. I think this one is done!
diff -u /mnt/init-orig/usr/share/fog/lib/partition-funcs.sh /mnt/init/usr/share/fog/lib/partition-funcs.sh --- /mnt/init-orig/usr/share/fog/lib/partition-funcs.sh 2019-05-04 17:58:07.000000000 -0400 +++ /mnt/init/usr/share/fog/lib/partition-funcs.sh 2019-07-12 10:26:47.000000000 -0400 @@ -73,7 +73,7 @@ local file="$2" [[ -z $disk ]] && handleError "No disk passed (${FUNCNAME[0]})\n Args Passed: $*" [[ -z $file ]] && handleError "No file to receive from passed (${FUNCNAME[0]})\n Args Passed: $*" - sfdisk $disk < $file >/dev/null 2>&1 + flock $disk sfdisk $disk < $file >/dev/null 2>&1 [[ ! $? -eq 0 ]] && majorDebugEcho "sfdisk failed in (${FUNCNAME[0]})" } # $1 is the name of the disk drive
-
Found a couple more sfdisk that might need protecting…
[root@fog ipxe]# diff -ur /mnt/init-orig/usr/share/fog/lib /mnt/init/usr/share/fog/lib diff -ur /mnt/init-orig/usr/share/fog/lib/funcs.sh /mnt/init/usr/share/fog/lib/funcs.sh --- /mnt/init-orig/usr/share/fog/lib/funcs.sh 2019-05-04 17:58:07.000000000 -0400 +++ /mnt/init/usr/share/fog/lib/funcs.sh 2019-07-12 12:57:23.000000000 -0400 @@ -1977,7 +1977,7 @@ sfdiskLegacyOriginalPartitionFileName "$imagePath" "$disk_number" if [[ -r $sfdiskoriginalpartitionfilename ]]; then dots "Inserting Extended partitions (Original)" - sfdisk $disk < $sfdiskoriginalpartitionfilename >/dev/null 2>&1 + flock $disk sfdisk $disk < $sfdiskoriginalpartitionfilename >/dev/null 2>&1 case $? in 0) echo "Done" @@ -1988,7 +1988,7 @@ esac elif [[ -e $sfdisklegacyoriginalpartitionfilename ]]; then dots "Inserting Extended partitions (Legacy)" - sfdisk $disk < $sfdisklegacyoriginalpartitionfilename >/dev/null 2>&1 + flock $disk sfdisk $disk < $sfdisklegacyoriginalpartitionfilename >/dev/null 2>&1 case $? in 0) echo "Done" diff -ur /mnt/init-orig/usr/share/fog/lib/partition-funcs.sh /mnt/init/usr/share/fog/lib/partition-funcs.sh --- /mnt/init-orig/usr/share/fog/lib/partition-funcs.sh 2019-05-04 17:58:07.000000000 -0400 +++ /mnt/init/usr/share/fog/lib/partition-funcs.sh 2019-07-12 10:26:47.000000000 -0400 @@ -73,7 +73,7 @@ local file="$2" [[ -z $disk ]] && handleError "No disk passed (${FUNCNAME[0]})\n Args Passed: $*" [[ -z $file ]] && handleError "No file to receive from passed (${FUNCNAME[0]})\n Args Passed: $*" - sfdisk $disk < $file >/dev/null 2>&1 + flock $disk sfdisk $disk < $file >/dev/null 2>&1 [[ ! $? -eq 0 ]] && majorDebugEcho "sfdisk failed in (${FUNCNAME[0]})" } # $1 is the name of the disk drive
-
@Eric-Johnson @Quazz You guys rock!! Thank you very much for digging that deep and finding this!
From the sound of what you describe it pretty much is some kind of timing issue and therefore perfectly matches the findings on the device being busy/locked at that stage. While I still don’t really understand why this is happening now but has not occurred (or not being reported) in the past much I am pretty confident that you have hit the nail on the head with this.
Looking through the scripts I see even more places where
sfdisk
might bite us and I have a feeling that some other issue reports we currently have might be caused by this same busy/lock problem withsfdisk
somewhere else in the scripts. Here is a full (?) list of the places:roth@x220:~/workspace/fog/fos/Buildroot/board/FOG/FOS/rootfs_overlay$ find . -type f -exec grep "sfdisk " {} /dev/null \; | grep -v -e ":[[:space:]]*#" -e majorDebugEcho ./usr/share/fog/lib/partition-funcs.sh: sfdisk -d $disk 2>/dev/null > $file ./usr/share/fog/lib/partition-funcs.sh: sfdisk $disk < $file >/dev/null 2>&1 ./usr/share/fog/lib/partition-funcs.sh: sfdisk -d $disk 2>/dev/null | egrep '(Id|type)=\ *[5f]' | wc -l ./usr/share/fog/lib/partition-funcs.sh: parttype=$(sfdisk -d $disk 2>/dev/null | awk -F[,=] "/^$escape_part/{print \$6}") ./usr/share/fog/lib/partition-funcs.sh: sfdisk -d $disk ./usr/share/fog/lib/funcs.sh: local count=$(sfdisk -d $disk 2>/dev/null | awk /start=\ *[1-9]/'{print $4+0}' | sort -n | head -n1) ./usr/share/fog/lib/funcs.sh: [[ $hasgpt -eq 0 ]] && have_extended_partition=$(sfdisk -l $disk 2>/dev/null | egrep "^${disk}.* (Extended|W95 Ext'd \(LBA\))$" | wc -l) ./usr/share/fog/lib/funcs.sh: sfdisk -d $disk 2>/dev/null > $sfdiskfilename ./usr/share/fog/lib/funcs.sh: sfdisk -d $disk 2>/dev/null > $sfdiskfilename ./usr/share/fog/lib/funcs.sh: sfdisk $disk < $sfdiskoriginalpartitionfilename >/dev/null 2>&1 ./usr/share/fog/lib/funcs.sh: sfdisk $disk < $sfdisklegacyoriginalpartitionfilename >/dev/null 2>&1 ./usr/share/fog/lib/funcs.sh: fsid="$(sfdisk -d "$disk" | grep "$part" | sed -n 's/.*Id=\([0-9]\+\).*\(,\|\).*/\1/p')"
Question: Is there a good reason that we shouldn’t add
flock ...
to all those calls as well? @Eric-Johnson @Quazz @Tom-ElliottThough I don’t know if the same can even happen if
sfdisk
is just reading (-d
for dumping the table) instead of it writing to disk but on the other hand I reckon addingflock ...
wouldn’t hurt it in any case?!?! On the other hand it sounds a bit like “we don’t know what’s happening here so let’s just try to hit everything with a rock that looks like it might be dangerous” - not my kind of style. -
Just want to chime in to say good job everyone! I would have thrown my hat in for testing fixes if I wasn’t sweating my buns off in hot school buildings reassembling classroom technology. I have experienced a pattern of right after uploading an image, as the upload is complete and the machine attempts to come out of sysprep, I get an error. Now I am not sure it is related to this, but I heard someone else having the same issue. After re-deploying to the very same machine with the image that was just captured, everything works just fine. Regardless it looks like you guys already have a good idea of what is going on, so I’ll shut up now
-
@fry_p On first read this doesn’t sound related to me but we’ll see. I know you are very busy right now but would you mind opening a new topic with this one as well and post more information there? Picture of the error would be great!
-
@Sebastian-Roth said in FOG 1.5.6: Auto resize is unpredictable:
@fry_p On first read this doesn’t sound related to me but we’ll see. I know you are very busy right now but would you mind opening a new topic with this one as well and post more information there? Picture of the error would be great!
I figured a new topic may be in order. I will open one up if I have time the beginning of next week when I would be able to replicate. If I am able to get some time I will gather as much info as possible including error messages and pictures.
-
@Eric-Johnson I don’t want to take over this topic as it’s been mainly you and @Quazz who figured this one out! But I did add the changes and would be thankful if you’d give it a try in your setup. @Cheetah2003 and all the others are welcome too!
Download 64 Bit and 32 Bit and put those in
/var/www/html/fog/service/ipxe/
dir on your FOG server. Probably good to rename the original ones instead of overwriting.And I am still wondering if we need to use
flock
forfdisk
(notsfdisk
) calls and maybe others as well. I have a feeling that maybe some change in buildroot did cause this random failure in the first place. I am fairly sure this is not something we had in the inits for months and years. But I guess it’s not worth spending the time to track it down to the line of code that is causing it. Maybe a combination of udev and sfdisk - very likely one or both are involved. -
@Sebastian-Roth As far as I understand, any tool that uses
BLKRRPART
could be prevented access because of udev event handling.It’s usually very fast and therefore unlikely to cause issues, but since it is executed parallel to everything else it can potentially get in the way from time to time.
As far as I know, other programs that interact with the storage device act in the same way and also use
BLKRRPART
(such asfdisk
andhdparm
)For now, I’d say, leave it as is and monitor for reported problems. This problem is rare enough on its own already (personally haven’t come across it at all) that it doesn’t really warrant changing everything with the possibility of the affecting something else. (doesn’t look like it should, but never know)
edit: Important to note that Kernel version could affect how
BLKRRPART
functions and what not plus theudev
events would be handled by the kernel as well afaik, so perhaps it’s as simple as the kernel versions? -
@Quazz Thanks heaps for digging into this even more. I guess it will be very hard to actually track down when and how this was introduced.
This problem is rare enough on its own already (personally haven’t come across it at all)
I would have said so myself a day or two ago. But then I even ran into the same issues when debugging a different partition layout problem for another user in my VM test setup (VirtualBox).