易陆发现互联网技术论坛

 找回密码
 开始注册
查看: 394|回复: 3
收起左侧

Failed to run bootcmd module bootcmd

[复制链接]
发表于 2023-9-12 17:00:03 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?开始注册

x
Failed to run bootcmd module bootcmd
: w, D6 }' G6 K! N# t, Z
1 \- d$ ]! K  l" b$ m% s( b' u/ o" x) v/ \4 e
2023-09-12 08:11:12,132 - util.py[WARNING]: Failed to run bootcmd module bootcmd! k" J2 f/ B. e$ f, S, Y# p4 ]
2023-09-12 08:11:12,140 - util.py[WARNING]: Running module bootcmd (<module 'cloudinit.config.cc_bootcmd' from '/usr/lib/python2.7/site-packages/cloudinit/config/cc_bootcmd.pyc'>) failed# s8 r7 D: W2 ~
! B7 R( t' r7 E, K; d) A  R
+ J  f7 \$ ]  B! ^0 N
6 ~; O. n) N, Y6 ]
/ t4 V' y; O! D8 r# K

" @( l; I( L( \, J  L语法格式:cloud-init [参数]
: r! N0 `* \, ^0 Q) I( h
) k. e& d1 Y1 U" @9 r% _, [常用参数: init 初始化cloud-init并执行初始化模块 : m2 ^: o: K& j
初始化/ b# b- f5 U* A9 w

! J& W& Y9 h1 W) I5 lcloud-init并执行初始化模块:; U% \9 ]/ ]; v6 _" @# P

5 g6 O# a  [9 k2 p4 F3 w& _  ^& ^[root@cool ~]# cloud-init init
9 w2 A% h# s! U$ p$ U) E/ Z3 v. W# T, ?9 v- u8 L8 Q/ x( Y( F
使用给定的配置键激活模块:
# i0 {0 `( y) M+ k' M/ t! ~
, ^7 [( g9 D3 m1 E4 u4 m9 k1 Y) J[root@cool ~]# cloud-init modules
% a  [/ P: Y& U; _1 `, _- z; {; ?, T% `( k1 z3 G
报告云启动状态或等待完成:
7 v  ~5 Y/ n0 z4 |* r3 J% p, {) S$ M  [+ {" n7 }+ M
[root@cool ~]# cloud-init status& @, Y6 U1 S2 @2 l# L6 X( [* Y( w
# `# N" }8 R$ G# p( v
删除日志和工件,以便重新运行cloud-init:9 X# y; [1 F7 o) {0 q# O
0 w7 L/ t5 n. j# |
[root@cool ~]# cloud-init clean
/ U* S2 E: b4 q0 A+ U8 d0 T$ y0 v& B* n
根据以上信息,得知我们需要自动扩容vda3分区(growpart)、扩容LVM和xfs文件系统(runcmd)。3 x, F) U0 N: @' \& V) T
创建文件/etc/cloud/cloud.cfg.d/growpart.cfg
. d' E! ~: D( q. B' p5 j  Xvim /etc/cloud/cloud.cfg.d/growpart.cfg. Y/ D& z( b) o. B

9 m- Q& P, l( I, o: ]#cloud-config
1 E# D5 F& g9 Hgrowpart:
8 g" B$ x2 C! a; f1 K/ Z& H5 E  mode: auto( z: C  F+ U; V6 f: E; g7 |6 {0 ?
  devices: [/dev/vda2]
1 t! u" V8 V$ N. m7 Z  ignore_growroot_disabled: false
" I9 _- i3 M. f6 `% |runcmd:
; Q, @* F2 d3 x, P, Z  - [pvresize,/dev/vda2]
4 ~& q; p: m' v( K" D% c  - [lvextend,-l,+100%FREE,/dev/mapper/vklas-root]
. }* \; r# V; a1 f" _+ J  - [xfs_growfs,/]- s$ V! K' a8 l1 R/ v! c- c1 J

5 f* O  j2 F2 X" h4 `" \' p' Z注意:文件系统为ext2、ext3、ext4,则采用通过resize2fs 进行调整: B2 s7 b/ Z! j: q# ]
( i8 x5 R  D# u$ I9 s
2.5 每次重启均调整
$ n) E+ I  b: Z$ G4 N( U5 }- t. T" \$ D9 D, ^( h7 f
该需求涉及到云平台会有调整虚拟机的需求,也就是虚拟机磁盘进行调整后,文件系统也依然需要调整,故衍生出每次调整后自动扩容的了。$ a: `6 h7 }% l
不同的cloud-init模块有不同的执行频次:once-per-instance 、 always。可以在Modules文档中https://cloudinit.readthedocs.io/en/latest/topics/modules.html
% _0 z" }; H: N: L0 f/ T查看每个模块的Module frequency属性。例如,bootcmd在每次引导时运行,而runcmd只在第一次引导时运行。频次也可以在cloud.cfg配置文件模块列表中覆盖——cloud_init_modules, cloud_config_modules和cloud_final_modules。
% N6 `' M, ~: U- p故我们有bootcmd和runcmd两种方法实现该需求。7 T) n: P; B& J( J
' m2 g! V3 z" C/ i" }$ j& p, u
runcmd
6 ?: J: f- s( Q. u0 N6 \通过修改/etc/cloud/cloud.cfg文件,覆盖模块频次9 D' r9 [! ^: y: i4 `: J; L
vim /etc/cloud/cloud.cfg
! Q8 P" Q: ~  Q) l6 x1 H2 |( m' ~- {+ ?% F! U7 G8 s( }% O
cloud_config_modules:8 l8 D; J5 O+ S% b9 j. a: c
- [runcmd,always]
1 s0 H$ K( ?2 Z# `, @( U- D
* `: {& F  G( ]  k# m2.5.2 bootcmd# Z) V. f! u! F* O. t* P; z
修改/etc/cloud/cloud.cfg.d/growpart.cfg,将runcmd替换成bootcmd,全文如下:
8 Z1 @9 \% q$ G- p$ p
; p: h' U* e% a1 v#cloud-config
* p6 M: M9 S3 c: G- f$ Y# F) Igrowpart:
% G' D4 z. \  S0 q; a8 Y  mode: auto5 `. ~, }  I0 ~: V+ }% b
  devices: [/dev/vda2]& P% U( ~4 h, `- ~
  ignore_growroot_disabled: false
+ p5 g5 O, y/ D4 l, T. p  sbootcmd:$ X+ r6 _1 f  L# U; Y/ m
  - [pvresize,/dev/vda2]
( ]( m1 a- k8 U& P8 \. R  - [lvextend,-l,+100%FREE,/dev/mapper/vklas-root]
1 R) J- ^$ T0 I1 j, M  - [xfs_growfs,/]
0 t/ ^, T1 ?& ~' Y: s
2 r: Q" G$ M( v; d8 m& {9 o, Y在云平台中调整后,还需再次重启才能生效2 ?7 T# S; I) N" d

) q+ A# c' _( C2 T; E9 u
) v7 Q3 M3 W' F( C
6 u4 m! R+ b; b2 W
 楼主| 发表于 2023-9-12 17:00:04 | 显示全部楼层
初始化
2 q, M7 Z6 }, p4 `: E% }2 G( Z' o% G, K5 u- p/ O) Q8 j, m2 U' B! V' D
cloud-init并执行初始化模块:
' |$ r) _9 a2 c5 O; a; F. b* w5 o" Z& e$ v3 `" E0 e" N# T8 @
[root@cool ~]# cloud-init init
( b2 P: W4 W2 r" c: [. P- ?9 f9 a! w  O# k/ N# |! F4 e/ g5 _2 x" f
使用给定的配置键激活模块:
1 {" K9 @) g% G9 B/ ~5 v% e! s1 h: a+ T  E
[root@cool ~]# cloud-init modules
, t) q/ x/ N, v2 q4 H
' f5 a9 [7 w; |) }9 H( ~; E( |报告云启动状态或等待完成:  m. {6 u& T% D# @% d* P% d

+ P# m- G- ?2 `  ^/ H5 w; x1 r8 G[root@cool ~]# cloud-init status& i4 v6 {2 X$ z0 Y& z6 T' S

$ N( |; q' o( \$ M0 n9 z- {1 h删除日志和工件,以便重新运行cloud-init:
0 g! n2 k. s' W, Q4 l; g7 y; |9 V: [1 }# [- n) T6 a- t
[root@cool ~]# cloud-init clean
 楼主| 发表于 2023-9-12 17:00:05 | 显示全部楼层
[root@localhost ~]# cloud-init init
/ a( c* \/ v$ {) E1 S- \Cloud-init v. 19.4 running 'init' at Tue, 12 Sep 2023 08:39:50 +0000. Up 2409.94 seconds.
5 d  m, c7 }( Tci-info: +++++++++++++++++++++++++++++++++++++++Net device info+++++++++++++++++++++++++++++++++++++++5 c! N1 @  P* Z( c, a  u* U
ci-info: +--------+------+------------------------------+---------------+--------+-------------------+
5 l! w# H2 J$ N, G7 I/ Z: aci-info: | Device |  Up  |           Address            |      Mask     | Scope  |     Hw-Address    |
7 G7 n. x8 Z- l" g, L' T* hci-info: +--------+------+------------------------------+---------------+--------+-------------------+: D4 {2 i" V% a3 k2 N! l
ci-info: |  ens3  | True |        192.168.8.112         | 255.255.255.0 | global | 52:54:00:4c:ad:0e |$ @2 I' |  @6 B' N9 x  e& j/ Q
ci-info: |  ens3  | True | fe80::1c64:dcb6:c0e9:4a3e/64 |       .       |  link  | 52:54:00:4c:ad:0e |" ]# K2 \* _" m: u, B& h( k* y
ci-info: |   lo   | True |          127.0.0.1           |   255.0.0.0   |  host  |         .         |
4 ^7 @5 K2 m3 ?& Cci-info: |   lo   | True |           ::1/128            |       .       |  host  |         .         |- `3 M- S* Q7 ~7 b8 P! l. `+ ^
ci-info: +--------+------+------------------------------+---------------+--------+-------------------+
% n* b9 \! O& O! T6 E) sci-info: +++++++++++++++++++++++++++++Route IPv4 info+++++++++++++++++++++++++++++8 h9 }6 Z4 _9 s/ u0 i  S
ci-info: +-------+-------------+-------------+---------------+-----------+-------+8 {- K3 m0 o4 H! E8 D8 x8 K
ci-info: | Route | Destination |   Gateway   |    Genmask    | Interface | Flags |
" {2 `9 u4 S: }ci-info: +-------+-------------+-------------+---------------+-----------+-------+
  z) z7 N6 D7 v# M$ E1 k; Ici-info: |   0   |   0.0.0.0   | 192.168.8.1 |    0.0.0.0    |    ens3   |   UG  |3 m' @6 k0 @6 |# f
ci-info: |   1   | 192.168.8.0 |   0.0.0.0   | 255.255.255.0 |    ens3   |   U   |
' Q. Q3 I/ P2 @0 h- r" Ici-info: +-------+-------------+-------------+---------------+-----------+-------+" G5 M2 w2 W' Q8 V9 p, O, N
ci-info: +++++++++++++++++++Route IPv6 info+++++++++++++++++++2 B7 c3 `/ H7 Z- n
ci-info: +-------+-------------+---------+-----------+-------+: E$ C* `: ?9 ]- U' S( R7 k: r8 r& B
ci-info: | Route | Destination | Gateway | Interface | Flags |, C- ~& M. t4 Q2 i! e# f  `, ^
ci-info: +-------+-------------+---------+-----------+-------+
# V& z* o- w4 d$ X. g* mci-info: |   9   |  fe80::/64  |    ::   |    ens3   |   U   |! K" j5 Q# n- z- I5 L2 p
ci-info: |   13  |   ff00::/8  |    ::   |    ens3   |   U   |0 s% \0 E" g) K5 J
ci-info: +-------+-------------+---------+-----------+-------+9 r. y! T  w* S3 N/ c$ M
2023-09-12 08:39:51,754 - warnings.py[WARNING]: **************************************************************************
3 ^( I$ i' P) s! _# A new feature in cloud-init identified possible datasources for        #' ^  j0 L, d) v6 |( k; l
# this system as:                                                        #
4 v+ Q: y- [0 A) w( n#   []                                                                   #
% \' M6 o* b) {5 e) t# However, the datasource used was: None                                 #
3 B* I1 Y) u) k$ J0 a2 J#                                                                        #
  @6 \) a* J1 b* e. v# In the future, cloud-init will only attempt to use datasources that    #
: L; x( N) O- l, e+ h# are identified or specifically configured.                             #
& e, E! j6 z. C& s) u8 U# For more information see                                               #
7 F8 A9 p8 ]! y! Q#   https://bugs.launchpad.net/bugs/1669675                              #
$ [# u8 d! M0 d5 n# g1 l# c' k#                                                                        #: Y) n9 k6 z! s% d" X
# If you are seeing this message, please file a bug against              #
7 R% x' a& }8 H' k: K% R6 E# cloud-init at                                                          #* Z' }3 v# J1 |
#    https://bugs.launchpad.net/cloud-init/+filebug?field.tags=dsid      #
# o6 Z- x  v9 B% A: M# U. d) l# Make sure to include the cloud provider your instance is               #! t1 q1 G7 E. ^; j/ M
# running on.                                                            ## S" d. x5 d( i$ _& ~$ F$ Q
#                                                                        #4 L$ h" T" A" U5 k  o
# After you have filed a bug, you can disable this warning by launching  #
# x; a; s: H5 _. o# V* Y# your instance with the cloud-config below, or putting that content     #: O0 u: ^7 B' @3 B: W: `" H( A/ A
# into /etc/cloud/cloud.cfg.d/99-warnings.cfg                            #
2 G7 s! y: \+ \- x5 L( _/ r#                                                                        #$ w+ m; ]- u" A. g* y8 A: H
# #cloud-config                                                          #
. a2 u3 _7 C1 N. ~1 }3 u# warnings:                                                              #+ V1 |8 M/ j) f+ p5 h" Z5 ^) v
#   dsid_missing_source: off                                             ## ~# I" l, X" i, L' y; G
**************************************************************************
1 R  H/ e* K' z; P* z* u% i" t+ P: C' Y" x2 k
[root@localhost ~]# cloud-init status  
$ }: ~' {. z2 y" t) ~status: running/ M' s; p* C% K! V
[root@localhost ~]#
7 ?3 S4 H4 e8 p$ d; n+ R, X
 楼主| 发表于 2023-9-12 17:00:06 | 显示全部楼层
[root@localhost ~]# cloud-init modules
0 ~1 l7 w" @* E! e4 j1 S" jCloud-init v. 19.4 running 'modules:config' at Tue, 12 Sep 2023 08:41:06 +0000. Up 2485.43 seconds.# |( G$ U1 J6 C6 J/ S" ?# S5 Z# e
[root@localhost ~]# 1 R0 j3 _, j  X7 n  _/ P
您需要登录后才可以回帖 登录 | 开始注册

本版积分规则

关闭

站长推荐上一条 /4 下一条

北京云银创陇科技有限公司以云计算运维,代码开发

QQ|返回首页|Archiver|小黑屋|易陆发现技术论坛 ( 蜀ICP备2026014127号-1 )点击这里给我发消息

GMT+8, 2026-4-8 21:41 , Processed in 0.047774 second(s), 21 queries .

Powered by Discuz! X3.4 Licensed

© 2012-2025 Discuz! Team.

快速回复 返回顶部 返回列表