Skip to content
This repository was archived by the owner on Aug 22, 2024. It is now read-only.

install does not run on Ubuntu 22.04 #66

@golharam

Description

@golharam
sh /opt/amazon-ebs-autoscale/install.sh -d /dev/xvdba -f lvm.ext4 -m /scratch
+ cat
+ USAGE=Install Amazon EBS Autoscale

    /opt/amazon-ebs-autoscale/install.sh [options] [[-m] <mount-point>]

Options

    -d, --initial-device DEVICE
                        Initial device to use for mountpoint - e.g. /dev/xvdba.
                        (Default: none - automatically create and attaches a volume)
                        If provided --initial-size is ignored.

    -f, --file-system   btrfs | lvm.ext4
                        Filesystem to use (default: btrfs).
                        Options are btrfs or lvm.ext4

    -h, --help
                        Print help and exit.

    -m, --mountpoint    MOUNTPOINT
                        Mount point for autoscale volume (default: /scratch)
                        
    -t, --volume-type   VOLUMETYPE
                        Volume type (default: gp3)

    --volume-iops       VOLUMEIOPS
                        Volume IOPS for gp3, io1, io2 (default: 3000)

    --volume-throughput VOLUMETHOUGHPUT
                        Volume throughput for gp3 (default: 125)

    --min-ebs-volume-size SIZE_GB
                        Mimimum size in GB of new volumes created by the instance.
                        (Default: 150)

    --max-ebs-volume-size SIZE_GB
                        Maximum size in GB of new volumes created by the instance.
                        (Default: 1500)
            
    --max-total-created-size SIZE_GB
                        Maximum total size in GB of all volumes created by the instance.
                        (Default: 8000)
                        
    --max-attached-volumes N
                        Maximum number of attached volumes. (Default: 16)

    --initial-utilization-threshold N
                        Initial disk utilization treshold for scale-up. (Default: 50)

    -s, --initial-size  SIZE_GB
                        Initial size of the volume in GB. (Default: 200)
                        Only used if --initial-device is NOT specified.

    -i, --imdsv2        
                        Enable imdsv2 for instance metadata API requests.
    
+ MOUNTPOINT=/scratch
+ SIZE=200
+ VOLUMETYPE=gp3
+ VOLUMEIOPS=3000
+ VOLUMETHOUGHPUT=125
+ MIN_EBS_VOLUME_SIZE=150
+ MAX_EBS_VOLUME_SIZE=1500
+ MAX_LOGICAL_VOLUME_SIZE=8000
+ MAX_ATTACHED_VOLUMES=16
+ INITIAL_UTILIZATION_THRESHOLD=50
+ DEVICE=
+ FILE_SYSTEM=btrfs
+ dirname /opt/amazon-ebs-autoscale/install.sh
+ BASEDIR=/opt/amazon-ebs-autoscale
+ . /opt/amazon-ebs-autoscale/shared/utils.sh
/opt/amazon-ebs-autoscale/install.sh: 31: /opt/amazon-ebs-autoscale/shared/utils.sh: Syntax error: "(" unexpected

In fixing this, I noticed a few issues:

  1. I noticed in utils.sh, all the function are declared as
function some_function()

if they are changed to

some_function()

they work.

  1. mkdir -p /usr/local/amazon-ebs-autoscale/{bin,shared}

This mkdir command actually creates a "{bin,shared} folder:

# sh /opt/amazon-ebs-autoscale/install.sh -d /dev/xvdb -f lvm.ext4 -m /scratch
+ cat
+ USAGE=Install Amazon EBS Autoscale

    /opt/amazon-ebs-autoscale/install.sh [options] [[-m] <mount-point>]

