推荐给好友 上一篇 | 下一篇

Problems starting a jail with ezjail

5bjo#Kz9DFr AOver the weekend I was setting up a few FreeBSD jails to do some regression testing for the Bacula project. I had two already configured and running from my earlier work. My goal was to create a couple more and test multiple versions of databases etc. I found I could create a jail, but not login. When I checked in via the console, I saw that the initial startup script which did the jail setup was not running. I fixed it with a simple mv command. The rest of this article outlines the symptoms and how I fixed it.BSD爱好者乐园6? L_YdB%F#A0@
 
g`&Vh?rj 
;NUf-a+NThe symptomsBSD爱好者乐园p,B5j!].Wre.P
I started the jail:BSD爱好者乐园e ? V1sDl

BSD爱好者乐园(V if!d2tG

# ezjail-admin start mysql51.example.orgBSD爱好者乐园Icre)Z7?!o
Configuring jails:.
D0ItaDv"}(BStarting jails: mysql51.example.org.BSD爱好者乐园R6G$_~q e#Geh*K w

BSD爱好者乐园zW2QHi?

Then I tried to login into them:BSD爱好者乐园#g,Q LOx ~
$ ssh -A mysql51.example.org
Lny d-Z4CL+py'] @ aPassword:
tjX&^b+GV,APassword:BSD爱好者乐园p?-B+Ing { K"m-{
Password:BSD爱好者乐园3HtWC'l
Received disconnect from 10.55.0.102: 2: Too many authentication failures for dan

sx g%gYR|

#[{j!I.~*XSZBM(jThis stumped me. I knew the password.
[-f vr XX 
5S5A&lGRm6Tp^ 
V0[gv0qQzBThe investigationBSD爱好者乐园qi't|4t&^+w7f8n
Why didn't it let me in? Let me try the console:BSD爱好者乐园L}y(S9d

BSD爱好者乐园4}p(z.TB:E3Hw+\

# ezjail-admin console mysql51.example.org
3a&} tx3?LyCopyright (c) 1992-2009 The FreeBSD Project.
"l[-noRy?8SCopyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
:XQd7M^2Fa%^ yq        The Regents of the University of California. All rights reserved.

7t!B}3Fon"lt

G4f)s4^-`gc%AFreeBSD 8.0-STABLE (PHENOM) #1: Fri Dec 18 02:04:40 EST 2009BSD爱好者乐园F1r;?y@@a

-S&G6g/eId7AWelcome to FreeBSD!BSD爱好者乐园]~4f5p5jpz)`,S Jy

BSD爱好者乐园6{ S"c,y7a5YHoL}

Before seeking technical support, please use the following resources:BSD爱好者乐园 gE w2}+bhm

E}3P!Q4?o  Security advisories and updated errata information for all releases areBSD爱好者乐园p8Mo-XM/c
   at http://www.FreeBSD.org/releases/ - always consult the ERRATA section
(LGtD5V!t]*_7V   for your release first as it's updated frequently.BSD爱好者乐园Ja#L y E2dH$_ q`1O'I

BSD爱好者乐园.T:D5H/QK5T

o  The Handbook and FAQ documents are at http://www.FreeBSD.org/ and,BSD爱好者乐园pc[3HT*g!~7n2|
   along with the mailing lists, can be searched by going toBSD爱好者乐园%^zQ? s7A0Q
   http://www.FreeBSD.org/search/.  If the doc distribution hasBSD爱好者乐园a_mXls(EP{{
   been installed, they're also available formatted in /usr/share/doc.

T:U,O|+k'VBSD爱好者乐园i L*R|!~m*o}h

If you still have a question or problem, please take the output of
qw,Z(d@`uname -a', along with any relevant error messages, and email itBSD爱好者乐园'X:k ^z)OJ,E
as a question to the questions@FreeBSD.org mailing list.  If you are
.KPON `o,L;l kunfamiliar with FreeBSD's directory layout, please refer to the hier(7)BSD爱好者乐园d^0g|T
manual page.  If you are not familiar with manual pages, type `man man'.

lKB,c:B.N#}/w CBSD爱好者乐园{5`!{6H%Lxj)kP

You may also use sysinstall(8) to re-enter the installation andBSD爱好者乐园rcS%Q ?7CZF
configuration utility.  Edit /etc/motd to change this login announcement.BSD爱好者乐园3M2ylj%BQ
mysql51#BSD爱好者乐园 N"V6w ?qM

2F-vbX"^+rPThis dumped me right into the jail. So I got started:BSD爱好者乐园%T/D4p U%x/v*h

Hq(mEfjmysql51# bashBSD爱好者乐园'A+qC)V"dm;H;[F
bash: Command not found.BSD爱好者乐园 ]9jrIl0Fj]!d,J

BSD爱好者乐园-uL8nX,T

No bash? There should be bash. That's one of the first things my jails install. Is my account there?BSD爱好者乐园1X+o2o*} x0b

BSD爱好者乐园y$O5{_ A*i4{

mysql51# grep dan /etc/passwd
5i#[1}9o,I!d~mysql51#

PvUWI5v4k4d

^(PT U5kkNo, no account. OK, so the jail isn't being properly set up. What's in messages:BSD爱好者乐园Jz`&? KY{a#[*s

g A8wd+?(A"qmysql51 root: /etc/rc: WARNING: Ignoring old-style startup script /etc/rc.d/ezjail-config.shBSD爱好者乐园T6w%t+uABT
mysql51 sshd[40673]: error: PAM: authentication error for illegal user dan from 10.55.0.1BSD爱好者乐园A8vz0X {%\
mysql51 last message repeated 2 times

D$C!~v^CBSD爱好者乐园M2RYG E0o$s

Old style? What's up with that?

hn G*@ y

cPNA8S0j# ls -l /etc/rc.d/ezjail-config.shBSD爱好者乐园7BxP{ xF|l
lrwxr-xr-x  1 root  wheel  15 Jan 22 16:14 /etc/rc.d/ezjail-config.sh -> /ezjail.flavourBSD爱好者乐园(ZAU3u SQ Q4u

.iMO-a$S|uI/ezjail.flavour is the startup script executed once when the jail is first run. It can do most setup that you might require. Failure to start is the cause of these problems. But why?BSD爱好者乐园(I+zr6J&|_b&F4Kc?

BSD爱好者乐园Q*C'_N*m0Gf

Google to the rescue: http://www.mail-archive.com/freebsd-jail@freebsd.org/msg01080.html. In short, the file name needs to change from ezjail-config.sh to ezjail-config. More precisely, the symlink needs to be renamed.
+hp}KyJ(t 
4c6]}'@'k*nG_6d_ 
"L-de Z]PThe fixBSD爱好者乐园{P!el`/o
I stopped the jail:

T-{k1_b X8DBSD爱好者乐园+u4Q%p%MWZN

# ezjail-admin stop mysql51.example.orgBSD爱好者乐园&n1`hM1xMR
Stopping jails: mysql51.example.org.

lmC,p \rz

K9fS h8z*~~ EI renamed the culprit file:
e'} UxfoC0^,qa# cd /usr/jails/mysql51.example.org/etc/rc.dBSD爱好者乐园kP+Yj!@)gKNB ]
# mv ezjail-config.sh ezjail-configBSD爱好者乐园E*NQFg ypAh
# cd /usr/jailsBSD爱好者乐园9`0V m5Z#DRY

jg$C0U#r&T(A c-{ jAnd I restarted the jail. This time it took a bit longer to start, which is good. That meant it was running all the startup scripts (installing packages, creating users, etc.BSD爱好者乐园g&?$SFt

BSD爱好者乐园 u3pA D Y8dPY)S

# ezjail-admin start mysql51.example.orgBSD爱好者乐园 Ws-q9Uq%x
Configuring jails:.BSD爱好者乐园+[o9az'mQ'x
Starting jails: mysql51.example.org.

%T i X.ZED5HBSD爱好者乐园(bi9D-HAZS$x

I was then able to connect to the jail without issue.BSD爱好者乐园7bA(@9O.M[ld1OS'z"y
 BSD爱好者乐园"F4D \tMU)a E
 BSD爱好者乐园_,OF9a gfT M
The longterm fixBSD爱好者乐园(LQ&b$s-X1[~AX!v
The long term fix is at the URL post above. It needs to be incorporated into the port. I plan to create a patch and test tomorrow night.

OGl+[&}

mW&C0m7\ F ] Y0]^Ahh, after writing the above, I heard this fix is already in the ezjail repo, but not yet released. Still. I'll see about the patch.

7P9L"?DXD?BSD爱好者乐园Is4_ M*[m#](h |4s

Hmm, I've tested the patch. Works fine. It's beensubmitted. And the port skeleton can bedownloaded hereBSD爱好者乐园n ste$X x%y

因为使用范围的限制,BSD方面文章更新速度不快,站长会坚持每天更新博客,欢迎访问!
[版权声明]BSD爱好者乐园站内文章,如来源不是互联网,则均系原创或翻译之作,可随意转载,或以此为基础进行演译,但务必以链接形式注明原始出处和作者信息,否则属于侵权行为。另对本站转载他处文章,俱有说明,如有侵权请联系本人,本人将会在第一时间删除侵权文章。
TAG: ezjail jail
 

评分:0

我来说两句

seccode