易陆发现互联网技术论坛

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

Failed to run bootcmd module bootcmd

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

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

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

x
Failed to run bootcmd module bootcmd
3 z' A8 y3 m- Z4 S/ g: ~( E! b* d3 ?5 I# l6 j

, {0 z+ C- k# c2023-09-12 08:11:12,132 - util.py[WARNING]: Failed to run bootcmd module bootcmd  r9 Y7 F; a1 P
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* b+ [' H* x% Z. X* ^, I$ Q

/ N/ t- o2 E5 U+ W% B. x$ U3 k8 s- q0 {7 Y6 \9 x

, d5 y# S8 F7 Z4 t2 o7 O( x1 A7 ]) i# t  \) Z+ T

8 b7 S: x# K( r4 H+ g8 p语法格式:cloud-init [参数]
6 m+ @% J9 a' r  ^+ C& m% g- Q4 w6 t9 R' i3 l  C
常用参数: init 初始化cloud-init并执行初始化模块
' J. L9 Z: i5 E6 j3 Y: P+ W初始化* m: e1 N# W! d$ S& J0 m
" Y$ `2 `+ h: i* l% ]. B7 A
cloud-init并执行初始化模块:
& [4 g! M4 B& @: n6 l) T9 F3 K% i. F( k) ]3 h; a0 v+ Q  a
[root@cool ~]# cloud-init init: G: z- j$ l5 H; j& p1 }

: S% c8 L) j0 l  e使用给定的配置键激活模块:
  w! t7 t' [9 a+ ?2 S
# s3 i$ \, S0 R  m5 k% h[root@cool ~]# cloud-init modules
- l1 P# ~1 K; {! L0 A. S8 L9 {: t
1 {% n# h( i$ n报告云启动状态或等待完成:
2 {% k4 R! w; m) t. ], |+ }* j
& S+ \* s" S* p) R9 G[root@cool ~]# cloud-init status
. a' w  L$ Z0 l+ `" J8 K
6 H: B, `  P" T7 Y/ r; [4 G删除日志和工件,以便重新运行cloud-init:
% S* s8 R! W: Q4 @2 j
& Z( Q2 q+ Z9 r[root@cool ~]# cloud-init clean
3 X# k2 v% h) @3 \4 L
' ]& H6 M2 g, Z7 t* `% M根据以上信息,得知我们需要自动扩容vda3分区(growpart)、扩容LVM和xfs文件系统(runcmd)。
9 L! A: L7 Z% j8 p$ U: D9 u创建文件/etc/cloud/cloud.cfg.d/growpart.cfg/ A! E; T. s( s# R; G3 h/ |
vim /etc/cloud/cloud.cfg.d/growpart.cfg
3 d2 Y3 t  T9 h! B- S$ G5 X" `7 F' w: F7 ^% A( ~! j3 H$ \7 V
#cloud-config3 j7 o' V9 ?3 o4 m& e
growpart:
" ]  f' Y+ G4 h' T* k  mode: auto
: P$ T% M2 w+ h1 t+ h6 \/ _  devices: [/dev/vda2]" ~9 l3 Q% {8 D3 b
  ignore_growroot_disabled: false
$ d! |% Q: f" Wruncmd:
' }9 `% c# u: Q5 o5 Q  - [pvresize,/dev/vda2]+ f3 X& |" t% O. _/ I
  - [lvextend,-l,+100%FREE,/dev/mapper/vklas-root]6 k7 D/ O( n+ C: I" W. }2 [
  - [xfs_growfs,/]
1 i& _6 J6 f. o1 {( ^
2 t% _: l* d  Q注意:文件系统为ext2、ext3、ext4,则采用通过resize2fs 进行调整
1 E0 Z( A' V, O9 R& B- ~8 H! _
" }+ {3 x) h# x" P1 I9 N2.5 每次重启均调整
3 q7 {) M0 j& ?/ M& N0 r$ b* I- g! y3 @
该需求涉及到云平台会有调整虚拟机的需求,也就是虚拟机磁盘进行调整后,文件系统也依然需要调整,故衍生出每次调整后自动扩容的了。; n9 k: p0 j* O. ~" o0 ?- U3 o
不同的cloud-init模块有不同的执行频次:once-per-instance 、 always。可以在Modules文档中https://cloudinit.readthedocs.io/en/latest/topics/modules.html- y/ K5 f9 d% \1 h$ ~- Y$ z
查看每个模块的Module frequency属性。例如,bootcmd在每次引导时运行,而runcmd只在第一次引导时运行。频次也可以在cloud.cfg配置文件模块列表中覆盖——cloud_init_modules, cloud_config_modules和cloud_final_modules。, T. o2 r  X. p/ ~+ b
故我们有bootcmd和runcmd两种方法实现该需求。
7 m; X% K( Z5 b9 {5 Q& `! e+ [+ \6 {, f$ R
runcmd9 H$ O  n. O+ P: p1 E7 `* l
通过修改/etc/cloud/cloud.cfg文件,覆盖模块频次
. w0 F0 \  `5 S! l; l* o! Xvim /etc/cloud/cloud.cfg
- a, {; c' ?* y! ^
% H: S" U$ [' U$ F! @1 c0 icloud_config_modules:
) ?5 H& z0 e7 M' j, D. V3 H+ B. V - [runcmd,always]
" [$ Y' ]( n; c6 l6 r% }; b5 a5 z' V
2.5.2 bootcmd
- L$ W. ]. y" ~% \& X' B- n修改/etc/cloud/cloud.cfg.d/growpart.cfg,将runcmd替换成bootcmd,全文如下:
# I/ X* X: \" a/ E) s" g4 m" g7 S9 Q$ d1 k; u$ W# e1 e4 S' p# L0 `
#cloud-config
( k& }- i# H2 `8 Z, J& m, ~5 Bgrowpart:# ~$ ~7 Q% s3 ]$ Q# K+ D( R& V8 V
  mode: auto
( ^. _( `5 D& M4 G  devices: [/dev/vda2]' L6 b& _9 R) F8 d" @( |) r
  ignore_growroot_disabled: false
; }' k$ e0 }# l8 @! G! Y6 Bbootcmd:
* t' }# _; Y/ J  - [pvresize,/dev/vda2]
! r* l# w8 @% z" l" q  - [lvextend,-l,+100%FREE,/dev/mapper/vklas-root]% N- J) m6 L' l% H
  - [xfs_growfs,/]
( `5 Y2 `! A% Y" B# A/ j6 [+ b  F+ A/ J! Q: B3 O
在云平台中调整后,还需再次重启才能生效# ]4 t6 @# T% E1 _' {! U- ]
4 E9 ]! U$ x" V2 a/ m1 m& t5 _
3 D6 _# Q) w/ B8 b- o: N& G3 d" f
! g% v$ q1 |0 [  n1 R1 y( {$ ?
 楼主| 发表于 2023-9-12 17:00:04 | 显示全部楼层
初始化  h4 y7 I! @5 ~$ ?: |* ^1 a. W

! g/ h+ d: {8 z% @6 U: Icloud-init并执行初始化模块:
; C, q0 l* l* q$ c4 T) r. S7 L: a0 f: ?, \0 }
[root@cool ~]# cloud-init init/ \; \3 l/ P, S- L

) B/ R7 N  w) \" Y) A使用给定的配置键激活模块:
% _2 L2 c* \0 n- b9 b. n+ Z+ \; E" {6 l2 |: \8 I4 u* e
[root@cool ~]# cloud-init modules8 y& L7 v$ u4 i6 y5 h$ ^! L7 J

, B6 l2 K; ?3 i/ X9 u报告云启动状态或等待完成:) x" l0 A- f3 D

: O% T: K$ y) s) U: P3 R$ c1 h. k[root@cool ~]# cloud-init status, d7 g" Q. n* E

5 p8 s3 _. j- s7 Z/ m删除日志和工件,以便重新运行cloud-init:
. x7 ~+ z+ r: l
# K. r" i* O" w5 u# f[root@cool ~]# cloud-init clean
 楼主| 发表于 2023-9-12 17:00:05 | 显示全部楼层
[root@localhost ~]# cloud-init init
* A) L5 D1 C% ~Cloud-init v. 19.4 running 'init' at Tue, 12 Sep 2023 08:39:50 +0000. Up 2409.94 seconds.
4 H1 A% T- X5 V1 |8 b! c( rci-info: +++++++++++++++++++++++++++++++++++++++Net device info+++++++++++++++++++++++++++++++++++++++
; R8 _" \# y) |) y7 Yci-info: +--------+------+------------------------------+---------------+--------+-------------------+7 v( k+ c) U8 w7 w
ci-info: | Device |  Up  |           Address            |      Mask     | Scope  |     Hw-Address    |
2 e* a1 m/ B$ e9 e1 ]ci-info: +--------+------+------------------------------+---------------+--------+-------------------+  L3 p9 d+ P+ D; w5 i( n
ci-info: |  ens3  | True |        192.168.8.112         | 255.255.255.0 | global | 52:54:00:4c:ad:0e |. g2 L, u$ m' N; V' N5 @/ ]
ci-info: |  ens3  | True | fe80::1c64:dcb6:c0e9:4a3e/64 |       .       |  link  | 52:54:00:4c:ad:0e |9 r+ `4 Q; B9 e$ `* |2 C9 v$ d& @1 j
ci-info: |   lo   | True |          127.0.0.1           |   255.0.0.0   |  host  |         .         |
. f+ }9 a9 e& U+ _* O& Z6 S+ @ci-info: |   lo   | True |           ::1/128            |       .       |  host  |         .         |
7 }% u  E6 p) o) n3 ~5 k' C0 kci-info: +--------+------+------------------------------+---------------+--------+-------------------+
- M- T: x$ K4 q  C$ M2 D3 O/ pci-info: +++++++++++++++++++++++++++++Route IPv4 info+++++++++++++++++++++++++++++- d. a# d8 d% e8 B' A
ci-info: +-------+-------------+-------------+---------------+-----------+-------+! |8 B5 B6 Q0 }( i: _1 a- `
ci-info: | Route | Destination |   Gateway   |    Genmask    | Interface | Flags |
( X, g. s  R+ X( @0 X! b3 c( B' aci-info: +-------+-------------+-------------+---------------+-----------+-------+
1 A8 M1 S7 X3 n; `+ Ici-info: |   0   |   0.0.0.0   | 192.168.8.1 |    0.0.0.0    |    ens3   |   UG  |, @/ k5 N1 i% b& {
ci-info: |   1   | 192.168.8.0 |   0.0.0.0   | 255.255.255.0 |    ens3   |   U   |
2 l$ c8 Y! c. V: p- w+ O4 B* ici-info: +-------+-------------+-------------+---------------+-----------+-------+" S8 D" h7 {9 f$ \
ci-info: +++++++++++++++++++Route IPv6 info+++++++++++++++++++5 h% x# G) t" q; `" S
ci-info: +-------+-------------+---------+-----------+-------+
2 f. P7 j6 A1 q! \3 y5 ?ci-info: | Route | Destination | Gateway | Interface | Flags |
9 f3 ~6 S8 Q. n. [2 mci-info: +-------+-------------+---------+-----------+-------+
. {% P6 g( p7 N( lci-info: |   9   |  fe80::/64  |    ::   |    ens3   |   U   |
7 `9 u- u( |8 _/ Y# C( hci-info: |   13  |   ff00::/8  |    ::   |    ens3   |   U   |
0 l: J" [! @7 W# U- e/ Lci-info: +-------+-------------+---------+-----------+-------+3 J4 i* M( G3 S7 G' }0 h# ?, u0 J% F
2023-09-12 08:39:51,754 - warnings.py[WARNING]: **************************************************************************5 s" a9 L6 k. x5 v: j
# A new feature in cloud-init identified possible datasources for        #
' D0 F; c4 I% x* K( L# _7 n8 D" b# this system as:                                                        #
" K4 F3 |3 N/ H#   []                                                                   #4 \4 N$ q& y) f" b4 e: j# B
# However, the datasource used was: None                                 #
$ N2 u0 Q4 E) x$ u7 p#                                                                        #1 Q* \- a; ?3 d3 ]6 q. p
# In the future, cloud-init will only attempt to use datasources that    #
0 x6 h0 a" i4 @0 G) n0 |# are identified or specifically configured.                             #
6 P7 {% I5 e4 D# {- }5 H- D# For more information see                                               #
; c6 l0 e2 G' d2 @, B  u; j8 T) ?#   https://bugs.launchpad.net/bugs/1669675                              #( g+ Y( ?- }) I: |* a& P/ R
#                                                                        #2 F* [7 i+ M: O' w4 ^& @- ?
# If you are seeing this message, please file a bug against              #2 N2 T/ \+ X$ u$ T
# cloud-init at                                                          #/ x  w1 v6 [6 N( ?  ^7 U2 V: I
#    https://bugs.launchpad.net/cloud-init/+filebug?field.tags=dsid      #
$ C* }6 k+ X1 T% e: \" M$ B# Make sure to include the cloud provider your instance is               #
2 J" u3 e' \; l% `8 k# running on.                                                            #
& J5 k. ^- @1 f; A' b#                                                                        #
! q# B5 A4 _+ }# After you have filed a bug, you can disable this warning by launching  #. v6 Z- o/ e0 H8 w& R, h2 F
# your instance with the cloud-config below, or putting that content     #
6 }0 M" z1 h! G/ x# into /etc/cloud/cloud.cfg.d/99-warnings.cfg                            #
4 M( S9 T4 d5 C/ O' y) t2 B* F5 I1 e2 F#                                                                        #2 k$ u2 Z. A+ X8 J5 F8 }- a; o
# #cloud-config                                                          #
( n4 a; L% i) z" |+ D& P# warnings:                                                              #
2 N$ B5 U+ ^7 U4 a/ n- K4 d& W# g#   dsid_missing_source: off                                             #4 @, N& I5 T6 ]
**************************************************************************
) u$ l3 L% W& Q1 Y4 B' n
0 f7 ~+ @+ c$ C# t# V( D; y[root@localhost ~]# cloud-init status  
% V) n1 ?: y! ~5 B" S/ N* Estatus: running" L% l4 P/ B+ q4 N8 i
[root@localhost ~]#
( o) }3 \8 A5 C+ }
 楼主| 发表于 2023-9-12 17:00:06 | 显示全部楼层
[root@localhost ~]# cloud-init modules
- G4 z( O  g. @% L, M2 O) ?/ q) kCloud-init v. 19.4 running 'modules:config' at Tue, 12 Sep 2023 08:41:06 +0000. Up 2485.43 seconds.3 j5 v# Z5 x9 y8 w% O- h& J
[root@localhost ~]# 7 L: I2 h, H" t5 F. g& F8 f8 B
您需要登录后才可以回帖 登录 | 开始注册

本版积分规则

关闭

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

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

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

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

Powered by Discuz! X3.4 Licensed

© 2012-2025 Discuz! Team.

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