[archlinux][crypto] 从T450迁移archlinux操作系统至T460s笔记本
从T450笔记本迁移archlinux操作系统之T460s笔记本,同时:
1。 使用cryptsetup做底层块加密。
2. 全新使用btrfs文件系统。
一,硬盘分区。 1T的SSD,使用UEFI启动。
parted /dev/nvme0n1
mkpart fat32 1MiB 512MiB
mkpart linux-swap 513MiB 107530MiB
mkpart xfs 107530MiB %
set boot on
name 1 PARTITION_BOOT
name 2 PARTITION_SWAP
name 3 PARTITION_SECURITY
二, 块加密
[cipher][archlinux][disk encryption][btrfs] 磁盘分区加密 + btrfs
cryptsetup luksFormat /dev/nvme0n1p3
cryptsetup open /dev/nvme0n1p3 crypto_disk
mkfs.btrfs -L CRYPTO_DISK /dev/mapper/crypto_disk
mount /dev/mapper/crypto_disk mnt
btfs subvolume create mnt/_top
btfs subvolume create mnt/_top/root
btfs subvolume create mnt/_top/home
mkdir mnt/snapshot
mkdir mnt/snapshot/home
mkdir mnt/snapshot/root
btrfs subvolume set-default ./
三,挂载
umount mnt/
mount -o compress=lzo,subvol=_top/root /dev/mapper/crypto_disk mnt
mkdir mnt/home
mkdir mnt/boot
mount -o compress=lzo,subvol=_top/home /dev/mapper/crypto_disk mnt/home
mount /dev/nvme0n1p1 mnt/boot
swapon /dev/nvme0n1p2
四, rsync 从备份服务器做系统迁移
参考:[daily][archlinux][rsync] rsync
使用进行备份时同样的命令。
五,修改fstab,并安装EFISTUB
# genfstab -U /mnt >> /mnt/etc/fstab
https://wiki.archlinux.org/index.php/Dm-crypt/System_configuration
当前的配置
HOOKS="base systemd autodetect modconf block bcache sd-lvm2 filesystems keyboard fsck"
修改后的配置
HOOKS="base systemd autodetect modconf block sd-encrpt filesystems keyboard fsck"
BINARES="/usr/bin/btrfs"
# mkinitcpio -p linux
https://wiki.archlinux.org/index.php/Arch_boot_process
https://wiki.archlinux.org/index.php/EFISTUB
参考:
[troubleshoot][archlinux][bcache] 修改linux文件系统 / 分区方案 / 做混合硬盘 / 系统转生大!手!术!(调整底层架构,不!重!装!)
以及:https://wiki.archlinux.org/index.php/EFISTUB#Using_UEFI_directly
中的第11,15小节,用如下命令:
#efibootmgr -d /dev/nvme0n1 -p -c -L "T7" -l /vmlinuz-linux -u "cryptdevice=UUID=`cat uuid.txt`:crypto_data root=/dev/mapper/crypto_data
initrd=/initramfs-linux.img resume=/dev/nvme0n1p2"
因为我们是加密的,所以内容上有些特殊。
六:因为我们用的是SSD,需要支持TRIM
https://wiki.archlinux.org/index.php/Dm-crypt/Specialties#Discard.2FTRIM_support_for_solid_state_drives_.28SSD.29
6.1 fstab 增加discard选项
6.2 增加启动选项
#efibootmgr -d /dev/nvme0n1 -p -c -L "T7" -l /vmlinuz-linux -u "cryptdevice=UUID=`cat uuid.txt`:crypto_data:allow_discards
root=/dev/mapper/crypto_data initrd=/initramfs-linux.img resume=/dev/nvme0n1p2 rd.luks.options=discard"
七: 重启
reboot
八: 启动失败
报错如下:
sed_opal:OPAL: Error on step function: with error -: unknown Error
https://vxlabs.com/2015/02/11/use-the-hardware-based-full-disk-encryption-your-tcg-opal-ssd-with-msed/
http://resources.infosecinstitute.com/linux-tpm-encryption-initializing-and-using-the-tpm/
https://security.stackexchange.com/questions/54921/opal-hardware-encryption
https://www.pugetsystems.com/labs/articles/Introduction-to-Self-Encrypting-Drives-SED-557/
经过调查:
这个事叫做: SED(Self-Encrypting Drivers)https://wiki.archlinux.org/index.php/Self-Encrypting_Drives
T460s的硬盘是 NVME的ssd,
可是目前,他们不支持:
Note: NVMe disks are only partially supported: The sedutil-cli --scan command and the Linux PBA (pre-boot-authorisation) image currently
only see SATA disks. It is possible to enable self-encryption on an NVMe device by passing the name to sedutil-cli, but not possible to
boot from a locked NVMe disk (the PBA image does not see it). More details here.
如果想用,貌似不行要自己fork然后patch一段代码进去,用于启动时解密, 这就尴尬了。。。hhh
https://github.com/Drive-Trust-Alliance/sedutil/issues/120
yaourt -S sedutil
果然使用 sedutil-cli 无法看见我的硬盘。
只能放弃加密。
不对,我不是全盘加密啊。。。。 我只加密了根分区。要再调查一下。
也许是STUB启动出了问题。用grub再启动一次。
成功启动,555555555,只需要在/etc/default/grub 中增加一个参数
GRUB_CMDLINE_LINUX_DEFAULT="luks.uuid=652c137a-xxxx-xxxx-xxxxxxx quiet"
也就是说,之前写的内核参数是不对的,因为我们用了sd-crypt, 却给了crypto的参数。
sd-crypt参数详见:https://www.freedesktop.org/software/systemd/man/systemd-cryptsetup-generator.html
根据以上内容,参照grub的内核参数,重新修改STUB的内核参数。
成功启动!
增加 intel-ucode 支持:
另外测试了,将两个img cat到一个文件里,也是好用的:
修改其他硬件相关的配置:
网卡重命名等。略。
指点杆力度设置:
https://wiki.archlinux.org/index.php/TrackPoint
KVM错误
/home/tong/VM/kingkong-centos6. [tong@T7] [:]
> sudo qemu-system-x86_64 -enable-kvm
Could not access KVM kernel module: No such file or directory
failed to initialize KVM: No such file or directory
参考:https://bobcares.com/blog/how-to-fix-error-could-not-access-kvm-kernel-module/
原因有二: 1. CPU没有开启虚拟化。 2. kernel 没有加载KVM模块。
/home/tong/VM/kingkong-centos6. [tong@T7] [:]
> lsmod |grep ^kvm
kvm
很显然,BIOS中没有开启。
完!
TODO:
https://wiki.archlinux.org/index.php/Unified_Extensible_Firmware_Interface
https://wiki.archlinux.org/index.php/Secure_Boot
[archlinux][crypto] 从T450迁移archlinux操作系统至T460s笔记本的更多相关文章
- [archlinux][hardware] ThankPad T450自带SSD做bcache之后的使用寿命分析
这个分析的起因,是由于我之前干了这两个事: [troubleshoot][archlinux][bcache] 修改linux文件系统 / 分区方案 / 做混合硬盘 / 系统转生大!手!术!(调整底层 ...
- [archlinux] 迁移T7从T460s到T470
这已经不是第一次做OS的迁移了,T7早已经迁移过多台设备了.所以,其实只需要如下三步: 1. rsync 我一直有全系统备份的习惯,T7一直会不定期的全系统rsync到Tstation上面去.所以我 ...
- ArchLinux 安装笔记 --zz
为何安装 ArchLinux 为了更深层次的理解 Linux (其实只是闲的蛋疼 准备安装介质 U盘首选,没有之一.自己的本子是 MBR 的,UEFI 神马的我才不知道呢哼! 制作 U 盘启动: Li ...
- Create Access Point on Archlinux
Create Access Point on Archlinux */--> Create Access Point on Archlinux 1 Solution Download creat ...
- Arch Linux 系统迁移
镜像下载.域名解析.时间同步请点击 阿里巴巴开源镜像站 备份 Arch Linux 系统 安装 pigz 使用 pigz 多线程压缩比使用 tar 单线程压缩速度明显提升多倍 sudo pacman ...
- Linux 下源码编译安装 vim 8.1
前言 目前 linux 的各个发行版基本上都是带了一个 vi 编辑器的,而本文要说的 vim 编辑器对 vi 做了一些优化升级,更好用.当我们需要远程操作一台 linux 服务器的时候,只能使用命令行 ...
- 顿悟:Linux是拿来用的,不是拿来折腾的
Linux是拿来用的,而不是折腾其本身.相信这个道理不少聪明人(实用主义者)都明白,然而总是有那么一群人拿Linux去安装各种发行版.研究Linux命令.配置桌面.美化桌面.研究各种wm/DE.永无止 ...
- (openssh、telnet、vsftpd、nfs、rsync、inotify、samba)
(openssh.telnet.vsftpd.nfs.rsync.inotify.samba) 一:OpenSSH服务与Telnet服务(必须掌握) 前言:OpenSSH是加密传输,Telnet是明文 ...
- links and softwares
links 普通 http://www.ncpa-classic.com//special/2014gejujie/index.shtml ; 中国大剧院 http://tieba.baidu.com ...
随机推荐
- 测试覆盖率工具:EclEmma
测试覆盖率工具:EclEmma 2016-08-26 目录 1 测试覆盖率实现技术2 EclEmma介绍3 EclEmma测试覆盖率指标4 EclEmma安装5 示例项目介绍 5.1 创建项目 5 ...
- 【九天教您南方cass 9.1】 04 编码法Ⅱ绘制地形图
同学们大家好,欢迎收看由老王测量上班记出品的cass9.1视频课程 我是本节课主讲老师九天. 我们讲课的教程附件也是共享的,请注意索取测量空间中. [点击索取cass教程]5元立得 (给客服说暗号:“ ...
- 奋斗STM32V3版ADC例程
https://wenku.baidu.com/view/a60b2042c850ad02de8041b7.html
- Java 继承中构造方法的执行顺序问题
在Java中,如果一个类没有任何显式创建的构造器则该类默认会有一个无参构造器:如果显式创建了有参构造器则该类就不再有默认无参构造器. 在Java继承中,构造器并不能被继承,而是被显示或隐式调用. 1. ...
- An SPI class of type org.apache.lucene.codecs.PostingsFormat with name 'Lucene50' does not exist. You need to add the corresponding JAR file supporting this SPI to your classpath. The current classp
背景介绍: 当ES中guava库与hive等组件的库冲突时,对Elasticsearch库进行shade,relocate解决库冲突问题. 当使用"org.apache.maven.plug ...
- [原创]MSP430FR4133练习(一):GPIO输入电平状态判断
硬件环境:MSP430FR4133 LANCHPAD开发板 软件环境:IARV7.10 For 430 源代码: #include "driverlib.h" void main( ...
- java+Quartz实现定时任务
1.首先:导入quartz相关的jar包,这里我用的是maven构建的项目,pom.xml文件导入如下: <dependency> <groupId>org.quartz-sc ...
- tcp 三次握手 转
转载 记得刚毕业找工作面试的时候,经常会被问到:你知道“3次握手,4次挥手”吗?这时候我会“胸有成竹”地“背诵”前期准备好的“答案”,第一次怎么怎么,第二次……答完就没有下文了,面试官貌似也没有深入下 ...
- talk is cheap, show me the code——dcgan,wgan,wgan-gp的tensorflow实现
最近学习了生成对抗网络(GAN),基于几个经典GAN网络结构做了些小实验,包括dcgan,wgan,wgan-gp.坦率的说,wgan,wgan-gp论文的原理还是有点小复杂,我也没有完全看明白,因此 ...
- 什么是跨域访问,JSON&JSONP
http://blog.csdn.net/notechsolution/article/details/50394391 更详细的讲解,关于同源策略等: http://www.cnblogs.com/ ...