用户工具

站点工具


01-基础学习:读书:lfs-book-8.1-systemd

LFS-BOOK-8.1-systemd

粘滞位

保证所有用户对目录 /tmp 和 /var/tmp 都是可写的,但又不能移除其他用户的文件。后面的这个限制是由所谓的 “粘滞位”实现的,即位掩码 1777 中的最高位(1)。

创建目录的操作方式

/usr/{,local/}{bin,include} 为/usr/ 和/usr/local创建相同的目录结构

I have no name!:/# mkdir -pv /usr/{,local/}{bin,include,lib,sbin,src}
mkdir: created directory '/usr'
mkdir: created directory '/usr/bin'
mkdir: created directory '/usr/include'
mkdir: created directory '/usr/lib'
mkdir: created directory '/usr/sbin'
mkdir: created directory '/usr/src'
mkdir: created directory '/usr/local'
mkdir: created directory '/usr/local/bin'
mkdir: created directory '/usr/local/include'
mkdir: created directory '/usr/local/lib'
mkdir: created directory '/usr/local/sbin'
mkdir: created directory '/usr/local/src'

{1..8} 循环创建

I have no name!:/# mkdir -pv /usr/{,local/}share/man/man{1..8}
mkdir: created directory '/usr/share/man/man1'
mkdir: created directory '/usr/share/man/man2'
mkdir: created directory '/usr/share/man/man3'
mkdir: created directory '/usr/share/man/man4'
mkdir: created directory '/usr/share/man/man5'
mkdir: created directory '/usr/share/man/man6'
mkdir: created directory '/usr/share/man/man7'
mkdir: created directory '/usr/share/man/man8'
mkdir: created directory '/usr/local/share/man/man1'
mkdir: created directory '/usr/local/share/man/man2'
mkdir: created directory '/usr/local/share/man/man3'
mkdir: created directory '/usr/local/share/man/man4'
mkdir: created directory '/usr/local/share/man/man5'
mkdir: created directory '/usr/local/share/man/man6'
mkdir: created directory '/usr/local/share/man/man7'
mkdir: created directory '/usr/local/share/man/man8'

ln相关

原文件指定了完整路径,目标只需要目录即可

I have no name!:/# ln -sv /tools/lib/libgcc_s.so{,.1} /usr/lib
'/usr/lib/libgcc_s.so' -> '/tools/lib/libgcc_s.so'
'/usr/lib/libgcc_s.so.1' -> '/tools/lib/libgcc_s.so.1'

grep

root:/sources/glibc-2.25/build# grep -o '/usr/lib.*/crt[1in].*succeeded' dummy.log
/usr/lib/../lib/crt1.o succeeded
/usr/lib/../lib/crti.o succeeded
/usr/lib/../lib/crtn.o succeeded
root:/sources/glibc-2.25/build# grep --help |grep '\-o'
  -b, --byte-offset         print the byte offset with output lines
  -o, --only-matching       show only the part of a line matching PATTERN
  -u, --unix-byte-offsets   report offsets as if CRs were not there
root:/sources/glibc-2.25/build# grep --help |grep '\-B'
  -B, --before-context=NUM  print NUM lines of leading context
root:/sources/glibc-2.25/build# 
root:/sources/glibc-2.25/build# 
root:/sources/glibc-2.25/build# grep -B2 '^ /usr/include' dummy.log  
#include "..." search starts here:
#include <...> search starts here:
 /usr/include

timeout命令

使用netstat -ntlp或者 ss -lntp进行端口自发现时,如果文件描述符过多,速度会非常慢,可能导致机器负载飙升,使用timeout可以解决此问题:

