Don't convert partuuids for nonexistent source partitions#8
Conversation
|
Since I don't personally use this feature, if someone else can give the thumbs up on the change, I'd be happy to merge! |
|
Wouldn't it make sense to make sure there is no empty element in src_partition? Would be interesting to know you partitioning which causes this issue 😉 |
My disk has primary partitions sda1 and sda2, and then logical partitions sda5+, so there will be indices in between without partitions, whereas the code iterates through indices 1-n. If you look at where Lines 677 to 694 in 423470c and there's also a check later on in the main code path: Lines 1001 to 1006 in 423470c But it doesn't seem to have made it to the part where partuuids get converted: Lines 958 to 967 in 423470c (actually I might change my code to match L1003-L1006 and check |
|
I didn't detect Bill already used an array to mark a partition as not to exist :-(. Frankly I would just delete this partition in the list instead of mark it as non existing. But then you can't use a simple array with partition indices any more and will need much more complicated logic :-( I agree to use |
f30d539 to
721428a
Compare
Copying this issue from billw2#149 as that repo is abandoned.
Issue
When converting to partuuids, if there is an empty element in
${src_partition[@]}, then/etc/fstabwill have/dev/replaced withPARTUUID=without actually changing the device name to a PARTUUID.I don't have the exact logs when this happened to me, but it looked something like this:
and I ended up with a broken fstab:
I had previously run
sudo rpi-clone -l sdaso perhaps that is why there was an empty element insrc_partition, I'm not sure.Changes
Check that
${src_partition[p]}is not empty before editing/etc/fstab.Then, the command I used will instead exit with an error, which is much safer: