Syncing Time Zone via IPMI

After using UTC time zone exclusively on my servers for a while, I decided to give local time a try for the next 6 months or so. In addition to “normal” shenanigans time zones bring, I got another interesting one – my IPMI servers required me to manually tell them whether daylight saving is in effect or not. What that meant is that, even with time zone set correctly, every daylight saving time change my server’s BMC will be 1 hour off.

As all my servers were Supermicro (M11SDV-4CT-LN4F and A1SRi-2558F) I decided to use Supermicro’s powerful IPMI to programmatically deal with that issue.

My thoughts were going in the following direction. As long as I keep script on my main server that will update time zone information (if needed) twice a day (at 02:00 and 03:00), it should be enough to keep me happy. As retrieving time zone information via IPMI is not something that’s standardized, I contacted Supermicro’s support to get the details. While they didn’t really provide those details, they did point me toward their SMCIPMITool utility.

Unfortunately this didn’t fully solve it for me as it didn’t support FreeBSD. However, it did have debug mode (in SMCIPMITool.properties set debug_level=1) and this really helped.

Terminal
./SMCIPMITool 192.168.1.1 admin password ipmi oem x10cfg ntp timezone

[ YOU -> BMC : 30 68 01 00 00 ]
[ YOU <- BMC : 00 01 2D 30 37 30 30 01 ]

With these response bytes it was easy enough to construct ipmitool raw bytes:

Terminal
ipmitool -I lanplus -H 192.168.1.1 -U admin -P password raw 0x30 0x68 0x01 0x00 0x00
01 2d 30 30 30 30 00

The first byte tells us if NTP is enabled or not, next 5 bytes tells time zone in ASCII (+0000), while the last byte says if daylight saving is on or not.

Using the same principle, it’s easy enough to update IPMI:

Terminal
ipmitool -I lanplus -H 192.168.1.1 -U admin -P password raw 0x30 0x68 0x01 0x
01 0x00 0x01 0x2d 0x30 0x37 0x30 0x30 0x00

Trying to script this change is a bit tricky. There isn’t really easy and fireproof method of determining if daylight savings is active. However, I decided to ignore that field and just set offset every time as that’s really easy to determine (date +%z).

The final script was looking something like this:

ipmi-update
#!/bin/bash

IP="192.168.1.1"
USER="admin"
PASSWORD="password"

CURR_STATE=`ipmitool -I lanplus -H $IP -U $USER -P $PASSWORD raw 0x30 0x68 0x01 0x00 0x00 | xargs | tr ' ' '\n' | awk '{printf " 0x" $1}' | xargs`
NEXT_STATE="0x01 `date +%z | hexdump -C | head -1 | cut -d' ' -f3-7 | tr ' ' '\n' | awk '{printf " 0x" $1}'| xargs` 0x00"

if [[ "$CURR_STATE" != "$NEXT_STATE" ]]; then
ipmitool -I lanplus -H $IP -U $USER -P $PASSWORD raw 0x30 0x68 0x01 0x01 0x00 $NEXT_STATE 2>/dev/null
fi

Muting Sound Every Time Ubuntu Starts

Ubuntu 19.04 doesn’t remember audio settings between reboots. This means that after every reboot I need to mute sound again and again. Since making it remember volume between reboots is hard, I went for the next best thing – mute it on reboot to start with.

Command is easy:

Terminal
amixer set Master mute

To perform it on every startup, we can use @reboot crontab directive. However, be careful which crontab you’re editing as this statement is applicable only for root. It will simply be ignored for any other account’s crontab.

Keeping that in mind, this is what sorted it out for me

Terminal
sudo crontab -e
crontab
@reboot /usr/bin/amixer set Master mute

Now my laptop starts muted and any unmuting is left to my discretion.

Mini Čobanac

Pretty much every time I’m back in Croatia I have čobanac – a regional spicy stew with lot of meat and paprika. However, I never actually made one myself as it’s a meal that needs a lot of cooking (ideally in a huge pot) and variety of recipes makes it impossible to make one-and-only proper recipe. However, wife and I figured we can adjust the recipe to get a tasty 4 liter meal in a small 5 liter pot.

