Raptor Computing Systems Community Forums (BETA)
Software => Operating Systems and Porting => Topic started by: bloudraak on April 17, 2022, 10:07:17 am
-
I'm trying to run BMC commands via SSH to check the power status of the host, turn it on, and turn it off.
I can successfully SSH into the host and run some commands, for example:
$ cat /etc/os-release
ID="openbmc-phosphor"
NAME="Phosphor OpenBMC (Phosphor OpenBMC Project Reference Distro)"
VERSION="2.7.0-dev"
VERSION_ID="2.7.0-dev-571-g67efd9872"
PRETTY_NAME="Phosphor OpenBMC (Phosphor OpenBMC Project Reference Distro) 2.7.0-dev"
BUILD_ID="2.7.0-dev"
OPENBMC_TARGET_MACHINE="talos"
I know the BMC versioning is probably out of date, but Raptor isn't making it easy to stay current (neither does Dell and other vendors).
Looking at the documentation, it seems obmcutil would be the right tool for the job, and it gives me some help:
obmcutil -h
But when I run one of the commands, I always get an error.
$ obmcutil osstate
/usr/bin/obmcutil: line 181: mapper: command not found
Are there any other commands I can run via SSH to check the status of power and power on a device when it's powered off?
For background, I'm using my Talos II for release engineering and running Ubuntu 20.04 and other operating systems under KVM (whichever I can get my hands on). I'm using Jenkins to automate tasks through SSH, especially patching and powering off devices. Power is expensive in California, with the most expensive time to run machines being the evening. Running homelab sets me back around $200+ extra a month. That's a lot of wasted beers -- or 4+ trips to the Zoo with my daughter. So I turn servers off when not in use. My Talos II consumes 85W+, so it doesn't run cheap. I need to figure out ways to power the host on when Jenkins needs it, such as building stuff for POWER and then gracefully power it down when not in use. I can shut down the operating systems via Jenkins but have no way to turn it back on.
I'm exploring how to automatically build and test BMC, which would involve Jenkins uploading and updating it. Since Jenkins (and other CI/CD tools I'm playing with) natively support SSH, I think it may be worthwhile to explore what else I can do when I SSH into the BMC.
-
Try checking with
obmcutil state
And chassis power can be manipulated
obmcutil poweron
obmcutil poweroff
-
The issue I'm getting is that the command always fails with mapper
obmcutil state
/usr/bin/obmcutil: line 160: mapper: command not found
-
This should be in /usr/sbin/mapper. Is it not there?
root@tim-bmc:~# ls -l `which mapper`
-rwxr-xr-x 1 root root 11272 Feb 19 2020 /usr/sbin/mapper
-
It's there. :)
I created a custom admin user account, and /usr/sbin/ is not in the path. That's why obmcutil couldn't find it. Once I ran as root, the command worked as expected.
-
Thanks for all the help. Pointing out the path for mapper helped a ton.
It seems the admin user I created didn't have sufficient permissions. When I SSH'ed into BMC with the root account, I was able to shut down the device and then turn it back on.
-
Yes, I've never run any commands on the BMC as any user other than root. Not ideal, but I'm not in there much either.
-
Makes sense. Since I’m running doing this in Jenkins, it seems wise to have a dedicated account and change the password frequently.