嘟嘟社区

腾讯轻量 Windows 2022 系统 DD Debian 11


本帖最后由 zxxx 于 2022-4-24 14:52 编辑

1. 下载 EasyBCD 和 mfslinux

https://sm.myapp.com/original/System/EasyBCD_v2.3.exe
https://mfsbsd.vx.sk/files/iso/mfslinux/mfslinux-0.1.10-f9c75a4.iso

2. 安装 EasyBCD 添加 mfslinux 启动菜单并设置为默认选项

3. 重新启动

4. 通过 SSH 连接

username: root
password: mfsroot

5. 开始 DD

  1. fdisk -l
  2. Disk /dev/vda: 30 GiB, 32212254720 bytes, 62914560 sectors
  3. Units: sectors of 1 * 512 = 512 bytes
  4. Sector size (logical/physical): 512 bytes / 512 bytes
  5. I/O size (minimum/optimal): 512 bytes / 512 bytes
  6. Disklabel type: dos
  7. Disk identifier: 0xf8c3d85e
  8. Device     Boot Start      End  Sectors Size Id Type
  9. /dev/vda1  *     2048 62910463 62908416  30G  7 HPFS/NTFS/exFAT

复制代码

  1. wget -O- "https://cloud.debian.org/images/cloud/bullseye/latest/debian-11-genericcloud-amd64.raw" | dd of=/dev/vda

复制代码

Download completed (2147483648 bytes)
4189053+9690 records in
4189053+9690 records out

6. mount

  1. fdisk -l
  2. GPT PMBR size mismatch (4194303 != 62914559) will be corrected by write. <=== 错误?
  3. The backup GPT table is not on the end of the device.
  4. Disk /dev/vda: 30 GiB, 32212254720 bytes, 62914560 sectors
  5. Units: sectors of 1 * 512 = 512 bytes
  6. Sector size (logical/physical): 512 bytes / 512 bytes
  7. I/O size (minimum/optimal): 512 bytes / 512 bytes
  8. Disklabel type: gpt
  9. Disk identifier: 2AC9A341-47CF-F740-B3FA-A9FF9D45F89A
  10. Device      Start     End Sectors  Size Type
  11. /dev/vda1  262144 4194270 3932127  1.9G Linux filesystem
  12. /dev/vda14   2048    8191    6144    3M BIOS boot
  13. /dev/vda15   8192  262143  253952  124M EFI System
  14. Partition table entries are not in disk order.

复制代码

无法 mount

  1. mkdir /mnt/vda1
  2. mount /dev/vda1 /mnt/vda1
  3. NTFS signature is missing.
  4. Failed to mount ‘/dev/vda1’: Invalid argument
  5. The device ‘/dev/vda1’ doesn’t seem to have a valid NTFS.
  6. Maybe the wrong device is used? Or the whole disk instead of a
  7. partition (e.g. /dev/sda, not /dev/sda1)? Or the other way around?
  8. mount: mounting /dev/vda1 on /mnt/vda1 failed: Invalid argument

复制代码

修复

  1. fdisk /dev/vda
  2. Welcome to fdisk (util-linux 2.36.1).
  3. Changes will remain in memory only, until you decide to write them.
  4. Be careful before using the write command.
  5. GPT PMBR size mismatch (4194303 != 62914559) will be corrected by write.
  6. The backup GPT table is not on the end of the device. This problem will be corrected by write.
  7. Command (m for help): w
  8. The partition table has been altered.
  9. Calling ioctl() to re-read partition table.
  10. Syncing disks.

复制代码

重新 mount

  1. mount /dev/vda1 /mnt/vda1
  2. ls /mnt/vda1/usr/local

复制代码

bin      etc      games    include  lib      man      sbin     share    src

此时并没有 /usr/local/qcloud 这个文件夹

7. 配置 SSH

允许 root 使用密码登录

  1. sed -i ‘s/.*PermitRootLogin.*/PermitRootLogin yes/’ /mnt/vda1/etc/ssh/sshd_config
  2. sed -i ‘s/.*PasswordAuthentication.*/PasswordAuthentication yes/’ /mnt/vda1/etc/ssh/sshd_config

复制代码

修改 root 密码

  1. chroot /mnt/vda1/
  2. passwd root
  3. ********
  4. ********
  5. passwd -S root
  6. root P 04/24/2022 0 99999 7 -1
  7. cat /etc/shadow | grep root
  8. root:$y$j9T$onpHR5WOJnsR2/G8ChkaH0$2vtxjM/PIMbULsMWQnfPwF/TKLT8gPDFjyESjlRz2E4:19106:0:99999:7:::
  9. exit
  10. umount /mnt/vda1/

复制代码

8. 重启到 Debian 11

  1. reboot

复制代码

本帖最后由 zxxx 于 2022-4-24 14:50 编辑

重启之后无法使用设置的 root 的密码登录。

通过控制面板【一键免密登录】登录,发现密码被修改了

重启之前

  1. cat /etc/shadow | grep root
  2. root:$y$j9T$onpHR5WOJnsR2/G8ChkaH0$2vtxjM/PIMbULsMWQnfPwF/TKLT8gPDFjyESjlRz2E4:19106:0:99999:7:::

复制代码

重启之后

  1. sudo cat /etc/shadow | grep root
  2. root:$1$SCHOoGBY$qPO8vlLAXHuELwt.aEhDu0:19106:0:99999:7:::

复制代码

同时多出来一个文件夹 /usr/local/qcloud

  1. ls /usr/local
  2. bin  etc  games  include  lib  man  qcloud  sbin  share  src

复制代码

尝试重新设置 root 密码

  1. sudo passwd root
  2. New password:
  3. Retype new password:
  4. passwd: password updated successfully
  5. sudo cat /etc/shadow | grep root
  6. root:$y$j9T$T76Q00rHl.AWo4XebXcPB/$wBLwqUl5XhvjUAGQFx/NLhcz5zHrVEU0oTr9uIZEJM3:19106:0:99999:7:::

复制代码

然后就可以顺利的使用新密码登录了。

请教为什么不能使用自己设置的root密码登录呢?