Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

[Solved] Dual boot Debian and Windows + copy Debian O/S to new laptop

Ask for help with issues regarding the Installations of the Debian O/S.
Message
Author
User avatar
sunrat
Administrator
Administrator
Posts: 6382
Joined: 2006-08-29 09:12
Location: Melbourne, Australia
Has thanked: 115 times
Been thanked: 456 times

Re: Copy O/S partition to new laptop

#21 Post by sunrat »

You can pipe dd through a compression utility such as gzip to reduce the size of the image. Alternatively use Clonezilla to back up the disk which can use compression, it's the default IIRC.
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!

Dai_trying
Posts: 1100
Joined: 2016-01-07 12:25
Has thanked: 5 times
Been thanked: 16 times

Re: Copy O/S partition to new laptop

#22 Post by Dai_trying »

ticketman wrote: 2021-11-18 16:01 Did you ever encounter the problem with immovable files restricting the amount you can shrink by?
I haven't had any issues at all tbh, but if there are immovable files it seems logical that it would be restricted this way, although I often turn off (or reduce the size of) windows swap file (depending on system resources) which could make a difference.

ticketman
Posts: 136
Joined: 2012-06-30 11:06
Has thanked: 3 times

Re: Copy O/S partition to new laptop

#23 Post by ticketman »

Before backing up the windows partitions, I :
- Disabled windows fast boot, as dual boot systems need to clean boot (caution - windows updates can resurrect it)
* see under "Choose what the power buttons do"
* more info under https://www.windowscentral.com/how-disa ... st-startup
- Uninstalled all windows third party virus checkers (e.g. Norton)
- Disabled "System Restore" from windows using power shell command : Disable-ComputerRestore -Drive "C:\"
- Disabled windows hibernation function using power shell command : powercfg -h off
Rebooted windows so changes took effect.

My windows laptop partitions were then backed up like this using the system rescue cd/usb:

Code: Select all

sgdisk --backup=/mnt/GPTtable  /dev/nvme0n1
The operation has completed successfully.

dd bs=4M if=/dev/nvme0n1p1 | gzip -c > /mnt/p1EFI.img.gz
25+0 records in
25+0 records out
104857600 bytes (105 MB, 100 MiB) copied, 1.45294 s, 72.2 MB/s

dd bs=4M if=/dev/nvme0n1p2 | gzip -c > /mnt/p2.img.gz
4+0 records in
4+0 records out
16777216 bytes (17 MB, 16 MiB) copied, 0.144012 s, 116 MB/s

dd bs=4M if=/dev/nvme0n1p3 | gzip -c > /mnt/p3Boot.img.gz
113881+1 records in
113881+1 records out
477653630976 bytes (478 GB, 445 GiB) copied, 3065.69 s, 156 MB/s

dd bs=4M if=/dev/nvme0n1p4 | gzip -c > /mnt/p4.img.gz
249+1 records in
249+1 records out
1047527424 bytes (1.0 GB, 999 MiB) copied, 16.1382 s, 64.9 MB/s

dd bs=4M if=/dev/nvme0n1p5 | gzip -c > /mnt/p5.img.gz
7680+0 records in
7680+0 records out
32212254720 bytes (32 GB, 30 GiB) copied, 608.3 s, 53.0 MB/s

dd bs=4M if=/dev/nvme0n1p6 | gzip -c > /mnt/p6.img.gz
256+0 records in
256+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 17.4374 s, 61.6 MB/s
Of note is the compression of the Windows O/S (partition 3) - from 445GB to 17.8GB ! The backup was rather slow - took about 50 minutes, becuase of the compression step. But at least I could store the result on a exFAT formatted usb drive.

I then used gparted on the rescue usb to delete partitions 6, 5 and 4 in that order (nvme0n1p6, nvme0n1p5, nvme0n1p4) These partitions are used by windows and the OEM for recovery of the windows system. Since I will be managing my own backup systems, I don't need these partitions.

