Linux 中profile 和bashrc的执行顺序

发布于: 2013年01月29日

一般来说,login Linux系统时会涉及到以下几个文件的执行:

/etc/profile

~/.profile

~/.bahrc

执行顺序是这样的:

1. 首选系统寻找/etc/profile,执行里面的shell命令,可能在该文件里面会引用执行/etc/bash.bashrc文件

2. 执行完/etc/profile后,会寻找并执行用户目录下的profle文件~/.profile

3. 用户目录下的bashrc文件~/.bashrc不会自动执行,而是在~/.profile里面引用执行。如果用户目录下没有~/.profile文件,登陆时~/.bashrc文件时无效的。如果一定要执行,可以手动以下面的命令进行:

source  ~/.bashrc

以上仅个人摸索经验,如有不对,恳请指正。

 

Congratulations!! Linux From Scratch-7.2

发布于: 2013年01月25日

本以为要一个月时间的完成,经历无数坎坷的LFS-7.2,意想不到地只花了两周及三个难关就完成了。不知道算是高估了LFS的难度?还是低估了自己的Linux和英语水平?:-D

LFS启动成功兴奋之余,仍然发现了一个问题:为何不用initrd也可启动?可能跟我编译了一个6M以上的巨大内核有关吧?但是LFS Book甚至没有提及initrd,为何?

下一步是BLFS还是Gentoo,我还没有想好。不过还是先给LFS编译一个SSH吧,netbook键盘太难受了。

贴上我的实际完成时间线:

2013.1.18 16:51 6.29. Bison-2.6.2 Installation of Bison
2013.1.18 17:14 6.30. Procps-3.2.8 Installation of Procps
2013.1.18 17:22 6.31. Grep-2.14 Installation of Grep
2013.1.18 17:24 6.32. Readline-6.2 Installation of Readline
2013.1.21 9:56 6.33. Bash-4.2 Installation of Bash
2013.1.21 10:20 6.34. Libtool-2.4.2 Installation of Libtool
2013.1.21 11:05 6.35. GDBM-1.10 Installation of GDBM
2013.1.21 11:13 6.36. Inetutils-1.9.1 Installation of Inetutils
2013.1.21 11:21 6.37. Perl-5.16.1 Installation of Perl
2013.1.21 12:30 6.38. Autoconf-2.69 Installation of Auutoconf
2013.1.21 13:08 6.39. Automake-1.12.3 Installation of Automake
2013.1.21 16:26 6.40. Diffutils-3.2 Installation of Diffutils
2013.1.22 8:06 6.41. Gawk-4.0.1 Installation of Gawk
2013.1.22 8:22 6.42. Findutils-4.4.2 Installation of findutils
2013.1.22 9:04 6.43. Flex-2.5.37 Installation of Flex
2013.1.22 9:13 6.44. Gettext-0.18.1.1 Installation of Gettext
2013.1.22 10:36 6.45. Groff-1.21 Installation of Groff
2013.1.22 10:46 6.46. Xz-5.04 Installation Xz
2013.1.22 10:52 6.47. GURB-2.00 Installation of GRUB
2013.1.22 11:00 6.48. Less-444 Installation of Less
2013.1.22 11:02 6.49. Gzip-1.5 Installation of Gzip
2013.1.22 11:08 6.50. IPRoute2-3.5.1 Installation of IPRoute2
2013.1.22 12:02 6.51. Kbd-1.15.3 Installation of Kbd
2013.1.22 12:08 6.52. Kmod-9 Installation of Kmod
2013.1.22 12:13 6.53. Libpipeline-1.2.1 Installation of Libpipeline
2013.1.22 12:17 6.54. Make-3.82 Installation of Make
2013.1.22 12:30 6.55. Man-DB-2.6.2 Installation of Man-DB
2013.1.22 12:34 6.56. Patch-2.6.1 Installation of Patch
2013.1.22 12:37 6.57. Sysklogd-1.5 Installation of Sysklogd
2013.1.22 12:39 6.58. Sysvinit-2.88dsf Installation of Sysvinit
2013.1.22 12:41 6.59. Tar-1.26 Installation of Tar
2013.1.22 12:58 6.60. Texinfo-4.13a Installation of Texinfo
2013.1.22 13:01 6.61. Udev-188 (Extracted from systemd-188) Installation of Udev
2013.1.22 13:12 6.62. Vim-7.3 Installation of Vim
2013.1.22 13:47 Chapter 7. Setting Up System Bootscripts
2013.1.22 16:58 Done 7.3. Customizing the /etc/hosts File. Skip 7.4 and 7.5
2013.1.22 17:03 7.6. LFS-Bootscripts-20120901 Installation of LFS-Bootscripts
2013.1.22 17:14 Done 7.9. Configuring the setclock Script
2013.1.24 10:40 Skip 7.10. Configuring the Linux Console
2013.1.24 10:41 Skip 7.11. Configuring the sysklogd Script and 7.12. The rc.site File
2013.1.24 10:49 Done 7.13. The Bash Shell Startup Files
2013.1.24 10:50 Done 7.14. Creating the /etc/inputrc File
2013.1.24 10:51 8.2. Creating the /etc/fstab File
2013.1.24 11:00 Starting 8.3. Linux-3.5.2 Installation of the kernel
2013.1.24 12:48 Make Kernel
2013.1.24 14:59 8.4. Using GRUB to Set Up the Boot Process
2013.1.24 15:31 Chapter 9. The End
2013.1.24 15:31 First Time Reboot! Will good luck be with me!!
2013.1.24 15:40 Congratulations!!

