To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

Commit d32009ad authored by Florian Moser's avatar Florian Moser
Browse files

Add cheat sheet archive

parent b77565d7
# Introduction
<!-- Not sure if we need an introduction, might come in handy though-->
Before installing
=================
Switch from RAID to AHCI
------------------------
Especially newer laptops (2018+) have options to switch between RAID and AHCI boot mode.
If the laptop is running in RAID mode and Linux does not recognize its drives, it will have to be switched to AHCI. Unfortunately, this also means Windows
needs to be reconfigured, otherwise it won't boot anymore. Just google [windows 10 switch from raid to ahci](http://triplescomputers.com/blog/uncategorized/solution-switch-windows-10-from-raidide-to-ahci-operation/).
If the drive still is not visible, try to look for an entry called `Fastboot` and set it to off (or how Dell calls it, `Thorough`).
Disable fast boot in Windows 8/8.1/10
-------------------------------------
- Open the control panel (Win 10: the old-style control panel, not the
newish one) and select the power options
- Click on „Choose what the power buttons do“ on the left bar
- By acquiring admin rights click „Change settings that are currently
unavailable“
- scroll down and uncheck the box for fast startup
ThinkPad T.40 Serie BIOS Version
- BIOS version should be greater or equal to 1.14. 2.x to be sure not
to brick the system
How to detect 32bit EFI and how to deal with it
-----------------------------------------------
- No provided install image will boot
- Windows is installed in 32bit mode
- Some older Macbooks have this config
- To install a 64bit Linux (we never encountered a 32bit CPU with
that), manually replace the bootloader with a grub standalone and
boot the kernel manually. Reference\
https://wiki.archlinux.org/index.php/Unified\_Extensible\_Firmware\_Interface\#Booting\_64-bit\_kernel\_on\_32-bit\_UEFI
Useful Macbook hardware bitwidth table
--------------------------------------
- http://www.everymac.com/mac-answers/snow-leopard-mac-os-x-faq/mac-os-x-snow-leopard-64-bit-macs-64-bit-efi-boot-in-64-bit-mode.html
Getting to BIOS in Windows 8/8.1/10
-----------------------------------
- Get to the power button (metro bar in 8/8.1, start menu in 10)
- Press the shutdown button
- Press and hold SHIFT while selecting Restart
- In the appearing GUI select „Extended options“ or similar until „Go
to UEFI firmware“
Find out boot type, disable hybrid boot mode: UEFI or BIOS?
-----------------------------------------------------------
- MUST do this before booting the Linux live system, otherwise
existing systems might be broken!
- In the BIOS, go to the boot options and set either BIOS (often
called legacy) XOR UEFI mode! **DO NOT USE HYBRID MODES.**
- If available (e.g. on Lenovo Workstation laptops), disable CSM when
using UEFI / enable it when using BIOS mode.
- Save, reboot and check if the existing OS starts
- If yes, you found the right mode
- If no, it’s the other mode, so switch it and don’t forget to
attempt to boot the existing OS again, this time it must work or
there’s a real problem.
Find out the partition table type: EFI or MBR?
----------------------------------------------
- MUST find this out before installing, can mess up the system
otherwise!
- Check for a partition labeled “EFI” and formatted as FAT32
(generally pretty small). Note that this partition might not be
visible from Windows.\
If there is such a partition, it’s EFI, else it’s an MBR table.
Remember that type!
- At the last step of installing, double-check that the installer
detected partition type correctly.
Turn off Bitlocker
------------------
On some laptops (including all Surface devices) BitLocker Drive Encryption is enabled by default. It needs to be disabled first.
**Do not change any BIOS/UEFI settings before disabling BitLocker!** You will have to provide the decryption key otherwise, which the user typically has no access to, which in turn makes the entire disk unreadable.
### Disabling BitLocker
To disable BitLocker, do the following:
* Launch a command prompt with administrator rights and use `manage-bde -off C:`, where `C:` is the drive you wish to decrypt.
* Use the command `manage-bde -status` to query the decryption progress.
* You will need to wait until decryption is complete, which can take up to an hour depending on the number of files on the drive.
After decryption, continue installing Linux as usual.
### Unlock BitLocker Encrypted Devices
If you change any UEFI settings on a BitLocker encrypted device (typically Surface devices), you will be prompted for the BitLocker key on next boot.
Since Surface devices come encrypted out of the box, the user does typically not have that key and Windows will refuse to boot. If this happens, resetting the UEFI settings to factory settings should fix the issue.
Alternatively, you can just enter the correct Bitlocker key. This works only if the user has a Microsoft account linked to the device. You can get the BitLocker key as follows:
* On another device, google for "BitLocker Recovery Key". You should find several Microsoft Support or FAQ pages on how to recover the key.
* Search for a link saying "To get your recovery key, go to BitLocker Recovery Keys" or similar. Go there.
* Ask the user to sign in using their Microsoft account. The website will then display their recovery key, which can be used to unlock the device.
\mysubsection*{4 Primary Partitions In MBR}
\label{subsec:win-4pparts}
MBR can have a maximum of 4 primary partitions, so if you already have this many,
you'll need to do something about it.
To fix the problem do the following:
* Delete any primary partition not needed anymore. (On HP -> `HP_TOOLS`, on
Lenovo check which ones are not needed.).
* Resize any one partition you want the data from.
* Use the data freed from the resized partition and create a new partition of
type `Extended Partition`.
* Use that container for any future partitions.
\mysubsection*{Shrinking Partitions}
\label{subsec:win-sparts}
Sometimes it happens that windows doesn't allow resizing a partition for some
reasons. Here is a list of helpful hints to try and make Windows comply again.
* Defragment Disk.
* Disable Hibernation. Restart.
* [Win + x] -> `Command Prompt (Admin)`
* `powercfg /h off`
* Disable Pagefile. Restart.
* [Win + R] -> `SystemPropertiesPerformance.exe` -> Pick `Advanced`
* In `Virtual Memory` pick `Change` and unchange `Automatically manage `
`paging file size for all drives`
* Set `No paging file` on partition you want to remove it from
* Disable System Protection. Restart.
* [Win + R] -> `SystemPropertiesProtection.exe`
* Select partition to remove protection from and click `Configure`
* `Disable system protection` -> `Apply`
* If none of the above help, there are tools specifically made to move files around, such as EaseUS. Ask Florian Moser for a license of the tool. If you don't know who that is, ask around.
For more help: [https://technet.microsoft.com/en-us/library/cc731894.aspx](https://technet.microsoft.com/en-us/library/cc731894.aspx)
\cleartooddpage
Partitioning
============
Watch for hybrid HDD/SSD systems
--------------------------------
- Intel provides an SSD cache (found on a HP laptop). It doesn’t even
show under Windows. On OpenSuse, it show up as an extra hard disk
labeled: Intel Fast Flash.
DO NOT TOUCH this disk.
- We experienced problems resizing the hard disk on that machine (it
said it’s inconsistent). To solve this, you have to start up Windows
and disable Intel Smart Response in the utility installed on
Windows.
MBR system setup
----------------
- make sure system has no EFI! See above: “Find out the partition
table type: EFI or MBR?”
- Each HDD can only have max. 4 partitions which are either primary or
logical, so I recommend first creating a new logical partition which
again can contain 4 partitions, which we can all use for the Linux
installation
- If there are already 4 primary partitions on the disk (e.g. old HP
laptops), you must delete a partition. We typically choose the ones
like „HP TOOLS“.
- More on this topic can be found here:\
http://wiki.project21.ch/Partitionierung\_von\_HDs\_mit\_vier\_primären\_Partitionen
EFI system setup
----------------
- make sure the system has EFI! See above: “Find out the partition
table type: EFI or MBR?”
- Lenovo \*\*40 =&gt; BIOS update before proceeding!
<!-- -->
- make sure, that the system has booted in EFI mode (check whether
/sys/firmware/efi exists)
- make sure the system found the efi partition and it is mounted at
/boot/efi (type ’mount’ in console, which lists all mounted devices)
- when selecting the partition scheme for installation, check whether
the efi partition is recognized and will be mounted at /boot/efi
- If any EFI bugs occur, check the wiki article for EFI, which
contains workarounds for many bugs.
Recommended partitions on a Linux system:
-----------------------------------------
- At least 20 GB for /
- swap partition at least as large as total amount of installed RAM
- optional own partitions for /home, /usr, /var, … whatever the
clients wish. Note that this is a religious question without clear
answer which option is better:
- Advantage of separate home: More clear to backup (e.g. with dd),
more independent of system
- Advantage of just one partition („/“): The entire space can be
used for whatever, no separate and fix space constraint for
system and home.
\mysection{Mac OS X}
\label{sec:mac}
\mysubsection*{Repair Bootcamp After Repartition On BIOS Macs}
\label{subsec:mac-bios}
*(tested on Macbook Pro 13-inch, Early 2011)*
`Disk Utility` will delete Hybrid MBR, so we need to fix it.
*Replace `diskX` with your disk, e.g. `disk0`*
- `sudo fdisk /dev/diskX` to see MBR
- `sudo gpt show /dev/diskX` to see GPT
- Install GPT fdisk from [https://sourceforge.net/projects/gptfdisk/](https://sourceforge.net/projects/gptfdisk/)
(or use gdisk on Linux)
- **ALWAYS BACKUP** current partition table to an **external location** first:
- `sudo gdisk /dev/diskX` , `p` , `b`, enter backup file
- Create Hybrid MBR:
- `sudo gdisk /dev/diskX` , `x`, `r`
- `p`, remember partition number of Bootcamp/Windows
- `h`, enter Bootcamp partition number
- Place EFI GPT (0xEE) partition first in MBR (good for GRUB)?
(Y/N): `Y`
- Enter an MBR hex code [\[]{}For bootcamp partition[\]]{}: `07`
- Set the bootable flag? (Y/N): `Y`
- Unused partition space(s) found. Use one to protect more partitions?
(Y/N): `N`
- `p`, `o`, check if MBR is correct
- `w` to write hybrid MBR to disk
- In case something goes wrong: Restore GPT
- `sudo gdisk /dev/diskX`
- `x`, `r`, `l`, enter backup file, `w`
- If Mac OS X does not let you modify the MBR:
- Reboot recovery, open Terminal, `csrutil disable`, reboot
- `csrutil enable` after done
\mysubsection*{Installing rEFInd}
\label{subsec:mac-refind}
*(tested on Macbook Pro 13-inch, Early 2011)*
The installation of rEFInd fails under El Capitan (Mac OS X 10.11). The reason is
the activated system integrity protection ('rootless', more info here:
http://www.rodsbooks.com/refind/sip.html). Ignoring the error message (ALERT:
SIP ENABLED) will result in the files being copied into the ESP but the device
not being able to start from it. This is because the NVRAM variables weren't
properly adjusted.
### Workaround 1: Clemens' Suggestion
Reference: [http://www.rodsbooks.com/refind/installing.html#manual_renaming](http://www.rodsbooks.com/refind/installing.html#manual_renaming)
- Ignore SIP error, attempt installation with `Y`
- Open a terminal and enter (maybe using sudo):
- `diskutil list` (find ESP, usually `disk0s1`)
- `diskutil mount /dev/disk0s1`
- `cd /Volumes/EFI/EFI`
- `mv refind BOOT`
- `cd BOOT`
- `mv refind_x64.efi bootx64.efi`
- Restart, hold down [Alt] and pick `EFI BOOT` for rEFInd
Advantage: Mac detects rEFInd automatically on the ESP, survives NVRAM resets
and no need to boot into recovery.
Disadvantage: Mac OS X boots per default, not rEFInd
Solution: Boot into recovery [Option + R] -> Utilities -> Terminal
- `diskutil mount /dev/disk0s1`
- `bless --mount /Volumes/EFI --setBoot --file /Volumes/EFI/EFI/BOOT/bootx64.efi --shortform`
Refind should boot automatically henceforth.
Should Recovery not exist then use a bootable installer [https://support.apple.com/en-us/HT201372](https://support.apple.com/en-us/HT201372).
### Workaround 2: Recommended By rEFInd
Reference: [http://www.rodsbooks.com/refind/sip.html#disable](http://www.rodsbooks.com/refind/sip.html#disable)
- Boot recovery
- Do one of the following:
- Install rEFInd from there **OR**
- `csrutil disable`
- Reboot into Mac OS X
- Install rEFInd
- Reboot into recovery
- `csrutil enable`
On newer MacBooks (Clemens' Early 2011 doesn't have an `csr-active-config`
entry, `nvram -p` for listing all available entries) it is also possible to
toggle the SIP state with rEFInd. Mount ESP, follow **Workaround 1** and
finally edit `refind.conf` (see: [http://www.rodsbooks.com/refind/sip.html#refind_manage](http://www.rodsbooks.com/refind/sip.html#refind_manage)).
\pagebreak
Using openSUSE
==============
Booting openSUSE in BIOS / EFI mode
-----------------------------------
- To check how the USB key has booted compare the screen to the
pictures below
![image](suse_efi_mode.jpg)
BIOS mode\
![image](suse_bios_mode.jpg)
EFI mode
Installing software in Yast
---------------------------
- Open Yast via start menu → settings → yast
- Open “Install Software” (or so)
- There you can search for keywords and select packages to install
Very small zypper HOWTO
-----------------------
- Search for packages: \# zypper se &lt;name&gt;
- Get recest versions: \# zypper ref
- Install a package: \# zypper in &lt;package&gt;
- Update packages: \# zypper up
- Upgrade system: \# zypper dup
- Remove package: \# zypper remove &lt;package&gt;
- Get help: \# zypper help
- zypper shell: \# zypper sh (so you can drop the “zypper” prefix)
- List repos: \# zypper lr
- Add repo: \# zypper ar &lt;url&gt; &lt;name&gt;
- Need more help: \$ man zypper and Google Fu
### Adding the custom repository
- Our custom repo contains kernels for exotic hardware and some other
useful stuff.
- Add it via:\
\# zypper ar -f
http://download.opensuse.org/repositories/home:/maxf:/LD/openSUSE\_Leap\_42.1/
TheAlt
Exotic problems
---------------
### Secure Boot
- The openSUSE kernel maintained by Max cannot be secure booted!
### Get rid of graphic driver
- \# echo ‘blacklist nouveau’ tee
/etc/modprobe.d/my\_cool\_blacklist.conf
- Maybe add nomodeset:
- Edit /etc/default/grub to add ‘nomodeset’ to the kernel cmdline
- \# grub2-mkconfig -o /boot/grub2/grub.cfg
### Get rid of grub on Macs and set rEFInd to default
- \# efibootmgr gives you all boot entries
- \# efibootmgr -o XXXX,YYYY,ZZZZ sets the boot order. Put refind
first here
- \# efibootmgr -b &lt;grub-no&gt; -B deletes the efi entry of grub
### Get broadcom-wl
- Add packman repo: YaST → Software repos → Add, select community
repos → Next → select packman → finish
- \# zypper ref
- \# zypper install broadcom-wl
### Installation worked fine, but instead of GRUB only Windows is booting
- Disable secure boot (which would prevent GRUB from chainloading)
- Find /boot/efi/EFI/Microsoft/Boot/bootmgfw.efi (Windows boot loader)
- Rename it such that any Linux expert can still find it!
- Find /boot/efi/EFI/&lt;distro\_name&gt;/grubx64.efi (GRUB)
- copy GRUB to the location that was previously owned by the windows
boot loader
- open the os\_prober file in /etc/grub.d and search for the Windows
boot entry
- update the position of the (renamed) windows boot loader and copy
the text of the menuentry to /etc/grub.d/40\_custom
- remove os\_prober
- ’grub-mkconfig -o /boot/grub/grub.cfg’
- Document all changes so a future linux expert helping our client can
figure out what you did!
- In case of a problem ask Maximilian or Jan
\mysection{Boot Problems}
\label{sec:boot}
\mysubsection*{Detecting 32bit EFI \& Dealing With It}
\label{subsec:boot-32bit}
- No provided install image will boot
- Windows is installed in 32bit mode
- Some older Macbooks also have this configuration
It is possible to install Linux on such devices, but requires some more handwork. Note that we only ever found this configuration on 64 bit processors, so it's usually possible to install 64 bit Linux.
* Ask the Patrol for a 32-bit-Grub-USB.
* Plug both the 32-bit-Grub-USB and the Linux Installer USB in the device
* Boot from the 32-bit-Grub-USB
* You should land in a grub shell. The command prompt should say `grub>`, not `grub-rescue>`. If you see `rescue`, something went wrong.
* Type `ls`, you should see a list of partitions in the form `(HD0,GPT1)`. Try to guess which disk (HD0, HD1, HD2...) is the USB Installer - they usually have two GPT partitions.
* Type `set root=(HDX,GPT1)`, X being the number of the disk you think is the installer.
* If you get some error, it was the wrong partition or disk. Reboot and try another.
* The Kernel files reside in `/casper/vmlinuz.efi` and `/casper/initrd.lz` for Ubuntu installers, `/boot/x86_64/loader/linux` and `/boot/x86_64/loader/initrd` for opensuse.
* Load the vmlinuz by typing: (change path as required)
`vmlinuz casper/vmlinuz.efi`
* Load the initial ramdisk by typing: (change path as required)
`initrd casper/initrd.lz`
* You can use tab completion in the above step. If there are multiple files starting with `vmlinuz` or `initrd`, you usually need the one with the shortest file name.
* If you can't find the kernel files, you probably loaded the wrong partition or disk. Reboot and try again.
* Type `boot`, hit enter and pray.
* If all goes well, the installer now boots. Install Linux as normal.
After the install, you might still need to install the 32 bit version of grub in order to boot anything at all. If Linux doesn't boot now, do the following:
* Plug in the 32-bit-Grub-USB, unplug all other USB keys.
* Boot the 32-bit-Grub-USB. Type 'ls'. Try to guess on which partition you installed Linux before (root partition)
* `set root=(HD0,GPTX)`, X being the partition number you installed Linux on.
* The kernel files usually reside in `/boot/grub` or `/boot/distroname`. Just like before, load the vmlinuz.efi and initrd files.
* Type `boot`, hit enter and PRAY.
* If you're lucky, the freshly installed Linux now comes up.
* once it is up, `sudo grub-install --target=i386-efi /dev/sda1` (if your boot partition is not `sda1`, change accordingly).
* regenerate the grub config (`grub-mkconfig -o /boot/grub/grub.cfg`). Change the path accordingly.
* Test whether Linux now boots.
\cleartooddpage
\mysubsection*{Exchange GRUB To rEFInd}
\label{subsec:boot-grubrefind}
Use `efibootmgr` to set the boot order.
- `efibootmgr` or `efibootmgr -v` (for verbose output) gives you the current
boot order. Relevant outputs are `BOOTXXXX` where `XXXX` are four numerical
digits.
- Set the boot order with `efibootmgr -o XXXX,YYYY,ZZZZ`
- Delete the GRUB boot entry with `efibootmgr -b XXXX -B` where `XXXX` is the
number of the GRUB boot entry.
- You can remove duplicate entries with `efibootmgr -D` if cleanup is needed.
\mysubsection*{GRUB Configuration}
\label{subsec:boot-grubconf}
### Ubuntu
See `/etc/default/grub` to edit kernel parameters.
GRUB configuration can be regenerated with `update-grub`.
### OpenSUSE
Try to configure GRUB with YaST. (-> Boot Loader Settings).
\pagebreak
\mysubsection*{Bootloader Hack}
\label{subsec:boot-hack}
Some EFI systems do not implement the EFI standard properly, which leads to
problems.
### Symptoms
* No matter what boot order you set with `efibootmgr`, Windows still boots.
* Settings you change with `efibootmgr` keep disappearing on reboot.
* Sometimes, it's possible to get to GRUB by "using a device" to boot. A boot
device named "opensuse", "ubuntu" or "grub" might show up.
### How-To (Non-Mac Computers)
- Try to boot the actual distro that has been installed by "using a device"
to boot. Do so by holding shift while clicking on "reboot" in Windows.
- If that doesn't work, boot a live system and chroot into the installed
system. If you don't know how to do that, ask the Patrol for the manual.
- Once booted or chrooted into the Linux system, become root (sudo su) and
go to `/boot/efi/EFI/Microsoft/Boot` and locate a file named
`bootmgfw.efi`. Rename it to `bootmgfw-original.efi`.
- Go to `/boot/efi/EFI/grub2` (sometimes also just `grub`) and locate the
file `grubx64.efi`. Copy it over to `/boot/efi/EFI/Microsoft/Boot/`. If a
file called `shimx64.efi` exists, copy that one over as well.
- Find the file `grub.cfg` in `/boot/efi/EFI/grub2` and copy it over to
`/boot/efi/EFI/Microsoft/Boot/`.
- Go back to `/boot/efi/EFI/Microsoft/Boot/`. If `shimx64.efi` exists,
rename it to `bootmgfw.efi`. If it does not exist, rename `grubx64.efi` to
`bootmgfw.efi`.
- Now go to `/boot/grub/`, or `/boot/opensuse/` (the exact folder path may
vary). Find the file `grub.cfg` and open it. Find the `menuentry` block
for Windows (usually called "Windows Bootloader (on /dev/sdx)" or
similar). Copy the entire block.
- Uninstall the package `os-prober`.
- Now go to /etc/grub.d. If a file with `os-prober` in its name exists,