Rebooted and windows was still happy!

Next is to shrink the windows partition, using the rescue disk and gparted.
I think the issue with immovable files might be they can't be moved if windows is running. When gparted moves them, I suspect that when windows is then booted, windows has a slight panic but manages to fix itself. I guess we shall see!
Last edited by ticketman on 2021-11-20 12:28, edited 1 time in total.

p.H
Global Moderator
Global Moderator
Posts: 3049
Joined: 2017-09-17 07:12
Has thanked: 5 times
Been thanked: 132 times

Re: Copy O/S partition to new laptop

#24 Post by p.H »

ticketman wrote: 2021-11-16 14:22 The good news is that I have succeeded in disabling secure boot on the laptop (I also had to remove bitlocker encryption), so I can now boot my system rescue disk.
Why did you have to remove Bitlocker encryption ? AFAIK it is only a Windows thing, and you don't need Windows to boot your rescue disk.
CwF wrote: 2021-11-17 14:30
resize the windows O/S partition while windows is still running from it?
Linux can, about time windows could!
AFAIK Linux cannot shrink a mounted filesystem except btrfs.
ticketman wrote: 2021-11-18 16:01 Did you ever encounter the problem with immovable files restricting the amount you can shrink by?
Yes I did. The partition could not be shrunk by more than ~50% because the swap and/or hibernation file was located in the middle.

ticketman
Posts: 136
Joined: 2012-06-30 11:06
Has thanked: 3 times

Re: Copy O/S partition to new laptop

#25 Post by ticketman »

p.H asked:
Why did you have to remove Bitlocker encryption ? AFAIK it is only a Windows thing, and you don't need Windows to boot your rescue disk.
It is because I believe it would not be possible to shrink a partition if it is encrypted (but I could be wrong on that)

You also reminded me of a step I missed:
- Disabled windows hibernation function using power shell command : powercfg -h off
I have edited my previous post to include that.

ticketman
Posts: 136
Joined: 2012-06-30 11:06
Has thanked: 3 times

Re: Copy O/S partition to new laptop

#26 Post by ticketman »

Ok, before shrinking the windows O/S partition, I decided to back-up the partitions again. There are now only 3 of them, and I decided to forgo compressing them. These results are here:

Code: Select all

[root@sysrescue ~]# lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
loop0         7:0    0 689.3M  1 loop /run/archiso/sfs/airootfs
sda           8:0    1   1.9G  0 disk /run/archiso/bootmnt
├─sda1        8:1    1   753M  0 part 
└─sda2        8:2    1   1.4M  0 part 
sdb           8:16   0 465.8G  0 disk 
└─sdb1        8:17   0 465.8G  0 part 
nvme0n1     259:0    0 476.9G  0 disk 
├─nvme0n1p1 259:1    0   100M  0 part 
├─nvme0n1p2 259:2    0    16M  0 part 
└─nvme0n1p3 259:3    0 444.8G  0 part 
[root@sysrescue ~]# mount /dev/sdb1 /mnt

[root@sysrescue ~]# sgdisk --backup=/mnt/GPTtable  /dev/nvme0n1
The operation has completed successfully.

[root@sysrescue ~]# dd bs=4M if=/dev/nvme0n1p1 of=/mnt/p1.img
25+0 records in
25+0 records out
104857600 bytes (105 MB, 100 MiB) copied, 0.124773 s, 840 MB/s

[root@sysrescue ~]# dd bs=4M if=/dev/nvme0n1p2 of=/mnt/p2.img
4+0 records in
4+0 records out
16777216 bytes (17 MB, 16 MiB) copied, 0.0347494 s, 483 MB/s

[root@sysrescue ~]# dd bs=4M if=/dev/nvme0n1p3 of=/mnt/p3.img
113881+1 records in
113881+1 records out
477653630976 bytes (478 GB, 445 GiB) copied, 1299.93 s, 367 MB/s
By omitting the compression, it now only took 22 minutes to save partition 3.

