Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem when updating from 0.29.6 to .9 on Ubuntu 16.04 #1292

Open
GarryG opened this issue Jul 29, 2021 · 3 comments
Open

Problem when updating from 0.29.6 to .9 on Ubuntu 16.04 #1292

GarryG opened this issue Jul 29, 2021 · 3 comments

Comments

@GarryG
Copy link

GarryG commented Jul 29, 2021

While updating through the regular packages w/ "apt upgrade", I get these errors when a restart of the daemon is initiated:

invoke-rc.d: initscript nipapd, action "start" failed.
● nipapd.service - LSB: NIPAP XML-RPC server
Loaded: loaded (/etc/init.d/nipapd; bad; vendor preset: enabled)
Active: failed (Result: exit-code) since Do 2021-07-29 15:46:44 CEST; 35ms ago
Docs: man:systemd-sysv-generator(8)
Process: 3182 ExecStart=/etc/init.d/nipapd start (code=exited, status=1/FAILURE)

Jul 29 15:46:44 ipam1-nbg1 nipapd[3182]: 2021-07-29 15:46:44,154: backend ERROR Unable to execute query: must be owner of function calc_indent
Jul 29 15:46:44 ipam1-nbg1 nipapd[3182]: 2021-07-29 15:46:44,164: backend ERROR Unable to execute query: must be owner of function calc_indent
Jul 29 15:46:44 ipam1-nbg1 nipapd[3182]: 2021-07-29 15:46:44,174: backend ERROR Unable to execute query: must be owner of function calc_indent
Jul 29 15:46:44 ipam1-nbg1 nipapd[3182]: 2021-07-29 15:46:44,184: backend ERROR pgsql: FATAL: remaining connection slots are reserved for non-replication superuser connections
Jul 29 15:46:44 ipam1-nbg1 nipapd[3182]: ERROR: Backend unable to connect to database
Jul 29 15:46:44 ipam1-nbg1 nipapd[3182]: ...fail!
Jul 29 15:46:44 ipam1-nbg1 systemd[1]: nipapd.service: Control process exited, code=exited status=1
Jul 29 15:46:44 ipam1-nbg1 systemd[1]: Failed to start LSB: NIPAP XML-RPC server.
Jul 29 15:46:44 ipam1-nbg1 systemd[1]: nipapd.service: Unit entered failed state.
Jul 29 15:46:44 ipam1-nbg1 systemd[1]: nipapd.service: Failed with result 'exit-code'.

Is there anything obvious I might be doing wrong?

@jplitza
Copy link
Contributor

jplitza commented Dec 13, 2021

I faced the same problem updating on Ubuntu 18.04. I guess the database initialization took place under the "postgres" user, but the schema migration 6→7 is executed as user "nipap", which doesn't work.

I found this answer on StackOverflow that shows how to mass-change the owner of functions. You also have to change the owner of the tables (although these aren't nearly as many).

@mkrogh
Copy link

mkrogh commented Jan 4, 2022

Also had the same issue on ubuntu 18.04.

Fixed it by running the following sql in sudo -u postgres psql nipap

ALTER FUNCTION calc_indent OWNER TO nipap;
ALTER FUNCTION array_undup OWNER TO nipap;
ALTER FUNCTION calc_tags OWNER TO nipap;
ALTER FUNCTION find_free_ranges(integer) OWNER TO nipap;
ALTER FUNCTION find_free_ranges(integer[]) OWNER TO nipap;
ALTER FUNCTION iprange2cidr OWNER TO nipap;
ALTER FUNCTION calc_pool_free_prefixes(integer,integer,cidr) OWNER TO nipap;
ALTER FUNCTION calc_pool_free_prefixes(ip_net_pool,integer,cidr) OWNER TO nipap;
ALTER FUNCTION cidr_count OWNER TO nipap;
ALTER FUNCTION find_free_prefix(integer,inet[],integer) OWNER TO nipap;
ALTER FUNCTION find_free_prefix(integer,inet[],integer,integer) OWNER TO nipap;
ALTER FUNCTION get_prefix OWNER TO nipap;
ALTER FUNCTION vrf_rt_order OWNER TO nipap;
ALTER FUNCTION tf_ip_net_plan__prefix_iu_before OWNER TO nipap;
ALTER FUNCTION tf_ip_net_vrf_iu_before OWNER TO nipap;

The functions I found by brute force running sudo /usr/sbin/nipapd --auto-upgrade-db over and over seeing which new function it broke at. And when postgres complained about function names not being unique SELECT oid::regprocedure FROM pg_proc WHERE proname = 'find_free_ranges';. There is probably a smarter way to see the functions associated with nipap, but this did the trick for now.

@biwhite
Copy link

biwhite commented Jan 11, 2022

Also had the same issue on ubuntu 18.04.

Fixed it by running the following sql in sudo -u postgres psql nipap

ALTER FUNCTION calc_indent OWNER TO nipap;
ALTER FUNCTION array_undup OWNER TO nipap;
ALTER FUNCTION calc_tags OWNER TO nipap;
ALTER FUNCTION find_free_ranges(integer) OWNER TO nipap;
ALTER FUNCTION find_free_ranges(integer[]) OWNER TO nipap;
ALTER FUNCTION iprange2cidr OWNER TO nipap;
ALTER FUNCTION calc_pool_free_prefixes(integer,integer,cidr) OWNER TO nipap;
ALTER FUNCTION calc_pool_free_prefixes(ip_net_pool,integer,cidr) OWNER TO nipap;
ALTER FUNCTION cidr_count OWNER TO nipap;
ALTER FUNCTION find_free_prefix(integer,inet[],integer) OWNER TO nipap;
ALTER FUNCTION find_free_prefix(integer,inet[],integer,integer) OWNER TO nipap;
ALTER FUNCTION get_prefix OWNER TO nipap;
ALTER FUNCTION vrf_rt_order OWNER TO nipap;
ALTER FUNCTION tf_ip_net_plan__prefix_iu_before OWNER TO nipap;
ALTER FUNCTION tf_ip_net_vrf_iu_before OWNER TO nipap;

Same here, although I needed to tab-complete the arguments list before each OWNER, otherwise it chucked errors back. as below

nipap=#  ALTER FUNCTION calc_indent OWNER TO nipap;
ERROR:  syntax error at or near "OWNER"
LINE 1: ALTER FUNCTION calc_indent OWNER TO nipap;
                                   ^
nipap=#  ALTER FUNCTION calc_indent (integer, inet, integer) OWNER TO nipap;
ALTER FUNCTION

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants