启动时恢复 apt 文件的内容

启动时恢复 apt 文件的内容

我有一个无头 debian Raspberry PI,它运行Owncloud server.

apt owncloud 安装文件曾经位于此处:

http://download.owncloud.org/download/repositories/stable/Debian_8.0/

owncloud.list所以我在我的目录中创建了一个名为的文件,/etc/apt/sources.list其中包含以下内容:

德布http://download.owncloud.org/download/repositories/stable/Debian_8.0//

相应的密钥已安装在 apt 中,一切正常。

现在 owncloud 已将安装文件的位置更改为:

http://download.owncloud.org/download/repositories/product/Debian_8.0/

我已将 owncloud.list 的内容更改为:

德布http://download.owncloud.org/download/repositories/product/Debian_8.0//

并将相应的密钥添加到apt中。

一切再次正常,Owncloud 得到更新,除了当我启动系统时。然后文件的旧内容owncloud.list和旧密钥再次出现。

所以我必须手动更改 owncloud.list 并再次导入新密钥。

这里发生了什么?

我确实按照下面提到的说明进行操作。系统的状态是刚启动后。记下 owncloud.list 文件的日期。我两天前按照说明进行了编辑。那么我们开始吧:

root@RAPI2-V2:/etc/apt/sources.list.d# ls -l
total 8
-rw-r--r-- 1 root root  76 Apr 18  2016 owncloud.list
-rw-r--r-- 1 root root 193 Nov 21  2015 raspi.list
root@RAPI2-V2:/etc/apt/sources.list.d# apt-key list
/etc/apt/trusted.gpg
--------------------
pub   2048R/90FDDD2E 2012-04-01
uid                  Mike Thompson (Raspberry Pi Debian armhf ARMv6+VFP) <[email protected]>
sub   2048R/5373DC6C 2012-04-01

pub   2048R/7FA3303E 2012-06-17
uid                  Raspberry Pi Archive Signing Key
sub   2048R/EDD83D6C 2012-06-17

pub   2048R/5180350A 2015-10-08 [expired: 2017-12-16]
uid                  ce OBS Project <[email protected]>

pub   2048R/479BC94B 2013-08-26 [expired: 2018-08-25]
uid                  ownCloud build service <obsrun@localhost>

pub   4096R/46925553 2012-04-27 [expires: 2020-04-25]
uid                  Debian Archive Automatic Signing Key (7.0/wheezy) <[email protected]>

pub   4096R/2B90D010 2014-11-21 [expires: 2022-11-19]
uid                  Debian Archive Automatic Signing Key (8/jessie) <[email protected]>

root@RAPI2-V2:/etc/apt/sources.list.d# cat /etc/apt/sources.list && cat /etc/apt/sources.list.d/*
deb http://mirrordirector.raspbian.org/raspbian/ jessie main contrib non-free rpi
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
#deb-src http://archive.raspbian.org/raspbian/ jessie main contrib non-free rpi
deb http://ftp.debian.org/debian jessie-backports main
deb http://download.owncloud.org/download/repositories/stable/Debian_8.0/ /
deb http://archive.raspberrypi.org/debian/ jessie main ui
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
#deb-src http://archive.raspberrypi.org/debian/ jessie main ui

apt-get 更新错误:

root@RAPI2-V2:/etc/apt/sources.list.d# apt-get update
Hit http://mirrordirector.raspbian.org jessie InRelease
Get:1 http://ftp.debian.org jessie-backports InRelease [166 kB]
Hit http://archive.raspberrypi.org jessie InRelease
Hit http://ftp.debian.org jessie-backports/main armhf Packages
Get:2 http://download.owncloud.org  InRelease [145 B]
Ign http://download.owncloud.org  InRelease
Hit http://mirrordirector.raspbian.org jessie/main armhf Packages
Get:3 http://download.owncloud.org  Release.gpg [481 B]
Hit http://ftp.debian.org jessie-backports/main Translation-en
Hit http://mirrordirector.raspbian.org jessie/contrib armhf Packages
Get:4 http://download.owncloud.org  Release [981 B]
Hit http://mirrordirector.raspbian.org jessie/non-free armhf Packages
Hit http://mirrordirector.raspbian.org jessie/rpi armhf Packages
Hit http://archive.raspberrypi.org jessie/main armhf Packages
Hit http://archive.raspberrypi.org jessie/ui armhf Packages
Err http://download.owncloud.org  Release

Ign http://archive.raspberrypi.org jessie/main Translation-en_GB
Ign http://archive.raspberrypi.org jessie/main Translation-en
Ign http://archive.raspberrypi.org jessie/ui Translation-en_GB
Ign http://archive.raspberrypi.org jessie/ui Translation-en
Ign http://mirrordirector.raspbian.org jessie/contrib Translation-en_GB
Ign http://mirrordirector.raspbian.org jessie/contrib Translation-en
Ign http://mirrordirector.raspbian.org jessie/main Translation-en_GB
Ign http://mirrordirector.raspbian.org jessie/main Translation-en
Ign http://mirrordirector.raspbian.org jessie/non-free Translation-en_GB
Ign http://mirrordirector.raspbian.org jessie/non-free Translation-en
Ign http://mirrordirector.raspbian.org jessie/rpi Translation-en_GB
Ign http://mirrordirector.raspbian.org jessie/rpi Translation-en
Fetched 168 kB in 15s (11.1 kB/s)
W: An error occurred during the signature verification. 

存储库不会更新,并且将使用以前的索引文件。 GPG错误:http://download.owncloud.org 发布:以下签名无效:KEYEXPIRED 1535163442 KEYEXPIRED 1535163442 KEYEXPIRED 1535163442 KEYEXPIRED 1535163644 KEYEXPIRED 1535163442 KEYEXPIRED 1535163442 KEYEXPIRED 1535163442 KEY已过期 1535163442 密钥已过期 1535163644

W: Failed to fetch http://download.owncloud.org/download/repositories/stable/Debian_8.0/Release

W: Some index files failed to download. They have been ignored, or old ones used instead.
E: dpkg was interrupted, you must manually run 'dpkg --configure -a' to correct the problem.

我已经尝试过了,dpkg --configure -a但那不起作用。

现在,如果我更新 owncloud.list 并根据说明添加密钥,错误就会消失:

root@RAPI2-V2:/etc/apt/sources.list.d# cat owncloud.list
deb http://download.owncloud.org/download/repositories/production/Debian_8.0/ /
root@RAPI2-V2:/etc/apt/sources.list.d# apt-get update
Hit http://mirrordirector.raspbian.org jessie InRelease
Hit http://ftp.debian.org jessie-backports InRelease
Hit http://archive.raspberrypi.org jessie InRelease
Hit http://ftp.debian.org jessie-backports/main armhf Packages
Get:1 http://download.owncloud.org  InRelease [145 B]
Ign http://download.owncloud.org  InRelease
Get:2 http://download.owncloud.org  Release.gpg [481 B]
Hit http://ftp.debian.org jessie-backports/main Translation-en
Get:3 http://download.owncloud.org  Release [981 B]
Hit http://mirrordirector.raspbian.org jessie/main armhf Packages
Hit http://mirrordirector.raspbian.org jessie/contrib armhf Packages
Hit http://mirrordirector.raspbian.org jessie/non-free armhf Packages
Hit http://archive.raspberrypi.org jessie/main armhf Packages
Hit http://mirrordirector.raspbian.org jessie/rpi armhf Packages
Hit http://archive.raspberrypi.org jessie/ui armhf Packages
Get:4 http://download.owncloud.org  Packages [739 B]
Get:5 http://download.owncloud.org  Translation-en_GB [145 B]
Ign http://archive.raspberrypi.org jessie/main Translation-en_GB
Get:6 http://download.owncloud.org  Translation-en [145 B]
Ign http://archive.raspberrypi.org jessie/main Translation-en
Ign http://archive.raspberrypi.org jessie/ui Translation-en_GB
Ign http://archive.raspberrypi.org jessie/ui Translation-en
Get:7 http://download.owncloud.org  Translation-en_GB [145 B]
Get:8 http://download.owncloud.org  Translation-en [145 B]
Get:9 http://download.owncloud.org  Translation-en_GB [145 B]
Get:10 http://download.owncloud.org  Translation-en [145 B]
Get:11 http://download.owncloud.org  Translation-en_GB [145 B]
Ign http://mirrordirector.raspbian.org jessie/contrib Translation-en_GB
Get:12 http://download.owncloud.org  Translation-en [145 B]
Ign http://mirrordirector.raspbian.org jessie/contrib Translation-en
Ign http://mirrordirector.raspbian.org jessie/main Translation-en_GB
Ign http://mirrordirector.raspbian.org jessie/main Translation-en
Get:13 http://download.owncloud.org  Translation-en_GB [145 B]
Ign http://download.owncloud.org  Translation-en_GB
Ign http://mirrordirector.raspbian.org jessie/non-free Translation-en_GB
Ign http://mirrordirector.raspbian.org jessie/non-free Translation-en
Ign http://mirrordirector.raspbian.org jessie/rpi Translation-en_GB
Get:14 http://download.owncloud.org  Translation-en [145 B]
Ign http://download.owncloud.org  Translation-en
Ign http://mirrordirector.raspbian.org jessie/rpi Translation-en
Fetched 2,201 B in 14s (146 B/s)
E: dpkg was interrupted, you must manually run 'dpkg --configure -a' to correct the problem.

运行dpkg --configure -a会删除最后一个错误,并且apt-get update不会出现错误。

这是更新后的关键内容:

root@RAPI2-V2:/etc/apt/sources.list.d# apt-key list
/etc/apt/trusted.gpg
--------------------
pub   2048R/90FDDD2E 2012-04-01
uid                  Mike Thompson (Raspberry Pi Debian armhf ARMv6+VFP) <[email protected]>


sub   2048R/5373DC6C 2012-04-01

pub   2048R/7FA3303E 2012-06-17
uid                  Raspberry Pi Archive Signing Key
sub   2048R/EDD83D6C 2012-06-17

pub   2048R/5180350A 2015-10-08 [expired: 2017-12-16]
uid                  ce OBS Project <[email protected]>

pub   2048R/479BC94B 2013-08-26 [expires: 2023-08-23]
uid                  ownCloud build service <obsrun@localhost>
sub   2048R/8DE365D9 2013-08-26 [expires: 2023-08-23]
sub   2048D/86EB6027 2013-08-26 [expires: 2023-08-23]

pub   4096R/46925553 2012-04-27 [expires: 2020-04-25]
uid                  Debian Archive Automatic Signing Key (7.0/wheezy) <[email protected]>

pub   4096R/2B90D010 2014-11-21 [expires: 2022-11-19]
uid                  Debian Archive Automatic Signing Key (8/jessie) <[email protected]>

现在如果我重新启动。 owncloud.list 文件恢复为旧版本,新密钥消失。

新更新:

重新启动了。当它出现时我做了:

移除钥匙

添加密钥

更改 owncloud.list

apt-get 更新

得到错误:

E: dpkg 被中断,您必须手动运行“dpkg --configure -a”来纠正问题。

dpkg --configure -a然后跑了一个

apt-get update

没有错误。

新的重启。

owncloud.list 文件已再次恢复

现在我发现问题不仅与 apt/dpkg 文件有关,根主目录在重新启动之前看起来像这样:

root@RAPI2-V2:/etc/apt/sources.list.d# ls -ltr ~
total 3376
drwxr-xr-x 2 root     root        4096 Dec 14  2015 Videos
drwxr-xr-x 2 root     root        4096 Dec 14  2015 Templates
drwxr-xr-x 2 root     root        4096 Dec 14  2015 Public
drwxr-xr-x 2 root     root        4096 Dec 14  2015 Pictures
drwxr-xr-x 2 root     root        4096 Dec 14  2015 Music
drwxr-xr-x 2 root     root        4096 Dec 14  2015 Downloads
drwxr-xr-x 2 root     root        4096 Dec 14  2015 Documents
drwxr-xr-x 2 root     root        4096 Dec 14  2015 Desktop
-rw-r--r-- 1 root     root      355681 Dec 15  2015 installed.txt
-rw-r--r-- 1 root     root       36430 Jan 27  2016 installed-programs.txt
-rwxr-xr-x 1 root     root       24994 Mar  4  2016 speedtest-cli
-rw-r--r-- 1 root     root        1003 Mar 22  2016 Release.key.2
-rw-r--r-- 1 root     root        1003 Mar 22  2016 Release.key.1
-rw-r--r-- 1 root     root      509192 Mar 24  2016 contacts.tar.gz
-rw-r--r-- 1 root     root      185921 Apr 14  2016 packages.txt
-rw-r--r-- 1 root     root      186367 Apr 14  2016 packages2.txt
-rwxr-xr-- 1 root     root         105 Apr 14  2016 disable-updatechecker.config.php
-rw-r--r-- 1 www-data www-data      20 Apr 14  2016 phpinfo.php
-rw-r--r-- 1 root     root      186367 Apr 14  2016 packages3.txt
-rw-r--r-- 1 root     root      253800 Apr 16  2016 speetest-servers.txt
-rw-r--r-- 1 root     root      179471 Apr 16  2016 packages4.txt
-rw-r--r-- 1 root     root     1193779 Apr 17  2016 calendar.tar.gz
-rw-r--r-- 1 root     root       68857 Apr 19  2016 owncloud.tar.gz
-rw-r--r-- 1 root     root      185696 Nov 20  2017 inst.txt
-rwxr-xr-x 1 root     root         175 May 21  2018 Backup-to-TorFtp.cmd
-rw-r--r-- 1 root     root        4485 Sep 18 11:39 Release-new.key

请注意,我已删除该Release.key文件。我把它下载到Release-new.key文件里了。现在重新启动后,主目录如下所示:

root@RAPI2-V2:~# ls -ltr ~
total 3372
drwxr-xr-x 2 root     root        4096 Dec 14  2015 Videos
drwxr-xr-x 2 root     root        4096 Dec 14  2015 Templates
drwxr-xr-x 2 root     root        4096 Dec 14  2015 Public
drwxr-xr-x 2 root     root        4096 Dec 14  2015 Pictures
drwxr-xr-x 2 root     root        4096 Dec 14  2015 Music
drwxr-xr-x 2 root     root        4096 Dec 14  2015 Downloads
drwxr-xr-x 2 root     root        4096 Dec 14  2015 Documents
drwxr-xr-x 2 root     root        4096 Dec 14  2015 Desktop
-rw-r--r-- 1 root     root      355681 Dec 15  2015 installed.txt
-rw-r--r-- 1 root     root       36430 Jan 27  2016 installed-programs.txt
-rwxr-xr-x 1 root     root       24994 Mar  4  2016 speedtest-cli
-rw-r--r-- 1 root     root        1003 Mar 22  2016 Release.key.2
-rw-r--r-- 1 root     root        1003 Mar 22  2016 Release.key.1
-rw-r--r-- 1 root     root      509192 Mar 24  2016 contacts.tar.gz
-rw-r--r-- 1 root     root        1358 Apr  7  2016 Release.key
-rw-r--r-- 1 root     root      185921 Apr 14  2016 packages.txt
-rw-r--r-- 1 root     root      186367 Apr 14  2016 packages2.txt
-rwxr-xr-- 1 root     root         105 Apr 14  2016 disable-updatechecker.config.php
-rw-r--r-- 1 www-data www-data      20 Apr 14  2016 phpinfo.php
-rw-r--r-- 1 root     root      186367 Apr 14  2016 packages3.txt
-rw-r--r-- 1 root     root      253800 Apr 16  2016 speetest-servers.txt
-rw-r--r-- 1 root     root      179471 Apr 16  2016 packages4.txt
-rw-r--r-- 1 root     root     1193779 Apr 17  2016 calendar.tar.gz
-rw-r--r-- 1 root     root       68857 Apr 19  2016 owncloud.tar.gz
-rw-r--r-- 1 root     root      185696 Nov 20  2017 inst.txt
-rwxr-xr-x 1 root     root         175 May 21  2018 Backup-to-TorFtp.cmd

现在,文件Release-new.key已经消失了,Release.key文件也被收割了。

到底发生了什么事?看起来 SD 卡没有更新,但是如何在 syslog 或 kern.log 中没有任何错误的情况下发生这种情况?每次启动时它也会认为是 9 月 17 日。唯一可疑的消息:

Sep 17 19:17:09 RAPI2-V2 kernel: [    5.785232] FAT-fs (mmcblk0p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
Sep 17 19:17:09 RAPI2-V2 kernel: [    8.230865]  sda: sda1

我已经运行了 fsck。没什么好抱怨的。

答案1

该问题与 apt/dpkg 无关,而是与 I/O 未写入 SD 卡有关。没有任何错误消息。显然,即使没有向卡写入任何内容,SD 卡也会报告成功的 I/O 状态。我将在 RaPi 论坛上提出问题。

相关内容