I then used gparted to shrink partition 3 by moving the RIGHT HAND handle only of the partition bar with the mouse. I moved it until I got a new partition size of about 140GB. Applying the operation was very quick.

Rebooted windows, and windows was absolutely fine - no error messages!

I think I should now rename this thread as "Dual boot Debian and Windows + copy Debian O/S to new laptop"

Next task is to install debian 12 (at last!)
Not sure if to create a partition for it now from the unallocated space, or let the installer do it ...

ticketman
Posts: 136
Joined: 2012-06-30 11:06
Has thanked: 3 times

Re: Dual boot Debian and Windows + copy Debian O/S to new laptop

#27 Post by ticketman »

Before proceding, I did yet another backup of the laptop partitions and GPT table.

The following steps were then done:

Downloaded latest debian 12 'bookworm' installer iso file onto my old desktop PC:
https://cdimage.debian.org/cdimage/week ... 4/iso-dvd/
and burnt it to a usb stick, e.g. using
sudo dd bs=4M if=debian-live-bookworm-amd64-DVD-1.iso of=/dev/sd# conv=fdatasync
where # is the usb stick (use lsblk to check!)
Connected the laptop to wired ethernet
Ran the debian 'bookworm' installer:
followed this https://www.linuxtechi.com/dual-boot-wi ... debian-10/
where manual disk partition is used, first creating a swap and then the debian system partitions.
(some steps are ordered differently in the debian 12 install)
As this is being installed on a new laptop, I chose a new host name.
When asked for software to install, I chose Debian desktop env, xfce, and standard system utilities
(but bear in mind that I intend later to overwrite the debian laptop partition with that from my desktop PC later,
so you may want to choose other software).
Finished the installation, removed the install disk.
Checked the system can still boot windows and can boot debian (from the grub menu).

Glad to report I can now boot debian or windows using the grub menu!
(Also debian is the default boot option - good choice!)

Now I need to configure this raw laptop debian installation to be like the one from my desktop PC.

p.H
Global Moderator
Global Moderator
Posts: 3049
Joined: 2017-09-17 07:12
Has thanked: 5 times
Been thanked: 132 times

Re: Dual boot Debian and Windows + copy Debian O/S to new laptop

#28 Post by p.H »

