Changes for page Ubuntu Linux

Last modified by Sebastian Marsching on 2022/03/27 15:30

From version 9.1
edited by Sebastian Marsching
on 2022/03/27 15:12
Change comment: There is no comment for this version
To version 10.1
edited by Sebastian Marsching
on 2022/03/27 15:13
Change comment: Rollback to version 5.1

Summary

Details

Page properties
Syntax
... ... @@ -1,1 +1,1 @@
1 -XWiki 2.1
1 +Markdown 1.2
Content
... ... @@ -1,14 +1,14 @@
1 1  {{toc/}}
2 2  
3 -= Moving /var =
3 +# Moving /var
4 4  
5 -After moving {{code language="none"}}/var{{/code}} to a separate partition, Ubuntu will not boot anymore. This is caused by Ubuntu needing the directories {{code language="none"}}/var/run{{/code}} and {{code language="none"}}/var/lock{{/code}} **before** {{code language="none"}}/var{{/code}} is mounted. The solution is simple: Just create {{code language="none"}}/var/run{{/code}} and {{code language="none"}}/var/lock{{/code}} on the root partition and Ubuntu will boot again.
5 +After moving `/var` to a separate partition, Ubuntu will not boot anymore. This is caused by Ubuntu needing the directories `/var/run` and `/var/lock` **before** `/var` is mounted. The solution is simple: Just create `/var/run` and `/var/lock` on the root partition and Ubuntu will boot again.
6 6  
7 -= Installing the Developer Tools =
7 +# Installing the Developer Tools
8 8  
9 -The basic developer tools (e.g. C compiler) can be installed by installing the virtual {{code language="none"}}build-essentials{{/code}} package.
9 +The basic developer tools (e.g. C compiler) can be installed by installing the virtual `build-essentials` package.
10 10  
11 -= Switching from MBR to GPT and UEFI Boot =
11 +# Switching from MBR to GPT and UEFI Boot
12 12  
13 13  In this scenario, we have a harddisk that is formatted with an MBR and has Windows 7 and Linux installed on it. We want to change this to GPT (and hence to UEFI).
14 14  
... ... @@ -16,65 +16,74 @@
16 16  
17 17  1. Be sure to make a backup of your computer's harddisk. As part of this process some data has to be deleted and there also is a chance to lose more data, because something goes wrong.
18 18  1. Boot from the Ubuntu 12.04 LTS Desktop CD (64-bit). Make sure to boot in UEFI mode. You can either disable PC-BIOS mode in your computer's boot setting or select the UEFI mode in the computer's boot select menu. How to do this strongly depends on your computer's mainboard.
19 -1. Add the Universe repository to the software sources and install {{code language="none"}}gdisk{{/code}}. Probably it is a good idea to make a backup of your harddisk's MBR using {{code language="none"}}dd{{/code}}. For the rest of this guide we assume that your disk drive is {{code language="none"}}/dev/sda{{/code}}. So run {{code language="none"}}sudo gdisk /dev/sda{{/code}}. {{code language="none"}}gdisk{{/code}} will automatically [[convert your disk from MBR to GPT>>http://www.rodsbooks.com/gdisk/mbr2gpt.html]], keeping the partitions (if possible). Now you have to delete the Windows "reserved" and system partitions. Typically, these are the first two partitions on the disk. Now exit {{code language="none"}}gdisk{{/code}} saving the changes.
19 +1. Add the Universe repository to the software sources and install `gdisk`. Probably it is a good idea to make a backup of your harddisk's MBR using `dd`. For the rest of this guide we assume that your disk drive is `/dev/sda`. So run `sudo gdisk /dev/sda`. `gdisk` will automatically [convert your disk from MBR to GPT](http://www.rodsbooks.com/gdisk/mbr2gpt.html), keeping the partitions (if possible). Now you have to delete the Windows "reserved" and system partitions. Typically, these are the first two partitions on the disk. Now exit `gdisk` saving the changes.
20 20  1. Shutdown the Ubuntu system and boot from the Windows 7 installation DVD (in UEFI mode). The Windows 7 installer can automatically create the needed partitions in the free area of the disk, that you created by deleting the Windows partitions earlier. It will create three partitions: Two special ones mainly needed for booting and a regular one for the Windows system partition.
21 -1. When the installer rebooted, I got a funny error every time I tried to boot from the harddisk. I got a blue screen with an error code of 0xc0000225. After some time I [[figured>>http://forums.anandtech.com/showthread.php?t=2260563]] [[out>>http://www.computerbase.de/forum/showthread.php?t=1152436]] that this was caused by the second harddisk in the computer being formatted using MBR. After converting this disk to GPT, everything worked smoothly. Windows is supposed to support mixed GPT and MBR disks in the same system, however in some causes it seems to cause trouble.
21 +1. When the installer rebooted, I got a funny error every time I tried to boot from the harddisk. I got a blue screen with an error code of 0xc0000225. After some time I [figured](http://forums.anandtech.com/showthread.php?t=2260563) [out](http://www.computerbase.de/forum/showthread.php?t=1152436) that this was caused by the second harddisk in the computer being formatted using MBR. After converting this disk to GPT, everything worked smoothly. Windows is supposed to support mixed GPT and MBR disks in the same system, however in some causes it seems to cause trouble.
22 22  1. After the Windows installation has finished, we can boot back into Ubuntu using the Ubuntu 12.04 LTS Desktop CD. Again, we have to boot in UEFI mode.
23 -1. We have to change to the target system by mounting all required partitions and chrooting to the target system. How to do this exactly depends on your system layout. In my case, I had the boot partition on /dev/sda4 and all other partitions in LVM. Therefore, I first installed the {{code language="none"}}lvm2{{/code}} package, activated the volume group {{code language="none"}}vg0{{/code}} with {{code language="none"}}vgchange -a y vg0{{/code}} and mounted all required filesystems with the commands
24 -{{code language="bash" layout="LINENUMBERS"}}sudo mount /dev/vg0/root /mnt
25 -sudo mount /dev/vg0/home /mnt/home
26 -sudo mount /dev/sda4 /mnt/boot
27 -sudo mkdir /mnt/boot/efi
28 -sudo mount /dev/sda1 /mnt/boot/efi
29 -sudo mount -o bind /dev /mnt/dev
30 -sudo mount -o bind /dev/pts /mnt/dev/pts
31 -sudo mount -o bind /proc /mnt/proc
32 -sudo mount -o bind /run /mnt/run
33 -sudo mount -o bind /sys /mnt/sys{{/code}}
34 -In this example the system's ESP (this is the partition where the EFI boot-loaders are stored) has been created by the Windows setup as {{code language="none"}}/dev/sda1{{/code}}.
23 +1. We have to change to the target system by mounting all required partitions and chrooting to the target system. How to do this exactly depends on your system layout. In my case, I had the boot partition on /dev/sda4 and all other partitions in LVM. Therefore, I first installed the `lvm2` package, activated the volume group `vg0` with `vgchange -a y vg0` and mounted all required filesystems with the commands
24 + ```bash
25 + sudo mount /dev/vg0/root /mnt
26 + sudo mount /dev/vg0/home /mnt/home
27 + sudo mount /dev/sda4 /mnt/boot
28 + sudo mkdir /mnt/boot/efi
29 + sudo mount /dev/sda1 /mnt/boot/efi
30 + sudo mount -o bind /dev /mnt/dev
31 + sudo mount -o bind /dev/pts /mnt/dev/pts
32 + sudo mount -o bind /proc /mnt/proc
33 + sudo mount -o bind /run /mnt/run
34 + sudo mount -o bind /sys /mnt/sys
35 + ```
36 + In this example the system's ESP (this is the partition where the EFI boot-loaders are stored) has been created by the Windows setup as `/dev/sda1`.
35 35  1. Now we can change into the target system:
36 -{{code language="bash"}}sudo su -
37 -chroot /mnt{{/code}}
38 -1. You should make a backup of the GRUB configuration files before proceeding. The relevant files are in {{code language="none"}}/boot/grub{{/code}}, {{code language="none"}}/etc/default/grub{{/code}} and {{code language="none"}}/etc/grub.d{{/code}}.
39 -1. Now you should purge all GRUB packages. You can usually do this by running {{code language="none"}}aptitude purge "?name(grub-)" "?name(grub2-)"{{/code}}.
40 -1. Next you should delete all remaining GRUB files ({{code language="none"}}/boot/grub{{/code}}, {{code language="none"}}/etc/default/grub{{/code}} and {{code language="none"}}/etc/grub.d{{/code}}). Then you should create a symbollink in {{code language="none"}}/boot{{/code}} that points to the install location of GRUB in the ESP: {{code language="none"}}ln -s efi/EFI/grub /boot/grub{{/code}}.
41 -1. After that you can install the EFI version of GRUB: {{code language="none"}}aptitude install grub-efi{{/code}}.
42 -1. In the target system, we have to edit {{code language="none"}}/etc/fstab{{/code}} and add an entry for the ESP. You can find out the UUID of the partition by running {{code language="none"}}grub-probe --target=fs_uuid /boot/efi{{/code}}. Then add a line like
43 -{{code language="none"}}UUID=<UUID> /boot/efi vfat defaults 0 1{{/code}}
44 -to your /etc/fstab (of course you have to replace {{code language="none"}}<UUID>{{/code}} by the UUID printed by {{code language="none"}}grub-probe{{/code}}.
45 -1. Now we install GRUB with {{code language="none"}}grub-install --boot-directory=/boot/efi/EFI --bootloader-id=grub --no-floppy --recheck{{/code}} (I got this from [[another guide>>http://thinkpad-forum.de/threads/123262-EFI-Grub2-Multiboot-HowTo]]).
46 -1. You might have to edit {{code language="none"}}/etc/default/grub{{/code}} to suit your needs. I disabled the OS prober (because it does not detect the UEFI Windows loader anyway but found some old systems on my second harddisk) by adding {{code language="none"}}GRUB_DISABLE_OS_PROBER="true"{{/code}}. I also changed {{code language="none"}}GRUB_HIDDEN_TIMEOUT{{/code}} to the empty string and {{code language="none"}}GRUB_HIDDEN_TIMEOUT_QUIET{{/code}} to {{code language="none"}}false{{/code}}. This was needed because the OS prober was disabled and thus GRUB would not show the boot menu by default any longer (the same would happen if OS prober was enabled but it did not find other operating systems).
47 -1. Because memtest86+ was installed on the system, I had to copy the file {{code language="none"}}20_memtest86+{{/code}} from the backup of the GRUB configuration files back to {{code language="none"}}/etc/grub.d{{/code}}.
48 -1. In order to be able to boot Windows 7 from GRUB (using the boot menu of the EFI BIOS is inconvenient), I added an extra entry to {{code language="none"}}/etc/grub.d/40_custom{{/code}} (as describe in the [[Ubuntu Community Wiki>>https://help.ubuntu.com/community/UEFIBooting#Chainloading_Windows_x86_64_UEFI-GPT]]):
49 -{{code language="none"}}menuentry "Windows 7 (UEFI)" {
50 - search -fs-uuid --no-floppy --set=root <UUID>
51 - chainloader (${root})/EFI/Microsoft/Boot/bootmgfw.efi
52 -}{{/code}}
53 -In this example {{code language="none"}}<UUID>{{/code}} again has to be replaced by the UUID of the ESP.
54 -1. In order to generate the GRUB configuration file, {{code language="none"}}update-grub{{/code}} needs to be run.
55 -1. Finally, GRUB has to be registered in the EFI settings. This can be done by running {{code language="none"}}efibootmgr --create --gpt --disk /dev/sda --part 1 --write-signature --label "GRUB" --loader "\\EFI\\grub\\grub.efi"{{/code}}.
38 + ```
39 + sudo su -
40 + chroot /mnt
41 + ```
42 +1. You should make a backup of the GRUB configuration files before proceeding. The relevant files are in `/boot/grub`, `/etc/default/grub` and `/etc/grub.d`.
43 +1. Now you should purge all GRUB packages. You can usually do this by running `aptitude purge "?name(grub-)" "?name(grub2-)"`.
44 +1. Next you should delete all remaining GRUB files (`/boot/grub`, `/etc/default/grub` and `/etc/grub.d`). Then you should create a symbollink in `/boot` that points to the install location of GRUB in the ESP: `ln -s efi/EFI/grub /boot/grub`.
45 +1. After that you can install the EFI version of GRUB: `aptitude install grub-efi`.
46 +1. In the target system, we have to edit `/etc/fstab` and add an entry for the ESP. You can find out the UUID of the partition by running `grub-probe --target=fs_uuid /boot/efi`. Then add a line like
47 + ```
48 + UUID=<UUID> /boot/efi vfat defaults 0 1
49 + ```
50 + to your /etc/fstab (of course you have to replace `<UUID>` by the UUID printed by `grub-probe`.
51 +1. Now we install GRUB with `grub-install --boot-directory=/boot/efi/EFI --bootloader-id=grub --no-floppy --recheck` (I got this from [another guide](http://thinkpad-forum.de/threads/123262-EFI-Grub2-Multiboot-HowTo)).
52 +1. You might have to edit `/etc/default/grub` to suit your needs. I disabled the OS prober (because it does not detect the UEFI Windows loader anyway but found some old systems on my second harddisk) by adding `GRUB_DISABLE_OS_PROBER="true"`. I also changed `GRUB_HIDDEN_TIMEOUT` to the empty string and `GRUB_HIDDEN_TIMEOUT_QUIET` to `false`. This was needed because the OS prober was disabled and thus GRUB would not show the boot menu by default any longer (the same would happen if OS prober was enabled but it did not find other operating systems).
53 +1. Because memtest86+ was installed on the system, I had to copy the file `20_memtest86+` from the backup of the GRUB configuration files back to `/etc/grub.d`.
54 +1. In order to be able to boot Windows 7 from GRUB (using the boot menu of the EFI BIOS is inconvenient), I added an extra entry to `/etc/grub.d/40_custom` (as describe in the [Ubuntu Community Wiki](https://help.ubuntu.com/community/UEFIBooting#Chainloading_Windows_x86_64_UEFI-GPT)):
55 + ```
56 + menuentry "Windows 7 (UEFI)" {
57 + search -fs-uuid --no-floppy --set=root <UUID>
58 + chainloader (${root})/EFI/Microsoft/Boot/bootmgfw.efi
59 + }
60 + ```
61 + In this example `<UUID>` again has to be replaced by the UUID of the ESP.
62 +1. In order to generate the GRUB configuration file, `update-grub` needs to be run.
63 +1. Finally, GRUB has to be registered in the EFI settings. This can be done by running `efibootmgr --create --gpt --disk /dev/sda --part 1 --write-signature --label "GRUB" --loader "\\EFI\\grub\\grub.efi"`.
56 56  1. After finishing these steps, you can leave the target system and unmount all partitions. Finally, reboot the computer and select GRUB from the computer's boot menu. Now you should see the normal GRUB screen, where you can select to boot Linux or Windows.
57 57  
58 -= Configuring the Vino VNC server on Ubuntu Desktop =
66 +# Configuring the Vino VNC server on Ubuntu Desktop
59 59  
60 -== Allowing access from localhost only ==
68 +## Allowing access from localhost only
61 61  
62 -{{code language="bash"}}
70 +```bash
63 63  gsettings set org.gnome.Vino network-interface lo
64 -{{/code}}
72 +```
65 65  
66 66  This is perfect if there is only a single user on the machine because this way, a SSH tunnel can provide sufficient access restrictions.
67 67  
68 -== Fixing problems with some VNC clients ==
76 +## Fixing problems with some VNC clients
69 69  
70 -Since Ubuntu 14.04 LTS, some (older) clients cannot connect. This seems to be caused by the use of TLS in the VNC server. This feature can be disabled (see [[bug #1290666>>https://bugs.launchpad.net/ubuntu/+source/vino/+bug/1290666]]):
78 +Since Ubuntu 14.04 LTS, some (older) clients cannot connect. This seems to be caused by the use of TLS in the VNC server. This feature can be disabled (see [bug #1290666](https://bugs.launchpad.net/ubuntu/+source/vino/+bug/1290666)):
71 71  
72 -{{code language="bash"}}
80 +```bash
73 73  gsettings set org.gnome.Vino require-encryption false
74 -{{/code}}
82 +```
75 75  
76 -== Find packages that have been removed but not purged ==
84 +## Find packages that have been removed but not purged
77 77  
78 -{{code language="bash"}}
86 +```bash
79 79  aptitude search "?config-files"
80 -{{/code}}
88 +```
89 +