Author Topic: Mananging Talos II remotely via BMC.  (Read 751 times)

bloudraak

  • Newbie
  • *
  • Posts: 12
  • Karma: +1/-0
    • View Profile
Mananging Talos II remotely via BMC.
« 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:

Code: [Select]
$ 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:
Code: [Select]
obmcutil -h
But when I run one of the commands, I always get an error.

Code: [Select]
$ 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.

Borley

  • Full Member
  • ***
  • Posts: 134
  • Karma: +10/-0
    • View Profile
Re: Mananging Talos II remotely via BMC.
« Reply #1 on: April 17, 2022, 10:57:52 am »
Try checking with
Code: [Select]
obmcutil state
And chassis power can be manipulated
Code: [Select]
obmcutil poweron
obmcutil poweroff
Blackbird C1P9S01, CPU 02CY650, 2x 8GB 2666 RAM, 1024GB M.2 SSD, AMD RX 560X, 2U heatsink, 500W SFX PSU, Debian 11

bloudraak

  • Newbie
  • *
  • Posts: 12
  • Karma: +1/-0
    • View Profile
Re: Mananging Talos II remotely via BMC.
« Reply #2 on: April 18, 2022, 08:28:37 am »
The issue I'm getting is that the command always fails with mapper
Code: [Select]
obmcutil state
/usr/bin/obmcutil: line 160: mapper: command not found

ClassicHasClass

  • Sr. Member
  • ****
  • Posts: 368
  • Karma: +27/-0
  • Talospace Earth Orbit
    • View Profile
    • Floodgap
Re: Mananging Talos II remotely via BMC.
« Reply #3 on: April 18, 2022, 05:07:11 pm »
This should be in /usr/sbin/mapper. Is it not there?

Code: [Select]
root@tim-bmc:~# ls -l `which mapper`
-rwxr-xr-x    1 root     root         11272 Feb 19  2020 /usr/sbin/mapper

bloudraak

  • Newbie
  • *
  • Posts: 12
  • Karma: +1/-0
    • View Profile
Re: Mananging Talos II remotely via BMC.
« Reply #4 on: April 18, 2022, 09:47:00 pm »
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.

bloudraak

  • Newbie
  • *
  • Posts: 12
  • Karma: +1/-0
    • View Profile
Re: Mananging Talos II remotely via BMC.
« Reply #5 on: April 20, 2022, 12:00:14 pm »
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.

ClassicHasClass

  • Sr. Member
  • ****
  • Posts: 368
  • Karma: +27/-0
  • Talospace Earth Orbit
    • View Profile
    • Floodgap
Re: Mananging Talos II remotely via BMC.
« Reply #6 on: April 21, 2022, 08:11:44 pm »
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.

bloudraak

  • Newbie
  • *
  • Posts: 12
  • Karma: +1/-0
    • View Profile
Re: Mananging Talos II remotely via BMC.
« Reply #7 on: April 21, 2022, 11:30:57 pm »
Makes sense. Since I’m running doing this in Jenkins, it seems wise to have a dedicated account and change the password frequently.