[root@tv.router ~]# timeout 1 netstat -ntlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name   
tcp        0      0 0.0.0.0:10050               0.0.0.0:*                   LISTEN      15641/zabbix_agentd 
tcp        0      0 127.0.0.1:199               0.0.0.0:*                   LISTEN      3889/snmpd          
tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      14287/nginx         
tcp        0      0 0.0.0.0:30000               0.0.0.0:*                   LISTEN      2591/monit          
tcp        0      0 127.0.0.1:53                0.0.0.0:*                   LISTEN      2077/dnsmasq        
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      3904/sshd           
tcp        0      0 0.0.0.0:5080                0.0.0.0:*                   LISTEN      29673/python2.7     
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      13836/sendmail      
tcp        0      0 0.0.0.0:443                 0.0.0.0:*                   LISTEN      14287/nginx 

grub配置

直接使用宿主机的grub,添加配置即可

title LFS-8.0-systemd (4.9.9)
	root (hd0,0)
	kernel /vmlinuz-4.9.9-lfs-8.0-rc1-systemd root=/dev/sde1 ro

无法启动的处理

报错

Kernel panic Error - not syncing: VFS: unable to mount rootfs on unknown-block(0,0)

可能的原因:

  1. make menuconfig时没有严格按照手册
  2. 缺少VMware驱动

VMware驱动参考一下2个网页

在Vmware虚拟机里面编译lfs 7.10的内核后,启动出现如下错误:
kernel panic -not syncing:VFS:Unable to mount root fs on unknown block(0,0)

可能的原因:
1- scsi驱动没有编译到内核,检查如下的选项是否选择
→ Device Drivers→ SCSI device support
<> SCSI disk support
<

> SCSI generic support\\

→ Device Drivers→ SCSI device support→ SCSI low-level drivers
-- LSI MPT Fusion SAS 3.0 & SAS 2.0 Device Driver
(128) LSI MPT Fusion SAS 2.0 Max number of SG Entries (16 - 256)
(128) LSI MPT Fusion SAS 3.0 Max number of SG Entries (16 - 256)
<

> Legacy MPT2SAS config option\\

→ Device Drivers
[*] Fusion MPT device support —>

→ Device Drivers→ Fusion MPT device support
— Fusion MPT device support
<> Fusion MPT ScsiHost drivers for SPI
<

> Fusion MPT ScsiHost drivers for SAS \\

(

128) Maximum number of scatter gather entries (16 - 128)
<> Fusion MPT misc device (ioctl) driver
[
] Fusion MPT logging facility

golfreeze: 
LFS 7.7 End Kernel panic Error - not syncing: VFS: unable to mount rootfs on unknown-block(0,0) 
 
If your system running on Vmware program [Esx-i , vmare] 
please kindly re-install kernel with build in "VMware VMCI Driver" + "VMware PVSCSI driver"
 
เข้าไปที่ folder=  Linux-3.19 
#echo $LANG
#make LANG=en_GB.ISO-8859-1 LC_ALL= menuconfig
 
# All options are required unless noted as "Optional" or under a # Begin and # End block, which is also noted as "Optional" or "Hardware Specific"
# It is important that they are selected as built-in or the kernel might fail to correctly detect the partitions and/or filesystems.
# It is a good idea to run "make defconfig" first
 
Device Drivers  --->
   Generic Driver Options  --->
      ()  path to uevent helper
      [*] Maintain a devtmpfs filesystem to mount at /dev
      [*]   Automount devtmpfs at /dev, after the kernel mounted the rootfs (optional)
 
   # Optional, required for VMware virtual machines
   # Begin here
   Misc devices  --->
      <*> VMware VMCI Driver
   # End here
 
  # Optional, required for VMware virtual machines
   # Begin here
      [*] SCSI low-level drivers  --->
         <*>   BusLogic SCSI support (used by older VMware virtual solutions, can be optionally selected)
         <*>   VMware PVSCSI driver support (used by vSphere I think, but not by default, can be used by Player and Workstation too)
   # End here

成果

01-基础学习/读书/lfs-book-8.1-systemd.txt · 最后更改: 2020/04/07 06:34 由 annhe

页面工具