快照:错误:操作太早,设备尚未播种或设备型号未确认

快照:错误:操作太早,设备尚未播种或设备型号未确认

我正在尝试通过自动化安装mysql-workbench-community和。但是,当我运行时,我收到错误postmansnapsnap install mysql-workbench-community --classicerror: too early for operation, device not yet seeded or device model not acknowledged

snap install mysql-workbench-community --classic如果我尝试第二次或第三次运行,它最终会安装。

作为目前的解决方法,我创建了一个循环来检查是否snap已安装,如果已安装则退出循环。如果未安装,它将尝试安装snap30 次,然后才会失败。

脚本如下:

#!/bin/bash

counter=0

dnf install epel-release -y
dnf install snapd -y
if [ ! -L /snap ]; then
        ln -s /var/lib/snapd/snap /snap
fi
systemctl enable --now snapd.socket



echo -n "Installing MySQL Workbench ... "
while true
do
        if snap list 2>/dev/null |  grep -q mysql-workbench-community; then 
                break
        else
                snap install mysql-workbench-community --classic
                let "counter+=1"
                sleep 5
        fi

        if [ $counter = 30 ]; then
                exit 10
        fi

done
echo "OK"


snap connect mysql-workbench-community:password-manager-service
snap connect mysql-workbench-community:ssh-keys

echo -n "Installing Postman ... "
while true
do
        if snap list 2>/dev/null |  grep -q postman; then 
                break
        else
                snap install postman --classic
                let "counter+=1"
                sleep 5
        fi

        if [ $counter = 30 ]; then
                exit 10
        fi
done
echo "OK"

我很好奇为什么我必须snap在它工作之前安装几次,以及可以做什么,这样我就不需要创建循环。

相关内容