ticketman wrote: 2021-11-20 12:32
Why did you have to remove Bitlocker encryption ? AFAIK it is only a Windows thing, and you don't need Windows to boot your rescue disk.
It is because I believe it would not be possible to shrink a partition if it is encrypted (but I could be wrong on that)
So it was not related with secure boot but good point anyway. I do not have any knowledge with resizing an NTFS filesystem encrypted with Bitlocker.
ticketman wrote: 2021-11-20 18:33 I chose Debian desktop env, xfce, and standard system utilities (but bear in mind that I intend later to overwrite the debian laptop partition
Why then did you bother to install a desktop environment ?

When you overwrite the system, make sure /EFI/debian/grub.cfg in the EFI partition matches the root filesystem UUID and /etc/fstab in the root partition matches all partition UUIDs.

ticketman
Posts: 136
Joined: 2012-06-30 11:06
Has thanked: 3 times

Re: Dual boot Debian and Windows + copy Debian O/S to new laptop

#29 Post by ticketman »

p.H wrote:
Why then did you bother to install a desktop environment ?
Just to see if the debian install would boot ok (into a graphical environment).

I then shrank my debian partition, only because in the future I may need to install yet a third O/S.

I have now overwritten my laptop debian partition using fsarchiver data from my desktop PC

Code: Select all

fsarchiver restfs /mnt/DEBIAN.fsa id=0,dest=/dev/nvme0n1p5
Although windows still boots, debian drops me into a grub prompt "grub>"

p.H wrote:
make sure /EFI/debian/grub.cfg in the EFI partition matches the root filesystem UUID and /etc/fstab in the root partition matches all partition UUIDs
Thanks for reminding me!
Unfortunately I forgot to label the laptop EFI partition. This I did using

Code: Select all

fatlabel /dev/nvme0n1p1 EFI
gparted confirmed that worked.

However, on re-boot I still get dumped into the grub prompt, so something else needs fixing.

My file system labels on the laptop are now:
nvme0n1p1 "EFI"
nvme0n1p3 "Boot"
nvme0n1p4 "LINUXSWAP"
nvme0n1p5 "DEBIAN"

and my fstab is:

Code: Select all

LABEL=EFI		/boot/efi	vfat		umask=0077		0	1
LABEL=DEBIAN		/		ext4		errors=remount-ro	0	1
LABEL=LINUXSWAP		none		swap		sw			0	0
Help!
I think it may be the grub.cfg that may need fixing : it contains lines like :

Code: Select all

	echo	'Loading Linux 5.14.0-4-amd64 ...'
	linux	/boot/vmlinuz-5.14.0-4-amd64 root=UUID=6c51fada-3769-4146-ae78-b8221777b044 ro  quiet
	echo	'Loading initial ramdisk ...'
	initrd	/boot/initrd.img-5.14.0-4-amd64
so is using uuids, even though my old desktop system is using disk labels.

p.H
Global Moderator
Global Moderator
Posts: 3049
Joined: 2017-09-17 07:12
Has thanked: 5 times
Been thanked: 132 times

Re: Dual boot Debian and Windows + copy Debian O/S to new laptop

#30 Post by p.H »

ticketman wrote: 2021-11-20 20:41 However, on re-boot I still get dumped into the grub prompt, so something else needs fixing.
What is unclear in
p.H wrote: 2021-11-20 19:05 make sure /EFI/debian/grub.cfg in the EFI partition matches the root filesystem UUID
?

ticketman
Posts: 136
Joined: 2012-06-30 11:06
Has thanked: 3 times

Re: Dual boot Debian and Windows + copy Debian O/S to new laptop

#31 Post by ticketman »

Hi p.H,
Oops, I wrongly was looking at /boot/grub/grub.cfg on the p5 partition.

So I mounted the vfat EFI partition and opened to edit /EFI/debian/grub.cfg
It has a line that I presume is the wrong uuid, so I replaced it with 6c51fada-3769-4146-ae78-b8221777b044.

Then rebooted, but now I don't get the dual boot option anymore - it goes straight into trying to boot debian.
After a lot of mdadm error messages, the boot fails.

Some more details:
1st screen up just offers to boot debian
Then it says:
Loading Linux 5.14.0-4-amd64 ...
Loading initial ramdisk ...

Then I get on next screen:
ACPI BIOS Error (bug): Could not resolve symbol [\_SB.PCIO.LPC0.ECO], AE_NOT_FOUND
(this happens with the system rescue disc as well and can be ignored for now)
amdgpu requires firmware installed
mdadm: No arrays found in config file or automatically (this is repeated many times)

Finally I get dropped into a blinking cursor.
If I then type ctrl-alt-F1 I can get a login prompt from which I can log in to a text-only screen.

I guess I need to do an update of grub somehow, having now changed grub.cfg?

Well, I entered
sudo update-grub
and it updated the vmlinuz files

I shutdown and rebooted.
This time I got the correct dual boot menu (choice of debian or windows).
Choosing debian, I once again got the same screen behaviour as described above, again dropping into a blinking cursor.
Rebooted again and this time chose the Linux 5.14.0-4-amd64 recovery option, and ran journalctl -xb
Main things of note in the output were:

Code: Select all

Kernel command line: BOOT_IMAGE=/boot/vmlinuz-5.14.0-4-amd64 root=UUID=6c51fada-3769-4146-ae78-b8221777b044 ro single
Unknown command line parameters: single BOOT_IMAGE=/boot/vmlinuz-5.14.0-4-amd64 
...
nvme nvme0: missing or invalid SUBNQN field
...
/lib/systemd/system/plymouth-start.service:16: Unit configured to use KillMode=none. This is unsafe as it disables systemd's process .. (text missing)
...
missing firmware for wifi and bluetooth
The repeated message on boot

Code: Select all

mdadm: No arrays found in config file or automatically 
suggests to me this is the main problem to fix, but not sure how.
The output of blkid gave

Code: Select all

LABEL="DEBIAN" UUID="6c51fada-3769-4146-ae78-b8221777b044" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="042f8c35-2e55-4954-8956-e13015b3b195"
(amongst data for other partitions).
I am curious what PARTUUID is.

ticketman
Posts: 136
Joined: 2012-06-30 11:06
Has thanked: 3 times

Re: Dual boot Debian and Windows + copy Debian O/S to new laptop

#32 Post by ticketman »

Ok, the following steps fixed the boot problem:
Using ctl-alt-F1 to get a command console from the blinking cursor, I logged in and removed the mdadm package:

Code: Select all

apt remove mdadm
(mdadm seems to be just about RAID support, and I have no need for that).
This resulted in an automatic attempt to run update-initramfs, which reported an error about the RESUME setting. Lucklily I have seen that problem before, so next I rebooted and used the system rescue disk to edit :
/etc/initramfs-tools/conf.d/resume
to just contain:

Code: Select all

RESUME=none
Rebooted into blinking cursor and command console again, made sure ethernet cable was in, and added some of the missing firmware:

Code: Select all

apt install firmware-amd-graphics
Then did

Code: Select all

update-initramfs -u -k all
update grub
and rebooted.
I could select debian again from the dual boot menu and, lo and behold, my debian desktop appeared in all its former glory! Phew!
I now need to get wifi snd bluetooth drivers working, but that should be a matter of installing the right firmware packages.
And do another system backup!

p.H
Global Moderator
Global Moderator
Posts: 3049
Joined: 2017-09-17 07:12
Has thanked: 5 times
Been thanked: 132 times

Re: Dual boot Debian and Windows + copy Debian O/S to new laptop

#33 Post by p.H »

ticketman wrote: 2021-11-21 12:24 So I mounted the vfat EFI partition and opened to edit /EFI/debian/grub.cfg
It has a line that I presume is the wrong uuid, so I replaced it with 6c51fada-3769-4146-ae78-b8221777b044.

Then rebooted, but now I don't get the dual boot option anymore - it goes straight into trying to boot debian.
The cloned system did not know about Windows, so you had to run update-grub to detect it and rebuild /boot/grub/grub.cfg.
ticketman wrote: 2021-11-21 12:24 ACPI BIOS Error (bug): Could not resolve symbol [\_SB.PCIO.LPC0.ECO], AE_NOT_FOUND
(this happens with the system rescue disc as well and can be ignored for now)
amdgpu requires firmware installed
mdadm: No arrays found in config file or automatically (this is repeated many times)

Finally I get dropped into a blinking cursor.
ACPI BIOS errors are usually harmless. Sometimes you can remove them with a kernel or module parameter.
mdadm message is harmless too and normal if you do not have any RAID array.
The blinking cursor indicates a failure to initialize the graphic mode, which is common when firmware for ATI/AMD GPU is missing.
ticketman wrote: 2021-11-21 12:24 I am curious what PARTUUID is.
PARTUUID is the partition UUID, not to be confused with the filesystem/swap UUID. It is attached to the partition itself and is stored in the partition table. Conversely, the UUID (filesystem or swap UUID) is attached to the partition contents.
GPT also has partition names (PARTLABEL), not to be confused with filesystem/swap LABEL.
PARTUUID and PARTLABEL do not change when you reformat a partition.
Both can be used in config files such as /etc/fstab.
ticketman wrote: 2021-11-21 17:44 update-initramfs, which reported an error about the RESUME setting
Did you set the swap UUID to the same value as the original ?
ticketman wrote: 2021-11-21 17:44 /etc/initramfs-tools/conf.d/resume
to just contain:

Code: Select all

RESUME=none
This disables hibernation (suspend to disk) capability. You should set it to "auto" or leave it undefined.
ticketman wrote: 2021-11-21 17:44

Code: Select all

apt install firmware-amd-graphics

Code: Select all

update-initramfs -u -k all
update grub
The last two commands were superfluous. GRUB does not care about firmwares, and the installation of firmware-amd-graphics automatically updated the initramfs.

ticketman
Posts: 136
Joined: 2012-06-30 11:06
Has thanked: 3 times

Re: Dual boot Debian and Windows + copy Debian O/S to new laptop

#34 Post by ticketman »

Thanks to p.H for the helpful comments.
I am going to summarise here the steps I went through.
I'll let the experts comment on them and I will edit them accordingly.
NOTE: The procedures here are based on targeting a modern laptap with UEFI and a GPT formatted system disk.
UEFI + GPT is common now for recent PCs and laptops (circa 2020+).
There are at least 3 methods of going about this:

Method 1
  • Install another physical disk and install debian on that.
  • Use the boot menu in the UEFI to choose which system to boot.
This is far the easiest way! You also get to keep secure boot.

Method 2
If you don't have room for a second physical disk, and don't mind re-installing windows, then
  • Use a windows install disk to install a fresh copy of windows.
  • During the windows install, make sure you set the windows partition space small enough so that the unallocated space is enough for your debian install.
  • Then install debian into the unallocated space.
The advantage here is you don't have to go about resizing the windows partition.
Again, you should be able to keep your secure boot.

Note that I have heard that nvidia drivers don't play well when secure boot is enabled, so you may have to jump through more hoops in that situation. I prefer to do away with secure boot altogether.

Method 3
This resizes an existing windows installation.
  • Prepare a system rescue usb:
download from https://www.system-rescue.org/Download/
burn to usb, e.g. using:
dd bs=4M if=rescue.iso of=/dev/sd# conv=fdatasync (replace # with the usb drive)
  • Disable laptop secure boot (laptop specific)
  • Disable laptop bitlocker in UEFI
You may need your bitlocker keys :
get them from aka.ms/myrecoverykey (your gmail credentials should work)
If no option in UEFI, then:
start powershell (admin) by right-clicking on the windows start button and enter the following commands:
Clear-BitLockerAutoUnlock
Disable-BitLocker -MountPoint "C:"
Disable-BitLocker -MountPoint "D:"
  • Use the UEFI/BIOS settings to ensure laptop disc is using ACHI and not RAID
  • Boot the rescue disk and run gdisk to repair any resulting errors in the GPT tables
  • Disable windows fast boot, as dual boot system need a clean boot
- Caution - windows updates can resurrect it!
- See under "Choose what the power buttons do", or https://www.windowscentral.com/how-disa ... st-startup
  • Disable windows hibernation function:
- Enter the powershell command: powercfg -h off
  • Have to hand a large external storage disk (format to exFAT).
  • Save the GPT table to the storage disk using sgdisk from the rescue disk. Commands are:
- lsblk (just to see what disks are present)
- Mount the storage disk : mount /dev/sd#1 /mnt (replace # with the storage disk drive)
sgdisk --backup=/mnt/GPTtable /dev/nvme0n1
  • While here, save all windows partitions, using either
dd bs=4M if=/dev/nvme0n1p1 | gzip -c > /mnt/p1.img.gz (compressed) or
dd bs=4M if=/dev/nvme0n1p1 of=/mnt/p1.img
(similarly for p2, p3, ...)
Note that these are saved so you can recover your system should all go bad.
  • Uninstall windows third party virus checkers (e.g. Norton)
  • Disable"System Restore" from windows :
- Powershell command: Disable-ComputerRestore -Drive "C:\"
  • Use gparted from the rescue disk to remove all partitions except p1 (EFI), p2 (MS reserved), p3 (Windows Boot O/S)
  • Check system can still boot windows.
  • Resize p3 using gparted - only shrink from the RIGHT (so partition does not move)
  • Check system can still boot windows
May need to run chkdsk /F to keep windows happy (look at the notifications window) sudo dd bs=4M if=debian12.iso of=/dev/sd# conv=fdatasync (where # is the usb drive)
  • Run the debian 'bookworm' installer (ensure the laptop has a wired ethernet connection)
Follow this https://www.linuxtechi.com/dual-boot-wi ... debian-10/
where manual disk partition is used, first creating a swap and then the debian system partitions.
(some steps are ordered differently in the debian 12 install)
As this is being installed on a new laptop, I chose a new host name.
When asked for software to install I chose Debian desktop env, xfce, and standard system utilities
(bear in mind that I intend later to overwrite the debian laptop partition with that from my desktop later,
so you may want to choose other software).
  • Finish the installation, remove the install disk.
  • Check the system can still boot windows and can boot debian (from the grub menu).
At this point you should have a usable dual-boot system with a small set of debian packages installed.
You can continue installing and customising.
However, I wanted to port all my packages and customisations from another PC. I show how I did this, but be aware that I hit several issues, which ultimately were overcome. Here goes:

Porting over an existing debian 12 system
  • Use fsarchiver to copy debian O/S partition from previous system onto external storage.
Use system rescue to do the following:
  • Resize the laptop debian (p5) partition
(only because I want to have space for a third O/S in the future. Glutton for punishment!)
  • Use fsarchiver to restore the saved debian partition from external storage to the laptop debian partition
  • Assign file system labels to the laptop EFI, debian and linux swap partitions
- use gparted to label the debian and linux swap
- for the EFI, use the command: fatlabel /dev/nvme0n1p1 EFI
  • Edit the laptop fstab to use the file system labels accordingly
  • Update laptop host name in /etc/hostname and /etc/hosts
  • Get a list of the laptop UUIDs using lsblk -f
  • Mount the laptop vfat EFI partition and edit /EFI/debian/grub.cfg
- There you will see a UUID that needs to be replaced by the UUID of the laptop debian partition
  • Edit /etc/initramfs-tools/conf.d/resume to just contain: RESUME=none
- Note : this will disable hibernation capability. You could set it to "auto"
  • Now try rebooting into debian. If you get just a blank screen with a blinking cursor, then
- Hit ctl-alt-F1 to get a log-in console and log in. Enter the commands:
sudo update-initramfs -u -k all
sudo update grub
sudo reboot

Hopefully you will now have a working dual-boot system!
Another reason for failing to arrive at a graphical environment after booting can be that the new laptop hardware has a different gpu from the old system. You will then have to use the command console to remove the old drivers and install new ones.
If troubled by the mdadm messages, just remove the mdadm package.
RAID systems don't play well with dual boot systems anyway.

ticketman
Posts: 136
Joined: 2012-06-30 11:06
Has thanked: 3 times

Re: Dual boot Debian and Windows + copy Debian O/S to new laptop

#35 Post by ticketman »

I forgot how to go about thanking forum members - please remind me how!

User avatar
sunrat
Administrator
Administrator
Posts: 6382
Joined: 2006-08-29 09:12
Location: Melbourne, Australia
Has thanked: 115 times
Been thanked: 456 times

Re: Dual boot Debian and Windows + copy Debian O/S to new laptop

#36 Post by sunrat »

ticketman wrote: 2021-11-22 20:21 I forgot how to go about thanking forum members - please remind me how!
Click on the thumbs up symbol in the member's post.

Your method 3 contains steps which are optional or only needed in certain situations. I've set up dual boot with an existing Windows system a number of times and never needed many of your steps. I never use bitlocker or hibernation though. I never had to use SystemRecue disk.
Windows Disk Management has always shrunk enough to make space for me. You may need to delete the pagefile.sys and hiberfil.sys https://superuser.com/questions/360381/ ... elete-them
- Disk Cleanup and Defrag before resizing may help with immovable files issue
- Fast boot is a UEFI/BIOS function. The Windows thing is called Fast Startup and is virtually useless so always disable it. Speeds boot time by 2 seconds and slows shutdown by 10 seconds when I tested it. :|
- I never had GPT tables errors
- Choosing AHCI rather than RAID is important
- Testing (currently Bookworm) should only be necessary for very new hardware and even then a kernel and maybe several other packages from Backports may help get the Stable release working. Testing and Sid are more prone to breakage and have masses of upgrades, so not recommended for production/work systems.

Otherwise, nice job getting it all working! I would always prefer a new install over cloning from another system and there are simple ways to copy the same packages from one system to another by listing them and using the list to install on the new system. Here's a handy command to list all packages in a form which can be used to just reinstall:

Code: Select all

apt list -i | cut -d'/' -f1 | awk 1 ORS=' ' >pkglist

Correction (thanks ticojohn):

Code: Select all

apt list -i | cut -d'/' -f1 |awk 1 ORS=' ' | sed s/Listing...\ //g >pkglist
Then to simulate install on the new system:

Code: Select all

apt install -s <pkglist

Remove the "-s" to actually perform the installation.
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!

User avatar
ticojohn
Posts: 1284
Joined: 2009-08-29 18:10
Location: Costa Rica
Has thanked: 21 times
Been thanked: 44 times

Re: Dual boot Debian and Windows + copy Debian O/S to new laptop

#37 Post by ticojohn »

Hey there @sunrat. I have a question and hope I can ask it without starting a new thread. In the command to install from a list of packages as you showed your last post in this thread

Code: Select all

apt install -s <pkglist
does one need to remove
Listing....
from the list?
I am not irrational, I'm just quantum probabilistic.

User avatar
sunrat
Administrator
Administrator
Posts: 6382
Joined: 2006-08-29 09:12
Location: Melbourne, Australia
Has thanked: 115 times
Been thanked: 456 times

Re: Dual boot Debian and Windows + copy Debian O/S to new laptop

#38 Post by sunrat »

ticojohn wrote: 2021-11-23 00:04 Hey there @sunrat. I have a question and hope I can ask it without starting a new thread. In the command to install from a list of packages as you showed your last post in this thread

Code: Select all

apt install -s <pkglist
does one need to remove
Listing....
from the list?
Yes indeed. I forgot about that. :oops: I haven't done it for a while.

The old method using dpkg --get-selections etc. should still work, as shown in the answer here - https://unix.stackexchange.com/question ... selections
Note: I haven't done that for even longer.
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!

User avatar
sunrat
Administrator
Administrator
Posts: 6382
Joined: 2006-08-29 09:12
Location: Melbourne, Australia
Has thanked: 115 times
Been thanked: 456 times

Re: Dual boot Debian and Windows + copy Debian O/S to new laptop

#39 Post by sunrat »

@ticojohn fixed. Thanks for alerting me to my error.
This works:

Code: Select all

apt list -i | cut -d'/' -f1 |awk 1 ORS=' ' | sed s/Listing...\ //g >pkglist
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!

ticketman
Posts: 136
Joined: 2012-06-30 11:06
Has thanked: 3 times

Re: Dual boot Debian and Windows + copy Debian O/S to new laptop

#40 Post by ticketman »

> forgot how to go about thanking forum members - please remind me how!
>Click on the thumbs up symbol in the member's post.
For some reason I can't see a thumbs up symbol ...

Post Reply