Options

    -d, --initial-device DEVICE
                        Initial device to use for mountpoint - e.g. /dev/xvdba.
                        (Default: none - automatically create and attaches a volume)
                        If provided --initial-size is ignored.

    -f, --file-system   btrfs | lvm.ext4
                        Filesystem to use (default: btrfs).
                        Options are btrfs or lvm.ext4

    -h, --help
                        Print help and exit.

    -m, --mountpoint    MOUNTPOINT
                        Mount point for autoscale volume (default: /scratch)
                        
    -t, --volume-type   VOLUMETYPE
                        Volume type (default: gp3)

    --volume-iops       VOLUMEIOPS
                        Volume IOPS for gp3, io1, io2 (default: 3000)

    --volume-throughput VOLUMETHOUGHPUT
                        Volume throughput for gp3 (default: 125)

    --min-ebs-volume-size SIZE_GB
                        Mimimum size in GB of new volumes created by the instance.
                        (Default: 150)

    --max-ebs-volume-size SIZE_GB
                        Maximum size in GB of new volumes created by the instance.
                        (Default: 1500)
            
    --max-total-created-size SIZE_GB
                        Maximum total size in GB of all volumes created by the instance.
                        (Default: 8000)
                        
    --max-attached-volumes N
                        Maximum number of attached volumes. (Default: 16)

    --initial-utilization-threshold N
                        Initial disk utilization treshold for scale-up. (Default: 50)

    -s, --initial-size  SIZE_GB
                        Initial size of the volume in GB. (Default: 200)
                        Only used if --initial-device is NOT specified.

    -i, --imdsv2        
                        Enable imdsv2 for instance metadata API requests.
    
+ MOUNTPOINT=/scratch
+ SIZE=200
+ VOLUMETYPE=gp3
+ VOLUMEIOPS=3000
+ VOLUMETHOUGHPUT=125
+ MIN_EBS_VOLUME_SIZE=150
+ MAX_EBS_VOLUME_SIZE=1500
+ MAX_LOGICAL_VOLUME_SIZE=8000
+ MAX_ATTACHED_VOLUMES=16
+ INITIAL_UTILIZATION_THRESHOLD=50
+ DEVICE=
+ FILE_SYSTEM=btrfs
+ dirname /opt/amazon-ebs-autoscale/install.sh
+ BASEDIR=/opt/amazon-ebs-autoscale
+ . /opt/amazon-ebs-autoscale/shared/utils.sh
+ PARAMS=
+ 6
/opt/amazon-ebs-autoscale/install.sh: 114: 6: not found
+ eval set -- 
+ set --
+ initialize
+ get_metadata placement/availability-zone
+ local key=placement/availability-zone
+ local metadata_ip=169.254.169.254
+ [ ! -z  ]
+ curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone
+ echo us-east-1d
+ export AWS_AZ=us-east-1d
+ echo us-east-1d
+ sed -e s/[a-z]$//
+ export AWS_REGION=us-east-1
+ get_metadata instance-id
+ local key=instance-id
+ local metadata_ip=169.254.169.254
+ [ ! -z  ]
+ curl -s http://169.254.169.254/latest/meta-data/instance-id
+ echo i-0b18bf0349b1660f3
+ export INSTANCE_ID=i-0b18bf0349b1660f3
+ export EBS_AUTOSCALE_CONFIG_FILE=/etc/ebs-autoscale.json
+ [ ! -z  ]
+ mkdir -p /usr/local/amazon-ebs-autoscale/{bin,shared}
+ cp /opt/amazon-ebs-autoscale/bin/{create-ebs-volume,ebs-autoscale} /usr/local/amazon-ebs-autoscale/bin
cp: cannot stat '/opt/amazon-ebs-autoscale/bin/{create-ebs-volume,ebs-autoscale}': No such file or directory
root@ip-172-25-135-225:/opt/amazon-ebs-autoscale# ll /usr/local/amazon-ebs-autoscale/
total 12
drwxr-xr-x  3 root root 4096 Sep 24 21:15 ./
drwxr-xr-x 12 root root 4096 Sep 24 21:15 ../
drwxr-xr-x  2 root root 4096 Sep 24 21:15 {bin,shared}/

