Jenkins 三言两语(二)

  1. Jenkins 虽然通过ssh访问一个node来执行build或者 deploy任务,而且它也确实执行了远程机器的.bashrc 脚本,但它却刻意的抹掉了PATH 环境变量。所以在你要运行的bash脚本里再 source 一遍 /etc/profile 就有了必要。
  2. Jenkins自己的环境变量,可以在脚本里直接用,但从bash里来的环境变量,如 $?,就得用反斜线转义 \$ 符号。
  3. .bashrc 别 echo 东西,否则 Jenkins 会拒绝干活。(应该弄一台专门的机器只跑 Jenkins)

PS: 上面第2条其实描述不准确,后面踩的坑证明,如果用 sh 命令里有环境变量,老老实实用单引号,如果非用双引号,你反而要用\$转义。切记!Jenkins环境不是bash环境。不论是否 Jenkins里定义的环境变量,如果要在bash脚本里用,就老老实实用单引号。

Linux TIPS collect (神奇的知识集合)

  1. http_proxy environment in sudo command: http_proxy=xxx:xxx sudo yourcommand doesn't work, you should sudo http_proxy=xxx:yyy yourcommand instead.
  2. ssh running local script: ssh username@hostname 'bash -s' < your.local.script.sh
  3. ssh running local script with paraemters: ssh username@hostname < your.local.script.sh 'bash -s' yourparam1 yourparam2 doesn't work, you should runssh username@hostname < your.local.script.sh 'bash -s' -- yourparam1 yourparam2
  4. make your fonts configuration work without a reboot: sudo fc-cache -fv

Can't boot VMs after host kernel upgrade (CentOS8)

I followed this article to upgrade the kernel of one of our Linux server runs CentOS8. According to that article, upgrade the kernel of a CentOS system is rather simple, you just need to run the following command as root:

rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
dnf -y install https://www.elrepo.org/elrepo-release-8.0-2.el8.elrepo.noarch.rpm
dnf -y --enablerepo=elrepo-kernel install kernel-ml

Everything goes fine before I try to boot up one of the VM in Virtualbox 6.

Boot failure, "The system is currently not set up to build kernel modules, please install the Linux kernel header files matching the current kernel.", it says.

Obviously, we need the correct header file, after digging a while on Google, I didn't get an answer. Then I review the steps I have done to upgrade the kernel. Oh, I got the solution below:

dnf -y --enablerepo=elrepo-kernel install kernel-ml-devel
/sbin/rcvboxdrv setup

Problem resolved.

Making bootable usb stick by dd command

You are already using Linux, so you have dd already, you don't need any other tools to make a bootable USB disk!

sudo dd bs=1M if=galliumos-3.1-baytrail.iso of=/dev/sda ; sync

Notice:

You should use your iso file name and replace /dev/sda to your own USB disk device.

Reference

ubuntu 20.04 upgrade axel to 2.17.9

try to download something but axel said "SSL error: (null)", so

axel https://github.com/axel-download-accelerator/axel/releases/download/v2.17.9/axel-2.17.9.tar.gz
tar xvfz axel-2.17.9.tar.gz 
cd axel-2.17.9
sudo apt install pkg-config -y
./configure && make && sudo make install
sudo apt remove axel
cd ..
rm -rf axel-2.17.9