我正在尝试从其启动脚本创建GCE实例图像(仅在一些设置说明之后) . 我使用命令行看起来像:

gcimagebundle -d "/dev/sda" -o "/tmp/" --log_file=/var/log/image_generation.log "--output_file_name=/tmp/myimage.tar.gz"

几秒后 gcimagebundle 退出,我收到以下错误消息(来自/var/log/image_generation.log文件):

INFO:root:found platform Centos
INFO:root:File System: ext4
INFO:root:Disk Size: 10737418240 bytes
INFO:root:Resolved /dev/sda to /dev/sda
INFO:root:exclude list: (/etc/ssh/.host_key_regenerated, 0:0:0) (/dev, 0:1:0) (/proc, 0:1:0) (/run, 0:1:1) (/selinux, 0:0:0) (/tmp, 0:1:0) (/sys, 0:1:0) (/var/lib/google/per-   instance, 0:1:0) (/var/lock, 0:1:1) (/var/log, 0:1:1) (/var/run, 0:1:1)
INFO:root:ignoring mounts /proc /sys /dev/pts /dev/shm /proc/sys/fs/binfmt_misc
WARNING:root:overwrite list = 
INFO:root:Initializing disk file
INFO:root:Making filesystem
INFO:root:Copying contents
WARNING:root:Error while running ['rsync', '--times', '--perms', '--owner', '--group', '--links', '--devices', '--acls', '--sparse', '--hard-links', '--recursive', '--xattrs', '--exclude-from=/tmp/tmpXtECHY/tmp6Y_7Dr', '/', '/tmp/tmpXtECHY/tmpencYI_'] return_code = 11
stdout=
stderr=rsync: failed to open exclude file /tmp/tmpXtECHY/tmp6Y_7Dr: Permission denied (13)
rsync error: error in file IO (code 11) at exclude.c(1062) [client=3.0.6]

我尝试在手册 sudo su 之后在新实例上执行相同的启动脚本,并且一切正常 .

我从启动脚本执行 whoami ,结果是 root .