I don't really know why "mkdir -p" wouldn't respect patterns as root. When I run in it on the shell, the command works as expected.

  1. Even though I specify lvm.ext4, the /scratch file system ends up being btrfs.

  2. The partition I specified doesn't get used. Instead another partition gets created as the starting volume

# sh /opt/amazon-ebs-autoscale/install.sh -d /dev/xvdb -f lvm.ext4 -m /scratch
+ cat
+ USAGE=Install Amazon EBS Autoscale

    /opt/amazon-ebs-autoscale/install.sh [options] [[-m] <mount-point>]

Options

    -d, --initial-device DEVICE
                        Initial device to use for mountpoint - e.g. /dev/xvdba.
                        (Default: none - automatically create and attaches a volume)
                        If provided --initial-size is ignored.

    -f, --file-system   btrfs | lvm.ext4
                        Filesystem to use (default: btrfs).
                        Options are btrfs or lvm.ext4

    -h, --help
                        Print help and exit.

    -m, --mountpoint    MOUNTPOINT
                        Mount point for autoscale volume (default: /scratch)
                        
    -t, --volume-type   VOLUMETYPE
                        Volume type (default: gp3)

    --volume-iops       VOLUMEIOPS
                        Volume IOPS for gp3, io1, io2 (default: 3000)

    --volume-throughput VOLUMETHOUGHPUT
                        Volume throughput for gp3 (default: 125)

    --min-ebs-volume-size SIZE_GB
                        Mimimum size in GB of new volumes created by the instance.
                        (Default: 150)

    --max-ebs-volume-size SIZE_GB
                        Maximum size in GB of new volumes created by the instance.
                        (Default: 1500)
            
    --max-total-created-size SIZE_GB
                        Maximum total size in GB of all volumes created by the instance.
                        (Default: 8000)
                        
    --max-attached-volumes N
                        Maximum number of attached volumes. (Default: 16)

    --initial-utilization-threshold N
                        Initial disk utilization treshold for scale-up. (Default: 50)

    -s, --initial-size  SIZE_GB
                        Initial size of the volume in GB. (Default: 200)
                        Only used if --initial-device is NOT specified.

    -i, --imdsv2        
                        Enable imdsv2 for instance metadata API requests.
    
+ MOUNTPOINT=/scratch
+ SIZE=200
+ VOLUMETYPE=gp3
+ VOLUMEIOPS=3000
+ VOLUMETHOUGHPUT=125
+ MIN_EBS_VOLUME_SIZE=150
+ MAX_EBS_VOLUME_SIZE=1500
+ MAX_LOGICAL_VOLUME_SIZE=8000
+ MAX_ATTACHED_VOLUMES=16
+ INITIAL_UTILIZATION_THRESHOLD=50
+ DEVICE=
+ FILE_SYSTEM=btrfs
+ dirname /opt/amazon-ebs-autoscale/install.sh
+ BASEDIR=/opt/amazon-ebs-autoscale
+ . /opt/amazon-ebs-autoscale/shared/utils.sh
+ PARAMS=
+ 6
/opt/amazon-ebs-autoscale/install.sh: 114: 6: not found
+ eval set -- 
+ set --
+ initialize
+ get_metadata placement/availability-zone
+ local key=placement/availability-zone
+ local metadata_ip=169.254.169.254
+ [ ! -z  ]
+ curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone
+ echo us-east-1d
+ export AWS_AZ=us-east-1d
+ echo+ sed -e s/[a-z]$//
 us-east-1d
+ export AWS_REGION=us-east-1
+ get_metadata instance-id
+ local key=instance-id
+ local metadata_ip=169.254.169.254
+ [ ! -z  ]
+ curl -s http://169.254.169.254/latest/meta-data/instance-id
+ echo i-0b18bf0349b1660f3
+ export INSTANCE_ID=i-0b18bf0349b1660f3
+ export EBS_AUTOSCALE_CONFIG_FILE=/etc/ebs-autoscale.json
+ [ ! -z  ]
+ mkdir -p /usr/local/amazon-ebs-autoscale/bin
+ mkdir /usr/local/amazon-ebs-autoscale/shared
+ cp /opt/amazon-ebs-autoscale/bin/create-ebs-volume /usr/local/amazon-ebs-autoscale/bin/
+ cp /opt/amazon-ebs-autoscale/bin/ebs-autoscale /usr/local/amazon-ebs-autoscale/bin/
+ chmod +x /usr/local/amazon-ebs-autoscale/bin/create-ebs-volume /usr/local/amazon-ebs-autoscale/bin/ebs-autoscale
+ ln -sf /usr/local/amazon-ebs-autoscale/bin/create-ebs-volume /usr/local/amazon-ebs-autoscale/bin/ebs-autoscale /usr/local/bin/
+ ln -sf /usr/local/amazon-ebs-autoscale/bin/create-ebs-volume /usr/local/amazon-ebs-autoscale/bin/ebs-autoscale /usr/bin/
+ cp /opt/amazon-ebs-autoscale/shared/utils.sh /usr/local/amazon-ebs-autoscale/shared
+ cp /opt/amazon-ebs-autoscale/config/ebs-autoscale.logrotate /etc/logrotate.d/ebs-autoscale
+ cat /opt/amazon-ebs-autoscale/config/ebs-autoscale.json
+ sed -e s#%%MAXEBSVOLUMESIZE%%#1500#
+ sed -e s#%%INITIALUTILIZATIONTHRESHOLD%%#50#
+ sed -e s#%%VOLUMETHOUGHPUT%%#125#
+ + sedsed -e -e s#%%MAXATTACHEDVOLUMES%%#16# s#%%MOUNTPOINT%%#/scratch#

+ sed -e s#%%FILESYSTEM%%#btrfs#
+ + sed -e s#%%MINEBSVOLUMESIZE%%#150#
+ sedsed -e -e s#%%VOLUMEIOPS%%#3000# s#%%MAXLOGICALVOLUMESIZE%%#8000#

+ sed -e s#%%VOLUMETYPE%%#gp3#
+ [ -e /scratch ]
+ [ -d /scratch ]
+ [ -e /scratch ]
+ [ -z  ]
+ create-ebs-volume --size 200 --type gp3
+ DEVICE=/dev/xvdbb
+ [ btrfs = btrfs ]
+ mkfs.btrfs -f -d single /dev/xvdbb
btrfs-progs v5.16.2
See http://btrfs.wiki.kernel.org for more information.

NOTE: several default settings have changed in version 5.15, please make sure
      this does not affect your deployments:
      - DUP for metadata (-m dup)
      - enabled no-holes (-O no-holes)
      - enabled free-space-tree (-R free-space-tree)

Label:              (null)
UUID:               298a301d-64e2-4eb8-8025-6fe66b1f2286
Node size:          16384
Sector size:        4096
Filesystem size:    200.00GiB
Block group profiles:
  Data:             single            8.00MiB
  Metadata:         DUP               1.00GiB
  System:           DUP               8.00MiB
SSD detected:       yes
Zoned device:       no
Incompat features:  extref, skinny-metadata, no-holes
Runtime features:   free-space-tree
Checksum:           crc32c
Number of devices:  1
Devices:
   ID        SIZE  PATH
    1   200.00GiB  /dev/xvdbb

+ mount /dev/xvdbb /scratch
+ + teeecho -a -e /etc/fstab /dev/xvdbb\t/scratch\tbtrfs\tdefaults\t0\t0

-e /dev/xvdbb	/scratch	btrfs	defaults	0	0
+ chmod 1777 /scratch
+ detect_init_system
+ INIT_SYSTEM=unknown
+ echo Could not install EBS Autoscale - unsupported init system
Could not install EBS Autoscale - unsupported init system
+ exit 1

There are other issues that come up after. I'm not clear if this is all a difference between AWS Linux and Ubuntu, updates to the Linux OS, or updates to this repo that is causing all this, or a combination.

I'll fix what I can and submit a PR, but hoping someone else has more information on how to handle this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions