找回密码
 注册
查看: 396|回复: 3

Failed to run bootcmd module bootcmd

[复制链接]

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
发表于 2023-9-12 17:00:03 | 显示全部楼层 |阅读模式
Failed to run bootcmd module bootcmd
2 a; k, F/ p1 a# d/ c$ c( u" Y: X9 A% A+ a+ [

4 L  t/ R7 D" b; x% m& p2 R2023-09-12 08:11:12,132 - util.py[WARNING]: Failed to run bootcmd module bootcmd
1 p! b# X" h( Z2023-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  w$ K& D6 `8 T- z% J) f
% L: O$ z( _0 P" D" a
; d1 N& D4 ^% w6 f6 j" D$ Q" n
9 J$ h" J3 g1 o; I1 k$ o, I

: s' j4 z7 p5 k! C) V# |- d6 i9 |
语法格式:cloud-init [参数]
: A8 j# a& t* s' S) }5 E
8 p9 H/ G; T" o常用参数: init 初始化cloud-init并执行初始化模块
- v: g% j* O, `/ |6 P+ V, w1 C初始化
' ^2 p2 G  B: k- T% k  ?1 w$ g( g7 f1 B* P4 G
cloud-init并执行初始化模块:6 E2 F. z7 R. G+ e6 g- q6 r  o
- ~; R+ }6 j: B* B
[root@cool ~]# cloud-init init
9 }0 C/ Q7 t4 S& p' q. ]' B2 S! G- N+ k  m/ x; E8 E
使用给定的配置键激活模块:
* \" a& f1 d4 y% ~
6 L, V% E. s: m& d& c8 C9 p3 p[root@cool ~]# cloud-init modules, M3 j8 H; Y$ [6 j7 Q
8 t+ U1 x1 l' E$ \3 `
报告云启动状态或等待完成:7 I2 |- {- Y- F8 O5 {0 h

, S! a9 l# H  ]! B. L[root@cool ~]# cloud-init status
2 z3 h/ m, a" F7 g2 }
* s) t2 q: o: Q* Y删除日志和工件,以便重新运行cloud-init:
. b, b: Q, k7 S# p" g
2 J( y1 N3 E% G2 O9 L& A[root@cool ~]# cloud-init clean( x. M# W9 B% o0 ^

" J  B" o6 f* l; t  f根据以上信息,得知我们需要自动扩容vda3分区(growpart)、扩容LVM和xfs文件系统(runcmd)。
5 o5 L4 ^- O1 X% d创建文件/etc/cloud/cloud.cfg.d/growpart.cfg
! M8 V* T+ h  \+ r( ]vim /etc/cloud/cloud.cfg.d/growpart.cfg
- [, F3 b' T& \
: u% W4 ^$ B7 g, R#cloud-config$ t$ c. j  x; Q& ?0 K$ q
growpart:7 H# D$ V: U" P& @% u7 r$ Z0 H
  mode: auto/ k  x$ @/ f/ O  M; _: f! K
  devices: [/dev/vda2]
8 [: p% h7 F  F4 z; g$ p% V2 }  ignore_growroot_disabled: false  q! t7 Q: _1 P) o3 {( r# H; I* j( C
runcmd:
# m, X3 O, H" T# i* u! ^3 N' Q  - [pvresize,/dev/vda2]
0 |( e* m2 P$ A* W# L  - [lvextend,-l,+100%FREE,/dev/mapper/vklas-root]
' }9 E5 h3 R6 Q. ]1 T7 ^$ Y6 `  - [xfs_growfs,/]4 j0 ]' v6 }9 \  ~; H/ p
, L% [, A% P& t3 u7 D- A% x. |5 g) g
注意:文件系统为ext2、ext3、ext4,则采用通过resize2fs 进行调整$ r6 U, P. \1 ^/ f3 ~: N7 {7 c9 T$ j$ A
  F" M# J& u. w+ P2 X
2.5 每次重启均调整, U9 n( {5 n/ e. V
; x  A! c% V/ w: |( x' t0 h
该需求涉及到云平台会有调整虚拟机的需求,也就是虚拟机磁盘进行调整后,文件系统也依然需要调整,故衍生出每次调整后自动扩容的了。
& z8 w# {( |& A$ G+ {6 o不同的cloud-init模块有不同的执行频次:once-per-instance 、 always。可以在Modules文档中https://cloudinit.readthedocs.io/en/latest/topics/modules.html: C0 H# l+ O9 s" x. M. ~7 [) y
查看每个模块的Module frequency属性。例如,bootcmd在每次引导时运行,而runcmd只在第一次引导时运行。频次也可以在cloud.cfg配置文件模块列表中覆盖——cloud_init_modules, cloud_config_modules和cloud_final_modules。& ?0 r* t; ?. j. J' h* t' K
故我们有bootcmd和runcmd两种方法实现该需求。3 K4 l; ]9 ~9 U' x8 C

( \& s4 x- w# T' {% lruncmd8 C% x; E; E3 v
通过修改/etc/cloud/cloud.cfg文件,覆盖模块频次
3 S# ^  ]  h: N7 _: L) j6 \# g7 lvim /etc/cloud/cloud.cfg
8 `/ x! \3 v' X, s: o; |7 B; F3 o! u( s7 G. t& _: ~0 w8 e5 c! H
cloud_config_modules:
3 n4 I6 r5 c9 F$ _& p4 ` - [runcmd,always]
3 |* u6 k+ R  o3 F, G5 X$ E# A6 y
2.5.2 bootcmd
  ~) M, [0 T2 N修改/etc/cloud/cloud.cfg.d/growpart.cfg,将runcmd替换成bootcmd,全文如下:
* k7 r8 v: E- p' G8 _5 r5 G0 _( Z, t7 A" l: t9 r2 G; {; R* y+ L
#cloud-config" l4 L2 U9 O' r' g* l
growpart:# w- B, D6 F  u( q3 G
  mode: auto
! w$ ~- T) q+ N* S% m' Q  devices: [/dev/vda2]6 X3 K7 f$ H* ^" f( z
  ignore_growroot_disabled: false9 D6 ]/ m9 U) {! q2 m" ]
bootcmd:
1 T- \  G& ]! F: e" L, P1 B7 f  - [pvresize,/dev/vda2]# {( |- T- B3 J# I6 C+ R$ z. e% |
  - [lvextend,-l,+100%FREE,/dev/mapper/vklas-root]/ s  S* [: \; L7 b" h* i
  - [xfs_growfs,/]/ L. B' ?7 a9 [: U

9 E5 P: e6 n; p+ v2 @在云平台中调整后,还需再次重启才能生效
% X. {8 ]7 Q/ L4 t$ ]- V! H
# f8 ?: x+ j8 \; Z3 L2 b/ N7 O- S. W5 b, ?* C2 X( U, B3 J
1 t  C4 j% ?/ o# `: E

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2023-9-12 17:00:04 | 显示全部楼层
初始化% U1 Y: G0 I& ?. e( A
9 G- e6 }! _& S& O; C( ?9 A
cloud-init并执行初始化模块:
* y- w4 u. P. e; v* z2 D3 |  ?3 g9 s* W2 c7 v- [3 E8 X3 D2 F3 d
[root@cool ~]# cloud-init init- L, L  m7 q1 |" j$ t" }& O: Z
. ?# _1 ]8 `6 X7 I
使用给定的配置键激活模块:
1 t  `7 @6 j. E6 {1 I
  t7 P/ h6 Z6 f. X! E$ t+ U7 D[root@cool ~]# cloud-init modules6 Z) M6 z, G3 k
/ q! E9 g1 G5 B! e
报告云启动状态或等待完成:
" R# |3 }1 u( [8 J  e8 \( U
+ u) V% e7 Q5 N* t[root@cool ~]# cloud-init status
+ O- z- W1 `1 c( j( h' K% |( d+ A- V/ D; U8 I
删除日志和工件,以便重新运行cloud-init:
4 ~& k+ A- G% H# i5 e4 o1 ?* L
& `1 \- B: I6 J( f  U8 _8 j. V[root@cool ~]# cloud-init clean

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2023-9-12 17:00:05 | 显示全部楼层
[root@localhost ~]# cloud-init init+ u1 F: J5 w1 }2 q
Cloud-init v. 19.4 running 'init' at Tue, 12 Sep 2023 08:39:50 +0000. Up 2409.94 seconds.5 H8 q7 K& V3 ~& Y
ci-info: +++++++++++++++++++++++++++++++++++++++Net device info+++++++++++++++++++++++++++++++++++++++  ^. `( d0 v7 H; X
ci-info: +--------+------+------------------------------+---------------+--------+-------------------+
" I+ u+ M+ A9 S7 @. hci-info: | Device |  Up  |           Address            |      Mask     | Scope  |     Hw-Address    |# i* O8 h: I/ C) O
ci-info: +--------+------+------------------------------+---------------+--------+-------------------+
8 ^% I  S3 x0 ^. y, ^1 x; Rci-info: |  ens3  | True |        192.168.8.112         | 255.255.255.0 | global | 52:54:00:4c:ad:0e |
0 m$ _- _( W! v4 @" [# C& Vci-info: |  ens3  | True | fe80::1c64:dcb6:c0e9:4a3e/64 |       .       |  link  | 52:54:00:4c:ad:0e |1 f7 ?8 |( t6 H4 J+ S
ci-info: |   lo   | True |          127.0.0.1           |   255.0.0.0   |  host  |         .         |; ^) X. |# I3 ?
ci-info: |   lo   | True |           ::1/128            |       .       |  host  |         .         |
# A+ T8 I( s4 y+ {2 S, S5 Mci-info: +--------+------+------------------------------+---------------+--------+-------------------+: F1 d' i4 `2 J3 _6 T
ci-info: +++++++++++++++++++++++++++++Route IPv4 info+++++++++++++++++++++++++++++
0 l; i* }# J1 w6 ici-info: +-------+-------------+-------------+---------------+-----------+-------++ O& Z7 `. [. Q9 G1 D* ?- P" I' y
ci-info: | Route | Destination |   Gateway   |    Genmask    | Interface | Flags |
2 C- G& ^) o& h- K9 S. Y7 M. pci-info: +-------+-------------+-------------+---------------+-----------+-------+
! q& z' i+ K/ O9 J' K5 g0 Tci-info: |   0   |   0.0.0.0   | 192.168.8.1 |    0.0.0.0    |    ens3   |   UG  |4 X0 E7 s$ ]5 Q0 V8 p! f+ e
ci-info: |   1   | 192.168.8.0 |   0.0.0.0   | 255.255.255.0 |    ens3   |   U   |
6 Z3 ]! j- m" f; c$ uci-info: +-------+-------------+-------------+---------------+-----------+-------+
* ~6 g8 Y6 d! U9 q: e" w2 ~) }ci-info: +++++++++++++++++++Route IPv6 info+++++++++++++++++++
, R( w6 \, d( P  g! p/ u: ?' h+ t+ ?5 Lci-info: +-------+-------------+---------+-----------+-------+- ^' Q3 J5 Z( U5 m7 D3 J
ci-info: | Route | Destination | Gateway | Interface | Flags |
) R' i  e& u, T, D$ M0 {" w7 N' kci-info: +-------+-------------+---------+-----------+-------+# x9 z/ V2 C0 q7 p# v
ci-info: |   9   |  fe80::/64  |    ::   |    ens3   |   U   |. z* X9 \. C- C* ?5 n6 H
ci-info: |   13  |   ff00::/8  |    ::   |    ens3   |   U   |9 [8 Y, ]$ _) c- E  O, N
ci-info: +-------+-------------+---------+-----------+-------+
9 ^/ n9 Q/ |, \2023-09-12 08:39:51,754 - warnings.py[WARNING]: **************************************************************************
! V9 D$ j' D9 t! h# A new feature in cloud-init identified possible datasources for        #
6 P8 I; ^8 L& e8 a: e0 X# this system as:                                                        #( o9 v9 j' u; r- D6 r9 J& q
#   []                                                                   #
" _5 C. _2 d4 v8 L* _$ [7 q# However, the datasource used was: None                                 #
$ W4 g/ }9 D/ z7 d#                                                                        #
$ v  T+ I% [# }6 f# In the future, cloud-init will only attempt to use datasources that    #1 F* `) K& y; @3 C4 I% j8 _* O6 K
# are identified or specifically configured.                             #
7 ^6 L; u: m; b% l% B5 Q# For more information see                                               #
6 M0 m% ?- k* u  [# y( `" y#   https://bugs.launchpad.net/bugs/1669675                              #' r4 x( B) C0 N$ m2 G; F
#                                                                        #
) d0 I5 B2 y  A+ b. b/ j! Q! A# If you are seeing this message, please file a bug against              #
) D; O# M' }2 z0 s1 W# cloud-init at                                                          #: l* b* k' N7 m" {( ]( W6 Y; f9 t
#    https://bugs.launchpad.net/cloud-init/+filebug?field.tags=dsid      #- n3 c5 }  X+ {! G
# Make sure to include the cloud provider your instance is               #
# c) [2 n: I2 Q: B( s; ^5 n# running on.                                                            #1 Q4 w- L( F& n- j' H
#                                                                        #
5 Y; Z1 G0 N. b* V. ]9 B) x% S# After you have filed a bug, you can disable this warning by launching  #7 ^8 U0 V: E8 T( ~2 h" T
# your instance with the cloud-config below, or putting that content     #( y- c2 [7 X3 I! l; W( R+ A
# into /etc/cloud/cloud.cfg.d/99-warnings.cfg                            #+ K9 V' W6 Y! P0 L
#                                                                        #1 y% @$ o  u" ^; y$ [/ }- ~- g
# #cloud-config                                                          #
1 o6 A& t# e, @% h8 f# warnings:                                                              #
3 M$ j8 O0 b+ X& P#   dsid_missing_source: off                                             #
  q; |/ n, N  t) t& l**************************************************************************
+ z9 V) X' J: N% }- c% Y+ b
6 }6 @2 k  H- L  S- W4 g[root@localhost ~]# cloud-init status  
( y  c: c( `' k2 t. y6 U5 A: x1 Dstatus: running
+ x$ y( f# f* Y3 j% I[root@localhost ~]#
9 C9 J! f" S7 l# y  L" X

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2023-9-12 17:00:06 | 显示全部楼层
[root@localhost ~]# cloud-init modules
9 K! u$ N9 Q8 x8 X6 lCloud-init v. 19.4 running 'modules:config' at Tue, 12 Sep 2023 08:41:06 +0000. Up 2485.43 seconds.- \3 Y; @0 [- h' c5 P5 i
[root@localhost ~]#
  T" X9 C" f& K6 [/ M, l! V' C
您需要登录后才可以回帖 登录 | 注册

本版积分规则

返回首页|Archiver|手机版|小黑屋|易陆发现技术论坛 ( 蜀ICP备2026014127号-1 )

GMT+8, 2026-6-12 00:41 , Processed in 0.024600 second(s), 22 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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