Sysadmin Mega Thread

It’s because the core operating system became no longer aligned

:ballot_box_with_check:

1 Like

I don’t like taking the easy rode because then I feel like I don’t learn as much.

Besides, staying on the RHEL train is more marketable.

1 Like

Mini 6-pin to SATA power cable arrived today, the last part I need to hook up these NVMe SSDs in my server:

And good thing I checked the voltages on the header, because the pinout is different :smiley:




Yesterday I mounted the SSDs in a 3.5" to dual 2.5" adapter that was sitting on my desk and lucked out that some holes in the adapter lined up more or less with some threaded holes in the chassis. Now with power!

➜  ~ sudo nvmecontrol devlist
 nvme0: ST480KN0001
    nvme0ns1 (457862MB)
 nvme1: ST480KN0001
    nvme1ns1 (457862MB)

Success.

4 Likes

@freqlabs what was your syntax for setting default variables in bash scripts? I think I want to use it.

: ${foo:=bar}      ; readonly foo

(the readonly part is optional)

1 Like

Ah yes, the colon there. Thank you.

Oh, it doesn’t let me do this actually:

: ${1:='Hello, world!'}

Guess I gotta assign a variable anyway.

I think for that you want

msg=${1:-'Hello, world!'}
1 Like

Why do you put the colon in the forefront like that?

Which one?

In : ${foo:=bar} the first colon is a builtin command equivalent to true, which ignores its args and just serves to consume the parameter expansions that follow. The second colon alters the meaning of the parameter expansion from “$foo or ‘bar’ if foo is unset” to “$foo or ‘bar’ if foo is unset or empty”:

     In the parameter expansions shown previously, use of the colon in the
     format results in a test for a parameter that is unset or null; omission
     of the colon results in a test for a parameter that is only unset.

It’s shorter than foo=${foo:-bar}


Assuming I have good reasons to do this, is this a reasonable way to go about it?

#!/usr/bin/env sh

# Prefer zsh over bash, don't use other shells
SH="$(ps -o args= $$)"

# Shell is zsh
expr "${SH}" : '.*zsh'  ||

# Switch to zsh if it is available
zsh "${0}" "${@}"       ||

# Shell is bash
expr "${SH}" : '.*bash' ||

# Switch to bash if it is available
bash "${0}" "${@}"      ||

exit 1

If anyone comes across this, it’s not functional as written here. Consider it a sketch.

Why not a case statement?

Er actually I didn’t quite make sense of what this script does. So there’s presumably more after this that gets run when you don’t hit the exit…

1 Like

The script wants to be zsh or bash, so I gave it the generic sh hashbang and have it call itself under prefered shell. So if you were in csh, you could run this and it would switch itself to zsh or bash.

Yes, the actual meat of the script follows this. It’s basically so that I can avoid macOS’s old bash but also run it on a system without zsh.

Fancy :smiley:

1 Like

Okay, so I’ve just fixed a bug in Linux on my laptop. Anyone know of any resources for get up to speed on the mailing lists and whatnot to get patches in?

Also, a hearty “Fuck You” to dell for their fan control mechanisms on XPS laptops.

4 Likes

For the actual kernel?

Yep, sorry, should have clarified that a bit, I guess.

1 Like

Were you having to compile your own kernel to get your fans to work?

No, the dell firmware would handle fan control, but with the XPS 15, it waits 45 seconds to bring the fans up to full speed, for some stupid-ass reason. :angry:

So, in the dell_smm module, there’s a sysfs node that allows you to set the fan speed normally. The only issue is that you need to pass a flag to the controller to put it in “manual mode”

Now, in order to enable the node to put it in manual mode, you need to have a hardcoded exception in the module. I had to add that exception for my laptop. :confused:

It’s a small fix, but a fix nonetheless.

2 Likes

Email Linus directly, he’ll love that.

/s

2 Likes