Commit 45a815ec authored by nilsl's avatar nilsl
Browse files

Merge branch 'master' of gitlab.ethz.ch:thealternative/courses

parents 5271f71f b0a8fb30
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 <name>
- Get recest versions: \# zypper ref
- Install a package: \# zypper in <package>
- Update packages: \# zypper up
- Upgrade system: \# zypper dup
- Remove package: \# zypper remove <package>
- Get help: \# zypper help
- zypper shell: \# zypper sh (so you can drop the “zypper” prefix)
- List repos: \# zypper lr
- Add repo: \# zypper ar <url> <name>
- 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 <grub-no> -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/<distro\_name>/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,
delete it.
- Find the file `40-custom.cfg`. If it doesn't exist, create it. Paste the
menuentry block you copied earlier in this file.
- In the text you just pasted, look for `bootmgfw.efi` and change it to
`bootmgfw-original.efi`.
- Save the file.
- Run `grub-mkconfig -o /boot/grub/grub.cfg`. Make sure the file path
matches the path where you originally found the `grub.cfg` you copied the
menuentry from.
- Reboot and verify that grub now loads properly. Also test whether Windows
boots!
For reference, ask Aline, Max or Jan.
\cleartooddpage
Surface Pro 4
=============
These little things need some special treatment to get the touchscreen
to work.
After the installation, add the following repository:
http://download.opensuse.org/repositories/home:/maxf:/LD/openSUSE\_Leap\_42.1/
From there, install kernel-default-ipts and kernel-firmware-ipts (for
intel precose touch support)
After that, you need to copy some hardware descriptor files from the
windows partition:
- Descriptor.bin: A HID descriptor file provided by vendor. The HID
Driver appends the panel’s HID descriptor to information.
- iaPreciseTouchDescriptor.bin: A HID descriptor file. A bare minimum
HID descriptor descripting the device. The HID Driver appends the
panel’s HID descriptor to information.
- KernelSKL.bin: Touch Vendor provided OpenCL kernel includes touch
algorithms.
- SFTConfig.bin: Touch Vendor provided configuration binary.
These files are located in:
%Windir%\\inf\\PreciseTouch\\
Kernel will look for these user space binaries in /itouch folder under
specific names.
- /itouch/vendor\_kernel\_skl.bin
- /itouch/integ\_sft\_cfg\_skl.bin
- /itouch/vendor\_descriptor.bin
- /itouch/integ\_descriptor.bin
So to be able to try different vendor kernels using softlinks can be
used as:
- ln -sf /itouch/KernelSKL.bin /itouch/vendor\_kernel\_skl.bin
- ln -sf /itouch/SFTConfig.bin /itouch/integ\_sft\_cfg\_skl.bin
- ln -sf /itouch/Descriptor.bin /itouch/vendor\_descriptor.bin
- ln -sf /itouch/iaPreciseTouchDescriptor.bin
/itouch/integ\_descriptor.bin
For further reference, ask Max or Aline or see
https://github.com/ipts-linux-org/ipts-linux/wiki\#user-space-components
\mysection{openSUSE}
\label{sec:suse}
\mysubsection*{Zypper Crashcourse}
\label{subsec:suse-zypper}
- Search for packages: `zypper se <name>`
- Get recent versions: `zypper ref`
- Install a package: `zypper in <package>`
- Update packages: `zypper up`
- Upgrade system: `zypper dup`
- Remove package: `zypper remove <package>`
- Get help: `zypper help`
- zypper shell: `zypper sh` (so you can drop the “zypper” prefix)
- List repos: `zypper lr`
- Add repo: `zypper ar <url> <name>`
- Need more help: `man zypper` & Google
\mysubsection*{How To `YaST`}
\label{subsec:suse-yast}
- Open `YaST` via `Start Menu` -> `Settings` -> `YaST`
- Open `Software Management`
- There you can search for keywords and select packages to install
\cleartooddpage
Fixing Broadcom Wireless
========================
If Wireless is not working properly under Ubuntu or openSUSE it might be
a firmware problem:
- Under openSUSE:\
\#sudo zypper install b43-fwcutter\
\#sudo /usr/sbin/install\_bcm43xx\_firmware
- Under Ubuntu:\
\# sudo apt install firmware-b43-installer
For further reference, see:\
http://linuxwireless.org/en/users/Drivers/b43/
\mysubsection*{apt Crashcourse}
\label{subsec:buntu-apt}
- Sync the repos: `sudo apt update`
- Upgrade packages: `sudo apt upgrade`
- Upgrade distro (handles changing repositories): `sudo apt dist-upgrade`
- Install packages: `sudo apt install $packages`
- Remove packages: `sudo apt remove $packages`
- Diagnostic check (update package cache, check for broken dependencies): `sudo apt check`
- Clean package cache: `sudo apt clean`
- Only clean cached files that can no longer be downloaded: `sudo apt autoclean`
Important options:
- -f : Attempt to fix broken dependencies
- --reinstall : reinstall a package
\cleartooddpage
Repair Bootcamp after repartitioning on older Macs (the ones with BIOS emulation) {#sec:Fix Bootcamp}
=================================================================================
Disk Utility will delete Hybrid MBR, so we need to fix it *(tested on
Macbook Pro 13-inch, Early 2011)*
*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/
(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 bootableflag? (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
- Restore GPT if something goes wrong:
- `sudo gdisk /dev/diskX`\
- `x`, `r`, `l`, enter backup file, `w`
- If MacOS does not let you modify the MBR:
- reboot into recovery, open terminal, `csrutil disable`, reboot
- `csrutil enable` it after you are done
Install refind
--------------
*(tested on Macbook Pro 13-inch, Early 2011)*
> Bei [\[]{}Install Procedure; 1. Mac OS X[\]]{} schlägt die
> Installation von refind unter der neusten Version von Mac OS X (El
> Capitan, 10.11) fehl Grund dafür ist, dass Apple System Integrity
> Protection (‘rootless’) aktiviert hat. Genaueres dazu hier:
> http://www.rodsbooks.com/refind/sip.html Wenn man die Fehlermeldung
> (ALERT: SIP ENABLED) ignoriert und trotzdem installiert wird refind
> auf die EFI Partition kopiert, das MacBook kann davon aber nicht
> starten. Grund ist, dass der Installer von refind im gebooteten OS
> keine Rechte hat die efi boot Variablen im nvram zu ändern und der
> standard Booteintrag deshalb nicht geändert werden kann
#### Workaround 1: (würd ich vorschlagen) {#workaround-1-wuxfcrd-ich-vorschlagen}
- siehe:
http://www.rodsbooks.com/refind/installing.html\#manual\_renaming
- SIP error bei refind Installation ignorieren, attempt installation
`Y`
- im Terminal: (evtl. mit sudo falls kein Adminaccount, verschieben
und umbenennen geht auch von Hand im Finder) - `diskutil list` ( EFI
partition finden, normalerweise disk0s1) -
`diskutil mount /dev/disk0s1` - `cd /Volumes/EFI/EFI` -
`mv refind BOOT` - `cd BOOT` - `mv refind_x64.efi bootx64.efi`
- neu starten, Option Key (alt) gedrückt halten, und EFI BOOT
auswählen für refind
> Vorteil: mac erkennt refind auf der EFI system partition automatisch,
> überlebt auch nvram reset, kein reboot in Recovery nötig damit es
> funktioniert
> möglicher Nachteil: mac bootet nicht automatisch von refind, sondern
> Mac OS X
> Lösung:
- in recovery booten (Option+R), Utilities, terminal aufmachen,
- `diskutil mount /dev/disk0s1`
- `bless --mount /Volumes/EFI --setBoot --file /Volumes/EFI/EFI/BOOT/bootx64.efi --shortform`
> jetzt sollte refind automatisch booten
- Falls keine recovery partition vorhanden geht auch bootable
Installer (https://support.apple.com/en-us/HT201372)
#### Workaround 2: (wie von refind vorgeschlagen)
siehe: http://www.rodsbooks.com/refind/sip.html\#disable basically:
- in recovery booten
- refind von dort installieren
- oder `csrutil disable`, reboot in osx, refind installieren, reboot
in recovery, `csrutil enable`
> auf neueren MacBooks (mein 2011er hat keinen csr-active-config Eintrag
> im nvram , `nvram -p` um zu ckecken) ist es auch möglich sip mit
> refind aus- und wieder einzuschalten, dazu die EFI system Partition
> mounten, **Workaround 1**, und dann und wie hier
> http://www.rodsbooks.com/refind/sip.html\#refind\_manage beschrieben
> refind.conf editieren oder aber das wie beschrieben per stick oä
> machen
\mysection{Special Snowflakes}
\label{sec:sflake}
\mysubsection*{Surface Pro 4 \& Surface Book}
\label{subsec:sflake-sp4b}
These little things need some special treatment to get the touchscreen
to work. We only support them under OpenSUSE, so this manual assumes
OpenSUSE is installed.
After the installation, add the following repository:
`http://download.opensuse.org/repositories/home:/maxf:/LD/openSUSE\_Leap\_42.2/`
From there, install kernel-default-ipts and kernel-firmware-ipts (for
intel precise touch support). **Uninstall the default kernel**.
Unfortunately, the SP4 drivers are only available for kernel 4.4, so you
are effectively downgrading the Linux kernel. If you leave the default
kernel installed, grub will boot it since it is newer.
After that, you need to copy some hardware descriptor files from the
Windows partition:
- iaPreciseTouchDescriptor.bin
- SurfaceTouchServicingDescriptorMSHW0078.bin
- SurfaceTouchServicingKernelSKLMSHW0078.bin
- SurfaceTouchServicingSFTConfigMSHW0078.bin
These files are located in:
`\\Windows\\inf\\PreciseTouch\\Intel`
Note that the name might vary slightly. Specifically, there might be different versions of the latter three files, which different numbers at the end (76, 78, 79...). If that is the case, use the files with the highest number.
Kernel will look for these user space binaries in /itouch folder under
specific names (same order as above):
- /itouch/integ\_descriptor.bin
- /itouch/vendor\_descriptor.bin
- /itouch/vendor\_kernel\_skl.bin
- /itouch/integ\_sft\_cfg\_skl.bin
After that, reboot and verify the touchscreen works.
For further reference, ask Max or Aline or see
https://github.com/ipts-linux-org/ipts-linux/wiki\#user-space-components
###Touchscreen Inverted
On the Surface Book, we have observed that the touchscreen is inverted after the above steps (the y axis is mirrored, so when you type in the bottom left corner, the reaction happens in the top left corner). To fix this, we use xinput to set the coordinate transformation matrix.
Note that only finger touch is affected, touch with the Surface Pen is correct.
* Install xinput (sometimes named xorg-xinput).
* Run `xinput` and look for a touch device that might be the touchscreen. There should be two devices, one named something like `0000:0000` and the other `0000:0000 Pen`. You want the one without the `Pen` suffix.
* Run `xinput set-prop "Device Name" "Coordinate Transformation Matrix" 1 0 0 0 -1 1 0 0 1`, where "Device Name" is the name of the touchscreen you found previously.
* Test whether the touchscreen behaves properly now.
Note that this solution is temporary. We have not yet tested any ways to
make it permanent. You could try to put the above `xinput
set-prop` command in `~/.xinitrc` or some other auto-start script. The proper solution would be to create a file for the touchscreen in `/etc/X11/xorg.conf.d/` and set the `TransformationMatrix` option. If you find a working solution, please tell the Patrol.
\pagebreak
\mysubsection*{Broadcom Problems}
\label{subsec:sflake-bcom}
In general, it's a good idea to look at what broadcom card you have, so you know what drivers you need:
`lspci -nn -d 14e4:`
### Broadcom Under openSUSE
Most likely, installing the broadcom-wl drivers will fix it:
- Add packman repo: YaST → Software repos → Add, select community
repos → Next → select packman → finish
- `zypper ref`
- `zypper install broadcom-wl`
### Broadcom Under Ubuntu
For reference, use: