cnet linux 系统简单安装规范
[
2009/12/09 11:00 | by 井宿 ]
2009/12/09 11:00 | by 井宿 ]
OS INSTALLATION & SETUP – RED HAT ENTERPRISE LINUX 4 WS - DRAFT
RHEL 4 WS Installation
1. Insert RHEL 4.0 WS Disc 1 into the CDROM drive and boot up the server.
2. Select “Skip” when prompted to test the media.
3. Select “Next” for the following few screens: Welcome, Language Selection, Keyboard, Mouse Configuration.
4. At the “Disk Partitioning Setup” screen, select “Manually partition with Disk Druid”.
5. For the disk partitioning, use the following setup:
a. For the 1st disk, normally /dev/ccsiss/c0d0 or /dev/ida/c0d0
i. 2000MB for swap
ii. Rest of the space for / using ext3 file system
b. For the rest of the disks, /dev/cciss/cxdy/ or /dev/ida/cxdy/
i. Create 1 partition per disk and mount it under /mnt/cxdy/
ii. All the partitions should be formatted as ext3 filesystem
6. Select GRUB as the boot loader.
a. For DL380 G1 & DL380 G2 servers, you will need to make sure that GRUB is installed in the first sector of boot partition, instead of MBR so that you can still access the System Partition Utility after O/S is installed. To do this, select the checkbox "Configure advanced boot loader options". At the next screen, select the option “First sector of boot partition” instead of the “MBR”
7. At the “Network Configuration” screen, you can key in all the network settings if you have the information available, else you can configure this later.
8. For “Firewall Configuration”, select “No firewall”, For “Enable SELinux”. select “Disabled”.
9. You will be prompted “Warning – no firewall”, select “Proceed”.
10. At the “Additional Language Support” screen, select “English (USA)” as the default language.
11. Select the appropriate value for “Time Zone Selection”.
12. At “Account Configuration” screen, enter the root password.
13. At the “Package Installation” screen, select “Customize software packages to be installed”. Use the following configuration, the total install size should be 1077M (or 1115M for Intel EM64T-based system),
a. Editors [2/5]
i. Emacs
ii. vim-enhanced
b. Text-based Internet [2/4]
i. elinks
ii. mutt
c. Mail Server [2/12]
i. Sendmail.cf
d. Development Tools [21/73] (or [20/72] for Intel EM64T-based system)
i. cvs
ii. diffstat
iii. gcc-g77
iv. gcc-gnat (not available for Intel EM64T-based system)
v. gcc-java
vi. patchutils
e. System Tools [2/32]
i. screen
ii. sysstat
14. At the “About to Install” screen, select “Next”.
15. When prompted to create boot disk, select “No”.
16. At the end of the installation process, select “Exit” to reboot the server.
Updating of RPM packages using YUM
After the installation, we will need to update of some of RPM packages which have newer versions after the OS is released.
1. Install yum-2.2.1-1.cms.noarch.rpm.
2. edit /etc/yum.conf and point to the nearest RHEL 4 respository
3. install gd-progs and netpbm-progs by executing the following command:
# yum install gd-progs netpbm-progs
4. update OS installation by executing the following command:
# yum update
Configuring the operating system
1. Login to the server as root.
2. Execute the command “ntsysv”
3. A list of services will show up, only the following items should be checked.
• acpid
• crond
• gpm
• irqbalance
• netfs
• network
• nfs (only required on the normal web servers)
• nfslock
• portmap
• rawdevices
• sendmail
• sshd
• syslog
4. Edit the file “/etc/grub.conf” and comment out the line beginning with splashimage. This makes sure that the whole startup process will be in text-mode and can be monitored using the iLO remote console.
5. Edit the file “/etc/sysconfig/i18n“ and change the variable LANG and SUPPORTED to "en_US.iso885915" and "en_US.iso885915:en_US:en" respectively. This is because the default en_US.UTF-8 setting is known to cause problems with program like man and grep.
6. Restart the server by using the command “shutdown –r now”.
RHEL 4 WS Installation
1. Insert RHEL 4.0 WS Disc 1 into the CDROM drive and boot up the server.
2. Select “Skip” when prompted to test the media.
3. Select “Next” for the following few screens: Welcome, Language Selection, Keyboard, Mouse Configuration.
4. At the “Disk Partitioning Setup” screen, select “Manually partition with Disk Druid”.
5. For the disk partitioning, use the following setup:
a. For the 1st disk, normally /dev/ccsiss/c0d0 or /dev/ida/c0d0
i. 2000MB for swap
ii. Rest of the space for / using ext3 file system
b. For the rest of the disks, /dev/cciss/cxdy/ or /dev/ida/cxdy/
i. Create 1 partition per disk and mount it under /mnt/cxdy/
ii. All the partitions should be formatted as ext3 filesystem
6. Select GRUB as the boot loader.
a. For DL380 G1 & DL380 G2 servers, you will need to make sure that GRUB is installed in the first sector of boot partition, instead of MBR so that you can still access the System Partition Utility after O/S is installed. To do this, select the checkbox "Configure advanced boot loader options". At the next screen, select the option “First sector of boot partition” instead of the “MBR”
7. At the “Network Configuration” screen, you can key in all the network settings if you have the information available, else you can configure this later.
8. For “Firewall Configuration”, select “No firewall”, For “Enable SELinux”. select “Disabled”.
9. You will be prompted “Warning – no firewall”, select “Proceed”.
10. At the “Additional Language Support” screen, select “English (USA)” as the default language.
11. Select the appropriate value for “Time Zone Selection”.
12. At “Account Configuration” screen, enter the root password.
13. At the “Package Installation” screen, select “Customize software packages to be installed”. Use the following configuration, the total install size should be 1077M (or 1115M for Intel EM64T-based system),
a. Editors [2/5]
i. Emacs
ii. vim-enhanced
b. Text-based Internet [2/4]
i. elinks
ii. mutt
c. Mail Server [2/12]
i. Sendmail.cf
d. Development Tools [21/73] (or [20/72] for Intel EM64T-based system)
i. cvs
ii. diffstat
iii. gcc-g77
iv. gcc-gnat (not available for Intel EM64T-based system)
v. gcc-java
vi. patchutils
e. System Tools [2/32]
i. screen
ii. sysstat
14. At the “About to Install” screen, select “Next”.
15. When prompted to create boot disk, select “No”.
16. At the end of the installation process, select “Exit” to reboot the server.
Updating of RPM packages using YUM
After the installation, we will need to update of some of RPM packages which have newer versions after the OS is released.
1. Install yum-2.2.1-1.cms.noarch.rpm.
2. edit /etc/yum.conf and point to the nearest RHEL 4 respository
3. install gd-progs and netpbm-progs by executing the following command:
# yum install gd-progs netpbm-progs
4. update OS installation by executing the following command:
# yum update
Configuring the operating system
1. Login to the server as root.
2. Execute the command “ntsysv”
3. A list of services will show up, only the following items should be checked.
• acpid
• crond
• gpm
• irqbalance
• netfs
• network
• nfs (only required on the normal web servers)
• nfslock
• portmap
• rawdevices
• sendmail
• sshd
• syslog
4. Edit the file “/etc/grub.conf” and comment out the line beginning with splashimage. This makes sure that the whole startup process will be in text-mode and can be monitored using the iLO remote console.
5. Edit the file “/etc/sysconfig/i18n“ and change the variable LANG and SUPPORTED to "en_US.iso885915" and "en_US.iso885915:en_US:en" respectively. This is because the default en_US.UTF-8 setting is known to cause problems with program like man and grep.
6. Restart the server by using the command “shutdown –r now”.
有关我QQ留言的释义
[
2009/12/08 13:45 | by 井宿 ]
2009/12/08 13:45 | by 井宿 ]
那天去看网博会,单位给发了2张赠票。
兴冲冲的往里走的时候被门口的狗拦下了。问我要身份证,说只有身份证能证明你是你自己。这不是废话么,我怎么TMD就不是我自己了。
我说我没带身份证。
那网博会的SB看门狗跟我说“你出门不带身份证啊?”
我心想 你丫肯定是出门被警察查怕了吧,你丫自己长得像天生的反派,不代表人人都能继承你丫的光荣传统。
说白了就是一SB , 大冬天的在门口挣点饭钱,犯得着这么官僚么, 也难怪,丫这样的,几辈子能当一次管理人士阿。
爷也不跟他扯淡,大不了不进去了。
兴冲冲的往里走的时候被门口的狗拦下了。问我要身份证,说只有身份证能证明你是你自己。这不是废话么,我怎么TMD就不是我自己了。
我说我没带身份证。
那网博会的SB看门狗跟我说“你出门不带身份证啊?”
我心想 你丫肯定是出门被警察查怕了吧,你丫自己长得像天生的反派,不代表人人都能继承你丫的光荣传统。
说白了就是一SB , 大冬天的在门口挣点饭钱,犯得着这么官僚么, 也难怪,丫这样的,几辈子能当一次管理人士阿。
爷也不跟他扯淡,大不了不进去了。
wmic 获取硬盘固定分区盘符:
wmic logicaldisk where "drivetype=3" get name
wmic 获取硬盘各分区文件系统以及可用空间:
wmic logicaldisk where "drivetype=3" get name,filesystem,freespace
wmic 获取进程名称以及可执行路径:
wmic process get name,executablepath
wmic 删除指定进程(根据进程名称):
wmic process where name="qq.exe" call terminate
或者用
wmic process where name="qq.exe" delete
wmic 删除指定进程(根据进程PID):
wmic process where pid="123" delete
wmic 创建新进程
wmic process call create "C:\Program Files\Tencent\QQ\QQ.exe"
在远程机器上创建新进程:
wmic /node:192.168.1.10 /user:administrator /password:123456 process call create cmd.exe
关闭本地计算机
wmic process call create shutdown.exe
重启远程计算机
wmic /node:192.168.1.10/user:administrator /password:123456 process call create "shutdown.exe -r -f -m"
更改计算机名称
wmic computersystem where "caption='%ComputerName%'" call rename newcomputername
更改帐户名
wmic USERACCOUNT where "name='%UserName%'" call rename newUserName
wmic 结束可疑进程(根据进程的启动路径)
wmic process where "name='explorer.exe' and executablepath<>'%SystemDrive%\\windows\\explorer.exe'" delete
wmic 获取物理内存
wmic memlogical get TotalPhysicalMemory|find /i /v "t"
wmic 获取文件的创建、访问、修改时间
@echo off
'wmic datafile where name^="c:\\windows\\system32\\notepad.exe" get CreationDate^,LastAccessed^,LastModified
wmic logicaldisk where "drivetype=3" get name
wmic 获取硬盘各分区文件系统以及可用空间:
wmic logicaldisk where "drivetype=3" get name,filesystem,freespace
wmic 获取进程名称以及可执行路径:
wmic process get name,executablepath
wmic 删除指定进程(根据进程名称):
wmic process where name="qq.exe" call terminate
或者用
wmic process where name="qq.exe" delete
wmic 删除指定进程(根据进程PID):
wmic process where pid="123" delete
wmic 创建新进程
wmic process call create "C:\Program Files\Tencent\QQ\QQ.exe"
在远程机器上创建新进程:
wmic /node:192.168.1.10 /user:administrator /password:123456 process call create cmd.exe
关闭本地计算机
wmic process call create shutdown.exe
重启远程计算机
wmic /node:192.168.1.10/user:administrator /password:123456 process call create "shutdown.exe -r -f -m"
更改计算机名称
wmic computersystem where "caption='%ComputerName%'" call rename newcomputername
更改帐户名
wmic USERACCOUNT where "name='%UserName%'" call rename newUserName
wmic 结束可疑进程(根据进程的启动路径)
wmic process where "name='explorer.exe' and executablepath<>'%SystemDrive%\\windows\\explorer.exe'" delete
wmic 获取物理内存
wmic memlogical get TotalPhysicalMemory|find /i /v "t"
wmic 获取文件的创建、访问、修改时间
@echo off
'wmic datafile where name^="c:\\windows\\system32\\notepad.exe" get CreationDate^,LastAccessed^,LastModified
调用n天前的系统时间
[
2009/12/03 15:31 | by 井宿 ]
2009/12/03 15:31 | by 井宿 ]
@echo off
::需要调用VBS
rem 指定天数
set DaysAgo=4
>"%temp%\MyDate.vbs" echo LastDate=date()-%DaysAgo%
>>"%temp%\MyDate.vbs" echo FmtDate=right(year(LastDate),4) ^& right("0" ^& month(LastDate),2) ^& right("0" ^& day(LastDate),2)
>>"%temp%\MyDate.vbs" echo wscript.echo FmtDate
for /f %%a in ('cscript /nologo "%temp%\MyDate.vbs"') do (
set DstDate=%%a
)
set DstDate=%DstDate:~0,4%-%DstDate:~4,2%-%DstDate:~6,2%
echo %DaysAgo%天之前的日期是:%DstDate%
pause
::需要调用VBS
rem 指定天数
set DaysAgo=4
>"%temp%\MyDate.vbs" echo LastDate=date()-%DaysAgo%
>>"%temp%\MyDate.vbs" echo FmtDate=right(year(LastDate),4) ^& right("0" ^& month(LastDate),2) ^& right("0" ^& day(LastDate),2)
>>"%temp%\MyDate.vbs" echo wscript.echo FmtDate
for /f %%a in ('cscript /nologo "%temp%\MyDate.vbs"') do (
set DstDate=%%a
)
set DstDate=%DstDate:~0,4%-%DstDate:~4,2%-%DstDate:~6,2%
echo %DaysAgo%天之前的日期是:%DstDate%
pause
Broadcom linux网卡驱动在xen+bond下的艰难问题及解决方案
[
2009/11/30 14:34 | by 井宿 ]
2009/11/30 14:34 | by 井宿 ]
状态: 服务器崩溃,黑屏, 无kernel panic输出屏幕, ssh远程失去响应.
重装系统, 换内存条, dell硬件检测均不能解决问题.
服务器配置: xen 2.6.18 内核, bond
察看log如下:
Nov 19 13:59:41 shiwan-xen-244 kernel: BUG: soft lockup - CPU#0 stuck for 10s! [sshd:8609]
Nov 19 13:59:41 shiwan-xen-244 kernel: CPU 0:
Nov 19 13:59:41 shiwan-xen-244 kernel: Modules linked in: xt_physdev ipt_MASQUERADE iptable_nat ip_nat xt_state ip_conntrack nfnetlink ipt_REJECT xt_tcpudp iptable_filter ip_tables x_tables netloop netbk blktap blkbk bridge ipv6 xfrm_nalgo crypto_api bonding dm_multipath scsi_dh video hwmon backlight sbs i2c_ec i2c_core button battery asus_acpi ac parport_pc lp parport joydev sr_mod cdrom sg bnx2 pcspkr serial_core serio_raw dm_raid45 dm_message dm_region_hash dm_mem_cache dm_snapshot dm_zero dm_mirror dm_log dm_mod ata_piix libata shpchp megaraid_sas sd_mod scsi_mod ext3 jbd uhci_hcd ohci_hcd ehci_hcd
Nov 19 13:59:41 shiwan-xen-244 kernel: Pid: 8609, comm: sshd Not tainted 2.6.18-128.el5xen #1
Nov 19 13:59:41 shiwan-xen-244 kernel: RIP: e030:[] [] :bnx2:bnx2_poll_work+0x8a/0x10ca
Nov 19 13:59:41 shiwan-xen-244 kernel: RSP: e02b:ffffffff8066ad78 EFLAGS: 00000286
Nov 19 13:59:41 shiwan-xen-244 kernel: RAX: ffff8807c3685900 RBX: ffff8807bf3ad630 RCX: 00000000c30f7764
Nov 19 13:59:41 shiwan-xen-244 kernel: RDX: 00000000c30f7764 RSI: 0000000000000063 RDI: ffff8807c30f4500
Nov 19 13:59:41 shiwan-xen-244 kernel: RBP: 0000000077637763 R08: ffff8801198ccbf0 R09: ffff8807c47f4600
Nov 19 13:59:41 shiwan-xen-244 kernel: R10: 0000000080000000 R11: ffffffff881ec594 R12: ffff8807c30f46b8
Nov 19 13:59:41 shiwan-xen-244 kernel: R13: ffff8801de757b80 R14: ffffffff8066af54 R15: 000000000000012b
Nov 19 13:59:41 shiwan-xen-244 kernel: FS: 00002b5f54267ea0(0000) GS:ffffffff805ba000(0000) knlGS:0000000000000000
Nov 19 13:59:41 shiwan-xen-244 kernel: CS: e033 DS: 0000 ES: 0000
Nov 19 13:59:41 shiwan-xen-244 kernel:
Nov 19 13:59:41 shiwan-xen-244 kernel: Call Trace:
Nov 19 13:59:41 shiwan-xen-244 kernel: [] __do_IRQ+0xeb/0x103
Nov 19 13:59:41 shiwan-xen-244 kernel: [] do_IRQ+0xec/0xf5
Nov 19 13:59:41 shiwan-xen-244 kernel: [] evtchn_do_upcall+0x13b/0x1fb
Nov 19 13:59:41 shiwan-xen-244 kernel: [] do_hypervisor_callback+0x1e/0x2c
Nov 19 13:59:41 shiwan-xen-244 kernel: [] :bnx2:bnx2_start_xmit+0x0/0x4a9
Nov 19 13:59:41 shiwan-xen-244 kernel: [] :bnx2:bnx2_poll_work+0x2/0x10ca
Nov 19 13:59:41 shiwan-xen-244 kernel: [] :bnx2:bnx2_poll+0xda/0x1cb
Nov 19 13:59:41 shiwan-xen-244 kernel: [] net_rx_action+0xa8/0x1b6
Nov 19 13:59:41 shiwan-xen-244 kernel: [] __do_softirq+0x8d/0x13b
Nov 19 13:59:41 shiwan-xen-244 kernel: [] call_softirq+0x1c/0x278
Nov 19 13:59:41 shiwan-xen-244 kernel: [] do_softirq+0x31/0x98
Nov 19 13:59:41 shiwan-xen-244 kernel: [] local_bh_enable+0x93/0xa5
Nov 19 13:59:41 shiwan-xen-244 kernel: [] dev_queue_xmit+0x2f2/0x313
Nov 19 13:59:41 shiwan-xen-244 kernel: [] ip_output+0x29a/0x2dd
Nov 19 13:59:41 shiwan-xen-244 kernel: [] ip_queue_xmit+0x432/0x48c
Nov 19 13:59:41 shiwan-xen-244 kernel: [] default_wake_function+0x0/0xe
Nov 19 13:59:41 shiwan-xen-244 kernel: [] default_wake_function+0x0/0xe
Nov 19 13:59:41 shiwan-xen-244 kernel: [] tcp_transmit_skb+0x62c/0x664
Nov 19 13:59:41 shiwan-xen-244 kernel: [] __tcp_push_pending_frames+0x78e/0x87a
Nov 19 13:59:41 shiwan-xen-244 kernel: [] alloc_skb_from_cache+0x74/0x13c
Nov 19 13:59:41 shiwan-xen-244 kernel: [] tcp_sendmsg+0x9cb/0xafb
Nov 19 13:59:41 shiwan-xen-244 kernel: [] do_sock_write+0xc4/0xce
Nov 19 13:59:41 shiwan-xen-244 kernel: [] sock_aio_write+0x4f/0x5e
Nov 19 13:59:41 shiwan-xen-244 kernel: [] remove_wait_queue+0x1c/0x2c
Nov 19 13:59:41 shiwan-xen-244 kernel: [] do_sync_write+0xc7/0x104
Nov 19 13:59:41 shiwan-xen-244 kernel: [] read_chan+0x62d/0x69b
Nov 19 13:59:41 shiwan-xen-244 kernel: [] autoremove_wake_function+0x0/0x2e
Nov 19 13:59:41 shiwan-xen-244 kernel: [] tty_ldisc_deref+0x68/0x7b
Nov 19 13:59:41 shiwan-xen-244 kernel: [] vfs_write+0xe1/0x174
解决方案:
升级网卡驱动.
网卡型号为:Broadcom 5709C,驱动列表请下载linux那个:
http://www.broadcom.com/su...
两种安装方式
官方链接http://zh-cn.broadcom.com/...(官方驱动的名字偶尔会改。请编译时更改名字,不要完全照抄,谢谢。)
一,源码RPM包安装方式
1,[root@lab ~]# ls
[root@lab ~]# rpm -ivh netxtreme2-4.8.10-1.src.rpm 安装源码包
1:netxtreme2 ########################################### [100%]
2,[root@lab ~]# cd /usr/src/redhat/
[root@lab redhat]# ls
BUILD RPMS SOURCES SPECS SRPMS
[root@lab redhat]# rpmbuild -bb SPECS/netxtreme2.spec
在源码编译结束的时候会看到如下的提示
Wrote: /usr/src/redhat/RPMS/i386/netxtreme2-4.8.10-1.i386.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.59603
+ umask 022
+ cd /usr/src/redhat/BUILD
+ cd netxtreme2-4.8.10
+ rm -rf /var/tmp/netxtreme2-buildroot /usr/src/redhat/BUILD/file.list.netxtreme2
+ exit 0 (如果返回值为1-255,就说明编译没有成功)
3,[root@lab redhat]# rpm -ivh RPMS/i386/netxtreme2-4.8.10-1.i386.rpm 安装编译之后生成的rpm包
Preparing... ########################################### [100%]
1:netxtreme2 ########################################### [100%]
4,这里有一点就要注意了,装完之后你可能不知道生成的模块去了哪里,可以用以下命令来查询,
[root@lab redhat]# rpm -ql netxtreme2 (netxtreme2 软件名,不是完整的包名)
/lib/modules/2.6.18-53.el5/updates/bnx2.ko 这下就知道模块所在的位置了,在/lib/modules/2.6.18-53.el5/updates 里边
/lib/modules/2.6.18-53.el5/updates/bnx2x.ko
/lib/modules/2.6.18-53.el5/updates/cnic.ko
/usr/share/doc/netxtreme2-4.8.10
/usr/share/doc/netxtreme2-4.8.10/LICENSE
/usr/share/doc/netxtreme2-4.8.10/README.bnx2.TXT
/usr/share/doc/netxtreme2-4.8.10/README.bnx2x.TXT
/usr/share/doc/netxtreme2-4.8.10/RELEASE.bnx2.TXT
/usr/share/doc/netxtreme2-4.8.10/RELEASE.bnx2x.TXT
/usr/share/man/man4/bnx2.4.gz
/usr/share/man/man4/bnx2x.4.gz
/usr/src/bnx2/bnx2.h
/usr/src/bnx2/cnic_drv.h
/usr/src/bnx2/cnic_if.h
5,[root@lab redhat]# lsmod |grep bnx2 安装后默认没有加载该模块
[root@lab redhat]# modprobe bnx2 手动加载,modprober命令会去搜索/lib/modules/2.6.18-53.el5下边所有的包
[root@lab redhat]# lsmod |grep bnx2 再次查看就有了
bnx2 171400 0
附三个生成的模块的说明,这个在Broadcom的tar包解压后,里边有详细说明
- bnx2 driver for the Broadcom NetXtreme II BCM5706/BCM5708/5709/5716
10/100/1000/2500/10000 Mbps PCIX/PCIE Ethernet Network Controller.
- bnx2x driver for the Broadcom NetXtremeII BCM57710/BCM57711/BCM57711E
10/100/1000/2500/10000 Mbps PCIE Ethernet Network Controller.
- cnic driver that supports additional features required by the bnx2i iSCSI
offload driver. The bnx2i iSCSI driver is packaged separately.
重装系统, 换内存条, dell硬件检测均不能解决问题.
服务器配置: xen 2.6.18 内核, bond
察看log如下:
Nov 19 13:59:41 shiwan-xen-244 kernel: BUG: soft lockup - CPU#0 stuck for 10s! [sshd:8609]
Nov 19 13:59:41 shiwan-xen-244 kernel: CPU 0:
Nov 19 13:59:41 shiwan-xen-244 kernel: Modules linked in: xt_physdev ipt_MASQUERADE iptable_nat ip_nat xt_state ip_conntrack nfnetlink ipt_REJECT xt_tcpudp iptable_filter ip_tables x_tables netloop netbk blktap blkbk bridge ipv6 xfrm_nalgo crypto_api bonding dm_multipath scsi_dh video hwmon backlight sbs i2c_ec i2c_core button battery asus_acpi ac parport_pc lp parport joydev sr_mod cdrom sg bnx2 pcspkr serial_core serio_raw dm_raid45 dm_message dm_region_hash dm_mem_cache dm_snapshot dm_zero dm_mirror dm_log dm_mod ata_piix libata shpchp megaraid_sas sd_mod scsi_mod ext3 jbd uhci_hcd ohci_hcd ehci_hcd
Nov 19 13:59:41 shiwan-xen-244 kernel: Pid: 8609, comm: sshd Not tainted 2.6.18-128.el5xen #1
Nov 19 13:59:41 shiwan-xen-244 kernel: RIP: e030:[
Nov 19 13:59:41 shiwan-xen-244 kernel: RSP: e02b:ffffffff8066ad78 EFLAGS: 00000286
Nov 19 13:59:41 shiwan-xen-244 kernel: RAX: ffff8807c3685900 RBX: ffff8807bf3ad630 RCX: 00000000c30f7764
Nov 19 13:59:41 shiwan-xen-244 kernel: RDX: 00000000c30f7764 RSI: 0000000000000063 RDI: ffff8807c30f4500
Nov 19 13:59:41 shiwan-xen-244 kernel: RBP: 0000000077637763 R08: ffff8801198ccbf0 R09: ffff8807c47f4600
Nov 19 13:59:41 shiwan-xen-244 kernel: R10: 0000000080000000 R11: ffffffff881ec594 R12: ffff8807c30f46b8
Nov 19 13:59:41 shiwan-xen-244 kernel: R13: ffff8801de757b80 R14: ffffffff8066af54 R15: 000000000000012b
Nov 19 13:59:41 shiwan-xen-244 kernel: FS: 00002b5f54267ea0(0000) GS:ffffffff805ba000(0000) knlGS:0000000000000000
Nov 19 13:59:41 shiwan-xen-244 kernel: CS: e033 DS: 0000 ES: 0000
Nov 19 13:59:41 shiwan-xen-244 kernel:
Nov 19 13:59:41 shiwan-xen-244 kernel: Call Trace:
Nov 19 13:59:41 shiwan-xen-244 kernel:
Nov 19 13:59:41 shiwan-xen-244 kernel: [
Nov 19 13:59:41 shiwan-xen-244 kernel: [
Nov 19 13:59:41 shiwan-xen-244 kernel: [
Nov 19 13:59:41 shiwan-xen-244 kernel: [
Nov 19 13:59:41 shiwan-xen-244 kernel: [
Nov 19 13:59:41 shiwan-xen-244 kernel: [
Nov 19 13:59:41 shiwan-xen-244 kernel: [
Nov 19 13:59:41 shiwan-xen-244 kernel: [
Nov 19 13:59:41 shiwan-xen-244 kernel: [
Nov 19 13:59:41 shiwan-xen-244 kernel:
Nov 19 13:59:41 shiwan-xen-244 kernel: [
Nov 19 13:59:41 shiwan-xen-244 kernel: [
Nov 19 13:59:41 shiwan-xen-244 kernel: [
Nov 19 13:59:41 shiwan-xen-244 kernel: [
Nov 19 13:59:41 shiwan-xen-244 kernel: [
Nov 19 13:59:41 shiwan-xen-244 kernel: [
Nov 19 13:59:41 shiwan-xen-244 kernel: [
Nov 19 13:59:41 shiwan-xen-244 kernel: [
Nov 19 13:59:41 shiwan-xen-244 kernel: [
Nov 19 13:59:41 shiwan-xen-244 kernel: [
Nov 19 13:59:41 shiwan-xen-244 kernel: [
Nov 19 13:59:41 shiwan-xen-244 kernel: [
Nov 19 13:59:41 shiwan-xen-244 kernel: [
Nov 19 13:59:41 shiwan-xen-244 kernel: [
Nov 19 13:59:41 shiwan-xen-244 kernel: [
Nov 19 13:59:41 shiwan-xen-244 kernel: [
Nov 19 13:59:41 shiwan-xen-244 kernel: [
Nov 19 13:59:41 shiwan-xen-244 kernel: [
解决方案:
升级网卡驱动.
网卡型号为:Broadcom 5709C,驱动列表请下载linux那个:
http://www.broadcom.com/su...
两种安装方式
官方链接http://zh-cn.broadcom.com/...(官方驱动的名字偶尔会改。请编译时更改名字,不要完全照抄,谢谢。)
一,源码RPM包安装方式
1,[root@lab ~]# ls
[root@lab ~]# rpm -ivh netxtreme2-4.8.10-1.src.rpm 安装源码包
1:netxtreme2 ########################################### [100%]
2,[root@lab ~]# cd /usr/src/redhat/
[root@lab redhat]# ls
BUILD RPMS SOURCES SPECS SRPMS
[root@lab redhat]# rpmbuild -bb SPECS/netxtreme2.spec
在源码编译结束的时候会看到如下的提示
Wrote: /usr/src/redhat/RPMS/i386/netxtreme2-4.8.10-1.i386.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.59603
+ umask 022
+ cd /usr/src/redhat/BUILD
+ cd netxtreme2-4.8.10
+ rm -rf /var/tmp/netxtreme2-buildroot /usr/src/redhat/BUILD/file.list.netxtreme2
+ exit 0 (如果返回值为1-255,就说明编译没有成功)
3,[root@lab redhat]# rpm -ivh RPMS/i386/netxtreme2-4.8.10-1.i386.rpm 安装编译之后生成的rpm包
Preparing... ########################################### [100%]
1:netxtreme2 ########################################### [100%]
4,这里有一点就要注意了,装完之后你可能不知道生成的模块去了哪里,可以用以下命令来查询,
[root@lab redhat]# rpm -ql netxtreme2 (netxtreme2 软件名,不是完整的包名)
/lib/modules/2.6.18-53.el5/updates/bnx2.ko 这下就知道模块所在的位置了,在/lib/modules/2.6.18-53.el5/updates 里边
/lib/modules/2.6.18-53.el5/updates/bnx2x.ko
/lib/modules/2.6.18-53.el5/updates/cnic.ko
/usr/share/doc/netxtreme2-4.8.10
/usr/share/doc/netxtreme2-4.8.10/LICENSE
/usr/share/doc/netxtreme2-4.8.10/README.bnx2.TXT
/usr/share/doc/netxtreme2-4.8.10/README.bnx2x.TXT
/usr/share/doc/netxtreme2-4.8.10/RELEASE.bnx2.TXT
/usr/share/doc/netxtreme2-4.8.10/RELEASE.bnx2x.TXT
/usr/share/man/man4/bnx2.4.gz
/usr/share/man/man4/bnx2x.4.gz
/usr/src/bnx2/bnx2.h
/usr/src/bnx2/cnic_drv.h
/usr/src/bnx2/cnic_if.h
5,[root@lab redhat]# lsmod |grep bnx2 安装后默认没有加载该模块
[root@lab redhat]# modprobe bnx2 手动加载,modprober命令会去搜索/lib/modules/2.6.18-53.el5下边所有的包
[root@lab redhat]# lsmod |grep bnx2 再次查看就有了
bnx2 171400 0
附三个生成的模块的说明,这个在Broadcom的tar包解压后,里边有详细说明
- bnx2 driver for the Broadcom NetXtreme II BCM5706/BCM5708/5709/5716
10/100/1000/2500/10000 Mbps PCIX/PCIE Ethernet Network Controller.
- bnx2x driver for the Broadcom NetXtremeII BCM57710/BCM57711/BCM57711E
10/100/1000/2500/10000 Mbps PCIE Ethernet Network Controller.
- cnic driver that supports additional features required by the bnx2i iSCSI
offload driver. The bnx2i iSCSI driver is packaged separately.
ssh tunnel
[
2009/11/25 16:12 | by 井宿 ]
2009/11/25 16:12 | by 井宿 ]
Ssh tunnel通常能实现3种功能
1) 加密网络传输
2) 绕过防火墙
3) 让位于广域网的机器连接到局域网内的机器
上图描述的是第1和第2种功能
实现上图功能,可以用2种方法
方法1在209.132.177.50上操作
# ssh -Nf -L 10000:localhost:80 209.132.177.100
方法2在209.132.177.100上操作
# ssh -Nf -R 10000:localhost:80 209.132.177.50
上面两条命令的解释
打开主机209.132.177.50的10000端口,定向到209.132.177.100的80端口。
这样我们访问209.132.177.50的10000端口就等于访问209.132.177.100的80端口了。
其实背地里是做了如下动作
1) 209.132.177.50的ssh在209.132.177.50打开了10000端口,并且连接到209.132.177.100的22端口,
2) 209.132.177.100的sshd在22端口收到该请求,把通过该请求的连接都 转发到localhost的80端口。
3) 209.132.177.50的客户端从随即高端口连接到209.132.177.50的10000端口进行浏览,即浏览到209.132.177.100的80端口的内容
-Nf是为了让ssh tunnel挂到后台执行。否则ssh会直接打开到209.132.177.100的终端。
上面这种架构适合于翻防火墙以及加密通讯。
下面要讲另一种架构,适合于方便从公网连接到局域网内的一台机器(回家还需要连接到公司办公的情景)
假设
位于公网的客户端是10.66.0.78(当然事实上这是一个私网IP),
公司有一个暴露在公网的主机,公网IP是10.66.0.190(当然事实上这还是一个私网IP),公司私网的IP是192.168.200.20,
我在公司真正要登录的主机是192.168.200.100。
那么我可以做如下操作
方法1在 10.66.0.190上执行
[root@dhcp-0-190 ~]# ssh -Nf -L 10.66.0.190:10000:localhost:22 192.168.200.100
方法2a. 在10.66.0.190上修改配置文件/etc/ssh/sshd_config
开启
GatewayPorts yes
然后重新载入sshd配置
[root@dhcp-0-190 ~]# service sshd reload
Reloading sshd: [ OK ]
b. 然后在192.168.200.100上执行
[root@localhost ~]# ssh -Nf -R 10.66.0.190:10000:192.168.200.100:22 192.168.200.20
然后我们就可以在公网通过访问10.66.0.190:10000端口来连接192.168.200.100的22端口了。
安全因素大家看我上面其中2条命令
# ssh -Nf -L 10000:localhost:80 209.132.177.100
# ssh -Nf -L 10.66.0.190:10000:localhost:22 192.168.200.100
再看下ssh tunnel用例
-L [bind_address:]port:host:hostport
bind_address默认是127.0.0.1
格式是
[要打开的监听IP:]要打开的监听端口:要映射到的监听IP:要隐射到的监听端口
为什么有时候用locahost,有时候用10.66.0.190?
如果说ssh tunnel打开的端口只需要给本机用到,那么就让端口只在回环接口监听,如果需要让别的机器共享ssh tunnel打开的端口,则需要让ssh在可访问的IP上打开端口了。
1) 加密网络传输
2) 绕过防火墙
3) 让位于广域网的机器连接到局域网内的机器
上图描述的是第1和第2种功能
实现上图功能,可以用2种方法
方法1在209.132.177.50上操作
# ssh -Nf -L 10000:localhost:80 209.132.177.100
方法2在209.132.177.100上操作
# ssh -Nf -R 10000:localhost:80 209.132.177.50
上面两条命令的解释
打开主机209.132.177.50的10000端口,定向到209.132.177.100的80端口。
这样我们访问209.132.177.50的10000端口就等于访问209.132.177.100的80端口了。
其实背地里是做了如下动作
1) 209.132.177.50的ssh在209.132.177.50打开了10000端口,并且连接到209.132.177.100的22端口,
2) 209.132.177.100的sshd在22端口收到该请求,把通过该请求的连接都 转发到localhost的80端口。
3) 209.132.177.50的客户端从随即高端口连接到209.132.177.50的10000端口进行浏览,即浏览到209.132.177.100的80端口的内容
-Nf是为了让ssh tunnel挂到后台执行。否则ssh会直接打开到209.132.177.100的终端。
上面这种架构适合于翻防火墙以及加密通讯。
下面要讲另一种架构,适合于方便从公网连接到局域网内的一台机器(回家还需要连接到公司办公的情景)
假设
位于公网的客户端是10.66.0.78(当然事实上这是一个私网IP),
公司有一个暴露在公网的主机,公网IP是10.66.0.190(当然事实上这还是一个私网IP),公司私网的IP是192.168.200.20,
我在公司真正要登录的主机是192.168.200.100。
那么我可以做如下操作
方法1在 10.66.0.190上执行
[root@dhcp-0-190 ~]# ssh -Nf -L 10.66.0.190:10000:localhost:22 192.168.200.100
方法2a. 在10.66.0.190上修改配置文件/etc/ssh/sshd_config
开启
GatewayPorts yes
然后重新载入sshd配置
[root@dhcp-0-190 ~]# service sshd reload
Reloading sshd: [ OK ]
b. 然后在192.168.200.100上执行
[root@localhost ~]# ssh -Nf -R 10.66.0.190:10000:192.168.200.100:22 192.168.200.20
然后我们就可以在公网通过访问10.66.0.190:10000端口来连接192.168.200.100的22端口了。
安全因素大家看我上面其中2条命令
# ssh -Nf -L 10000:localhost:80 209.132.177.100
# ssh -Nf -L 10.66.0.190:10000:localhost:22 192.168.200.100
再看下ssh tunnel用例
-L [bind_address:]port:host:hostport
bind_address默认是127.0.0.1
格式是
[要打开的监听IP:]要打开的监听端口:要映射到的监听IP:要隐射到的监听端口
为什么有时候用locahost,有时候用10.66.0.190?
如果说ssh tunnel打开的端口只需要给本机用到,那么就让端口只在回环接口监听,如果需要让别的机器共享ssh tunnel打开的端口,则需要让ssh在可访问的IP上打开端口了。
Linux Find 命令
[
2009/11/18 14:41 | by 井宿 ]
2009/11/18 14:41 | by 井宿 ]
通过文件名查找法:
这个方法说起来就和在WINDOWS下查找文件一样容易理解了。如果你把这个文件放在单个的文件夹里面,只要使用常见的“ls"命令就能方便的查找出来,那么使用“find”命令来查找它就不能给你留下深刻的印象,毕竟“find”命令的强大功能不止这个。如果知道了某个文件的文件名,而不知道这个文件放到哪个文件夹,甚至是层层套嵌的文件夹里。举例说明,假设你忘记了httpd.conf这个文件在系统的哪个目录下,甚至在系统的某个地方也不知道,则这是可以使用如下命令:
find / -name httpd.conf
这个命令语法看起来很容易就明白了,就是直接在find后面写上 -name,表明要求系统按照文件名查找,最后写上httpd.conf这个目标文件名即可。稍等一会系统会在计算机屏幕上显示出查找结果列表:
etc/httpd/conf/httpd.conf
这就是httpd.conf这个文件在Linux系统中的完整路径。查找成功。
如果输入以上查找命令后系统并没有显示出结果,那么不要以为系统没有执行find/ -name httpd.conf命令,而可能是你的系统中没有安装Apache服务器,这时只要你安装了Apache Web服务器,然后再使用find / -name httpd.conf就能找到这个配置文件了。
无错误查找技巧
在Linux系统中“find”命令是大多数系统用户都可以使用的命令,并不是ROOT系统管理员的专利。但是普通用户使用“find”命令时也有可能遇到这样的问题,那就是Linux系统中系统管理员ROOT可以把某些文件目录设置成禁止访问模式。这样普通用户就没有权限用“find”命令来查询这些目录或者文件。当普通用户使用“find”命令来查询这些文件目录是,往往会出现"Permissiondenied."(禁止访问)字样。系统将无法查询到你想要的文件。为了避免这样的错误,我们可是使用转移错误提示的方法尝试着查找文件,输入
find / -name access_log 2>/dev/null
这个方法是把查找错误提示转移到特定的目录中去。系统执行这个命令后,遇到错误的信息就直接输送到stderrstream 2 中,access_log 2就是表明系统将把错误信息输送到stderrstream 2中,/dev/null是一个特殊的文件,表明空的或者错误的信息,这样查询到的错误信息将被转移了,不会再显示了。
在Linux系统查找文件也会遇到这样一个实际问题。如果我们在整个硬盘,这个系统中查找某个文件就要花费相当长的一段时间,特别是大型Linux系统和容量较大的硬盘,文件放在套嵌很深的目录中的时候。如果我们知道了这个文件存放在某个大的目录中,那么只要在这个目录中往下找就能节省很多时间了。使用find /etc -name httpd.conf 就可以解决这个问题。上面的命令就是表示在etc目录中查询httpd.conf这个文件。这里再说明一下“/ ”这个函数符号的含义,如果输入 “find/ ”就是表示要求Linux系统在整个ROOT目录下查找文件,也就是在整个硬盘上查找文件,而“find/etc”就是只在 etc目录下查找文件。因为“find/etc”表示只在etc目录下查找文件,所以查找的速度就相应要快很多了。
根据部分文件名查找方法:
这个方法和在WINDOWS中查找已知的文件名方法是一样的。不过在Linux中根据部分文件名查找文件的方法要比在WINDOWS中的同类查找方法要强大得多。例如我们知道某个文件包含有srm这3个字母,那么要找到系统中所有包含有这3个字母的文件是可以实现的,输入:
find /etc -name '*srm*'
这个命令表明了Linux系统将在/etc整个目录中查找所有的包含有srm这3个字母的文件,比如 absrmyz, tibc.srm等等符合条件的文件都能显示出来。如果你还知道这个文件是由srm 这3个字母打头的,那么我们还可以省略最前面的星号,命令如下:
这个方法说起来就和在WINDOWS下查找文件一样容易理解了。如果你把这个文件放在单个的文件夹里面,只要使用常见的“ls"命令就能方便的查找出来,那么使用“find”命令来查找它就不能给你留下深刻的印象,毕竟“find”命令的强大功能不止这个。如果知道了某个文件的文件名,而不知道这个文件放到哪个文件夹,甚至是层层套嵌的文件夹里。举例说明,假设你忘记了httpd.conf这个文件在系统的哪个目录下,甚至在系统的某个地方也不知道,则这是可以使用如下命令:
find / -name httpd.conf
这个命令语法看起来很容易就明白了,就是直接在find后面写上 -name,表明要求系统按照文件名查找,最后写上httpd.conf这个目标文件名即可。稍等一会系统会在计算机屏幕上显示出查找结果列表:
etc/httpd/conf/httpd.conf
这就是httpd.conf这个文件在Linux系统中的完整路径。查找成功。
如果输入以上查找命令后系统并没有显示出结果,那么不要以为系统没有执行find/ -name httpd.conf命令,而可能是你的系统中没有安装Apache服务器,这时只要你安装了Apache Web服务器,然后再使用find / -name httpd.conf就能找到这个配置文件了。
无错误查找技巧
在Linux系统中“find”命令是大多数系统用户都可以使用的命令,并不是ROOT系统管理员的专利。但是普通用户使用“find”命令时也有可能遇到这样的问题,那就是Linux系统中系统管理员ROOT可以把某些文件目录设置成禁止访问模式。这样普通用户就没有权限用“find”命令来查询这些目录或者文件。当普通用户使用“find”命令来查询这些文件目录是,往往会出现"Permissiondenied."(禁止访问)字样。系统将无法查询到你想要的文件。为了避免这样的错误,我们可是使用转移错误提示的方法尝试着查找文件,输入
find / -name access_log 2>/dev/null
这个方法是把查找错误提示转移到特定的目录中去。系统执行这个命令后,遇到错误的信息就直接输送到stderrstream 2 中,access_log 2就是表明系统将把错误信息输送到stderrstream 2中,/dev/null是一个特殊的文件,表明空的或者错误的信息,这样查询到的错误信息将被转移了,不会再显示了。
在Linux系统查找文件也会遇到这样一个实际问题。如果我们在整个硬盘,这个系统中查找某个文件就要花费相当长的一段时间,特别是大型Linux系统和容量较大的硬盘,文件放在套嵌很深的目录中的时候。如果我们知道了这个文件存放在某个大的目录中,那么只要在这个目录中往下找就能节省很多时间了。使用find /etc -name httpd.conf 就可以解决这个问题。上面的命令就是表示在etc目录中查询httpd.conf这个文件。这里再说明一下“/ ”这个函数符号的含义,如果输入 “find/ ”就是表示要求Linux系统在整个ROOT目录下查找文件,也就是在整个硬盘上查找文件,而“find/etc”就是只在 etc目录下查找文件。因为“find/etc”表示只在etc目录下查找文件,所以查找的速度就相应要快很多了。
根据部分文件名查找方法:
这个方法和在WINDOWS中查找已知的文件名方法是一样的。不过在Linux中根据部分文件名查找文件的方法要比在WINDOWS中的同类查找方法要强大得多。例如我们知道某个文件包含有srm这3个字母,那么要找到系统中所有包含有这3个字母的文件是可以实现的,输入:
find /etc -name '*srm*'
这个命令表明了Linux系统将在/etc整个目录中查找所有的包含有srm这3个字母的文件,比如 absrmyz, tibc.srm等等符合条件的文件都能显示出来。如果你还知道这个文件是由srm 这3个字母打头的,那么我们还可以省略最前面的星号,命令如下:
shell 脚本加密
[
2009/11/18 11:17 | by 井宿 ]
2009/11/18 11:17 | by 井宿 ]
第一种方法(gzexe):
这种加密方式不是非常保险的方法,但是能够满足一般的加密用途,可以隐蔽脚本中的密码等信息。
它是使用系统自带的gzexe程序,它不但加密,同时压缩文件。
使用方法:
gzexe file.sh
它会把原来没有加密的文件备份为 file.sh~ ,同时 file.sh 即被变成加密文件;
第二种方法(shc):
使用 shc 对 Linux shell 脚本加密.
shc是一个专业的加密shell脚本的工具.它的作用是把shell脚本转换为一个可执行的二进制文件,这个办法很好的解决了脚本中含有IP、密码等不希望公开的问题.
shc的下载地址:
http://www.anyside.com/lin...
安装:
tar zxvf shc-3.8.tgz
cd shc-3.8
make test
make
make test
make strings
make install
使用方法:
shc -r -f script-name
运行后会生成两个文件,script-name.x 和 script-name.x.c. 其中script-name.x是加密后的可执行的二进制文件;用./script-name即可运行,script-name.x.c是生成script-name.x的原文件(c语言).
这种加密方式不是非常保险的方法,但是能够满足一般的加密用途,可以隐蔽脚本中的密码等信息。
它是使用系统自带的gzexe程序,它不但加密,同时压缩文件。
使用方法:
gzexe file.sh
它会把原来没有加密的文件备份为 file.sh~ ,同时 file.sh 即被变成加密文件;
第二种方法(shc):
使用 shc 对 Linux shell 脚本加密.
shc是一个专业的加密shell脚本的工具.它的作用是把shell脚本转换为一个可执行的二进制文件,这个办法很好的解决了脚本中含有IP、密码等不希望公开的问题.
shc的下载地址:
http://www.anyside.com/lin...
安装:
tar zxvf shc-3.8.tgz
cd shc-3.8
make test
make
make test
make strings
make install
使用方法:
shc -r -f script-name
运行后会生成两个文件,script-name.x 和 script-name.x.c. 其中script-name.x是加密后的可执行的二进制文件;用./script-name即可运行,script-name.x.c是生成script-name.x的原文件(c语言).
testseg[24850]: segfault at 0000000000000000 rip 0000000000400470 rsp 0000007fbffff8a0 error 6
这种信息一般都是由内存访问越界造成的,不管是用户态程序还是内核态程序访问越界都会出core, 并在系统日志里面输出一条这样的信息。这条信息的前面分别是访问越界的程序名,进程ID号,访问越界的地址以及当时进程堆栈地址等信息,比较有用的信息是最后的error number. 在上面的信息中,error number是4 ,下面详细介绍一下error number的信息:
在上面的例子中,error number是6, 转成二进制就是110, 即bit2=1, bit1=1, bit0=0, 按照上面的解释,我们可以得出这条信息是由于用户态程序读操作访问越界造成的。
error number是由三个字位组成的,从高到底分别为bit2 bit1和bit0,所以它的取值范围是0~7.
bit2: 值为1表示是用户态程序内存访问越界,值为0表示是内核态程序内存访问越界
bit1: 值为1表示是写操作导致内存访问越界,值为0表示是读操作导致内存访问越界
bit0: 值为1表示没有足够的权限访问非法地址的内容,值为0表示访问的非法地址根本没有对应的页面,也就是无效地址
根据segfault信息调试定位程序bug:
#include
int main()
{
int *p;
*p=12;
return 1;
}
1. gcc testseg.c -o testseg -g,运行./testseg查看dmesg信息如下:
testseg[26063]: segfault at 0000000000000000 rip 0000000000400470 rsp 0000007fbffff8a0 error 6
2. 运行addr2line -e testseg 0000000000400470,输出如下:
/home/xxx/xxx/c/testseg.c:5
这种信息一般都是由内存访问越界造成的,不管是用户态程序还是内核态程序访问越界都会出core, 并在系统日志里面输出一条这样的信息。这条信息的前面分别是访问越界的程序名,进程ID号,访问越界的地址以及当时进程堆栈地址等信息,比较有用的信息是最后的error number. 在上面的信息中,error number是4 ,下面详细介绍一下error number的信息:
在上面的例子中,error number是6, 转成二进制就是110, 即bit2=1, bit1=1, bit0=0, 按照上面的解释,我们可以得出这条信息是由于用户态程序读操作访问越界造成的。
error number是由三个字位组成的,从高到底分别为bit2 bit1和bit0,所以它的取值范围是0~7.
bit2: 值为1表示是用户态程序内存访问越界,值为0表示是内核态程序内存访问越界
bit1: 值为1表示是写操作导致内存访问越界,值为0表示是读操作导致内存访问越界
bit0: 值为1表示没有足够的权限访问非法地址的内容,值为0表示访问的非法地址根本没有对应的页面,也就是无效地址
根据segfault信息调试定位程序bug:
#include
int main()
{
int *p;
*p=12;
return 1;
}
1. gcc testseg.c -o testseg -g,运行./testseg查看dmesg信息如下:
testseg[26063]: segfault at 0000000000000000 rip 0000000000400470 rsp 0000007fbffff8a0 error 6
2. 运行addr2line -e testseg 0000000000400470,输出如下:
/home/xxx/xxx/c/testseg.c:5











