[[!meta title="Installing Debian on XPS13 9350 Developer Edition"]] [[!tag computers debian laptop xps13 project-sputnik stretch 14.04]] [[!toc]] Introduction ------------ This is an installation record for installing Debian Stretch on the XPS13 9350 Developer Edition. You will need: * A Dell XPS13 9350 Developer Edition * Two USB sticks (8GB should be sufficient) * An install image for [[Debian Stretch|https://www.debian.org/devel/debian-installer/]] (I recommend the netinst image) * Wifi Thanks to the Ubuntu install already on the laptop everything can probably be done on the laptop, but I'm doing most of it on my desktop. Setup ----- 1. Start the laptop as per the Quick Start Guide and get Ubuntu set up. * During the Ubuntu setup it will prompt you for one of your USB sticks to make a liveusb. * Don't forget to label the stick or you'll get confused later. 2. Write the install image to to the other USB stick. * This used to require dd but nowadays you can just do it with cp. ``` cp installer.iso /dev/sdd ``` * Don't forget to label the stick or you'll get confused later. The installer image will include two partitions. 3. Add another partition and format it. We're going to put the wireless firmware on this partiton. 4. Mount the third partition on /mnt 5. Create a directory 'firmware' on the third partition and[^1]: ``` cp /lib/firmware/iwlwifi-8000C-* /mnt/firmware/ ``` 6. Shut down ubuntu 7. Restart the laptop and press F2 when the Dell logo appears to enter BIOS setup mode. 8. Under "Secure Boot > Secure Boot Enable" select (•) Disabled. 9. If you have any problem booting the USB then under "General > Advanced Boot Options" select [✓] Enable Legacy Option ROMs. 10. Apply your changes. 11. You may want to change other settings here. In particular if you want to run VMs on your system ensure that the Virtualization settings are turned on. 12. Exit *NOTE:* We need to remember to turn Legacy Option ROMs off once we're done. *NOTE:* Debian doesn't currently support Secure Boot; but probably will do in the future. Repartitioning -------------- This sequence could probably be combined with installation below; but I'm paranoid and want to ensure I can still run ubuntu before destructively installing debian. 13. Press F12 when the Dell logo appears to enter BIOS Boot Menu 14. Select USB 15. After a few seconds the laptop will beep very loudly and GRUB will come up. Select Advanced Options > Expert Installation. 16. Run the following stages of the installer menu: * Choose Language * Configure the keyboard * Detect and mount CD-ROM * Load installer components from CD: loading network-console * Detect network hardware: + This will prompt for a removable media with the firmware files as above[^1]. d-i probably won't detect the partition on sda3; so Alt-→ to the next console and do: ``` mount -oext2 /dev/sda3 /media ``` + Alt-← to return to the installer menu. + d-i will prompt for the missing firmware files again, but won't complain if you tell it to scan again. * Configure the network * Detect disks 17. Configure installation remotely using SSH. This isn't really necessary but it makes life significantly easier. * This will prompt for a password and then give instructions for logging in remotely. * Log in from your desktop * Select "Start shell" 18. Alternatively Alt-→ again to use the console. 19. Some system information: ~ # fdisk -l /dev/nvme0n1 Disk /dev/nvme0n1: 477 GiB, 512110190592 bytes, 1000215216 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: gpt Disk identifier: 6F4D25D6-8E9A-4642-91F6-8B9123AE66AB Device Start End Sectors Size Type /dev/nvme0n1p1 2048 1026047 1024000 500M EFI System /dev/nvme0n1p2 1026048 7317503 6291456 3G Microsoft basic data /dev/nvme0n1p3 7317504 933734399 926416896 441.8G Linux filesystem /dev/nvme0n1p4 933734400 1000214527 66480128 31.7G Linux swap ~ # mount -oro /dev/nvme0n1p3 /mnt ~ # df -h /dev/nvme0n1p3 Filesystem Size Used Available Use% Mounted on /dev/nvme0n1p3 434.7G 6.3G 406.3G 2% /mnt ~ # umount /dev/nvme0n1p3 ~ # tune2fs -l /dev/nvme0n1p3 tune2fs 1.43-WIP (15-Mar-2016) Filesystem volume name: Last mounted on: / Filesystem UUID: a64ddc80-e9a1-4002-b509-ab82813b4c89 Filesystem magic number: 0xEF53 Filesystem revision #: 1 (dynamic) Filesystem features: has_journal ext_attr resize_inode dir_index filetype extent flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize Filesystem flags: signed_directory_hash Default mount options: user_xattr acl Filesystem state: clean Errors behavior: Continue Filesystem OS type: Linux Inode count: 28950528 Block count: 115802112 Reserved block count: 5790105 Free blocks: 112304287 Free inodes: 28723624 First block: 0 Block size: 4096 Fragment size: 4096 Reserved GDT blocks: 996 Blocks per group: 32768 Fragments per group: 32768 Inodes per group: 8192 Inode blocks per group: 512 Flex block group size: 16 Filesystem created: Tue May 24 17:01:33 2016 Last mount time: Wed Jun 8 22:49:18 2016 Last write time: Wed Jun 8 22:49:18 2016 Mount count: 23 Maximum mount count: -1 Last checked: Tue May 24 17:01:33 2016 Check interval: 0 () Lifetime writes: 16 GB Reserved blocks uid: 0 (user root) Reserved blocks gid: 0 (group root) First inode: 11 Inode size: 256 Required extra isize: 28 Desired extra isize: 28 Journal inode: 8 Default directory hash: half_md4 Directory Hash Seed: d91fc1a7-cf0d-48c4-a69e-b96c4768ec41 Journal backup: inode blocks ~ # resize2fs -P /dev/nvme0n1p3 resize2fs 1.43-WIP (15-Mar-2016) Estimated minimum size of the filesystem: 2060940 + /dev/nvme0n1p1 is the EFI partition. + /dev/nvme0n1p2 appears to contain the same stuff as the ubuntu USB we made earlier; presumably it's the installer for the base install. + /dev/nvme0n1p3 is the main ubuntu install. + /dev/nvme0n1p4 is the ubuntu swap. We want to resize /dev/nvme0n1p3 to, say, 32G. tune2fs says the block size is 4k and resize2fs estimates a minimum size of 2060940 blocks so that's about 8G, which is all consistent. We want to move the ubuntu swap to just after the ubuntu partition and resize it; I think 8G should be enough since I'm not planning on doing anything hard in ubuntu. *NOTE:* This swap isn't encrypted, so we don't want to use it for Debian. 20. Resize /dev/nvme0n1p3 to minimum size: ~ # e2fsck -f /dev/nvme0n1p3 e2fsck 1.43-WIP (15-Mar-2016) Pass 1: Checking inodes, blocks, and sizes Pass 2: Checking directory structure Pass 3: Checking directory connectivity Pass 4: Checking reference counts Pass 5: Checking group summary information /dev/nvme0n1p3: 226904/28950528 files (0.1% non-contiguous), 3497825/115802112 blocks ~ # resize2fs -p /dev/nvme0n1p3 4000000 resize2fs 1.43-WIP (15-Mar-2016) Resizing the filesystem on /dev/nvme0n1p3 to 4000000 (4k) blocks. Begin pass 2 (max = 672429) Relocating blocks XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX Begin pass 3 (max = 3534) Scanning inode table XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX Begin pass 4 (max = 23529) Updating inode references XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX The filesystem on /dev/nvme0n1p3 is now 4000000 (4k) blocks long. 21. Resize the partition in the partition table: ~ # fdisk /dev/nvme0n1 Welcome to fdisk (util-linux 2.28). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Command (m for help): d Partition number (1-4, default 4): 3 Partition 3 has been deleted. Command (m for help): n Partition number (3,5-128, default 3): First sector (7317504-1000215182, default 7317504): Last sector, +sectors or +size{K,M,G,T,P} (7317504-933734399, default 933734399): +32G Created a new partition 3 of type 'Linux filesystem' and of size 32 GiB. Command (m for help): p Disk /dev/nvme0n1: 477 GiB, 512110190592 bytes, 1000215216 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: gpt Disk identifier: 6F4D25D6-8E9A-4642-91F6-8B9123AE66AB Device Start End Sectors Size Type /dev/nvme0n1p1 2048 1026047 1024000 500M EFI System /dev/nvme0n1p2 1026048 7317503 6291456 3G Microsoft basic data /dev/nvme0n1p3 7317504 74426367 67108864 32G Linux filesystem /dev/nvme0n1p4 933734400 1000214527 66480128 31.7G Linux swap Command (m for help): w The partition table has been altered. Calling ioctl() to re-read partition table. Syncing disks. 22. Resize /dev/nvme0n1p3 to fill the whole partition: ~ # e2fsck -f /dev/nvme0n1p3 e2fsck 1.43-WIP (15-Mar-2016) Pass 1: Checking inodes, blocks, and sizes Pass 2: Checking directory structure Pass 3: Checking directory connectivity Pass 4: Checking reference counts Pass 5: Checking group summary information /dev/nvme0n1p3: 226904/1007616 files (0.3% non-contiguous), 1736567/4000000 blocks ~ # resize2fs -p /dev/nvme0n1p3 resize2fs 1.43-WIP (15-Mar-2016) Resizing the filesystem on /dev/nvme0n1p3 to 8388608 (4k) blocks. The filesystem on /dev/nvme0n1p3 is now 8388608 (4k) blocks long. 23. Mount /dev/nvme0n1p3 and have a quick check to ensure all is OK: ~ # mount -oro /dev/nvme0n1p3 /mnt/ ~ # ls /mnt/ bin etc lib32 mnt run tmp boot home lib64 opt sbin usr cdrom initrd.img lost+found proc srv var dev lib media root sys vmlinuz ~ # df /mnt/ -h Filesystem Size Used Available Use% Mounted on /dev/nvme0n1p3 31.4G 6.3G 23.5G 21% /mnt ~ # umount /mnt/ 24. Remove the current swap partition and create a new one: ~ # fdisk /dev/nvme0n1 Welcome to fdisk (util-linux 2.28). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Command (m for help): d Partition number (1-4, default 4): 4 Partition 4 has been deleted. Command (m for help): n Partition number (4-128, default 4): First sector (74426368-1000215182, default 74426368): Last sector, +sectors or +size{K,M,G,T,P} (74426368-1000215182, default 1000215182): +8G Created a new partition 4 of type 'Linux filesystem' and of size 8 GiB. Command (m for help): t Partition number (1-4, default 4): 4 Hex code (type L to list all codes): 19 Changed type of partition 'Linux filesystem' to 'Linux swap'. Command (m for help): p Disk /dev/nvme0n1: 477 GiB, 512110190592 bytes, 1000215216 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: gpt Disk identifier: 6F4D25D6-8E9A-4642-91F6-8B9123AE66AB Device Start End Sectors Size Type /dev/nvme0n1p1 2048 1026047 1024000 500M EFI System /dev/nvme0n1p2 1026048 7317503 6291456 3G Microsoft basic data /dev/nvme0n1p3 7317504 74426367 67108864 32G Linux filesystem /dev/nvme0n1p4 74426368 91203583 16777216 8G Linux swap Command (m for help): w The partition table has been altered. Calling ioctl() to re-read partition table. Syncing disks. ~ # mkswap /dev/nvme0n1p4 Setting up swapspace version 1, size = 8589930496 bytes UUID=ffe6618f-66cd-4f1f-ac24-3463b18aae40 Remember the UUID, you'll want it later. 25. Back on the laptop select "Abort the installation" and reboot into Ubuntu. I had some graphical oddities at this stage; wait until the login screen displays correctly. 26. Log in to the Ubuntu desktop and update the UUID of the swap device in /etc/fstab . 27. Restart Ubuntu and ensure it mounts its swap OK. (To Be Continued...) Installation ------------ 28. Repeat the above boot instructions to boot the install USB again. 29. I wish to install without systemd, so following [[the instructions on wiki.debian.org|https://wiki.debian.org/systemd#Installing_without_systemd]] I will postpend: preseed/late_command="in-target apt-get install -y sysvinit-core" to my grub command line. 30. This time you'll want to load crypto-dm-modules if you want to do encrypted filesystems. 31. Continue with the standard installation path: + Set up users and passwords + Configure the clock + Detect disks 32. Partition disks: + This is what I have before starting: /dev/nvme0n1 - 512.1 GB Unknown > 1.0 MB FREE SPACE > #1 524.3 MB B fat32 EFI system p > #2 3.2 GB fat32 Basic data p > #3 34.4 GB ext4 > #4 8.6 GB F swap swap > 465.4 GB FREE SPACE + Set the swap space to "do not use" + I'm setting #3 (the ubuntu partition) to mount on /mnt/danae + Add a partition for /boot - I'm giving this 4GB + Add a partition for "physical volume for encryption". I'm filling the rest of the disk with it. + Configure encrypted volumes + Set the encrypted volume as "physical volume for LVM" + Configure the Logical Volume Manager - Create volume group - Create whatever lvs you want + Add whatever partitions you want + My final setup looks like: Encrypted volume (nvme0n1p6_crypt) - 461.4 GB Linux device-mapper > #1 461.4 GB K lvm LVM VG vg-nvme, LV game-base - 9.0 GB Linux device-mapper (linear > #1 9.0 GB LVM VG vg-nvme, LV home - 160.0 GB Linux device-mapper (linear) > #1 160.0 GB f ext4 /home LVM VG vg-nvme, LV slash - 4.0 GB Linux device-mapper (linear) > #1 4.0 GB f ext4 / LVM VG vg-nvme, LV swap - 40.0 GB Linux device-mapper (linear) > #1 40.0 GB f swap swap LVM VG vg-nvme, LV usr - 16.0 GB Linux device-mapper (linear) > #1 16.0 GB f ext4 /usr LVM VG vg-nvme, LV var - 16.0 GB Linux device-mapper (linear) > #1 16.0 GB f ext4 /var /dev/nvme0n1 - 512.1 GB Unknown > 1.0 MB FREE SPACE > #1 524.3 MB B fat32 EFI system p > #2 3.2 GB fat32 Basic data p > #3 34.4 GB K ext4 /mnt/danae > #4 8.6 GB swap > #5 4.0 GB F ext4 boot /boot > #6 461.4 GB K crypto (nvme0n1p6_ > 335.4 kB FREE SPACE + Finish partitioning and write changes to disk 33. Install the base system + linux-image-amd64 + Targeted initrd 34. Configure the package manager 35. Select and install software. I'm going for: [*] Debian desktop environment [ ] ... GNOME [ ] ... Xfce [ ] ... KDE [ ] ... Cinnamon [ ] ... MATE [ ] ... LXDE [*] web server [*] print server [*] SSH server [*] standard system utilities [ ] Debian Pure Blends [ ] ... Debian Astro [ ] ... Debian Edu [ ] ... Debian EzGo [ ] ... Debian Games [ ] ... Debian GIS [ ] ... Hamradio [ ] ... Debian Junior [ ] ... Debian Med [ ] ... DebianMultimedia [ ] ... Debian Science [ ] ... DebiChem 36. Wait around for a while. Don't do what I did and let the laptop run out of battery. This took about 15 minutes for me. 37. Install the GRUB boot loader on a hard disk. 38. Finish the installation. 39. The system will reboot. All being well debian should be the top of the EFI boot order and Debian's grub should therefore start up. 40. Unfortunately something in the installation process went wrong for me and I never got a grub.cfg installed only a grub.cfg.new. This can be booted from with: normal (hd0,gpt5)/grub/grub.cfg.new 41. Hopefully you should now have a shiny new Debian login prompt. Oddly this appears to be on VC1. To fix the grub problem log in as root and then update-grub. After Installation ------------------ **udev** * The default install has a number of annoying udev rules that rename your network interfaces to crazy unique things. These rules can be overriden by adding new rules files in /etc/udev/rules.d . I have created empty files called 73-usb-net-by-mac.rules 75-net-description.rules You might also want 99-systemd.rules if you're keeping systemd. **systemd** * The system installs with still far too much systemd for my liking. Imma purge it all. This will also remove gdm3 and gnome so have xdm and a window manager ready. Doing this while using the X server appears to put the system in a not very consistent state so I'd recommend rebooting after. * Also after removing systemd you'll lose network-manager and will have to set up some other way of configuring your wireless card. **mouse** * psmouse and synaptics don't play nice together. blacklist psmouse in /etc/modprobe.d/modprobe.conf will stop the system loading psmouse. * By default synaptics ignores taps, and treats + single finger clicks as left + double finger clicks as right + triple finger clicks as middle + clicks in the bottom right as right + double finger drags as scrollwheel * If you want to use an external USB mouse note that the default setup doesn't do Emulate3Buttons [^1]: The list of files that iwlwifi complains are missing are 20, 19, 18, 17, 16, 15, 14, and 13.ucode but the ones from the ubuntu image appear to be sufficient.