[排错] 解决 Linux 开机时报错 “kernel panic – no syncing: Attempted to kill init ……”

报错代码

/init: error while loading shared libraries: libsystemd-shared-239.so: cannot open shared object file: No such file or directory
kernel panic - no syncing: Attempted to kill init! exitcode=0x00007f00

解决方法

步骤一:进入拯救模式

步骤二:确认第三方软件库

2.1 搜集第三方软件库信息

# ldconfig -p > /tmp/ldconfig.out

2.2 确认有没有第三方软件库

# for l in $(awk '{ print $1 }' /tmp/ldconfig.out); do matches=$(awk "\$1 == \"$l\" { print }" /tmp/ldconfig.out); if [ $(echo "$matches" | wc -l) -ge 2 ]; then echo "$matches"; echo; fi; done

(补充:如果没有第三方软件库的话这里不会有任何输出)

步骤三:检查 /etc/ld.so.conf 文件或者 /etc/ld.so.conf.d/ 目录里的文件去除第三方库

(步骤略)

步骤四:刷新库缓存

# ldconfig

步骤五:为启动失败的系统创建创建 initramfs 文件

# dracut -f /boot/initramfs-(uname -r).img $(uname -r)

(补充:这里以将正在运行的内核版本生成一个新的 initramfs 为例)

(注意:此时原来启动系统时使用的那个 initramfs 文件会被覆盖)

步骤六:重启系统

# reboot

参考文献

https://access.redhat.com/solutions/7096246

[排错] Linux 解决使用 setfacl 命令时报错 “setfacl: …… : Operation not supported”

报错命令

# setfacl ......

报错代码

setfacl: ......: Operation not supported

解决方法

添加 acl 参数

临时解决方法(临时在挂载时添加 acl 参数):

# mount -o remount,acl /mnt

(补充:这里以给挂载的 /mnt 目录添加 acl 参数为例)

永久解决方法(永久在挂载时添加 acl 参数):

# vi /etc/fstab

将部分内容修改如下:

......
/dev/sda5 /mnt xfs defaults,acl 0 0
......

(补充:这里以给从硬盘 /dev/sda5 挂载到 /mnt 目录的目录添加 acl 参数为例)

[排错] 解决 openSUSE & SUSE 使用 zypper 命令时报错 “error: can’t create transaction lock on /usr/lib/sysimage/rpm/.rpm.lock (Resource temporarily unavailable)”

报错命令

# zypper ......

报错代码

error: can't create transaction lock on /usr/lib/sysimage/rpm/.rpm.lock (Resource temporarily unavailable)

解决方法

步骤一:删除 Zypper 的软件数据库

# rm -rf /var/lib/rpm/_db*

步骤二:重建 Zypper 的软件数据库

# rpm --rebuilddb

步骤三:刷新 Zypper 缓存

# zypper refresh