FS#45753 - [arch-install-scripts] genfstab generates wrong root mountpoint
Attached to Project:
Arch Linux
Opened by Maurizio D'Addona (mauritiusdadd) - Thursday, 23 July 2015, 10:39 GMT
Last edited by Dave Reisner (falconindy) - Sunday, 12 June 2016, 14:59 GMT
Opened by Maurizio D'Addona (mauritiusdadd) - Thursday, 23 July 2015, 10:39 GMT
Last edited by Dave Reisner (falconindy) - Sunday, 12 June 2016, 14:59 GMT
|
Details
Description:
mounpoints generated by genfstab should should always be relative to the root mountpoint specified however, if the root mountpoint name ends with a / then the path generated is an absolute path. For example, let's assume that /dev/sda1 is the boot partition and /dev/sda2 is the root partition: mount /dev/sda2 /mnt mount /dev/sda1 /mnt/boot genfstab /mnt generates the correct fstab: $ genfstab /mnt # UUID=47b16691-bc7f-4147-8157-b21b4b87e58d /dev/sda2 / ext4 rw,relatime,discard,data=ordered 0 1 # UUID=2dee380a-179b-4356-9005-b53fb9f5c409 /dev/sda1 /boot ext2 rw,relatime 0 2 on the contrary genfstab /mnt/ generates a wrong fstab $ genfstab /mnt/ # UUID=47b16691-bc7f-4147-8157-b21b4b87e58d /dev/sda2 /mnt ext4 rw,relatime,discard,data=ordered 0 1 # UUID=2dee380a-179b-4356-9005-b53fb9f5c409 /dev/sda1 /boot ext2 rw,relatime 0 2 Steps to reproduce: * mount a filsystem to /mount/point * use the command: genfstab /mount/point/ Additional info: * the problem could be fixed replacing the line root=$1; shift with root="$(realpath -eL $1)"; shift I also crated a patch for genfstab.in from the git sources (see attachment) |
This task depends upon
Closed by Dave Reisner (falconindy)
Sunday, 12 June 2016, 14:59 GMT
Reason for closing: Fixed
Additional comments about closing: https://git.archlinux.org/arch-install-s cripts.git/commit/?id=daa2fac5b27cee8dca 404b03d9cf41c328574ba7
Sunday, 12 June 2016, 14:59 GMT
Reason for closing: Fixed
Additional comments about closing: https://git.archlinux.org/arch-install-s cripts.git/commit/?id=daa2fac5b27cee8dca 404b03d9cf41c328574ba7
target=${target#$root}
Given something like target=/mnt and root=/mnt/, target remains /mnt/. A similar problem exists for relative paths.
# retrieve the relative path
target="$(realpath --relative-to=$root $target)"
# convert to a canonicalized absolute path
target="$(realpath -m /${target})"