Bug 53319 - EC2 images: grwofs broken
EC2 images: grwofs broken
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: General
UCS 5.0
All other
: P5 normal (vote)
: UCS 5.0-2
Assigned To: Philipp Hahn
Julia Bremer
:
Depends on:
Blocks: ucs502ec2
  Show dependency treegraph
 
Reported: 2021-05-21 15:27 CEST by Philipp Hahn
Modified: 2022-07-04 14:08 CEST (History)
7 users (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 6: Setup Problem: Issue for the setup process
Who will be affected by this bug?: 2: Will only affect a few installed domains
How will those affected feel about the bug?: 2: A Pain – users won’t like this once they notice it
User Pain: 0.137
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Philipp Hahn univentionstaff 2021-05-21 15:27:31 CEST
+++ This bug was initially created as a clone of Bug #51968 comment 11 +++

FAIL partition is not resized during boot (works with the Univention Corporate Server (UCS) 4.4 (official image) rev. 9 ami)

-> df -h
Filesystem      Size  Used Avail Use% Mounted on
udev/xvda1      9.7G  2.8G  6.4G  31% /

-> fdisk -l /dev/xvda 
Disk /dev/xvda: 30 GiB, 32212254720 bytes, 62914560 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x1228ee5d
Device     Boot Start      End  Sectors Size Id Type
/dev/xvda1 *     2048 20969471 20967424  10G 83 Linux

Is that important?

Seems that cloud-initramfs-growroot (and the patched growroot) is no longer working, see utils/base_appliance.sh::setup_ec2. What worked for me now was modifying /etc/init.d/resize2fs (also a script from us -> setup_ec2)

#!/bin/bash
### BEGIN INIT INFO
# Provides:          resize2fs
# Required-Start:    $local_fs
# Required-Stop:
# Default-Start:     2
# Default-Stop:
# Short-Description: resize filesystem upon boot
### END INIT INFO

+growpart /dev/xvda 1
resize2fs /dev/xvda1 &
+rm $0
disown
Comment 1 Philipp Hahn univentionstaff 2021-07-06 17:39:46 CEST
systemd has native support for growing file systems: <https://www.freedesktop.org/software/systemd/man/systemd-makefs@.service.html#>
Comment 2 Philipp Hahn univentionstaff 2022-02-08 13:51:02 CET
This no longer works with UCS-5.0 as ROOT=$UUID is used, which /usr/share/initramfs-tools/scripts/init-premount/growroot does not handle:
> case "${rootdev}" in
>         *[0-9]) : ;;
>         # the root is a disk, not a partition (does not end in a digit)
>         # no need to do anything in this case, kernel already knows the full size.
>     *) exit 0;;
> esac

/run/initramfs/initramfs.debug:
…
+ /scripts/init-premount/growroot
+ PREREQS=
+ . /scripts/functions
+ TEMP_D=
+ RESTORE_FROM=
+ '[' -f /root/var/lib/cloud/instance/root-grown 
+ '[' -f /root/etc/growroot-disabled ]
+ '[' -f /root/etc/growroot-grown ]
+ '[' '!' -L 'UUID=b28e7ce9-76ad-475e-8684-bffdd139303e' ]
+ rootdev='UUID=b28e7ce9-76ad-475e-8684-bffdd139303e'
+ exit 0

# grep -n --color ^[^#] /etc/fstab
9:UUID=b28e7ce9-76ad-475e-8684-bffdd139303e /               ext4    errors=remount-ro 0       1
10:/dev/sr0        /media/cdrom0   udf,iso9660 user,noauto     0       0

# ucr search --brief --value /dev/xvda
grub/boot: /dev/xvda
grub/root: /dev/xvda1

This is automatically converted to "root=UUID=…" because it is not and cannot be disabled via UCR:
> /etc/default/grub:44:# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
> /etc/default/grub:45:GRUB_DISABLE_LINUX_UUID=true
Comment 3 Philipp Hahn univentionstaff 2022-06-16 11:54:22 CEST
<https://www.freedesktop.org/software/systemd/man/systemd-repart.html> only got added with systemd v245 and is only available from <https://packages.debian.org/source/buster-backports/systemd>.

r19620 | Bug #53319: support for identifying device by LABEL= or UUID=

Package: cloud-initramfs-tools
Version: 0.18.debian7A~5.0.0.202206161152
Branch: ucs_5.0-0
Scope: ucs5.0-2

OK: Tested successfully on AWS EC2

PS: I've contacted Debian because their version <https://packages.debian.org/search?keywords=cloud-initramfs-tools&searchon=sourcenames&suite=all&section=all> is severely behind upstream <https://launchpad.net/cloud-initramfs-tools>
Comment 4 Julia Bremer univentionstaff 2022-06-23 11:40:27 CEST
partition is resized durig boot: OK
Verified
Comment 5 Philipp Hahn univentionstaff 2022-06-23 13:05:34 CEST
ssh -i ~/.ssh/ph-test.pem -l root 10.210.240.245 'lsblk;df -h /'

> NAME    MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
> xvda    202:0    0  17G  0 disk 
> └─xvda1 202:1    0  17G  0 part /

> Filesystem      Size  Used Avail Use% Mounted on
> /dev/xvda1       17G  2.8G   13G  18% /
Comment 6 Florian Best univentionstaff 2022-07-04 14:08:18 CEST
UCS 5.0-2 has been released.

https://docs.software-univention.de/release-notes-5.0-2-en.html

If this error occurs again, please clone this bug.