近6年的Godaddy Linux Deluxe主机价格变动

发布于: 2013年01月16日

本站点自2007年至今,一直使用Godaddy Linux Deluxe主机,感叹时光飞逝岁月如梭。当年还是咬牙心疼买下的主机空间建立的站点,如今已经是不能放弃的日常必需品。

最近一次订单之后,我也在思考这个问题:人民币汇率一再增值,主机的价格是否持续便宜?把订单拉出来一看,发现事实并非那么回事。

下表是根据我的订单付款列表列出的历年价目表。所有价格均为原价,为使用优惠码。汇率为当年10月份的参考价。

godaddy_price_summary
历年价目详表

从下图可以看到,6年间美元月单价经历了2008年,2011年和2012年三次涨价。

godaddy_price_dollar
美元月单价趋势图

显然这几年间人民币汇率是升值的,所以从下图可以看到,及时人民币在升值,但总还是比不过美元单价的涨势。总体来说仅1010年单价微降1元人民币,其余年份均有上涨。

godaddy_price_rmb
折合为人民币的月单价趋势图

 结论:买东西的总是算不过卖东西的。

 

Chroot 后编译Glibc-2.16.0 bash出错

发布于: 2013年01月16日

九九八十一难之三

LFS-7.2 Chapter 6.9 Glibc-2.16.0

make时出错:

/bin/sh:command substitution: line3:syntax error near unexpected token’)’

Google 一下容易发现很多人碰到同样问题,比如这位这位,解决方案都是将bash-4.2降级到bash-4.1

我则没有贸然行动,于是在原chroot之前的环境下,bash-4.2源码目录执行了一次test

lfs@host$ make tests

果然发现了一堆错误,其中包含上面的这个。

我尝试按照LFS Book-7.2,Chapter 5.15 重新编译bash-4.2,但不打补丁bash-4.2-fixes-8.patch

编译后执行make tests,错误消失。make install后重新编译Glibc进行正常。

不知道不打补丁的bash-4.2后续会不会再出现问题。

Will good luck be with me!

gcc: error trying to exec ‘as’: execvp: No such file or directory

发布于: 2013年01月15日

九九八十一难之二:

第七章:6.7.1. Installation of Linux API Headers

make header_check

CHK include/linux/version.h
HOSTCC scripts/basic/fixdep
gcc: error trying to exec ‘as’: execvp: No such file or directory
make[1]: *** [scripts/basic/fixdep] Error 1
make: *** [scripts_basic] Error 2

Google到了最接近答案的内容:

 

http://www.linuxquestions.org/questions/linux-from-scratch-13/failed-on-chapter-6-7-1-installation-of-linux-api-headers-make-headers_check-928113/

 

 

除了对方使用LFS-7.0,而我使用LFS-7.2以外,诊断完全一致。

 

可执行文件 as 来自软件包Binutils-2.22,在/tools/bin里面并没有as文件,但存在i686-lfs-linux-gnu-as

在host 环境下执行:

# /tools/bin/i686-lfs-linux-gnu-ld -v

GNU ld (GNU Binutils) 2.22

chroot 到LFS之后执行:

# ./i686-lfs-linux-gnu-ld -v
bash: ./i686-lfs-linux-gnu-ld: No such file or directory

根据上面链接的最终解决方案是从第五章重新开始。无奈….

如果前面那里错了的话,那么应该是 Binutils-2.22 Pass 2

存档,Restart over again.

 

Day-2 跟进:

/tools 目录下可以搜索到连个相关文件:

/tools/bin/i686-lfs-linux-gnu-as

/tools/i686-lfs-linux-gnu/bin/as

但实际上这两个并非二进制文件,而是shell命令。

进入 Binutils-2.22 Pass 2重新make install 一次,发现/tools/bin目录下出现as文件。

结论:严重怀疑5.33. Stripping章节中的下面这行命令删除了不该删的东西:

strip –strip-unneeded /tools/{,s}bin/*

强烈建议同道人士跳过5.33. Stripping章节

Glibc-2.16.0 编译错误 -z relro 支持问题

发布于: 2013年01月11日

前一篇文章提到找点乐子,Linux From Scratch。我并没有食言。

LFS is starting…

Version 7.2

Debian 6.0 Host

编译到Glibc时出现第一个问题,configure 时出现-z relro支持问题,错误代码如下:

checking for -z nodelete option… yes
checking for -z nodlopen option… yes
checking for -z initfirst option… yes
checking for -z relro option… no
configure: error: linker with -z relro support required

gmane.org上的邮件列表日志认为是awk指向了mawk造成的。但只答对了一半,我google到的结果似乎是这样的:

awk要么指向mawk,要么指向gawk,已经没有原始版本的awk了。

mawk version:

mawk 1.3.3 Nov 1996, Copyright (C) Michael D. Brennan

gawk version:

GNU Awk 3.1.7
Copyright (C) 1989, 1991-2009 Free Software Foundation.

安装gawk看起来更新一些。

解决方法:apt-get install gawk

安装完成后awk会自动指向gawk,重新configure即可通过。

浙ICP备18056264号-1