Geo: Could not change to directory "/root" while running gitlab-ctl promote-to-primary-node
Summary
(Summarize the bug encountered concisely)
When attempting a promotion as root switching to /root
fails. The promotion itself succeeds.
Steps to reproduce
- Run
sudo -i
- Run
gitlab-ctl promot-to-primary-node
What is the current bug behavior?
(What actually happens)
Switching to /root
fails
What is the expected correct behavior?
(What you should see instead)
Switching to /root
succeeds
Relevant logs and/or screenshots
root@host:~# gitlab-ctl promote-to-primary-node
Ensure you have completed the following manual preflight checks:
- Check if you need to migrate to Object Storage
- Review configuration of each secondary node
- Run system checks
- Check that secrets match between nodes
- Ensure Geo replication is up-to-date
- Verify the integrity of replicated data
- Notify users of scheduled maintenance
Please read https://docs.gitlab.com/ee/administration/geo/disaster_recovery/planned_fail
over.html#preflight-checks
Did you perform all manual preflight checks (y/n)?
y
---------------------------------------
WARNING: Make sure your primary is down
If you have more than one secondary please see https://docs.gitlab.com/ee/gitlab-geo/dis
aster-recovery.html#promoting-secondary-geo-replica-in-multi-secondary-configurations
There may be data saved to the primary that was not been replicated to the secondary bef
ore the primary went offline. This data should be treated as lost if you proceed.
---------------------------------------
*** Is primary down? (N/y): y
All preflight checks have passed. This node can now be promoted.
Promoting the PostgreSQL to primary...
could not change directory to "/root": Permission denied <--------- Why are we changing dir?
waiting for server to promote.... done
server promoted
[....]
Results of GitLab environment info
Expand for output related to GitLab environment info
sudo gitlab-rake gitlab:env:info System information System: Ubuntu 18.04 Proxy: no Current User: git Using RVM: no Ruby Version: 2.6.6p146 Gem Version: 2.7.10 Bundler Version:1.17.3 Rake Version: 12.3.3 Redis Version: 5.0.9 Git Version: 2.27.0 Sidekiq Version:5.2.7 Go Version: unknown GitLab information Version: 13.1.1-ee Revision: a604fffd4ba Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: PostgreSQL DB Version: 11.7 URL: http://xxx HTTP Clone URL: http://xxx.git SSH Clone URL: git@fxxx:some-group/some-project.git Elasticsearch: no
Possible fixes
Edited by Fabian Zimmer