Init problems after install for the proof-of-concept scenario - Missing Step?

Hi All,
I’m having problems with install for the proof-of-concept scenario, with all MAAS components installed on a single host.

I’m getting stuck when I attempt to initial maas in new Ubuntu Environment and 3.2 fresh install.

Any ideas? I feel there is a step missing here.

Command:
sudo snap install --channel=3.2/beta maas
sudo snap install maas maas-test-db
sudo maas init region+rack --database-uri maas-test-db:/// **** FAILS HERE

snap list
core18 20220309 2344 latest/stable canonical✓ base
core20 20220318 1405 latest/stable canonical✓ base
lxd 4.0.9-8e2046b 22753 4.0/stable/… canonical✓ -
maas 3.2.0~beta1-11298-g.b74133ead 19262 3.2/beta canonical✓ -
maas-cli 0.6.5 13 latest/stable canonical✓ -
maas-test-db 12.4-22-g.aed1dfe 91 3.1/stable canonical✓ -

Confirm that the DB is running:
Command
maas-test-db.psql
\l

maasdb=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------±---------±---------±--------±------±----------------------
maasdb | maas | UTF8 | C | C |
postgres | postgres | UTF8 | C | C |
template0 | postgres | UTF8 | C | C | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | C | C | =c/postgres +
| | | | | postgres=CTc/postgres


Problems start here, all commands fail, never prompts me for a MAAS URL:

Command
sudo maas init region+rack --database-uri maas-test-db:///
OR
sudo maas init region+rack --database-uri maas-test-db:-#,

Error Message —>
usage: maas [-h] COMMAND …

optional arguments:
-h, --help show this help message and exit

drill down:
COMMAND
login Log in to a remote API, and remember its description and credentials.
logout Log out of a remote API, purging any stored credentials.
list List remote APIs that have been logged-in to.
refresh Refresh the API descriptions of all profiles.
init Initialize controller.
apikey Used to manage a user’s API keys. Shows existing keys unless --generate or
–delete is passed.
configauth Configure external authentication.
createadmin Create a MAAS administrator account.
changepassword
Change a MAAS user’s password.

unrecognized arguments: region+rack --database-uri maas-test-db:///

command
sudo maas init

Configuring authentication
No such group: maas
No such group: maas

*** UPDATE***
Hello All,

I’m reinstalled the Ubuntu and began the MAAS install, I’ve now been able to to make it beyond the following steps:

Command:
sudo snap install --channel=3.2/beta maas
sudo snap install maas maas-test-db
sudo maas init region+rack --database-uri maas-test-db:///

Hi, welcome to the MAAS community :slight_smile:

I see you are using 3.2/beta - just remember that it is not ready for production. If you are doing proof of concept work, maybe it is better to use 3.1?

Cheers,
Anton

@nnagreg, did you ever completely resolve this issue?

Hi, I ran into the same issue.
The installation seems to be complete.

sudo apt-add-repository ppa:maas/3.4
sudo apt-get -y install maas
.
.
.

Setting up maas (1:3.4.2-14353-g.5a5221d57-0ubuntu1~22.04.1) ...
Processing triggers for ufw (0.36.1-4ubuntu0.1) ...
Processing triggers for man-db (2.10.2-1) ...
Processing triggers for dbus (1.12.20-2ubuntu4.1) ...
Processing triggers for install-info (6.8-4build1) ...
Processing triggers for libc-bin (2.35-0ubuntu3.7) ...
Scanning processes...
Scanning candidates...
Scanning linux images...

Restarting services...

Following the installation steps on https://maas.io/docs/how-to-install-maas

sudo maas init region+rack --database-uri "postgres://$MAAS_DBUSER:$MAAS_DBPASS@$HOSTNAME/$MAAS_DBNAME"
usage: maas [-h] COMMAND ...

options:
  -h, --help      show this help message and exit

drill down:
  COMMAND
    login         Log in to a remote API, and remember its description and credentials.
    logout        Log out of a remote API, purging any stored credentials.
    list          List remote APIs that have been logged-in to.
    refresh       Refresh the API descriptions of all profiles.
    init          Initialize controller.
    apikey        Used to manage a user's API keys. Shows existing keys unless --generate or --delete is passed.
    configauth    Configure external authentication.
    config-tls    Configure MAAS Region TLS.
    config-vault  Configure MAAS Region Vault integration.
    createadmin   Create a MAAS administrator account.
    changepassword
                  Change a MAAS user's password.

https://maas.io/

unrecognized arguments: region+rack --database-uri postgres://maas_db_user:<redacted>@localhost/maas_database

I ran in to the unrecognized argument for mass init error. Also maas status gives me the below issue.

sudo maas status
usage: maas [-h] COMMAND ...

options:
  -h, --help      show this help message and exit

