notes-computer-lenovoThinkpadX1Nano2021

  1. General notes

fn-spacebar to cycle thru keyboard backlight settings

fn-Esc to activate the fn keys on the top row

  1. Initial boot and setup Windows

set the hardware camera privacy shutter to off (private/camera blocked)

volume to zero

windows update, check for updates, install, reboot if necessary, repeat until no more updates

display, turn down brightness, turn on night mode, adjust night mode set hours as desired

turn up plugged-in power mode to full perf

battery:

power & sleep:

windows security:

windows edge:

commercial vantage:

  1. BIOS config

Reboot into BIOS by rebooting from windows then pressing F1 when the title screen comes up. (shutting down from windows doesnt seem to really cleanly boot, it seems to reload an image)

Config->Network->Lenovo Cloud Services = off Config->Intel AMT->Intel AMT control = off

Save and reboot by pressing F10

Note: if you don't want the computer to beep when entering the BIOS, turn the volume all the way down (in Windows or Linux or whatever) before rebooting it.

  1. Install GNU/Linux

In Windows, start Disk management, then right click on the partition "Windows (C:)" and select "Shrink Volume...". I shrank it so as to leave about 2/3s of the total size of the drive as free space for GNU/Linux.

Make a boot USB drive for popos using the instructions linked from: https://support.system76.com/articles/install-pop/ I used the 20.10 version.

Plug in the USB drive to the laptop

Reboot into BIOS by rebooting from windows then pressing F1 when the title screen comes up. (shutting down from windows doesnt seem to really cleanly boot, it seems to reload an image)

Security->Secure Boot->Secure Boot = disabled

NOTE: Windows won't decrypt the main hard drive (encrypted with Bitlocker) when Secure Boot is disabled. So you'll probably want to reenable it before booting into Windows.

Save and reboot by pressing F10

At the title screen, press F12 to get the boot menu (you could also press Enter and then F12). Select the USB drive.

If it just immediately returns to that menu without booting, without restarting, unplug the USB drive and plug it back in and then select it in the menu again.

The system should boot into POP!_OS and display the Install Pop!_OS 20.10 dialog.

Select the language, country, and keyboard layout that you want.

Select Custom (Advanced)

Select Modify Partitions... in the lower left

Now you are in GParted. Create a 1024MiB? (1 GiB?) FAT32 partition, and an ext4 partition with the rest of the free space. Click the checkbox and apply. Take note of the "/dev" name of the big partition; for example, it might be /dev/nvme0n1p6. Exit Gparted.

Click Activities in the upper left and bring up a terminal (from the icon on the left, or you can type Terminal in the search bar).

To encrypt your new partition and choose your initial encryption password, enter the following commands, but if you big partition "/dev" name is other than /dev/nvme0n1p6, replace that with your "/dev" name:

sudo -i cryptsetup luksFormat /dev/nvme0n1p6 cryptsetup open /dev/nvme0n1p6 cryptdata pvcreate /dev/mapper/cryptdata vgcreate vgrp0 /dev/mapper/cryptdata lvcreate -L 32G vgrp0 -n swap lvcreate -l 100%FREE vgrp0 -n root mkfs.ext4 /dev/vgrp0/root mkswap /dev/vgrp0/swap

Exit out of the terminal, and go back to the installer. If you are still in the partition select screen, go Back using the button on the bottom, then Select Custom (Advanced) again. Now their should be a big pink/purple partition on the diagram. Click on it. It should ask for a decryption password, give it the one that you just set. Now you should be able to see the encrypted logical volume (LVM) as a second drive below the top one.

Click on the ~1GB fat32 partition that you created, activate Use partition, and it should say Use as: Boot (/boot/efi). Click away and a checkmark should appear on the corresponding part of the drive diagram. Click on the big (green?) part of the LVM, activate "Use partition" and it should say "Use as: Root (/)". Click away. Click on the (red?) swap partition, activate "Use partition" and it should say "Use as: Swap". Click away. Click Erase and Install. When it's done, select Restart Device (you can remove the USB key after it restarts). It should reboot into Linux now by default. You'll have to enter your encryption password.

Follow the prompts to select your desired keyboard layout and to configure your wifi.

On the "privacy" screen, turn off Location services (for some reason it skipped past this screen and i couldn't go back until after i set my name; dunno if that always happens).

Reboot and do the initial setup.

Click on Activities in the top left and go to the "Pop!_Shop". Click Installed then Update All. Pull down the Pop!_Shop menu near the upper left and select Check for Updates. If there are any then Update All again.

  1. Setup GNU/Linux

install dropbox desktop client (Ubuntu) from https://www.dropbox.com/install and sign into dropbox and sync (now you will be able to access this file from the terminal)

sudo apt install ack-grep aptitude atop dconf-editor emacs exiv2 fasd ffmpeg gcc g++ gimp git gnupg graphviz gv htop imagemagick iotop iptraf ipython3 libgetopt-declare-perl libjpeg-turbo-progs mairix mlocate mutt offlineimap neomutt notmuch pdftk perl-doc pinentry-gnome3 postfix preload pwgen pymacs python3-dev python3-gpg python3-matplotlib python3-notmuch python3-numpy python3-pip python3-scipy python3-virtualenv python-mode qiv screen smartmontools ssh texlive-full tmux urlview vim vlc whois wmctrl xdotool xournal youtube-dl

When it asked me to configure email, i chose no configuration. Don't know if that's a good idea. Later: it was not. dpkg-reconfigure.

I put "localhost" into /etc/mailname.

  1. # Firefox

in order for touchpad scrolling to work, you need to set environment variable MOZ_USE_XINPUT2=1. I've done this by putting "export MOZ_USE_XINPUT2=1" in my .bashrc but until you do that you can execute firefox as "MOZ_USE_XINPUT2=1 firefox" to get it working temporarily.

settings.startup.restore previous session = true settings.privacy.permissions.autoplay.default for all websites = block audio and video settings.privacy.Firefox Data Collection and Use = all off settings.privacy.Send websites a “Do Not Track” signal that you don’t want to be tracked = always settings.privacy.Logins and Passwords.Ask to save logins and passwords for websites = off

sign into firefox sync. Sync only bookmarks and open tabs.

install addons: dark background and light text (some password manager; also set autologout in extension prefs) ublock origin

  1. # Initial misc
      1. Nightlight settings.display.nightlight, set as desired
      2. Stop onscreen keyboard from popping up

The onscreen keyboard ("osk") pops up annoyingly all the time. To make this stop, install Gnome extension Block Caribou 36 (I think the osk is called Caribou). You do this via the web by going to https://extensions.gnome.org/extension/3222/block-caribou-36/ and then installing the Gnome extension extension via the link near the top, and then using the switch near the upper-right hand of this webpage to turn Block Caribou 36 to On.

  1. ## Swap capslock and escape (to use ESC in emacs evil mode) dconf write "/org/gnome/desktop/input-sources/xkb-options" "['caps:swapescape']"
      1. Workspaces

dconf write /org/gnome/mutter/dynamic-workspaces false dconf write /org/gnome/desktop/wm/preferences/num-workspaces 9

dconf write /org/gnome/desktop/wm/keybindings/switch-to-workspace-1 "['<Primary>F1']" dconf write /org/gnome/desktop/wm/keybindings/switch-to-workspace-2 "['<Primary>F2']" dconf write /org/gnome/desktop/wm/keybindings/switch-to-workspace-3 "['<Primary>F3']" dconf write /org/gnome/desktop/wm/keybindings/switch-to-workspace-4 "['<Primary>F4']" dconf write /org/gnome/desktop/wm/keybindings/switch-to-workspace-5 "['<Primary>F5']" dconf write /org/gnome/desktop/wm/keybindings/switch-to-workspace-6 "['<Primary>F6']" dconf write /org/gnome/desktop/wm/keybindings/switch-to-workspace-7 "['<Primary>F7']" dconf write /org/gnome/desktop/wm/keybindings/switch-to-workspace-8 "['<Primary>F8']" dconf write /org/gnome/desktop/wm/keybindings/switch-to-workspace-9 "['<Primary>F9']"

  1. # Copy over files

mkdir -p ~/Mail/bsgmail/ mkdir ~/Mail/bscovgmail/

Copy the following from another computer to this one:

/etc/postfix /etc/aliases ~/.notmuch-config ~/.bashrc ~/.bashrc-local ~/.bash_aliases ~/Mail/bsgmail/.gmailieer.json ~/Mail/bscovgmail/.gmailieer.json ~/.neomuttrc ~/.muttrc ~/.muttrc-local ~/.muttrc-local-pre ~/.muttrc.d ~/.spacemacs.d ~/.emacs.d prog data .screenrc .mairixrc .Xresources projects cov soft org website plbook

Some of these are symlinks (cov, org, website, plbook)

One one line that's: /etc/postfix /etc/aliases ~/.notmuch-config ~/.bashrc ~/.bashrc-local ~/.bash_aliases ~/.neomuttrc ~/.muttrc ~/.muttrc-local ~/.muttrc-local-pre ~/.muttrc.d ~/.spacemacs.d ~/.emacs.d prog data .screenrc .mairixrc .Xresources projects cov org website plbook

And then these two must be treated specially because they are in different subfolders with the same name, but you don't want to copy the whole subfolders: ~/Mail/bsgmail/.gmailieer.json ~/Mail/bscovgmail/.gmailieer.json

(.bash_logout doesn't need to be copied b/c it is just the original version, which is already provided by Popos; .bash_profile is empty)

  1. # Setup email notmuch notmuch new

cd soft cd lieer pip install .

mv ~/Mail/bsgmail/.gmailieer.json ~/Mail/bsgmail/.gmailieer.json-real mv ~/Mail/bscovgmail/.gmailieer.json ~/Mail/bscovgmail/.gmailieer.json-real

cd ~/Mail/bsgmail gmi init (EMAIL ADDR) mv ~/Mail/bsgmail/.gmailieer.json-real ~/Mail/bsgmail/.gmailieer.json gmi pull gmi pull gmi sync

cd ~/Mail/bscovgmail gmi init (EMAIL ADDR) mv ~/Mail/bscovgmail/.gmailieer.json-real ~/Mail/bscovgmail/.gmailieer.json gmi pull gmi pull gmi sync

notmuch config set query.active '(tag:inbox_bsgmail or tag:inbox_bscovgmail or tag:mbox)' notmuch config set query.allinbox '(tag:inbox_bsgmail) or (tag:inbox_bscovgmail) or (to:postmaster and tag:new) or (to:@pop-os and tag:new)'

  1. # More misc
      1. Disable animations dconf write /org/gnome/desktop/interface/enable-animations false
      2. Screen lock time

settings.privacy.screen lock.automatic screen lock delay = 10 minutes

  1. ## Python symlink

sudo ln -s /usr/bin/python3 /usr/bin/python

  1. ## Use evince for PDF viewing

edit /etc/mailcap (using sudo vi /etc/mailcap, for example) add the following line at the top:

application/pdf; evince %s; test=test -n "$DISPLAY"

  1. Stop the on-screen keyboard (osk) from popping up

https://github.com/pop-os/shell/issues/1503#issuecomment-1203045925

  1. Links

https://www.tnhh.net/posts/ubuntu-thinkpad-nano.html

https://download.lenovo.com/pccbbs/mobiles_pdf/x1nano_gen1_ug_linux.pdf

https://www.reddit.com/r/thinkpad/comments/m86650/is_anyone_running_a_linux_distros_on_the_x1_nano/

https://www.reddit.com/r/thinkpad/comments/kspujw/x1_nano_wireless_not_working_in_linux/gipj1tw/?utm_source=share&utm_medium=ios_app&utm_name=iossmf&context=3

https://www.reddit.com/r/thinkpad/comments/mc9gww/x1_nano_running_linux_recommended_settings/ https://www.tnhh.net/posts/ubuntu-thinkpad-nano.html https://wiki.archlinux.org/title/Lenovo_ThinkPad_X1_Nano https://www.reddit.com/r/thinkpad/comments/miy8cg/x1_nano_linux_pop_os_perfect_match/

https://download.lenovo.com/pccbbs/pubs/thinkpad_x1_nano_gen1/html_en/index.html#t=en%2Fcover.html