As compared to normal čobanac, there are a few adjustments. The most noticeable of all is lack of hotness. Most of hotness in čobanac is actually from hot peppers and you’ll note they are absent from the ingredient list. As parts of my family have different spice tolerance, here we have a non-spicy base and all spiciness can be added later either as cayenne or by using separately cooked chili peppers.

Speaking of hot peppers, west USA where I live doesn’t really have the same varieties I’m used to in Croatia. I know many think chili doesn’t taste of anything but the lovers of hot know there is a difference. If you cannot get feferoni pepper, serrano will probably be the closest in taste.

When it comes to meats, the more the merrier. It’s common to have three or more meats but I found that pork knuckles actually make the biggest difference. I know they are not everybody’s cup of tea but nobody is forcing you to eat them. However do cook them for both the flavor and density. Other meats should be added as goulash-sized cubes with the hardest meat coming in first. And do not get lean cuts as fatty meat will impart more taste.

Any 5 liter pot will do but two features are really beneficial. The first one is a substantial amount of metal that can keep temperature. This will not only save you some electricity but also even out the heat making burned meal less likely. The other feature is etched volume markings. It makes trivial to add liquid and maintain its level. Yes, you can eye the level too but this removes all the doubt.

Cooking time can vary greatly but as a general rule you want to take it slow. Just keep it as barely boiling and give it 4-5 hours at minimum.

Usual timetable can look something like this:

07:00 This is an excellent time to start čobanac if you want it ready for 13:00 meal. Just dice three onions as fine as possible (only pussies use machine for this) and start cooking them at low heat (3½) with a generous helping of oil. Do NOT burn them – mix often.

07:30 Your onions should be really soft now and it’s a good time to add shredded carrots and celery root in addition to a finely chopped garlic. Add water for mush-like consistency. Risk of burning stuff is greatly reduced now but do not forget to occasionally give it a mix.

07:45 Add pork knuckle and bring water up to 2 liter line. Also add smoked paprika, salt, and black pepper. Increase heat just a smidgen (4) and leave to a slow bubble mixing it here and there. As water boils away, add more to keep it at 2 liter line. If you have some extra bones, this is a good time to get them in.

09:00 Add beef and bring water to 3 liter line so that all beef is covered. Leave it to slowly boil.

09:30 Add pork and bring water to the final 4 liter level. As it slowly boils, add back water every half an hour with an occasional stir. If you are adding more meat later (e.g. lamb), keep water level a bit lower than 4 liters so that extra meat will fit.

10:00 If you have any lamb or similar softer meat, this is a great time to toss it in. While pork and beef are sufficient, variety doesn’t hurt.

11:30 Add strained tomatoes. At this point one could add hot peppers or if trying to make a non-spicy base, here we can add just a few small sweet peppers. Spice-lovers can alternatively look into cooking hot peppers in a separate pan with a bit of oil, strained tomatoes, and water. If you want to stir up a controversy, you can also add 200g of sliced crimini mushrooms.

12:30 Turn off the heat and leave it to cool down.

13:00 Congratulations, your čobanac is done and ready to serve with a few slices of bread and a simple salad. It took a while but I promise it’s worth it!

Ingredients for 4 liters of “basic” čobanac:

  • 3 onions
  • 1 dcl oil
  • 2 carrots
  • ½ celery root
  • 4 garlic cloves
  • 4 table spoons of smoked paprika
  • A dash of cayenne powder
  • 1 table spoon of salt
  • 1 tea spoon of pepper
  • 1 pork knuckle
  • 1 kg beef
  • 1 kg pork
  • 1/2 cup strained tomatos
  • 2-3 sweet peppers

Redirect Only Errors to StdOut

The most usual thing I want with redirect is just throwing errors to null:

Terminal
command >/dev/null

Alternatively, one can throw everything to null:

Terminal
command >/dev/null 2>1

However, what if you want only error being shown and proper output ignored? Well, there is a redirect for that too:

Terminal
command 2>1 >/dev/null