Dual boot: Difference between revisions

From 太極
Jump to navigation Jump to search
Line 86: Line 86:


= Debloat Ubuntu =
= Debloat Ubuntu =
[https://linuxtldr.com/debloat-ubuntu/ How to Debloat (or Swap) an Ubuntu System (Ultimate Guide)]
* [https://linuxtldr.com/debloat-ubuntu/ How to Debloat (or Swap) an Ubuntu System (Ultimate Guide)]
* [https://www.debugpoint.com/10-things-to-do-ubuntu-24-04-after-install/ 10 Things to Do After Installing Ubuntu 24.04 LTS]


= Create customized ubuntu iso =
= Create customized ubuntu iso =

Revision as of 11:32, 2 May 2024

Dual boot Windows and Ubuntu

Dual Booting with Windows. In your Windows install, open Control Panel and head to “Power Options”. Select “Choose what the power buttons do”, select “Change settings that are currently unavailable”, then disable the “fast startup” setting. Note that Windows updates may occasionally turn this setting back on without asking, so if you are unable to boot into Pop!_OS, check this setting first.

Dual Booting Ubuntu and Windows With a SSD and a HDD

Preparation

On my Dell Precision laptop

BIOS -> UEFI

Modern PCs now ship with UEFI instead of BIOS. UEFI performs the same basic functions as BIOS, but removes many limitations. First, UEFI allows booting from drives over 2.2GB in size, something not possible with BIOS, courtesy of the GPT partitioning scheme rather than MBR. UEFI can run in 32-bit or 64-bit mode, for faster boot times and much improved setup UIs, with the potential for high-res graphics and mouse support. As a mini-OS, UEFI enables advanced troubleshooting and recovery options.

Secure boot

  • Secure Boot is likely to be turned on by default in the UEFI settings of your machine, which will work fine for most distros but will limit your ability to run proprietary drivers. The setting can be easily disabled, but does leave your machine more susceptible to being compromised by rootkits from Windows. Ensure your antivirus is up to date and take extra care.
  • Secure Boot is a feature in the BIOS that helps prevent unauthorized access to the boot process by only allowing software with trusted signatures to run during the boot process. You might need to disable Secure Boot in the following situations:
    • If you need to run software that is not signed.
    • If you need to dual-boot your system.
    • If you're running certain PC graphics cards, hardware, or operating systems such as Linux or previous versions of Windows.
    • If your PC has a UEFI firmware chip that does not meet the UEFI Specifications Version 2.3.1, Errata C or higher, and has Windows 8.1 or Windows 10 installed with UEFI.

My case

  • /dev/sda - Windows
  • /dev/sdb - bigdisk
  • /dev/sdc - Linux

When I need to upgrade Linux,

  • No need to unplug Windows SSD
  • Run the live Linux (it's a little slow to show the first screen on my 2008 ECS P45T-A computer)
  • Run GParted and delete all partitions on /dev/sdc
  • Accept the default option to install Linux Mint alongside Windows 10
  • Continue the installation

System time/Fix the time offset

  • Wrong Time Displayed in Windows-Linux Dual Boot Setup? Here's How to Fix it
    • Linux: timedatectl set-local-rtc 1 (no sudo needed). If we type the command timedatectl again, we can verify the option "RTC in local TZ" is "yes".
    • Windows: Control panel -> Clock and Region -> Set the time and date -> Internet Time -> Change settings -> Change the server to "time.nist.gov" and click "Update now" button.
  • Dual-Booting Linux Messed Up Windows Time? Here’s How to Fix It
    • When you switch between Windows and Linux, you’ll notice that the time can get messed up. This is because Linux uses UTC internally, while Windows time is based on your local time zone. The fix is a quick Windows Registry tweak – run regedit (in admin mode) and navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation. Create a new Dword (32-bit) value named RealTimeIsUniversal and set the value to 1.

Decide on your new partitions

(Triple boot case) Looking at a typical scenario with a 512GB SSD, we might choose to resize our Windows total down to 128GB (between all the various partitions), add a 128GB ‘data’ partition formatted to NTFS together with two 128GB ‘distro’ partitions for Linux installs, each formatted to ext4 so they are ready to go. If you find yourself installing a number of distros and needing more space for specific ones, you can always change the split point between the partitions later, without needing to reinstall, again courtesy of the GParted Live tool.

Install your distros

  • If prompted, choose not to use a separate swap partition.
  • If the installer doesn’t create a swap file for you, you can do this after your first boot. To create a 4GB swap file for example, you would do the following – create the file with sudo fallocate -l 4G /swapfile. Set the swap file permissions with sudo chmod 600 /swapfile. Tell the system to use the swap space with sudo mkswap /swapfile. Finally, enable the swap with sudo swapon /swapfile. To enable this to happen on each reboot, you need to add a line to your fstab file in /etc/fstab, with the value /swapfile n one s wap s w 0 0.

GRUB

  • As part of the installation process, the GRUB bootloader will be installed, which will allow you to choose which OS (Windows or Linux) and distro (from those you have installed) to launch at startup. Windows will be listed as ‘Windows Boot Manager’, which will then launch into the standard Windows startup. GRUB can handle as many distros as you want to have installed, with debug options for each; however, it should be noted that each distro you install will likely install its own GRUB theme, so it may look different after you add another distro.
  • If you restart after your first distribution install and you launch straight back into Windows, then you may need to make an additional change in your system’s UEFI setup, choosing the Linux OS boot manager rather than the Windows Boot Manager as the default.

Dual Boot Ubuntu 22.04 LTS and Windows 11

How to Dual Boot Ubuntu 22.04 LTS and Windows 11

Change the default boot OS

See Grub.

Reverse to Windows only

If you want to revert your machine back to completely stock defaults, you need to remove the additional partitions, resize the main partition and remove GRUB (if you are reverting to Windows). You should re-enable Secure Boot if you turned it off, but there’s no harm in leaving the system in AHCI rather than RAID mode if you changed that too. GRUB is removed using the Windows startup repair tools.

Dual boot Debian and Windows

  • UEFI + GPT Solves Everything
    • With UEFI + GPT, Windows Boot Manager and GRUB are isolated and re-installing Windows (or upgrading it to another version) will not rewrite GRUB records on the disk. And because of this, the installation order of this 2 systems also does not matter at all.

Dual boot Ubuntu and Arch Linux

http://www.linuxandubuntu.com/home/dual-boot-ubuntu-and-arch-linux

Manage your bootloaders

  • When running multiple OSes, whether they are Linux or Windows, they will often be in contention for control of the bootloader. This typically manifests itself as either your machine booting straight into Windows or one or more of your distros disappearing from the boot menu. In the case of the former, this is often due to a Windows update or version upgrade – GRUB gets completely removed and has to be reinstalled. The quickest and easiest option is via the boot-repair tool and a live CD, but if even this doesn’t work, you can use the GRUB rescue prompt to boot a distro of your choice before doing a full reinstall.
  • From the prompt, you first need to tell GRUB which partition it needs to using. Using ls will give you your disks and partitions, which you can also list to look for your vmlinuz file. To set the root, use the set root=(hdX,Y) command, where X is the disk number and Y is the partition number (be aware that if you have a USB stick inserted, the disk number might change). After setting root, you can tell GRUB to load the config file with configfile /boot/grub/grub.cfg and you should be back at your regular menu and able to boot into your distro. Once in, force a reinstall with sudo grub-install /dev/sdx, where sdx is the disk reference (e.g. /dev/sda). Reboot and everything should be repaired!

MultiSystem – Create a MultiBoot USB from Linux

Debloat Ubuntu

Create customized ubuntu iso

Note that the Ubuntu Mini Remix by default contains only 3 repositories. We may want to add some more.

deb http://archive.ubuntu.com/ubuntu/ trusty main restricted
deb http://security.ubuntu.com/ubuntu/ trusty-security main restricted
deb http://archive.ubuntu.com/ubuntu/ trusty-updates main restricted

while for example an official v14.04 xubuntu contains 22 sources,

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://us.archive.ubuntu.com/ubuntu/ trusty main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://us.archive.ubuntu.com/ubuntu/ trusty-updates main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://us.archive.ubuntu.com/ubuntu/ trusty universe
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty universe
deb http://us.archive.ubuntu.com/ubuntu/ trusty-updates universe
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu 
## team, and may not be under a free licence. Please satisfy yourself as to 
## your rights to use the software. Also, please note that software in 
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://us.archive.ubuntu.com/ubuntu/ trusty multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty multiverse
deb http://us.archive.ubuntu.com/ubuntu/ trusty-updates multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://us.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse

deb http://security.ubuntu.com/ubuntu trusty-security main restricted
deb-src http://security.ubuntu.com/ubuntu trusty-security main restricted
deb http://security.ubuntu.com/ubuntu trusty-security universe
deb-src http://security.ubuntu.com/ubuntu trusty-security universe
deb http://security.ubuntu.com/ubuntu trusty-security multiverse
deb-src http://security.ubuntu.com/ubuntu trusty-security multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu trusty partner
# deb-src http://archive.canonical.com/ubuntu trusty partner

## This software is not part of Ubuntu, but is offered by third-party
## developers who want to ship their latest software.
deb http://extras.ubuntu.com/ubuntu trusty main
deb-src http://extras.ubuntu.com/ubuntu trusty main

Netboot

Proxmox

  • Meet netboot xyz - Network Boot Any Operating System. The most important part is about DHCP setup. This is using Unifie DHCP.
    • Ditching USB Boot for iPXE Boot with NetBoot.XYZ. This is using OpenWRT DHCP set up in Proxmox.
    • Must-Have OpenWrt Router Setup For Your Proxmox 2023/12/10. It worked! OpenWrt is installed on an LXC. The memory usage is tiny (~10MB). OpenVPN in LXC.
      $ pct create 106 ./rootfs.tar.xz --unprivileged 1 --ostype unmanaged \
            --hostname openwrt --net0 name=eth0 --net1 name=eth1 \
            --storage local-lvm
      # Open "openwrt" LXC -> Network -> eth0 has 'vmbr0' bridge, eth1 has 'vmbr1' bridge.
      #    Not worry about IP address. 
      $ nano /etc/pve/lxc/106.conf # Add the following 2 lines
      lxc.cgroup2.devices.allow: c10:200 rwm 
      lxc.mount.entry: /dev/net dev/net none bind,create=dir
      
      # vi /etc/config/firewall
      # At around line 133, uncheck a couple lines for the 1st config rule.
      # Reboot openwrt LXC. 
      # Run 'ip a' on openwrt (eg ip=192.168.xx.xxx)
      # Now open a browser and go to http://OpenWRT_ip:80
      # Go to 'Network' - 'Interace'.
      # Click 'Add a new interface'. name=lan, protocol=static address, device=eth1. 
      # General settings: IPv4: 10.50.50.1. Netmask: 255.255.255.0.  --> Save. --> Save & apply.
      
      # Now we can test Openwrt.
      # In a VM, edit 'Network' and change Bridge from dhcp to 'vmbr1'.
      # Now reboot the VM. The VM's IP should be 10.50.50.XXX.
    • Net boot ISOs with iPXE boot using iVentoy