pages tagged 14.04Squaring the Circlehttp://circle.thy.me.uk//tags/14.04/Squaring the Circleikiwiki2017-01-02T02:16:12ZInstalling Debian on XPS13 9350 Developer Editionhttp://circle.thy.me.uk//posts/installing_debian_on_xps13_9350/2017-01-02T02:16:12Z2016-06-08T11:20:56Z
<h2 id="introduction">Introduction</h2>
<p>This is an installation record for installing Debian Stretch on the
XPS13 9350 Developer Edition.</p>
<p>You will need:</p>
<ul>
<li>A Dell XPS13 9350 Developer Edition</li>
<li>Two USB sticks (8GB should be sufficient)</li>
<li>An install image for
<a href="https://www.debian.org/devel/debian-installer/">Debian Stretch</a>
(I recommend the netinst image)</li>
<li>Wifi</li>
</ul>
<p>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.</p>
<h2 id="setup">Setup</h2>
<ol>
<li>Start the laptop as per the Quick Start Guide and get Ubuntu set
up.
<ul>
<li>During the Ubuntu setup it will prompt you for one of your USB
sticks to make a liveusb.</li>
<li>Don't forget to label the stick or you'll get confused later.</li>
</ul></li>
<li><p>Write the install image to to the other USB stick.</p>
<ul>
<li><p>This used to require dd but nowadays you can just do it with cp.</p>
<p><code>
cp installer.iso /dev/sdd
</code></p></li>
<li>Don't forget to label the stick or you'll get confused later.
The installer image will include two partitions.</li>
</ul></li>
<li>Add another partition and format it. We're going to put the
wireless firmware on this partiton.</li>
<li>Mount the third partition on /mnt</li>
<li><p>Create a directory 'firmware' on the third partition and<sup><a class="footnote" href="http://circle.thy.me.uk//tags/14.04/#fn:1" id="fnref:1">1</a></sup>:</p>
<p><code>
cp /lib/firmware/iwlwifi-8000C-* /mnt/firmware/
</code> </p></li>
<li>Shut down ubuntu</li>
<li>Restart the laptop and press F2 when the Dell logo appears to enter
BIOS setup mode.</li>
<li>Under "Secure Boot > Secure Boot Enable" select (•) Disabled.</li>
<li>If you have any problem booting the USB then under "General >
Advanced Boot Options" select [✓] Enable Legacy Option ROMs.</li>
<li>Apply your changes.</li>
<li>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.</li>
<li>Exit</li>
</ol>
<p><em>NOTE:</em> We need to remember to turn Legacy Option ROMs off once we're
done.</p>
<p><em>NOTE:</em> Debian doesn't currently support Secure Boot; but probably
will do in the future.</p>
<h2 id="repartitioning">Repartitioning</h2>
<p>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.</p>
<ol>
<li>Press F12 when the Dell logo appears to enter BIOS Boot Menu</li>
<li>Select USB</li>
<li>After a few seconds the laptop will beep very loudly and GRUB will
come up. Select Advanced Options > Expert Installation.</li>
<li><p>Run the following stages of the installer menu:</p>
<ul>
<li>Choose Language</li>
<li>Configure the keyboard</li>
<li>Detect and mount CD-ROM</li>
<li>Load installer components from CD: loading network-console</li>
<li><p>Detect network hardware:</p>
<ul>
<li><p>This will prompt for a removable media with the firmware
files as above<sup><a class="footnote" href="http://circle.thy.me.uk//tags/14.04/#fn:1" id="fnref:1">2</a></sup>. d-i probably won't detect
the partition on sda3; so Alt-→ to the next console and do:</p>
<p><code>
mount -oext2 /dev/sda3 /media
</code></p></li>
<li>Alt-← to return to the installer menu.</li>
<li>d-i will prompt for the missing firmware files again, but
won't complain if you tell it to scan again.</li>
</ul></li>
<li>Configure the network</li>
<li>Detect disks</li>
</ul></li>
<li>Configure installation remotely using SSH. This isn't really
necessary but it makes life significantly easier.
<ul>
<li>This will prompt for a password and then give instructions for
logging in remotely.</li>
<li>Log in from your desktop</li>
<li>Select "Start shell"</li>
</ul></li>
<li>Alternatively Alt-→ again to use the console.</li>
<li><p>Some system information:</p>
<pre><code>~ # 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: <none>
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 (<none>)
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
</code></pre>
<ul>
<li>/dev/nvme0n1p1 is the EFI partition.</li>
<li>/dev/nvme0n1p2 appears to contain the same stuff as the ubuntu
USB we made earlier; presumably it's the installer for the base
install.</li>
<li>/dev/nvme0n1p3 is the main ubuntu install.</li>
<li>/dev/nvme0n1p4 is the ubuntu swap.</li>
</ul>
<p>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.</p>
<p>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.</p>
<p><em>NOTE:</em> This swap isn't encrypted, so we don't want to use it for
Debian.</p></li>
<li><p>Resize /dev/nvme0n1p3 to minimum size:</p>
<pre><code>~ # 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.
</code></pre></li>
<li><p>Resize the partition in the partition table:</p>
<pre><code>~ # 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.
</code></pre></li>
<li><p>Resize /dev/nvme0n1p3 to fill the whole partition:</p>
<pre><code>~ # 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.
</code></pre></li>
<li><p>Mount /dev/nvme0n1p3 and have a quick check to ensure all is OK:</p>
<pre><code>~ # 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/
</code></pre></li>
<li><p>Remove the current swap partition and create a new one:</p>
<pre><code>~ # 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
</code></pre>
<p>Remember the UUID, you'll want it later.</p></li>
<li>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.</li>
<li>Log in to the Ubuntu desktop and update the UUID of the swap
device in /etc/fstab .</li>
<li>Restart Ubuntu and ensure it mounts its swap OK.</li>
</ol>
<p>(To Be Continued...)</p>
<h2 id="installation">Installation</h2>
<ol>
<li>Repeat the above boot instructions to boot the install USB again.</li>
<li><p>I wish to install without systemd, so following
<a href="https://wiki.debian.org/systemd#Installing_without_systemd">the instructions on wiki.debian.org</a>
I will postpend:</p>
<pre><code>preseed/late_command="in-target apt-get install -y sysvinit-core"
</code></pre>
<p>to my grub command line.</p></li>
<li>This time you'll want to load crypto-dm-modules if you want to do
encrypted filesystems.</li>
<li>Continue with the standard installation path:
<ul>
<li>Set up users and passwords</li>
<li>Configure the clock</li>
<li>Detect disks</li>
</ul></li>
<li><p>Partition disks:</p>
<ul>
<li><p>This is what I have before starting:</p>
<p>/dev/nvme0n1 - 512.1 GB Unknown </p>
<blockquote>
<pre><code> 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
</code></pre>
</blockquote></li>
<li><p>Set the swap space to "do not use"</p></li>
<li>I'm setting #3 (the ubuntu partition) to mount on /mnt/danae</li>
<li>Add a partition for /boot - I'm giving this 4GB</li>
<li>Add a partition for "physical volume for encryption". I'm
filling the rest of the disk with it.</li>
<li>Configure encrypted volumes</li>
<li>Set the encrypted volume as "physical volume for LVM"</li>
<li>Configure the Logical Volume Manager
<ul>
<li>Create volume group</li>
<li>Create whatever lvs you want</li>
</ul></li>
<li>Add whatever partitions you want</li>
<li><p>My final setup looks like:</p>
<p>Encrypted volume (nvme0n1p6_crypt) - 461.4 GB Linux device-mapper </p>
<blockquote>
<pre><code>#1 461.4 GB K lvm
</code></pre>
<p>LVM VG vg-nvme, LV game-base - 9.0 GB Linux device-mapper (linear
#1 9.0 GB <br />
LVM VG vg-nvme, LV home - 160.0 GB Linux device-mapper (linear) <br />
#1 160.0 GB f ext4 /home <br />
LVM VG vg-nvme, LV slash - 4.0 GB Linux device-mapper (linear) <br />
#1 4.0 GB f ext4 / <br />
LVM VG vg-nvme, LV swap - 40.0 GB Linux device-mapper (linear) <br />
#1 40.0 GB f swap swap <br />
LVM VG vg-nvme, LV usr - 16.0 GB Linux device-mapper (linear) <br />
#1 16.0 GB f ext4 /usr <br />
LVM VG vg-nvme, LV var - 16.0 GB Linux device-mapper (linear) <br />
#1 16.0 GB f ext4 /var <br />
/dev/nvme0n1 - 512.1 GB Unknown <br />
1.0 MB FREE SPACE <br />
#1 524.3 MB B fat32 EFI system p <br />
#2 3.2 GB fat32 Basic data p <br />
#3 34.4 GB K ext4 /mnt/danae <br />
#4 8.6 GB swap <br />
#5 4.0 GB F ext4 boot /boot <br />
#6 461.4 GB K crypto (nvme0n1p6_
335.4 kB FREE SPACE </p>
</blockquote></li>
<li><p>Finish partitioning and write changes to disk</p></li>
</ul></li>
<li>Install the base system
<ul>
<li>linux-image-amd64</li>
<li>Targeted initrd</li>
</ul></li>
<li>Configure the package manager</li>
<li><p>Select and install software. I'm going for:</p>
<pre><code>[*] 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
</code></pre></li>
<li><p>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.</p></li>
<li>Install the GRUB boot loader on a hard disk.</li>
<li>Finish the installation.</li>
<li>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.</li>
<li><p>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:</p>
<pre><code>normal (hd0,gpt5)/grub/grub.cfg.new
</code></pre></li>
<li><p>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.</p></li>
</ol>
<h2 id="afterinstallation">After Installation</h2>
<p><strong>udev</strong></p>
<ul>
<li><p>The default install has a number of annoying udev rules that
rename your network interfaces to crazy unique things.</p>
<p>These rules can be overriden by adding new rules files in
/etc/udev/rules.d . I have created empty files called</p>
<pre><code>73-usb-net-by-mac.rules
75-net-description.rules
</code></pre>
<p>You might also want 99-systemd.rules if you're keeping systemd.</p></li>
</ul>
<p><strong>systemd</strong></p>
<ul>
<li>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.</li>
<li>Also after removing systemd you'll lose network-manager and will
have to set up some other way of configuring your wireless card.</li>
</ul>
<p><strong>mouse</strong></p>
<ul>
<li><p>psmouse and synaptics don't play nice together.</p>
<pre><code>blacklist psmouse
</code></pre>
<p>in /etc/modprobe.d/modprobe.conf will stop the system loading
psmouse.</p></li>
<li>By default synaptics ignores taps, and treats
<ul>
<li>single finger clicks as left</li>
<li>double finger clicks as right</li>
<li>triple finger clicks as middle</li>
<li>clicks in the bottom right as right</li>
<li>double finger drags as scrollwheel</li>
</ul></li>
<li>If you want to use an external USB mouse note that the default
setup doesn't do Emulate3Buttons</li>
</ul>
<div class="footnotes">
<hr />
<ol>
<li id="fn:1"><p>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.<a class="reversefootnote" href="http://circle.thy.me.uk//tags/14.04/#fnref:1"> ↩</a></p></li>
<li id="fn:1"><p>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.<a class="reversefootnote" href="http://circle.thy.me.uk//tags/14.04/#fnref:1"> ↩</a></p></li>
</ol>
</div>