drill down:
  COMMAND
    login         Log in to a remote API, and remember its description and credentials.
    logout        Log out of a remote API, purging any stored credentials.
    list          List remote APIs that have been logged-in to.
    refresh       Refresh the API descriptions of all profiles.
    init          Initialize controller.
    apikey        Used to manage a user's API keys. Shows existing keys unless --generate or --delete is passed.
    configauth    Configure external authentication.
    config-tls    Configure MAAS Region TLS.
    config-vault  Configure MAAS Region Vault integration.
    createadmin   Create a MAAS administrator account.
    changepassword
                  Change a MAAS user's password.

https://maas.io/

argument COMMAND: invalid choice: 'status' (choose from 'login', 'logout', 'list', 'refresh', 'init', 'apikey', 'configauth', 'config-tls', 'config-vault', 'createadmin', 'changepassword')

Please let me know if you need more info on this.

Thanks

Hi, you installed MAAS with Deb packages so you can’t maas init. When you have run sudo apt get install maas you have already initialized Maas as a region+rack so you should be already good to go

@r00ta Thank for helping out. You are correct maas was already initialized.

Hello,
I’m facing the init issue.
Following the steps from docu

snap list
Name        Version                  Rev    Tracking       Publisher       Notes
core        16-2.61.4-20240607       17200  latest/stable  canonical✓      core
core18      20240612                 2829   latest/stable  canonical✓      base
core20      20240416                 2318   latest/stable  canonical✓      base
core22      20240419                 1439   latest/stable  canonical✓      base
core24      20240528                 423    latest/stable  canonical✓      base
helm        3.15.3                   418    latest/stable  snapcrafters✪   classic
jq          1.5+dfsg-1               6      latest/stable  mvo✪            -
kubectl     1.30.3                   3315   latest/stable  canonical✓      classic
kubectx     0.9.5                    48     latest/stable  mhalano         classic
lxd         4.0.10-e664786           29619  4.0/stable/…   canonical✓      -
maas        3.5.0-16308-g.c799a1080  36363  3.5/stable     canonical✓      -
snapd       2.63                     21759  latest/stable  canonical✓      snapd
terragrunt  0+git.ae675d6            16     latest/stable  terraform-snap  -

 maas init region+rack --database-uri "postgres://$MAAS_DBUSER:$MAAS_DBPASS@$HOSTNAME/$MAAS_DBNAME"
Error: argument COMMAND: invalid choice: 'init' (choose from 'help', 'nodes', 'node', 'machines', 'machine', 'allocate', 'deploy', 'commission', 'release', 'abort', 'mark-fixed', 'mark-broken', 'power-off', 'power-on', 'ssh', 'devices', 'device', 'controllers', 'controller', 'fabrics', 'fabric', 'vlans', 'vlan', 'subnets', 'subnet', 'spaces', 'space', 'files', 'tags', 'users', 'login', 'logout', 'switch', 'profiles', 'shell')

I have ubuntu 22.04 trying to install maas from scratch allready few times but the same maas init case show’s up.
After it fails I do snap remove maas, apt remove postresql, retry the steps from docu and still the same init case. Any advices ? what’s happening here ?
Cheers

Hi @jack0ne

maas CLI behaves differently when called w/out sudo.
Do you have the same issue when you run it with sudo?

sudo maas init region+rack --database-uri "postgres://$MAAS_DBUSER:$MAAS_DBPASS@$HOSTNAME/$MAAS_DBNAME"

@jack0ne another thing to check: when you uninstall maas snap, can you check if there is no maas binary left on your system?

$> which maas

Hello Troyanov,

I’m removing the software using steps like here

my output is:
root@vm1:~# which maas
/usr/local/bin/maas

Does the binaries haven’t been properly removed ?

Hm, it looks like a leftover from a deb installation?
With MAAS installed via snap the proper location would be /snap/bin/maas

Can you please share the output of these commands?

$> dpkg -S /usr/local/bin/maas
$> apt list --installed | grep maas

Something strange is here:

root@vm1:~# ls /snap/bin/ | grep maas

root@vm1:~# dpkg -S maas
maas-region-api: /etc/cron.d/maas_remote_syslog_compress
maas-region-api: /etc/maas/drivers.yaml
maas-region-api: /etc/maas/preseeds/curtin
maas-region-api: /etc/maas/preseeds/curtin_userdata_windows
maas-region-api: /var/lib/maas/temporal
maas-region-api: /etc/maas/preseeds/curtin_userdata_custom
sosreport: /usr/lib/python3/dist-packages/sos/report/plugins/maas.py
maas-region-api: /etc/maas/preseeds/commissioning
maas-region-api: /etc/maas/preseeds/curtin_userdata
maas-region-api: /etc/maas/preseeds
maas-proxy: /etc/logrotate.d/maas-proxy
maas-agent: /etc/sudoers.d/99-maas-agent-sudoers
maas-region-api: /etc/logrotate.d/maas-region-api
maas-region-api: /etc/maas/preseeds/curtin_userdata_centos
maas-region-api: /etc/maas/preseeds/enlist
maas-region-api: /etc/maas/preseeds/curtin_userdata_suse
maas-netmon: /etc/sudoers.d/99-maas-netmon-sudoers
maas-agent: /var/cache/maas
maas-rack-controller: /etc/logrotate.d/maas-rack-controller
maas-rack-controller: /etc/sudoers.d/99-maas-sudoers
maas-rack-controller: /var/lib/maas/tftp_root
maas-region-api: /etc/maas/preseeds/curtin_userdata_ol
maas-region-api: /etc/maas
maas-region-api: /var/lib/bind/maas
maas-region-api: /etc/bind/maas
maas-region-api, maas-rack-controller: /var/lib/maas
maas-region-api: /var/lib/maas/image-storage


root@vm1:~# apt list --installed | grep maas

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

I will remove the packages using OS tools and try to reinstall.

Still some issue here: trying to remove all packages etc


root@vm1:/var/lib/maas# apt list --installed | grep maas

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

root@vm1:/var/lib/maas# snap list
Name        Version             Rev    Tracking       Publisher       Notes
core        16-2.61.4-20240607  17200  latest/stable  canonical✓      core
core18      20240612            2829   latest/stable  canonical✓      base
core20      20240416            2318   latest/stable  canonical✓      base
core22      20240419            1439   latest/stable  canonical✓      base
core24      20240528            423    latest/stable  canonical✓      base
helm        3.15.4              421    latest/stable  snapcrafters✪   classic
jq          1.5+dfsg-1          6      latest/stable  mvo✪            -
kubectl     1.30.4              3344   latest/stable  canonical✓      classic
kubectx     0.9.5               48     latest/stable  mhalano         classic
lxd         4.0.10-e664786      29619  4.0/stable/…   canonical✓      -
snapd       2.63                21759  latest/stable  canonical✓      snapd
terragrunt  0+git.ae675d6       16     latest/stable  terraform-snap  -
root@vm1:/var/lib/maas# dpkg -l | grep maas
root@vm1:/var/lib/maas# which maas
/usr/local/bin/maas


Overall reseach on OS an following this article https://askubuntu.com/questions/370347/unable-to-uninstall-maas-completely :

find / -iname maas
/usr/local/bin/maas
/usr/local/lib/python3.10/dist-packages/maas
root@vm1:/var/lib/maas# ls -l /etc/maas/
total 0
root@vm1:/var/lib/maas# ls -l /usr/local/bin/
activate-global-python-argcomplete            normalizer                                    pip3                                          python-argcomplete-check-easy-install-script  register-python-argcomplete
maas                                          pip                                           pip3.10                                       python-argcomplete-tcsh                       wsdump
root@vm1:/var/lib/maas# ls -l /usr/local/lib/python3.10/dist-packages/maas
total 4
drwxr-xr-x 7 root root 4096 Aug  8 11:27 client
root@vm1:/var/lib/maas# ls -l /usr/local/lib/python3.10/dist-packages/maas/client/
total 40
drwxr-xr-x 3 root root 4096 Aug  8 11:27 bones
-rw-r--r-- 1 root root 4053 Aug  8 11:27 enum.py
-rw-r--r-- 1 root root  520 Aug  8 11:27 errors.py
-rw-r--r-- 1 root root 7012 Aug  8 11:27 facade.py
drwxr-xr-x 3 root root 4096 Aug  8 11:27 flesh
-rw-r--r-- 1 root root 1399 Aug  8 11:27 __init__.py
drwxr-xr-x 2 root root 4096 Aug  8 11:27 __pycache__
drwxr-xr-x 3 root root 4096 Aug  8 11:27 utils
drwxr-xr-x 3 root root 4096 Aug  8 11:27 viscera

How to

It seems you had MAAS snap and deb package installed?
I am not sure how you ended up in this situation, but if this is a test/dev environment without any production workload I’d recommend to make a clean install.

And please share exact steps that you did during your MAAS setup.

I have ubuntu 22.04 trying to install maas from scratch allready few times but the same maas init case show’s up.

After snap remove maas and
apt autoremove maas
apt-get purge maas*
apt autoremove postgresql*
apt-get purge postgresql*

I do: dpkg -l | grep maas - non results and I go from here
snap install maas
apt install postgresql postgresql-contrib
Edit /etc/postgresql/12/main/pg_hba.conf

maas init region+rack --database-uri postgres://maas:password@localhost/maasdb - using proper values for variables and facing the same error:

root@vm1:~# maas init region+rack --database-uri “postgres://$MAAS_DBUSER:$MAAS_DBPASS@$HOSTNAME/$MAAS_DBNAME”
Error: argument COMMAND: invalid choice: ‘init’ (choose from ‘help’, ‘nodes’, ‘node’, ‘machines’, ‘machine’, ‘allocate’, ‘deploy’, ‘commission’, ‘release’, ‘abort’, ‘mark-fixed’, ‘mark-broken’, ‘power-off’, ‘power-on’, ‘ssh’, ‘devices’, ‘device’, ‘controllers’, ‘controller’, ‘fabrics’, ‘fabric’, ‘vlans’, ‘vlan’, ‘subnets’, ‘subnet’, ‘spaces’, ‘space’, ‘files’, ‘tags’, ‘users’, ‘login’, ‘logout’, ‘switch’, ‘profiles’, ‘shell’)

I cannot reproduce the same issue that you are facing.

May I ask you to try installing MAAS in a clean environment and share all the commands executed?
Also please pay attention that PostgreSQL 12 is not supported for MAAS 3.5
https://maas.io/docs/postgresql-deprecation-notices

Sure:

root@vm1:~# systemctl list-units | grep maas
run-snapd-ns-maas.mnt.mount loaded active mounted /run/snapd/ns/maas.mnt
snap-maas-36363.mount loaded active mounted Mount unit for maas, revision 36363
snap.maas.pebble.service loaded active running Service for snap application maas.pebble
root@vm1:~# snap remove maas
maas removed
root@vm1:~# systemctl list-units | grep maas
root@vm1:~# dpkg -l | grep maas
root@vm1:~# apt list --installed | grep maas

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

root@vm1:~# which maas
/usr/local/bin/maas

root@vm1:/usr/local/bin# apt update
Hit:1 http://de.archive.ubuntu.com/ubuntu jammy InRelease
Get:2 http://de.archive.ubuntu.com/ubuntu jammy-updates InRelease [128 kB]
Hit:3 http://de.archive.ubuntu.com/ubuntu jammy-backports InRelease
Get:4 http://de.archive.ubuntu.com/ubuntu jammy-security InRelease [129 kB]
Hit:5 https://ppa.launchpadcontent.net/maas/3.5/ubuntu jammy InRelease
Fetched 257 kB in 1s (470 kB/s)
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
3 packages can be upgraded. Run ‘apt list --upgradable’ to see them.
root@vm1:/usr/local/bin# apt install snapd lxd lxd-client python3-lxc python3-openstackclient
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
Package lxd is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package ‘lxd’ has no installation candidate
E: Unable to locate package lxd-client
root@vm1:/usr/local/bin# snap install maas
maas (3.5/stable) 3.5.0-16308-g.c799a1080 from Canonical✓ installed

postgresql is allready there

root@vm1:~# tail -n 1 /etc/postgresql/14/main/pg_hba.conf
host maas_db maas_user 0/0 md5

seting up for variables:
root@vm1:~# MAAS_DBUSER=“maas_user”
MAAS_DBPASS=“maas_dbpass_679”
MAAS_DBNAME=“mass_db”
HOSTNAME=“localhost”

maas init region+rack --database-uri postgres://maas:password@localhost/maasdb
Error: argument COMMAND: invalid choice: ‘init’ (choose from ‘help’, ‘nodes’, ‘node’, ‘machines’, ‘machine’, ‘allocate’, ‘deploy’, ‘commission’, ‘release’, ‘abort’, ‘mark-fixed’, ‘mark-broken’, ‘power-off’, ‘power-on’, ‘ssh’, ‘devices’, ‘device’, ‘controllers’, ‘controller’, ‘fabrics’, ‘fabric’, ‘vlans’, ‘vlan’, ‘subnets’, ‘subnet’, ‘spaces’, ‘space’, ‘files’, ‘tags’, ‘users’, ‘login’, ‘logout’, ‘switch’, ‘profiles’, ‘shell’)

but if i use the full path … magic happend :smiley:

/snap/bin/maas init region+rack --database-uri root@vm1:/snap/bin# /snap/bin/maas init region+rack --database-uri “postgres://maas_user:maas_dbpass_679@localhost/mass_db”
MAAS URL [default=http://10.100.131.17:5240/MAAS]:
MAAS has been set up.

If you want to configure external authentication or use
MAAS with Canonical RBAC, please run

sudo maas configauth

To create admins when not using external authentication, run

sudo maas createadmin

To enable TLS for secured communication, please run

sudo maas config-tls enable

Blockquote

Sow it’s look like solved but strand are the old bins in /usr/local/bin/maas

I can only guess how you ended up with several binaries of maas on you machine, but you managed to solve it and thats great!