Re: Trouble/bug with initramfs-tools adding encrypted swap partition
From
Hans@21:1/5 to
All on Wed Apr 24 08:40:01 2024
This is a multi-part message in MIME format.
Am Dienstag, 23. April 2024, 22:26:17 CEST schrieb Richard:
Hi Richard,
this is, what I am doing when this happens:
1. booting into a live system (any new is working, I prefer kali-linux)
2. If you are using encrypted filesystems, open it. But you have to name it like it is named in /
etc/crypttab of the defective system
3. Now mount the device with root-filesystem to /mnt
4. If you have /boot as a separated partition, mount it to /mnt/boot
5. Now mount needed system directories to /mnt
mount --bind /sys /mnt/sys
mount --bind /proc /mnt/proc
mount --bind /dev /mnt/dev
6. If everything is mounted correct, you can chroot into the mounted system
chroot /mnt
7. Now you can create a new initrd
update-initramfs -u
8. exit the chroot and reboot.
--------------------
Note:
1. if you have encrypted filesystems, check in the chroot the files
/etc/crypttab
/etc/cryptsetup-initramfs/conf-hook
In conf-hook check the last line, the parm "ASKPASS=Y" should be commented out.
2. You can check the UUID of every partition with the command
blkid /dev/sda1
and compare it with the entries in /etc/fstab, /etc/crypttab and everywhere else it is used.
3. In chroot, you can of course also create a new initrd, using
update-initramfs -c -k all
4. Please remember, when you have encrypted partitions, then the UUID of the device is other,
than the partitions, you later mount. Example:
blkid /dev/sda3
UUID=1234556-dfre-3456.............
Now
cryptsetup luksOpen /dev/sda3 crypt_sda3
blkid /dev/mapper/crypt_sda3
UUID=9876g54-765g-87hg............
Watch this, when changing any UUIDs in /etc/fstab or anywhere else.
Last but not least: Hope this helps, good luck!
Best
Hans
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">Am Dienstag, 23. April 2024, 22:26:17 CEST schrieb Richard:</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">Hi Richard,</p>
<br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">this is, what I am doing when this happens:</p>
<br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">1. booting into a live system (any new is working, I prefer kali-linux)</p>
<br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">2. If you are using encrypted filesystems, open it. But you have to name it like it is named in /etc/crypttab of the defective system</p>
<br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">3. Now mount the device with root-filesystem to /mnt </p>
<br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">4. If you have /boot as a separated partition, mount it to /mnt/boot</p>
<br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">5. Now mount needed system directories to /mnt</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;"> mount --bind /sys /mnt/sys</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;"> mount --bind /proc /mnt/proc</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;"> mount --bind /dev /mnt/dev</p>
<br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">6. If everything is mounted correct, you can chroot into the mounted system</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;"> chroot /mnt</p>
<br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">7. Now you can create a new initrd</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;"> update-initramfs -u</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;"> </p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">8. exit the chroot and reboot.</p>
<br /><br /><hr />
<br /><br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">Note:</p>
<br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">1. if you have encrypted filesystems, check in the chroot the files</p>
<br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">/etc/crypttab</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">/etc/cryptsetup-initramfs/conf-hook </p>
<br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">In conf-hook check the last line, the parm "ASKPASS=Y" should be commented out.</p>
<br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">2. You can check the UUID of every partition with the command</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;"> blkid /dev/sda1 </p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">and compare it with the entries in /etc/fstab, /etc/crypttab and everywhere else it is used.</p>
<br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">3. In chroot, you can of course also create a new initrd, using </p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;"> update-initramfs -c -k all</p>
<br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">4. Please remember, when you have encrypted partitions, then the UUID of the device is other, than the partitions, you later mount. Example:</p>
<br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">blkid /dev/sda3</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">UUID=1234556-dfre-3456.............</p>
<br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">Now</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">cryptsetup luksOpen /dev/sda3 crypt_sda3</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">blkid /dev/mapper/crypt_sda3</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">UUID=9876g54-765g-87hg............</p>
<br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">Watch this, when changing any UUIDs in /etc/fstab or anywhere else.</p>
<br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">Last but not least: Hope this helps, good luck!</p>
<br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">Best</p>
<br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">Hans</p>
<br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;"> </p>
<br /></body>
</html>
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)