Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't convert partuuids for empty src_partition element #149

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

aaronkollasch
Copy link

Issue

When converting to partuuids, if there is an empty element in ${src_partition[@]}, then /etc/fstab will have /dev/ replaced with PARTUUID= 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:

$ sudo rpi-clone -l sda --convert-fstab-to-partuuid

This will change your /etc/fstab, are you sure?  (yes/no): yes

Converting /etc/fstab from device names to PARTUUID
lsblk: /dev/: not a block device
  Editing /etc/fstab, changing /dev/ to
...

and I ended up with a broken fstab:

proc            /proc           proc    defaults          0       0
PARTUUID=mmcblk0p6  /boot           vfat    defaults          0       2
PARTUUID=mmcblk0p7  /               ext4    defaults,noatime  0       1
# a swapfile is not a swap partition, no line here
#   use  dphys-swapfile swap[on|off]  for that

I had previously run sudo rpi-clone -l sda so perhaps that is why there was an empty element in src_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:

Could not find any sda partition names in /etc/fstab, nothing changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant