我尝试在从 LiveCD 运行时复制所有文件,将现有的 Ubuntu 安装移动到新分区。最终,新系统卡在了启动过程中。
我做了什么
- 已启动 LiveCD。
- 安装旧分区和新分区。
- 使用类似
cp -a /mnt/old_root/* /mnt/new_root
复制文件的方法,据说可以保留文件元数据。(也许我应该试试其他选择) /etc/fstab
在新系统上进行了更正。- 按照以下步骤重新安装 GRUB这些步骤在第一次尝试中这些步骤在第二次尝试中。
- 尝试启动新系统。
- 固定的这个问题但这不是原因。
更新:我尝试在新安装的系统上执行相同的步骤并得到了相同的结果。
不重要的细节:
- 我在 VirtualBox 版本 6.0.5 r128870 中运行系统
- 系统是Ubuntu 18.04.2 LTS;Linux 4.15.0-45-generic。
我得到了什么
- 系统启动开始。
- 看起来系统已成功安装
/
。/home
(当系统出现错误时,/etc/fstab
会迅速降至维护 shell) - 系统启动卡在动画启动画面。
- 如果我隐藏启动画面,我会看到相同的服务一次又一次启动失败。系统几乎不使用 CPU 或存储。
- 我可以从 GRUB 启动到恢复模式。
- 日志中的第一条错误信息:
2019-02-19T18:29:37+0000 hostname systemd[1]: Reached target Sockets.
2019-02-19T18:29:37+0000 hostname systemd[1]: Reached target Basic System.
2019-02-19T18:29:37+0000 hostname systemd[1]: Started D-Bus System Message Bus.
2019-02-19T18:29:37+0000 hostname dbus-daemon[1104]: dbus[1104]: Unknown group "power" in message bus configuration file
2019-02-19T18:31:07+0000 hostname systemd[1]: Failed to get initial list of names: Connection timed out
2019-02-19T18:31:07+0000 hostname systemd[1]: Failed to set up API bus: Connection timed out
2019-02-19T18:31:07+0000 hostname systemd[1]: Error occured during D-Bus APIs initialization: Connection timed out
2019-02-19T18:31:07+0000 hostname systemd[1]: Starting Login Service...
2019-02-19T18:31:07+0000 hostname systemd[1]: Starting System Logging Service...
2019-02-19T18:31:07+0000 hostname systemd[1]: Starting firewalld - dynamic firewall daemon...
2019-02-19T18:31:07+0000 hostname systemd[1]: Starting Detect the available GPUs and deal with any system changes...
2019-02-19T18:31:07+0000 hostname systemd[1]: Starting Avahi mDNS/DNS-SD Stack...
2019-02-19T18:31:07+0000 hostname systemd[1]: Started CUPS Scheduler.
2019-02-19T18:31:07+0000 hostname systemd[1]: Starting LSB: OpenIPMI Driver init script...
2019-02-19T18:31:07+0000 hostname systemd[1]: Starting WPA supplicant...
2019-02-19T18:31:08+0000 hostname avahi-daemon[1138]: Found user 'avahi' (UID 115) and group 'avahi' (GID 122).
2019-02-19T18:31:08+0000 hostname avahi-daemon[1138]: Successfully dropped root privileges.
2019-02-19T18:31:08+0000 hostname avahi-daemon[1138]: open(/run/avahi-daemon//pid): Permission denied
2019-02-19T18:31:08+0000 hostname avahi-daemon[1138]: Failed to create PID file: Permission denied
- 此类消息每 90 秒重复一次。据我了解,dbus-daemon 已死。
2019-02-19T20:53:47+0000 hostname systemd[1]: Failed to get initial list of names: Connection timed out
2019-02-19T20:53:47+0000 hostname systemd[1]: Failed to set up API bus: Connection timed out
2019-02-19T20:53:47+0000 hostname systemd[1]: Error occured during D-Bus APIs initialization: Connection timed out
2019-02-19T20:53:47+0000 hostname systemd[1]: Starting Network Manager...
2019-02-19T20:53:47+0000 hostname systemd[1]: dbus.service: Main process exited, code=exited, status=1/FAILURE
2019-02-19T20:53:47+0000 hostname systemd[1]: dbus.service: Failed with result 'exit-code'.
2019-02-19T20:53:47+0000 hostname systemd[1]: rsyslog.service: Start operation timed out. Terminating.
2019-02-19T20:53:47+0000 hostname systemd[1]: whoopsie.service: Service hold-off time over, scheduling restart.
2019-02-19T20:53:47+0000 hostname systemd[1]: whoopsie.service: Scheduled restart job, restart counter is at 7.
2019-02-19T20:53:47+0000 hostname systemd[1]: Started D-Bus System Message Bus.
2019-02-19T20:53:47+0000 hostname dbus-daemon[4650]: dbus[4650]: Unknown group "power" in message bus configuration file
2019-02-19T20:53:47+0000 hostname NetworkManager[4644]: <info> [1550609627.2637] NetworkManager (version 1.10.6) is starting... (after a restart)
2019-02-19T20:53:47+0000 hostname NetworkManager[4644]: <info> [1550609627.2641] Read config: /etc/NetworkManager/NetworkManager.conf (lib: 10-dns-resolved.conf, 20-connectivity-ubuntu.conf, no-mac-addr-change.conf) (run: netplan.conf) (etc: 10-globally-managed-devices.conf, 10-ubuntu-fan.conf, default-wifi-powersave-on.conf)
2019-02-19T20:55:17+0000 hostname systemd[1]: Failed to get initial list of names: Connection timed out
2019-02-19T20:55:17+0000 hostname systemd[1]: Failed to set up API bus: Connection timed out
2019-02-19T20:55:17+0000 hostname systemd[1]: Error occured during D-Bus APIs initialization: Connection timed out
2019-02-19T20:55:17+0000 hostname systemd[1]: Stopped crash report submission daemon.
2019-02-19T20:55:17+0000 hostname systemd[1]: Started crash report submission daemon.
2019-02-19T20:55:17+0000 hostname systemd[1]: rsyslog.service: Main process exited, code=killed, status=6/ABRT
2019-02-19T20:55:17+0000 hostname systemd[1]: rsyslog.service: Failed with result 'timeout'.
2019-02-19T20:55:17+0000 hostname systemd[1]: Failed to start System Logging Service.
2019-02-19T20:55:17+0000 hostname systemd[1]: dbus.service: Main process exited, code=exited, status=1/FAILURE
2019-02-19T20:55:17+0000 hostname systemd[1]: dbus.service: Failed with result 'exit-code'.
2019-02-19T20:55:17+0000 hostname systemd[1]: NetworkManager.service: Start operation timed out. Terminating.
2019-02-19T20:55:17+0000 hostname systemd[1]: Started D-Bus System Message Bus.
2019-02-19T20:55:17+0000 hostname whoopsie[4678]: [20:55:17] Could not create lock directory.
2019-02-19T20:55:17+0000 hostname whoopsie[4678]: [20:55:17] Using lock path: /var/lock/whoopsie/lock
2019-02-19T20:55:17+0000 hostname whoopsie[4678]: [20:55:17] Could not create lock file: Bad file descriptor
2019-02-19T20:55:17+0000 hostname whoopsie[4678]: [20:55:17] Could not read directory (13): /var/crash
2019-02-19T20:55:17+0000 hostname dbus-daemon[4685]: dbus[4685]: Unknown group "power" in message bus configuration file
2019-02-19T20:55:17+0000 hostname snapd[1246]: udevmon.go:190: udev monitor observed remove event for unknown device "/sys/dentry(4893:whoopsie.service)"
问题
cp -a
预计能起作用吗?- 新旧分区的区别到底在哪里?
- 我应该深入研究启动问题本身吗?
答案1
多亏了这个帖子,我可以通过在恢复 shell 中执行以下命令来解决问题:
chown root:root /
chmod 755 /
新系统运行良好,因此cp -a
方法可能没问题。问题是根目录的权限错误。(据我了解,当我格式化分区时,目录获得了权限;当我复制目录中的系统文件时,权限显然保持不变)。
答案2
当您继续使用系统时,它将导致更多权限问题,您应该使用选项来保留权限,例如 tar cpf -|(cd /newmount;tar xvpf -) 或 rsync -avzt source/ /dest (在 rsync 中注意尾随斜杠字符)