更改boot分区大小记录二
问题:
目前更新使用新的镜像dd到sda磁盘后, 使用partprobe通知内核目录信息已经改变,但是对sda3 sda4 格式化解密的时候失败
+ cryptsetup -q luksFormat /dev/sda3 /tmp/product/.key + die 4 'Stage 1, open device sda3 failed.' + local retval=4 + shift + '[' 4 == 0 ']' + echo ' ** Stage 1, open device sda3 failed.' ** Stage 1, open device sda3 failed. + cryptsetup -d /tmp/product/.key luksOpen /dev/sda3 xxxxxxx + die 4 'Stage 2, open device sda3 failed.' + local retval=4 + shift + '[' 4 == 0 ']' + echo ' ** Stage 2, open device sda3 failed.' ** Stage 2, open device sda3 failed. + mkfs.ext4 -t ext4 -L xxxxxx /dev/mapper/xxxxx + die 1 'Stage 3, open device sda3 failed.' + local retval=1 + shift + '[' 1 == 0 ']' + echo ' ** Stage 3, open device sda3 failed.' ** Stage 3, open device sda3 failed.
openat(AT_FDCWD, "/dev/sda2", O_RDONLY) = 7 fstat(7, {st_mode=S_IFBLK|0600, st_rdev=makedev(8, 2), ...}) = 0 ioctl(7, BLKGETSIZE64, [128849018880]) = 0
目前看到:openat, 这是啥??
First, openat() allows an application to avoid race conditions that could occur when using open(2) to open files in directories other than the current working directory. These race conditions result from the fact that some component of the directory prefix given to open(2) could be changed in parallel with the call to open(2). Such races can be avoided by opening a file descriptor for the target directory, and then specifying that file descriptor as the dirfd argument of openat(). Second, openat() allows the implementation of a per-thread “current working directory”, via file descriptor(s) maintained by the application. (This functionality can also be obtained by tricks based on the use of /proc/self/fd/dirfd, but less efficiently.)
   引入openat是方便一个进程内的各线程可拥有不同的当前目录,传统的chdir会影响整个进程,而使用openat只需要每个线程在初始化时打开一个目录(调用open),然后就可以以openat在“当前目录”操作文件了,如:
int dirfd = open("/var"); // 相当于chdir到“/var”
int filefd = openat(dirfd, "thread1"); // 在/var目录下打开“thread1”文件
那为什么会出现上述错误呢?
只能调试脚本:重新制作initrd 加入调试
目前可以直接看到问题原因: 磁盘分区时出现问题, 第一个分区的开始block 不是从1 开始;但是后面安装的时候安装脚本出现问题

>> Open device 0 + cryptsetup -q luksFormat /dev/sda3 /tmp/product/.key + die 4 'Stage 1, open device sda3 failed.' + local retval=4 + shift + '[' 4 == 0 ']' + echo ' ** Stage 1, open device sda3 failed.' ** Stage 1, open device sda3 failed. + exit 4 sh-4.2# sh-4.2# cryptsetup -q luksFormat /dev/sda3 /tmp//.key Device /dev/sda3 doesn't exist or access denied. sh-4.2# cryptsetup -q luksFormat /dev/sda3 /tmp//.key Device /dev/sda3 doesn't exist or access denied. sh-4.2# sh-4.2# ls /dev/sd sda sda1 sda2 sdb sdb1 sdb2 sdb3 sdb4 sdb5 sh-4.2# ls /dev/sd sda sda1 sda2 sdb sdb1 sdb2 sdb3 sdb4 sdb5 sh-4.2# pa parted partprobe passwd patch sh-4.2# pa parted partprobe passwd patch sh-4.2# fdisk -l Disk /dev/sda: 8019 MB, 8019099648 bytes 16 heads, 32 sectors/track, 30590 cylinders Units = cylinders of 512 * 512 = 262144 bytes Device Boot Start End Blocks Id System /dev/sda1 5 404 102400 83 Linux /dev/sda2 405 800 101376 83 Linux
    http代理服务器(3-4-7层代理)-网络事件库公共组件、内核kernel驱动 摄像头驱动 tcpip网络协议栈、netfilter、bridge 好像看过!!!!
但行好事 莫问前程
--身高体重180的胖子
                    
                
                
            
        
浙公网安备 33010602011771号