Skip to main content

Linux FAQ

kernel-ml vs kernel-lt#

RHEL 内核 flavor

  • kernel-ml - mainline
    • Linux 主线版本 - 更新,更新更快更多
  • kernel-lt - long term
    • Linux 长期支持版本 - 更稳定,更新更少

从新扫描分区#

partprobemdev -s
# 强制内核读取分区hdparm -z /dev/sda
# 手动创建mknod /dev/hdc1 b 22 1# 验证可读cat /dev/hdc1 > /dev/null
# 直接读取分区 - 挂载为 looplosetup /dev/loop0 /dev/hdc -o $((63*512))mount /dev/loop0 /mnt/hdc1# 查看fdisk -l -u /dev/hdc

The NVM Checksum Is Not Valid#

e1000e: Intel(R) PRO/1000 Network Driver - 3.2.6-ke1000e: Copyright(c) 1999 - 2015 Intel Corporation.e1000e 0000:00:1f.6: Interrupt Throttling Rate (ints/sec) set to dynamic conservative modee1000e 0000:00:1f.6: The NVM Checksum Is Not Valide1000e: probe of 0000:00:1f.6 failed with error -5

PCIe Bus Error: severity=Corrected, type=Physical Layer, id=00e5(Receiver ID)#

启动参数添加 pcie_aspm=off

halt vs poweroff vs shutdown#

  • halt
    • 终止所有进程并关闭 CPU
  • poweroff
    • 与 halt 相似,但也会关闭 PC 自身.会发送 ACPI 命令到主板, PSU 然后切断电源
  • shutdown -t now
    • 与 poweroff 相似,但会执行关机脚本
    • 最优雅的关机方式
    • 会先 kill -15 然后 kill -9
    • 现代的 haltreboot 一般也会调用 shutdown

'RTLD_NEXT' undeclared#

  • gcc 添加 -D_GNU_SOURCE
  • 因为不是标准的 POSIX 定义

mmap: Operation not permitted#

sysctl dev.mem.restricted# /proc/sys/dev/mem/restricted
# https://stackoverflow.com/a/36507784/1870054# 该操作会禁用很多 PaX 特性# https://en.wikibooks.org/wiki/Grsecurity/Appendix/Grsecurity_and_PaX_Configuration_Options#Support_soft_modesysctl -w kernel.pax.softmode=1

查看内核配置#

  • 常见配置路径
    • /boot/config
    • /boot/config-$(uname -r)
    • /proc/config.gz
      • 需要加载模块
cat /proc/config.gz | gunzip > running.configzcat /proc/config.gz > running.config
grep CONFIG_IKCONFIG running.config

没有 /proc/config.gz#

modprobe configs

释放磁盘空间#

rm 不一定会释放空间, 可以 cp /dev/null xx lsof | grep deleted

TBD

https://stackoverflow.com/questions/332629/rm-not-freeing-diskspace https://unix.stackexchange.com/questions/34140/tell-fs-to-free-space-from-deleted-files-now

https://serverfault.com/questions/232525/df-in-linux-not-showing-correct-free-space-after-file-removal/232526

ls -l /proc/*/fd/ | grep deleted lsof +L1

df -ah du -sh

df -i

dumpe2fs /dev/sda1 | grep -i reserved

Most Linux filesystems reserve 5% space for use only the root user.

You can see this with e.g

dumpe2fs /dev/sda1 | grep -i reserved You can change the reserved amount using :

tune2fs -m 0 /dev/sda1

Tracking down where disk space has gone on Linux? https://unix.stackexchange.com/questions/125429/tracking-down-where-disk-space-has-gone-on-linux

https://github.com/moby/moby/issues/32420

https://unix.stackexchange.com/questions/125429/tracking-down-where-disk-space-has-gone-on-linux