procount / pinn

An enhanced Operating System installer for the Raspberry Pi
1.12k stars 123 forks source link

Manjaro install image needs updating/partition label names #395

Open busywait opened 4 years ago

busywait commented 4 years ago

The latest Manjaro ARM kernel command lines expect particular partition names, BOOT_MNJRO and ROOT_MNJRO.

After I installed Manjara XFCE from PINN and updating the kernel (I moved to linux-rpi4-mainline) I hit the issue described here: https://forum.manjaro.org/t/raspberry-pi-kernel-changes/146653

I needed to boot in to another installed OS and change the partition names.

I think this could have been avoided if PINN using a more recent Manjaro image.

procount commented 4 years ago

Thanks for the heads up. I'll look into updating the version. It could perhaps be avoided by modifying the partition_setup.sh script as well to account for this. Also, you can use the recovery terminal in PINN to change the partition names if you don't have another OS installed.

busywait commented 4 years ago

It could perhaps be avoided by modifying the partition_setup.sh script as well to account for this.

The change seems sensible anyway, it's easier to distinguish from the other OS boot and root now :)

Also, you can use the recovery terminal in PINN to change the partition names if you don't have another OS installed.

I should have looked harder - I did go in to the maintenance UI, but didn't spot the place to rename partitions. (In fact, I assumed that it was deliberately not an option in case an OS required a particular name, as in this case).

procount commented 4 years ago

The only problem with them going with fixed labels, is that it makes installing 2 copies of Manjaro on the same SD card a bit problematic, like in Ubuntu. But maybe it can be accounted for in the script.

Re: renaming partitions, it's not a feature of PINN's Gui. You have to drop to a command terminal and do it manually.

busywait commented 4 years ago

Is the PINN install configuration and partition_setup.sh for Manjaro in the PINN source tree? Or, where should I look to see it?

busywait commented 4 years ago

I posted on to the Manjaro ARM forum about this https://forum.manjaro.org/t/raspberry-pi-kernel-changes/146653/20?u=busywait to find out if there is a reason the Manjaro devs chose not to set root using UUID.

procount commented 4 years ago

See the appropriate Manjaro folders in https://sourceforge.net/projects/pinn/files/os/

procount commented 4 years ago

You can't have 2 partitions with the same name. If you install 2 manjaros side by side, PINN will give the 2nd one different partition names. DOn't rename the partitions, but change the references. in fstab and cmdline. Then they will work ok (until the next kernel upgrade). You can try running the fixup script from the PINN gui after a kernel upgrade (on a fully backed up & tested or discardable image), which may sort it for you.

busywait commented 4 years ago

Thank you. I played with identically named partitions to see what would happen - I know that PINN will always ensure sensible unique names.

With my current PINN install re-running partition_setup.sh from the "Fix Partitions" UI in PINN fixes any actual problem booting after a kernel upgrade, but it uses /dev/mmcXXXX device names which Manjaro are deliberately avoiding.

There are some "fixes" for the current PINN Manjaro configurations that would be helpful to keep the image more consistent with the base Manjaro image:

It seems to be a simple change to fix the partition names for Manjaro in the two PINN partition.json files ./os/manjaro-rpi4-XXX/partitions.json so that the label attributes match the Manjaro image for at least the first Manjaro install on a card or disk:

   "label" : "BOOT_MNJRO",   
   "label" : "ROOT_MNJRO",

In ./os/manjaro-rpi4-XXX/partition_setup.sh don't replace labels with device names, instead use labels:

if [ -z "$id1" ] || [ -z "$id2" ]; then
  printf "Error: missing environment variable id1 or id2\n" 1>&2
  exit 1
fi
sed /tmp/1/cmdline.txt -i -e "s|root=[^ ]*|root=${id2}|"
sed /tmp/2/etc/fstab -i -e "s|^[^#].* / |${id2}  / |"
sed /tmp/2/etc/fstab -i -e "s|^[^#].* /boot |${id1}  /boot |"

With that, a single PINN install of Manjaro would replicate the base Manjaro disk image, and future-proof the install for the fraction of people that only install a single Manjaro version per disk/card via PINN. (Note that currently the /etc/fstab doesn't have an entry for the root fs by default in Manjaro 20.04 or 20.06).

Users with more than one Majaro install on the same boot device will need to manually patch up the changes that will be made by future linux-rpi4 (kernel) package upgrades. Two options:

(The "first" Manjaro install in the partition table will not have a problem.)

The final "easy" and helpful change is to upgrade the PINN tarballs from 20.04 to 20.06, which would save users from finding a conflict in the first package upgrade of a 20.04 install (because of a little oversight in the Manjaro repo).

busywait commented 4 years ago

There are lines in the Manjaro partition_setup.sh files related to resizing the root partition which still reference raspi-config. Seems inappropriate? There is no raspi-config in the Manjaro image, I don't think it will be mentioned in the cmdline.txt.

  if ! grep -q resize /proc/cmdline; then
    if ! grep -q splash /tmp/1/cmdline.txt; then
      sed -i "s| quiet||g" /tmp/1/cmdline.txt
    fi
    sed -i 's| init=/usr/lib/raspi-config/init_resize.sh||' /tmp/1/cmdline.txt
  else
    sed -i '1 s|.*|& sdhci.debug_quirks2=4|' /tmp/1/cmdline.txt
  fi
fi

Manjaro handles partition expansion via a script that is deleted after the first boot: /usr/share/manjaro-arm-oem-install/manjaro-arm-oem-install

The lines related to resizing are

    msg "Resizing partition..."
    resize-fs 1> /dev/null 2>&1

The script is called from /root/.bash_profile after auto-login of the root account during the first boot.

The script is part of a pacman package, and the source is hosted at https://gitlab.manjaro.org/manjaro-arm/packages/community/manjaro-arm-oem-install/-/tree/master