Devstack Services - openstack

I have installed ceilometer services in a devstack environnement by enabling them in local.conf"
enable_service ceilometer-acompute ceilometer-acentral ceilometer-anotification$
enable_service ceilometer-alarm-evaluator,ceilometer-alarm-notifier
enable_service ceilometer-api
enable_service ceilometer-aipmi
but I can not list the services when I do a rejoin-stack.sh and type Ctrl + a + ".
How I should resolve this problem, because I need to restart the ceilometer services as I am installing kwapi ?
Thank you in advance .

Ceilometer is middleware that is used by the other services. To "restart ceilometer" you should restart the entire stack with ./unstack.sh followed by ./stack.sh. If you want to uninstall and re-install, you could run ./clean.sh followed by ./stack.sh.

When you wanna restart services with devstack, have 2 main ways:
Run ./rejoin-stack.sh and press ctrl C + ctrl D to kill all services. Then re-run ./rejoin_stack.sh and press ctrl A + ctrl D for detaching. Then, all services were restarted.
Run "ps -ef | grep your_service_name" to find and kill the service that you need to restart. When you run above command, you will find the exact command to start that service. :D
But, I recommend you use the first way when restart any service with devstack. It is the best way to make your system run smoothy.

First cd to folder devstack
You can find the file ./rejoin_stack.sh
Execute the same.
It will be executed and screen will be opened for access.
press ctrl + a + shift + "
Then it will be listing the running services
can move to service which needs to be stopped by scrolling towards it.
on the service which is needs to be stopped press enter
then press ctrl + c , it will stop the service
then press up arrow key to run the service again
service will be restarted successfully.

Related

How to shut down a computer (host)

I know it sounds weird, but I have a case where Deno would need to shutdown its own host (and kill its own process therefore). Is this possible?
I am specifically needing this for linux (lubuntu), if that's relevant. I guess this requires sudo rights, which sucks but would be an option.
For those interested in details: I'm coding a minecraft server software and if the server has no player for 30 minutes, it will shut itself down to save some power. A raspberry PI that runs 24/7 anyways, has a wake on lan feature, so that it can boot again. After boot, the server manager software would automatically start as a linux service.
You can create a subprocess to do this:
await Deno.run({ cmd: ["shutdown", "-h", "now"] }).status();
Concepts
Deno is capable of spawning a subprocess via Deno.run.
--allow-run permission is required to spawn a subprocess.
Spawned subprocesses do not run in a security sandbox.
Communicate with the subprocess via the stdin, stdout and stderr streams.
Use a specific shell by providing its path/name and its string input switch, e.g. Deno.run({cmd: ["bash", "-c", "ls -la"]});
See also command line - Shutdown from terminal without entering password? - Ask Ubuntu for ideas on how to avoid needing sudo to call shutdown or alternative commands that you can invoke from Deno instead.
To extend on what #mfulton2 wrote, here is how I made it work, so that I did not need to start the program with sudo rights, but still was able to shut down the computer without the use of sudo outside or within the app.
Open or create the following file: sudo nano /etc/sudoer
Add the line username ALL = NOPASSWD: /sbin/shutdown
Add this line %admin ALL = NOPASSWD: /sbin/shutdown
In your deno script, write Deno.run({ cmd: ["shutdown", "-h", "now"]}).status();
Execute script!
Keep in mind that any experienced linux user would potentially tell you that this is very dangerous (it probably is) and that it might not be the very best way. But IMHO, the damage this can cause is minor enough, as it only affects the shutdown command.

az acr login raises DOCKER_COMMAND_ERROR with message docker daemon not running

Windows 11 with wsl2 ubuntu-22.04.
In Windows Terminal I open a PowerShell window and start wsl with command:
wsl
Then I start the docker daemon in this window with the following command:
sudo dockerd
It prompts for the admin password, which I enter and then it starts the daemon.
Next I open a new PowerShell window in Windows Terminal, run wsl and run a container to verify everything is working. So far so good.
Now I want to login to Azure Container Registry with the following command:
az acr login -n {name_of_my_acr}
This returns the following error:
You may want to use 'az acr login -n {name_of_my_acr} --expose-token' to get an access token,
which does not require Docker to be installed.
An error occurred: DOCKER_COMMAND_ERROR
error during connect: This error may indicate that the docker daemon is not running.:
Get "http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.24/containers/json":
open //./pipe/docker_engine: The system cannot find the file specified.
The error suggests the daemon is not running, but since I can run a container I assume the deamon is running - otherwise I would not be able to run a container either, right? What can I do to narrow down or resolve this issue?
Docker version info using docker -v command:
Docker version 20.10.12, build 20.10.12-0ubuntu4
An error occurred: DOCKER_COMMAND_ERROR error during connect: This error may indicate that the docker daemon is not running.: Get"http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.24/containers/json": open //./pipe/docker_engine: The system cannot find the file specified.
The above error due to some times docker might be disabled from starting on boot or login.
The following suggestion can be used:
Open the Powershell and type dockerd which will start the daemon.
Open the docker with run as administrator and run the command as below :
C:\Program Files\Docker\Docker\DockerCli.exe -SwitchDaemon
Check the version of WSL2, if it is older it might be a problem and then download the latest package WSL2 Linux kernel update package for x64-bit machines in the windows 11.
Reference:
Manual installation steps for older versions of WSL | Microsoft Docs

ssh command -T option

I'm wondering what the -T option in the following command does, cannot see this option in the manual somehow:
$ ssh -T git#gitlab.com
Welcome to GitLab, Simeon !
Could somebody explain?
I explained before what TTY was: a text terminal is needed when you open an interactive session to a remote server.
But: in the context of a remote Git repository hosting server (GitHub, Gitlab, BitBucket, ...), no remote server will ever allow you to open an interactive session (for security reason)
Then only reason why you would still do an ssh -T git#github.com would be to test if you are correctly authenticated, and the session would immediately end with:
Hi username! You've successfully authenticated,
but GitHub does not provide shell access.
Since no tty is needed for that test, you should use the -T option when making this test.

Phabricator Daemon: `phd` was unable to switch to the correct user with `sudo`

I am currently trying to install and run Phabricator on a Raspberry Pi for personal use (even though It's not recommended by Phacility, I thought I still give it a try). So far, I was able to setup everything except the phd user as daemon.
/etc/passwd
phd:x:1001:1001:,,,:/home/phd:/bin/bash
/etc/shadow
phd:NP:17107:0:99999:7:::
I created the user phd and gave im NP in shadow, but that still makes Phabricator unable to switch to phd when starting the daemon.
sudo ./bin/phd restart
Interrupting process 19517...
Process 19517 exited.
Freeing active task leases...
Freed 0 task lease(s).
Starting daemons as phd
Launching daemons:
(Logs will appear in "/var/tmp/phd/log/daemons.log".)
PhabricatorRepositoryPullLocalDaemon (Static)
PhabricatorTriggerDaemon (Static)
PhabricatorTaskmasterDaemon (Autoscaling: group=task, pool=4, reserve=0)
Usage Exception: Daemons are configured to run as user "phd" in
configuration option `phd.user`, but the current user is "root" and
`phd` was unable to switch to the correct user with `sudo`. Command output:
Command failed with error #255!
COMMAND
exec sudo -En -u 'phd' -- ./phd-daemon '--verbose'
STDOUT
(empty)
STDERR
[2016-11-04 08:54:54] EXCEPTION: (Exception) Specified daemon PID directory
('/var/tmp/phd/pid') does not exist or is not writable by the daemon user!
at [<phutil>/src/daemon/PhutilDaemonOverseer.php:115]
arcanist(head=master, ref.master=fad85844314b), phabricator(head=master,
ref.master=6982bded7124), phutil(head=master, ref.master=2b7b1007bf87)
#0 PhutilDaemonOverseer::__construct(array) called at
[<phabricator>/scripts/daemon/launch_daemon.php:13]
What I tried is starting the phd user via su phd -c "/home/phd/phabricator/bin/phd restart" but that queries a password from me.
I kept close to this guide https://secure.phabricator.com/book/phabricator/article/diffusion_hosting/ as well as this https://gist.github.com/sparrc/b4eff48a3e7af8411fc1
Any help is really, really appreciated!
Thanks to #JSON who just made me aware of a line that I apparently always missed, the solution was:
sudo chmod go+w /var/tmp/phd/pid
This will make the directoy writeable and free for all and let me start the error
We usually run
sudo -u phd ./bin/phd restart

Restarting a service in Openstack installed using Devstack

How to restart a specific openstack-service installed using devstack?
Rejoin stack screen as
./rejoin-stack.sh
and move to the specified service page using ctrl+a+", then type the number of the screen you need to go.
Hit 9 and then ctrl+C. The service would be stopped now. Re-run the following devstack command to start the service:
(e.g for nova-network)
cd /opt/stack/nova && /usr/bin/nova-network --config /etc/nova/nova.conf || echo "n-net failed to start" | tee "/opt/stack/stack/n-net.failure"
Hit Ctrl+d to detach from the stack screen.
To run screen command
screen -r
Now, you will be in screen window and you can see the list of Openstack services; Like "q-svc", "horizon", "key-access" in the bottom of the screen;
The current active screen will be marked with * like "horizon*"
To move to specific Openstack service press
"Ctrl + a" and "0-9"
Example: "Ctrl + a" 5
to jump to actual service; You can also move to next or previous screen using the below commands
"Ctrl + a" and n --- > for next
"Ctrl + a" and p --- > for previous
Now to stop and start the service; Go the respective screen window and press
"Ctrl + c"
To stop the service; This will now show the bash screen in the respective screen window; and to start the service, press UP arrow mark to see the last executed command in the screen window and press enter to start the same.
Life is easier with screen to start and stop the Openstack services configured to run with Devstack.
When ./stack.sh completes, openstack is ostensibly running.
as your stack user, you can then issue this command:
screen -dr
this should open up a screen session with windows for each of the services. the services are running from those screen terminal sessions or ptys.
you can simply kill the process and restart it from those ptys.
of course standard logical order of operations apply. if mysql is dead, nova-api won't start up very well. same goes for keystone being off. so, pay attention to dependencies.
if you are unsure of how to execute the services in the terminals, first do a ps auxww | grep service or something to that affect. That should provide some insight on how to run the binaries again.
Good luck.
rejoin-stack.sh was remove according this git commit, you need to do screen -c /path/to/devstack_install/stack-screenrc
Run this command as root (for example: to start keystone service)
$ systemctl start devstack#keystone.service
You can use restart, stop, status, etc. in place of start as your need.
you can use wildcard as well. Like as below.
$ systemctl start devstack#*
=> it will start all devstack services.
Things has changed in new version devstack.
By default DevStack is run with all the services as systemd unit
files. Systemd is now the default init system for nearly every Linux
distro, and systemd encodes and solves many of the problems related to
poorly running processes.
Assuming the unit n-cpu to make the examples more clear.
Enable a unit (allows it to be started):
sudo systemctl enable devstack#n-cpu.service
For more information, visit https://docs.openstack.org/devstack/latest/systemd.html
you can use systemctl start devstack#* to restart every devstack service

Resources