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

Failed to run bootcmd module bootcmd

[复制链接]

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
发表于 2023-9-12 17:00:03 | 显示全部楼层 |阅读模式
Failed to run bootcmd module bootcmd7 j+ A8 I6 b, U& L7 b4 R

) L- U* W$ H0 Y' ^! B7 M  x- n7 Q$ c. L! |/ r
2023-09-12 08:11:12,132 - util.py[WARNING]: Failed to run bootcmd module bootcmd
1 i; F7 p" t5 |7 q* _9 A0 X2023-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/ B- A: {9 C* {" P1 d5 N6 g

' ]& B- |. b9 a1 E5 K: z7 ?/ p8 A* J
6 Q) K' g* D+ {7 J
* L8 s  }/ ]2 I4 {) X
9 }, m) g# `$ n. P7 w0 Q, N$ j+ V% D' h2 S6 ]7 W' q$ t6 u& r
语法格式:cloud-init [参数]
9 K( B8 g5 i: e* i, v- I
! Z: v# r  L$ o9 v常用参数: init 初始化cloud-init并执行初始化模块
% E4 H8 @8 r. S5 L2 c) _: ]初始化5 L9 `' f, {5 U+ u& [" x7 k
+ V2 o$ f( O8 o1 f0 q  H1 H* O
cloud-init并执行初始化模块:
7 o- Q% i8 X3 }6 o' ~# D, T5 Z  Y, R* G* Y9 M: W- R4 e* Z
[root@cool ~]# cloud-init init
; }9 [0 f) V7 u; H9 x! `$ [% }6 E; ?9 z- H, A( X
使用给定的配置键激活模块:
; `7 K7 z: q! d- B0 C3 B+ X8 k' W  H; x+ `, V. O& Q) i, P# G6 ~
[root@cool ~]# cloud-init modules
. M$ L) I; T4 m/ ]7 Z" s% |: o
- t; k4 {+ E% x7 e: T' S4 N. z报告云启动状态或等待完成:
0 {0 r, _2 T6 h& s- i. g/ m6 x; `! y" v# E; v7 I: F
[root@cool ~]# cloud-init status( N: c2 q" c( a( J9 |

! d/ L' Q  z" Z8 |, t5 z删除日志和工件,以便重新运行cloud-init:
( U  L" G/ J& ]9 R# _8 K. V, G( @" i6 r
[root@cool ~]# cloud-init clean  _* C7 d, [, ?+ p  J6 X" P2 f
, D6 }$ D- j2 e$ i
根据以上信息,得知我们需要自动扩容vda3分区(growpart)、扩容LVM和xfs文件系统(runcmd)。
! T5 M% V: ]8 @* b7 S创建文件/etc/cloud/cloud.cfg.d/growpart.cfg0 I+ t8 C4 b* l6 j7 F3 y
vim /etc/cloud/cloud.cfg.d/growpart.cfg& P1 h8 Q4 n# a, [8 `
& k/ y/ G$ }! \) O  y% Q
#cloud-config
/ R+ p9 B. b6 ^) z$ z$ k! u% V4 vgrowpart:: Z6 x& d' G3 [" _4 d, Q0 W6 i) V
  mode: auto; V0 ]4 t& y5 K8 ?5 j' A
  devices: [/dev/vda2]% ^: v; r* k; W8 X- N. @* z0 w6 k  Y
  ignore_growroot_disabled: false
! R2 a8 H+ V: }! p7 O- aruncmd:
3 Q, r& d9 g( w) U7 R0 j. i! g6 H  - [pvresize,/dev/vda2]  Z5 S  |  `* i
  - [lvextend,-l,+100%FREE,/dev/mapper/vklas-root]; ?0 [" A: u+ J( e( t4 t" ]
  - [xfs_growfs,/]( b9 p0 h- Q" U7 \1 h, X

. d9 o4 D6 O" l$ u3 ?  V注意:文件系统为ext2、ext3、ext4,则采用通过resize2fs 进行调整3 l; i8 z9 u  E, g
2 g9 e4 h( \5 V, f8 q0 `4 _9 Z
2.5 每次重启均调整
" J0 v) t$ M' y; y" q8 j
7 U9 @' ]5 @) F+ g0 g. e9 E* B/ f该需求涉及到云平台会有调整虚拟机的需求,也就是虚拟机磁盘进行调整后,文件系统也依然需要调整,故衍生出每次调整后自动扩容的了。
6 e6 s$ p5 Q1 o+ V  K' X" E8 ?不同的cloud-init模块有不同的执行频次:once-per-instance 、 always。可以在Modules文档中https://cloudinit.readthedocs.io/en/latest/topics/modules.html
; e4 R% U  s6 Z% H查看每个模块的Module frequency属性。例如,bootcmd在每次引导时运行,而runcmd只在第一次引导时运行。频次也可以在cloud.cfg配置文件模块列表中覆盖——cloud_init_modules, cloud_config_modules和cloud_final_modules。7 h2 w% K- K- Y$ E( x  `
故我们有bootcmd和runcmd两种方法实现该需求。. m1 n; i5 G) x2 d

( @7 F, e' G4 M! ]& @" Bruncmd
- s; M. x/ [  w! H通过修改/etc/cloud/cloud.cfg文件,覆盖模块频次/ p. P( F8 S1 o3 L; e$ w) {
vim /etc/cloud/cloud.cfg
# y& Z# `+ v& S6 g% \( E' a( G$ Q3 O1 ^! g8 K# k" R) s- E( _0 ~
cloud_config_modules:
" j- ?) x1 }4 T! Z8 F! H. L - [runcmd,always]
. ]1 c% `% x7 v3 V& w) R" k/ V$ Q) a* G
2.5.2 bootcmd1 l2 L% k+ A8 {( F
修改/etc/cloud/cloud.cfg.d/growpart.cfg,将runcmd替换成bootcmd,全文如下:; J$ a$ T" g* l+ M! q2 |8 R' k# v
0 ?, ~" ^/ ?$ h) x& v; D
#cloud-config+ [+ X8 K  i% m) \
growpart:
7 A$ F  j2 n8 a5 G  mode: auto
- l. Z  X4 w: Q5 a' W7 Z  devices: [/dev/vda2]
1 U7 ~, ?! b6 }  Z3 b0 T  ignore_growroot_disabled: false
; z, g: R! X# Y4 x2 S7 A: Jbootcmd:
& h1 k  V+ O+ o# N9 h& A  Y# ^. W  - [pvresize,/dev/vda2]
+ d7 _7 _9 y. M- b5 z' h- N  - [lvextend,-l,+100%FREE,/dev/mapper/vklas-root]
  L) K  t& B6 H$ x  - [xfs_growfs,/]3 h* u: u1 l- ^0 u

& `8 u2 C  j4 m8 V" m在云平台中调整后,还需再次重启才能生效
& u1 p3 `4 P" l4 A6 x5 y- w
9 ?% v" U5 n4 F' I4 u4 B- W  r' {) L# p) M! A! P6 C! o

* w5 L8 h; h7 i* s+ a

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2023-9-12 17:00:04 | 显示全部楼层
初始化6 ?; v, F3 R8 D1 ]/ m) Y
# I, ]/ J8 J6 J& H% O" z
cloud-init并执行初始化模块:* y0 e! v, K% Y. T3 t5 ?

1 z6 D% K& q/ F; J6 @, j  g+ u[root@cool ~]# cloud-init init
) C8 ]5 J% C2 ]8 ^: c; w% Y: [) D3 ~5 B2 q
使用给定的配置键激活模块:0 I! Q7 M  C1 N4 o
/ t3 z1 W0 N- E% w( Q% d; x
[root@cool ~]# cloud-init modules
: N( d; {: i- O' k& j/ S2 _
9 J4 w3 Z! L" \- ?报告云启动状态或等待完成:: A/ u+ i  o4 j* H2 T- c& I
& I( c& }% A- f+ v
[root@cool ~]# cloud-init status
4 T1 J" ^; G8 @" [6 s3 l; `5 o. {3 p2 n) z9 d8 j' F& ]4 Z9 f: w
删除日志和工件,以便重新运行cloud-init:0 o& r4 [! u. ?! _7 }  d: _6 `
0 e0 h8 S9 g3 h' O2 \- L
[root@cool ~]# cloud-init clean

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2023-9-12 17:00:05 | 显示全部楼层
[root@localhost ~]# cloud-init init0 m. u3 X* l3 X0 E" ?% ]
Cloud-init v. 19.4 running 'init' at Tue, 12 Sep 2023 08:39:50 +0000. Up 2409.94 seconds.
* h' A+ R# u4 G' B7 m; Nci-info: +++++++++++++++++++++++++++++++++++++++Net device info+++++++++++++++++++++++++++++++++++++++
$ t: N5 M7 I+ }+ b% ici-info: +--------+------+------------------------------+---------------+--------+-------------------+/ X( f3 I6 p5 y% \3 H
ci-info: | Device |  Up  |           Address            |      Mask     | Scope  |     Hw-Address    |
8 D: z2 |' d- Dci-info: +--------+------+------------------------------+---------------+--------+-------------------++ q5 z5 [2 Z" E* U% j, U
ci-info: |  ens3  | True |        192.168.8.112         | 255.255.255.0 | global | 52:54:00:4c:ad:0e |9 I) {2 T$ y# e
ci-info: |  ens3  | True | fe80::1c64:dcb6:c0e9:4a3e/64 |       .       |  link  | 52:54:00:4c:ad:0e |/ X' F; u- h+ u! q) i- k) q' o/ d1 F4 W
ci-info: |   lo   | True |          127.0.0.1           |   255.0.0.0   |  host  |         .         |
( E$ Y7 \  e; t; o- j! t$ Tci-info: |   lo   | True |           ::1/128            |       .       |  host  |         .         |5 A* l# K/ w7 Z  B- L& l7 t
ci-info: +--------+------+------------------------------+---------------+--------+-------------------+6 A6 |) m" y- y9 _) I8 Z" a: H
ci-info: +++++++++++++++++++++++++++++Route IPv4 info+++++++++++++++++++++++++++++) D3 ]4 i  n" }9 k  N
ci-info: +-------+-------------+-------------+---------------+-----------+-------+
) s1 c4 H, `& r, y- Qci-info: | Route | Destination |   Gateway   |    Genmask    | Interface | Flags |$ |$ Y8 S4 C8 X) M2 t6 B6 B1 M
ci-info: +-------+-------------+-------------+---------------+-----------+-------+$ h% z, n& b- U2 L9 b
ci-info: |   0   |   0.0.0.0   | 192.168.8.1 |    0.0.0.0    |    ens3   |   UG  |
0 n5 r- Z0 U7 l  r$ Vci-info: |   1   | 192.168.8.0 |   0.0.0.0   | 255.255.255.0 |    ens3   |   U   |5 J7 S2 p7 j1 b$ T9 b6 N
ci-info: +-------+-------------+-------------+---------------+-----------+-------+
( n+ F3 m1 x* Cci-info: +++++++++++++++++++Route IPv6 info+++++++++++++++++++5 {" w* S; r6 [
ci-info: +-------+-------------+---------+-----------+-------+
" X! d4 J; z0 F! N4 {( B+ V* wci-info: | Route | Destination | Gateway | Interface | Flags |
9 ~( m( v# h" I0 N5 T6 |/ qci-info: +-------+-------------+---------+-----------+-------+
  w* k, T  q+ X- J2 s) u6 eci-info: |   9   |  fe80::/64  |    ::   |    ens3   |   U   |% r/ K" i' P' i; |1 x7 d1 c( x: S7 m
ci-info: |   13  |   ff00::/8  |    ::   |    ens3   |   U   |0 r/ I8 ]  Y7 s4 ?
ci-info: +-------+-------------+---------+-----------+-------+
. ?: v. L. w* J$ x% w2 m) a7 v, g( |2023-09-12 08:39:51,754 - warnings.py[WARNING]: **************************************************************************
2 P" q" s% k' p  ~) D2 v& e# A new feature in cloud-init identified possible datasources for        #
. e4 c( W! {) @1 K  }( k/ S5 i# this system as:                                                        #
" ?$ b+ c/ T/ _2 ?( O#   []                                                                   #  I# M0 H6 U2 S
# However, the datasource used was: None                                 #
) }+ q  G# [2 |' {6 m9 P9 V#                                                                        #
7 I" n2 C  \: x# In the future, cloud-init will only attempt to use datasources that    #" V& z) [" m7 G
# are identified or specifically configured.                             #3 r# l" Y9 f+ J4 W9 C# b2 T
# For more information see                                               #
7 ]( k& h2 j7 s. I6 X. Q#   https://bugs.launchpad.net/bugs/1669675                              #1 Q, c7 O+ i, Y
#                                                                        #7 N% z# ^; E: ?2 t: _" J/ a$ U
# If you are seeing this message, please file a bug against              #
7 d% L0 c% n" r' J) Z3 R% H! y  G6 @( L# cloud-init at                                                          #- x, K/ x' J$ S- |9 d
#    https://bugs.launchpad.net/cloud-init/+filebug?field.tags=dsid      #
5 k5 C1 u8 q6 h) Y- |0 I# Make sure to include the cloud provider your instance is               #* j& g9 z: i/ \1 ~) c# |
# running on.                                                            #
$ Z, j5 c# x8 f( Y6 P9 u# E#                                                                        #
+ Q' V% ~' t; W0 q! l; v# After you have filed a bug, you can disable this warning by launching  #
, E' y- K6 a, b7 [) Z# your instance with the cloud-config below, or putting that content     #
% j4 x& X4 w8 f9 S0 E9 m( u# into /etc/cloud/cloud.cfg.d/99-warnings.cfg                            #- W; P6 a, b+ T. \( x* e6 v# P
#                                                                        #/ _; G8 B; @9 c$ U% ^
# #cloud-config                                                          #+ s7 d) |1 O5 E
# warnings:                                                              #  f) \) X# j9 P8 Z# A# G( a  T
#   dsid_missing_source: off                                             #' l# X8 B- D. i* c0 c+ \
**************************************************************************( {+ D' P& \, v$ f
% A' C& x& ~4 P+ A. s( L1 F( |
[root@localhost ~]# cloud-init status  " c* g5 ~2 v4 z0 {
status: running
. b  J+ Z4 h" H8 P( n[root@localhost ~]# 1 D' F7 l6 t! |1 L1 X9 E/ ]( M

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2023-9-12 17:00:06 | 显示全部楼层
[root@localhost ~]# cloud-init modules . S; q4 {8 y0 s
Cloud-init v. 19.4 running 'modules:config' at Tue, 12 Sep 2023 08:41:06 +0000. Up 2485.43 seconds.0 c+ I" B2 y2 ?4 }4 r* h
[root@localhost ~]#
4 V* b2 t" e9 J
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-6-12 01:48 , Processed in 0.015556 second(s), 22 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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