﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>IT博客-ideallorn-随笔分类-Linux/FreeBSD Sys Admin</title><link>http://www.cnitblog.com/ideallorn/category/7836.html</link><description /><language>zh-cn</language><lastBuildDate>Tue, 27 Sep 2011 10:09:24 GMT</lastBuildDate><pubDate>Tue, 27 Sep 2011 10:09:24 GMT</pubDate><ttl>60</ttl><item><title>svn: error while loading shared libraries: /usr/local/lib/libsvn_ra_dav-1.so.0: cannot restore segment port after reloc: Permission denied </title><link>http://www.cnitblog.com/ideallorn/archive/2009/03/04/55093.html</link><dc:creator>releng</dc:creator><author>releng</author><pubDate>Wed, 04 Mar 2009 05:20:00 GMT</pubDate><guid>http://www.cnitblog.com/ideallorn/archive/2009/03/04/55093.html</guid><wfw:comment>http://www.cnitblog.com/ideallorn/comments/55093.html</wfw:comment><comments>http://www.cnitblog.com/ideallorn/archive/2009/03/04/55093.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/ideallorn/comments/commentRss/55093.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/ideallorn/services/trackbacks/55093.html</trackback:ping><description><![CDATA[<pre wrap="">http://wiki.yfang.cn/bin/view/MyTroubleShooting/Svn:ErrorWhileLoadingSharedLibraries:Libsvn_ra_dav-1_so_0:CannotRestoreSegmentPortAfterReloc:PermissionDenied<br><br>最简单的方法就是关闭 SELinux<br><br></pre>
<h3>问题描述 </h3>
<ul>
    <li> <code>时间</code> 2008.10.14
    </li>
    <li> <code>环境</code> <ntop>CentOS5
    </ntop></li>
    <li> <code>症状</code> 正常安装svn后执行不能
    </li>
</ul>
<div class="BeautifierPlugin">
<div class="fragment">
<pre><font color="green"># 执行svn命令，会提示</font><br>[root@localhost lib]<font color="green"># svn</font><br>svn: error <font color="brown">while</font> loading shared libraries: /usr/local/svn-1.4.0/lib/libsvn_ra_dav-1.so.0: <br>cannot restore segment prot after reloc: Permission denied</pre>
</div>
</div>
<h3><a name="问题原因和解决方案"></a> 问题原因和解决方案 </h3>
<ul>
    <li> 非常快的排除了系统文件权限（就是那个chmod能改的lrwxrwxrwx）可能，因为这是一个符号链接，一直追过去权限没有问题
    </li>
    <li> 不卖关子，这个问题的原因是因为SELinux被Enable但是没有配置过libsvn_ra_dav-1.so.0文件的security context的原因，为了检查这个问题，你可以执行下面的命令来确认
    </li>
</ul>
<div class="BeautifierPlugin">
<div class="fragment">
<pre><font color="green"># sestatus [-v] </font><br><font color="green"># 注意里面 SELinux status:         enabled 部分</font><br><br><font color="green"># 其他方法也可以查看，比如</font><br><font color="navy">cat</font> /selinux/enforce<br>1 代表 enforcing 状态, 0 代表 permissive 状态<br><br><font color="green"># 或者下面这个更直观</font><br>getenforce</pre>
</div>
</div>
<ul>
    <li> 通常有两种解决方案
    <ul>
        <li>
        方案一：避开问题，如果你提出了这个问题并为之困惑，我基本上可以判断你并不熟悉SElinux的工作性质，甚至从来没有注意过它的存在。基于这种考虑，
        如果你联系你们的服务器管理员后确认SElinux不是你们系统中必须的，那么把它干掉吧。具体方法是执行setenforce
        disabled来禁用selinux，或者至少setenforce
        permissive来用warning代替禁止你工作的error级错误，这样Selinux就不再强悍的把你挡掉了。同样的配置实现在CentOS5
        或者RHEL5中可以通过system-config-securitylevel-tui来设定，它包装了这个小功能。 </li>
        <li> 方案二：继续Enable SElinux的情况下，你需要针对这件事做的操作也很简单，执行下面的命令更改security context就可以了，问题是，你可能今后亦然遇到这种类似的问题，你需要比较了解SElinux的机制和你的应用程序的底层调用。
        </li>
    </ul>
    </li>
</ul>
<div class="BeautifierPlugin">
<div class="fragment">
<pre>chcon <font color="purple">-t</font> texrel_shlib_t /usr/local/svn-1.4.0/lib/libsvn_ra_dav-1.so.0</pre>
</div>
</div>
<p>
</p>
<h3><a name="多说两句"></a> 多说两句 </h3>
<ul>
    <li> SElinux对于Linux新手来说可能是一个比较难于理解的工具，对于一般的新手系统管理员来说，你可以先跳过这个工具，简单的disable掉它。
    </li>
    <li>
    SElinux很大程度上解决了简单的权限认证不能够保证系统真正安全的问题，是美国军方提出的。所以对于系统复杂，分工详细，安全要求比较高的系统来
    说，这是一个好东西，不过同时带来的是较为复杂的设置（一般非常强大的可定制工具都是这样），要求管理员对系统和程序比较了解，否则可能把自己希望的服务
    挡掉继而出现本文提到的类似问题。
    </li>
    <li> 感兴趣的朋友可以直接查看SElinux的官方文档，来获取更多消息。
    </li>
</ul>
<p>
</p>
<h3><a name="SElinux可能涉及到的命令"></a> SElinux可能涉及到的命令 </h3>
<div class="BeautifierPlugin">
<div class="fragment">
<pre><font color="green"># 查看SElinux Enable情况</font><br>sestatus<br>getenforce<br><br><font color="green"># 设定SElinux是否启用</font><br>setenforce<br><br><font color="green"># 防火墙管理的TUI，可以设定Selinux状态</font><br>system-config-securitylevel-tui<br><br><font color="green"># 查看当前用户security context</font><br>id -Z<br><br><font color="green"># 查看文件security context</font><br>ls -Z<br>ls --lcontext <br>ls --scontext<br><br><font color="green"># 查看运行进程的security context</font><br><font color="navy">ps</font> -eZ<br><br><font color="green"># 更改文件security context</font><br>chcon<br><br><font color="green"># 重置文件security context</font><br>restorecon<br><br><font color="green"># 根据已有的挡掉的log生成允许的规则，可以帮助你调试当前规则</font><br><font color="navy">cat</font> /var/log/message | audit2allow<br>audit2allow <font color="purple">-d</font> <font color="green">#这个是从dmesg里读</font></pre>
</div>
</div>
<pre wrap=""><br></pre><img src ="http://www.cnitblog.com/ideallorn/aggbug/55093.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/ideallorn/" target="_blank">releng</a> 2009-03-04 13:20 <a href="http://www.cnitblog.com/ideallorn/archive/2009/03/04/55093.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>RH64位系统上编译安装SVN</title><link>http://www.cnitblog.com/ideallorn/archive/2009/02/20/54758.html</link><dc:creator>releng</dc:creator><author>releng</author><pubDate>Fri, 20 Feb 2009 03:40:00 GMT</pubDate><guid>http://www.cnitblog.com/ideallorn/archive/2009/02/20/54758.html</guid><wfw:comment>http://www.cnitblog.com/ideallorn/comments/54758.html</wfw:comment><comments>http://www.cnitblog.com/ideallorn/archive/2009/02/20/54758.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/ideallorn/comments/commentRss/54758.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/ideallorn/services/trackbacks/54758.html</trackback:ping><description><![CDATA[SVN在RH32位系统上通常按照常规的方法很容易编译通过，但到了64位系统上却经常会出现等链接错误<br><font size="3"><font face="MS Shell Dlg"><font color="#000000"><br>subversion-1.4.5/neon/src/.libs/libneon.a: could not read symbols: Bad value</font></font></font><br><font size="3"><font face="宋体">collect2: ld returned 1 exit status</font></font><br><br>Google了一下，找到如下解决方法<br><br>1. 解压<span style="font-family: MS Shell Dlg;">两个包后</span><font size="3"><font face="MS Shell Dlg"><font color="#000000"><br>$ tar jxvf subversion-1.4.5.tar.bz2 .
<br>$ tar jxvf subversion-deps-1.4.5.tar.bz2 .</font></font></font><br>2. 分别编译 apr,apr-util, neon (一样的configure 选项)<br>cd apr<br><font size="3">./configure --prefix=$HOME --without-berkeley-db      --with-editor=/usr/bin/vim --with-apr=$HOME      --with-apr-util=$HOME --with-neon=$HOME      --without-apxs --without-apache --enable-shared --with-ssl<br>make &amp;&amp; make install<br>...<br>3. 最后再编译svn<br></font><font size="3">./configure --prefix=$HOME --without-berkeley-db
--with-editor=/usr/bin/vim --with-apr=$HOME --with-apr-util=$HOME
--with-neon=$HOME --without-apxs --without-apache --enable-shared
--with-ssl<br>
make &amp;&amp; make install</font><br><br><img src ="http://www.cnitblog.com/ideallorn/aggbug/54758.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/ideallorn/" target="_blank">releng</a> 2009-02-20 11:40 <a href="http://www.cnitblog.com/ideallorn/archive/2009/02/20/54758.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Add open-terminal in the right click on Fedora 6+ </title><link>http://www.cnitblog.com/ideallorn/archive/2009/02/05/54287.html</link><dc:creator>releng</dc:creator><author>releng</author><pubDate>Thu, 05 Feb 2009 08:49:00 GMT</pubDate><guid>http://www.cnitblog.com/ideallorn/archive/2009/02/05/54287.html</guid><wfw:comment>http://www.cnitblog.com/ideallorn/comments/54287.html</wfw:comment><comments>http://www.cnitblog.com/ideallorn/archive/2009/02/05/54287.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/ideallorn/comments/commentRss/54287.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/ideallorn/services/trackbacks/54287.html</trackback:ping><description><![CDATA[<ul>
    <li>yum install nautilus-open-terminal </li>
</ul><img src ="http://www.cnitblog.com/ideallorn/aggbug/54287.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/ideallorn/" target="_blank">releng</a> 2009-02-05 16:49 <a href="http://www.cnitblog.com/ideallorn/archive/2009/02/05/54287.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Solve the conflict between service 'messagebus' and 'openldap' on Fedora 9 </title><link>http://www.cnitblog.com/ideallorn/archive/2009/02/05/54288.html</link><dc:creator>releng</dc:creator><author>releng</author><pubDate>Thu, 05 Feb 2009 08:49:00 GMT</pubDate><guid>http://www.cnitblog.com/ideallorn/archive/2009/02/05/54288.html</guid><wfw:comment>http://www.cnitblog.com/ideallorn/comments/54288.html</wfw:comment><comments>http://www.cnitblog.com/ideallorn/archive/2009/02/05/54288.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/ideallorn/comments/commentRss/54288.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/ideallorn/services/trackbacks/54288.html</trackback:ping><description><![CDATA[<ul>
    <li>add 'bind_policy soft' in /etc/ldap.conf </li>
</ul><img src ="http://www.cnitblog.com/ideallorn/aggbug/54288.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/ideallorn/" target="_blank">releng</a> 2009-02-05 16:49 <a href="http://www.cnitblog.com/ideallorn/archive/2009/02/05/54288.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Print with linage on gvim </title><link>http://www.cnitblog.com/ideallorn/archive/2009/02/05/54286.html</link><dc:creator>releng</dc:creator><author>releng</author><pubDate>Thu, 05 Feb 2009 08:48:00 GMT</pubDate><guid>http://www.cnitblog.com/ideallorn/archive/2009/02/05/54286.html</guid><wfw:comment>http://www.cnitblog.com/ideallorn/comments/54286.html</wfw:comment><comments>http://www.cnitblog.com/ideallorn/archive/2009/02/05/54286.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/ideallorn/comments/commentRss/54286.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/ideallorn/services/trackbacks/54286.html</trackback:ping><description><![CDATA[<ul>
    <li>set printoptions=number:y </li>
</ul>
<img src ="http://www.cnitblog.com/ideallorn/aggbug/54286.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/ideallorn/" target="_blank">releng</a> 2009-02-05 16:48 <a href="http://www.cnitblog.com/ideallorn/archive/2009/02/05/54286.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>How to update the pkg (FC7 ~&gt;FC8) directly from the DVD/iso </title><link>http://www.cnitblog.com/ideallorn/archive/2009/02/05/54285.html</link><dc:creator>releng</dc:creator><author>releng</author><pubDate>Thu, 05 Feb 2009 08:47:00 GMT</pubDate><guid>http://www.cnitblog.com/ideallorn/archive/2009/02/05/54285.html</guid><wfw:comment>http://www.cnitblog.com/ideallorn/comments/54285.html</wfw:comment><comments>http://www.cnitblog.com/ideallorn/archive/2009/02/05/54285.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/ideallorn/comments/commentRss/54285.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/ideallorn/services/trackbacks/54285.html</trackback:ping><description><![CDATA[<ul>
    <li> Fedora-8-i386.dvd in /net/eog-nas1s/c/iso/FC/Fedora-8-i386/Fedora-8-i386-DVD.iso
    </li>
    <li> mount -t iso9660 -o loop /path/to/.iso /media/cdrom
    </li>
    <li> back up the two file /etc/yum.repos.d/fedora-updates.repo &amp; /etc/yum.repos.d/fedora.repo
    </li>
    <li> vim fedora-updates.repo
    <ul>
        <li> comment out the 'mirrorlist' line
        </li>
        <li> uncomment the baseurl, and change to 'baseurl=file:///media/cdrom'
        </li>
    </ul>
    </li>
    <li> the same operation on fedora.repo
    </li>
</ul><img src ="http://www.cnitblog.com/ideallorn/aggbug/54285.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/ideallorn/" target="_blank">releng</a> 2009-02-05 16:47 <a href="http://www.cnitblog.com/ideallorn/archive/2009/02/05/54285.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Change your Time Zone </title><link>http://www.cnitblog.com/ideallorn/archive/2009/02/05/54284.html</link><dc:creator>releng</dc:creator><author>releng</author><pubDate>Thu, 05 Feb 2009 08:46:00 GMT</pubDate><guid>http://www.cnitblog.com/ideallorn/archive/2009/02/05/54284.html</guid><wfw:comment>http://www.cnitblog.com/ideallorn/comments/54284.html</wfw:comment><comments>http://www.cnitblog.com/ideallorn/archive/2009/02/05/54284.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/ideallorn/comments/commentRss/54284.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/ideallorn/services/trackbacks/54284.html</trackback:ping><description><![CDATA[<ol>
    <li> Check the current Time Zone      *more /etc/sysconfig/clock
    </li>
    <li>  tzselect
    </li>
    <li> cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
    </li>
    <li> hwclock
    </li>
</ol><img src ="http://www.cnitblog.com/ideallorn/aggbug/54284.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/ideallorn/" target="_blank">releng</a> 2009-02-05 16:46 <a href="http://www.cnitblog.com/ideallorn/archive/2009/02/05/54284.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>