Difference between revisions of "CloverOS GNU/Linux"

From /tech/ Wiki
Jump to navigationJump to search
 
(46 intermediate revisions by 2 users not shown)
Line 7: Line 7:
  
 
==System Requirements==
 
==System Requirements==
x86_64 CPU that supports SSSE3 (Core 2 Duo, AMD FX and higher), 5GB of disk space, 64-128MB RAM depending on video driver
+
x86_64 CPU that supports SSSE3 (Core 2 Duo, AMD FX and higher), 5GB of disk space
 +
 
 +
Copying iso to usb drive: <pre>dd if=CloverOS-x86_64-date.iso of=/dev/sdx bs=4M ; sync</pre>
  
 
==Cheat sheet==
 
==Cheat sheet==
Line 22: Line 24:
  
 
===Updating config files after upgrading system (Optional)===
 
===Updating config files after upgrading system (Optional)===
<code>sudo dispatch-conf</code>
+
<pre>sudo dispatch-conf</pre>
  
 
After you run it, it will show you the changes to config files it's going to make:
 
After you run it, it will show you the changes to config files it's going to make:
Line 55: Line 57:
 
Volume control: Laptop (software) Volume up/down keys
 
Volume control: Laptop (software) Volume up/down keys
  
fvwm's settings are in <code>~/.fvwm2rc</code>
+
fvwm's settings are in <pre>~/.fvwm2rc</pre>
  
 
===Setting default sound device===
 
===Setting default sound device===
Run <code>./cloveros_settings.sh 3</code>
+
Run <pre>./cloveros_settings.sh 3</pre>
  
 
Or:
 
Or:
  
Run <code>alsamixer</code> and hit F6 to see your audio devices.
+
Run <pre>alsamixer</pre> and hit F6 to see your audio devices.
  
To make 1 the default device, edit <code>~/.asoundrc</code> and add this:
+
To make 1 the default device, edit <pre>~/.asoundrc</pre> and add this:
  
<code>
+
<pre>
 
defaults.pcm.card 1
 
defaults.pcm.card 1
 
defaults.ctl.card 1
 
defaults.ctl.card 1
</code>
+
</pre>
  
 
===Included software===
 
===Included software===
Line 99: Line 101:
  
 
===Listing available packages===
 
===Listing available packages===
Use <code>porthole</code> or <code>eix</code>
+
Use <pre>porthole</pre> or <pre>eix</pre>
  
 
Web interface: https://packages.gentoo.org
 
Web interface: https://packages.gentoo.org
Line 108: Line 110:
  
 
===Package isn't available===
 
===Package isn't available===
Make an issue so I can add the package to binhost. In the meantime, install from source using <code>~/cloveros_settings.sh 5 ; sudo emerge [package] ; ~/cloveros_settings.sh 5</code>
+
Make an issue so I can add the package to binhost. In the meantime, install from source using <pre>~/cloveros_settings.sh 5 ; sudo emerge [package] ; ~/cloveros_settings.sh 5</pre>
  
 
===Switching to source===
 
===Switching to source===
  
Switch to source by running <code>./cloveros_settings.sh 5</code>
+
Switch to source by running <pre>./cloveros_settings.sh 5</pre>
  
 
Or:
 
Or:
  
Edit <code>/etc/portage/make.conf</code> and edit the following lines:
+
Edit <pre>/etc/portage/make.conf</pre> and edit the following lines:
  
<code>
+
<pre>
 
EMERGE_DEFAULT_OPTS="--keep-going=y --autounmask-write=y --jobs=4 -G"
 
EMERGE_DEFAULT_OPTS="--keep-going=y --autounmask-write=y --jobs=4 -G"
 
ACCEPT_KEYWORDS="**"
 
ACCEPT_KEYWORDS="**"
 
FETCHCOMMAND_HTTPS="...
 
FETCHCOMMAND_HTTPS="...
</code>
+
</pre>
  
 
to
 
to
  
<code>
+
<pre>
 
#EMERGE_DEFAULT_OPTS="--keep-going=y --autounmask-write=y --jobs=4 -G"
 
#EMERGE_DEFAULT_OPTS="--keep-going=y --autounmask-write=y --jobs=4 -G"
 
#ACCEPT_KEYWORDS="**"
 
#ACCEPT_KEYWORDS="**"
 
#FETCHCOMMAND_HTTPS="...
 
#FETCHCOMMAND_HTTPS="...
</code>
+
</pre>
  
 
This disables the binhost and uses Portage's ebuilds for packages. Now you can emerge from source.
 
This disables the binhost and uses Portage's ebuilds for packages. Now you can emerge from source.
 +
 +
Run <pre>./cloveros_settings.sh c</pre> to get the CloverOS Portage configuration.
  
 
==FAQ==
 
==FAQ==
Line 140: Line 144:
 
===How do I install systemd/avahi/pulseaudio?===
 
===How do I install systemd/avahi/pulseaudio?===
 
Switch to source and then emerge
 
Switch to source and then emerge
 
===It hangs on boot in VirtualBox===
 
In VirtualBox 6.x, change Graphics Controller to VBoxSVGA. This fixes the "Setting system clock using the hardware clock [UTC] ..." hang.
 
 
![VirtualBox graphics adapters](https://i.imgur.com/pTtWptS.png)
 
  
 
===Nvidia card crashes on boot with a green screen===
 
===Nvidia card crashes on boot with a green screen===
 
/etc/modprobe.d/blacklist.conf:
 
/etc/modprobe.d/blacklist.conf:
  
<code>
+
<pre>
 
blacklist vga16fb
 
blacklist vga16fb
 
blacklist nouveau
 
blacklist nouveau
Line 155: Line 154:
 
blacklist nvidiafb
 
blacklist nvidiafb
 
blacklist rivatv
 
blacklist rivatv
</code>
+
</pre>
  
 
/boot/grub/grub.cfg:
 
/boot/grub/grub.cfg:
  
<code>
+
<pre>
 
linux  /boot/kernel-genkernel-x86_64-[ver]-gentoo root=UUID=[id] ro nomodeset nouveau.modeset=0
 
linux  /boot/kernel-genkernel-x86_64-[ver]-gentoo root=UUID=[id] ro nomodeset nouveau.modeset=0
</code>
+
</pre>
  
 
===Using old Radeon card with new video drivers===
 
===Using old Radeon card with new video drivers===
<code>
+
<pre>
 
sudo rmmod -f radeon && sudo modprobe amdgpu si_support=1
 
sudo rmmod -f radeon && sudo modprobe amdgpu si_support=1
</code>
+
</pre>
  
 
===Installing proprietary Nvidia drivers===
 
===Installing proprietary Nvidia drivers===
<code>
+
<pre>
kernelversion=$(cut -d" " -f3 /proc/version | sed "s/-.*//")
+
sudo EMERGE_DEFAULT_OPTS="" emerge \=gentoo-sources-$(uname -r | sed 's/-.*//')
kernelminorversion=$(sed "s/\.[^.]*$//" <<<$kernelversion)
+
sudo eselect kernel set linux-$(uname -r)
sudo EMERGE_DEFAULT_OPTS="" emerge \=gentoo-sources-$kernelversion
+
sudo wget https://raw.githubusercontent.com/damentz/liquorix-package/$(uname -r | sed 's/\.[^.]*$//')/linux-liquorix/debian/config/kernelarch-x86/config-arch-64 -O /usr/src/linux/.config
sudo eselect kernel set linux-$kernelversion-gentoo
+
sudo sed -i "s/CONFIG_CRYPTO_CRC32C=m/CONFIG_CRYPTO_CRC32C=y/; s/CONFIG_FW_LOADER_USER_HELPER=y/CONFIG_FW_LOADER_USER_HELPER=n/; s/CONFIG_I2C_NVIDIA_GPU=/#CONFIG_I2C_NVIDIA_GPU=; s/CONFIG_R8169=m/CONFIG_R8169=y/" /usr/src/linux/.config
sudo wget https://raw.githubusercontent.com/damentz/liquorix-package/$kernelminorversion/linux-liquorix/debian/config/kernelarch-x86/config-arch-64 -O /usr/src/linux/.config
 
 
sudo emerge nvidia-drivers
 
sudo emerge nvidia-drivers
 
sudo depmod
 
sudo depmod
Line 180: Line 178:
 
sudo eselect opencl set nvidia
 
sudo eselect opencl set nvidia
 
sudo sh -c 'echo -e "blacklist nouveau\nblacklist vga16fb\nblacklist rivafb\nblacklist nvidiafb\nblacklist rivatv" >> /etc/modprobe.d/blacklist.conf'
 
sudo sh -c 'echo -e "blacklist nouveau\nblacklist vga16fb\nblacklist rivafb\nblacklist nvidiafb\nblacklist rivatv" >> /etc/modprobe.d/blacklist.conf'
</code>
+
</pre>
  
 
Reboot
 
Reboot
Line 186: Line 184:
 
or
 
or
  
Kill X, <code>sudo rmmod -f nouveau vga16fb rivafb nvidiafb rivatv && sudo modprobe nvidia</code> and restart X
+
Kill X, <pre>sudo rmmod -f nouveau vga16fb rivafb nvidiafb rivatv && sudo modprobe nvidia</pre> and restart X
  
 
===Installing bumblebee for laptops===
 
===Installing bumblebee for laptops===
 
This is for laptops that have both Intel GPU and Nvidia GPU with Optimus
 
This is for laptops that have both Intel GPU and Nvidia GPU with Optimus
  
<code>
+
<pre>
 
sudo emerge bumblebee
 
sudo emerge bumblebee
 
sudo depmod
 
sudo depmod
sudo sed -i 's/^Driver=$/Driver=nvidia/; s/^Bridge=auto$/Bridge=primus/; s/^VGLTransport=proxy$/VGLTransport=rgb/; s/^KernelDriver=$/KernelDriver=nvidia/; s/^PMMethod=auto$/PMMethod=bbswitch/; s@^LibraryPath=$@LibraryPath=/usr/lib64/opengl/nvidia/lib:/usr/lib/opengl/nvidia/lib@; s@^XorgModulePath=$@XorgModulePath=/usr/lib64/opengl/nvidia/lib,/usr/lib64/opengl/nvidia/extensions,/usr/lib64/xorg/modules/drivers,/usr/lib64/xorg/modules@' /etc/bumblebee/bumblebee.conf
+
sudo sed -i 's/^Driver=$/Driver=nvidia/; s/^Bridge=auto$/Bridge=primus/; s/^VGLTransport=proxy$/VGLTransport=rgb/; s@^PrimusLibraryPath=/usr/lib/primus:/usr/lib32/primus$@PrimusLibraryPath=/usr/lib/primus:/usr/lib32/primus:/usr/lib64/primus@; s/^KernelDriver=$/KernelDriver=nvidia/; s/^PMMethod=auto$/PMMethod=bbswitch/; s@^LibraryPath=$@LibraryPath=/usr/lib64/opengl/nvidia/lib:/usr/lib/opengl/nvidia/lib@; s@^XorgModulePath=$@XorgModulePath=/usr/lib64/opengl/nvidia/lib,/usr/lib64/opengl/nvidia/extensions,/usr/lib64/xorg/modules/drivers,/usr/lib64/xorg/modules@' /etc/bumblebee/bumblebee.conf
</code>
+
</pre>
 +
 
 +
Depending on how new your laptop is, you will need to enable
 +
<pre>
 +
GRUB_CMDLINE_LINUX_DEFAULT="acpi_osi=Linux nogpumanager"
 +
</pre>
 +
in <pre>/etc/default/grub</pre> and use <pre>sudo grub-mkconfig -o /boot/grub/grub.cfg</pre> to have bbswitch manage your gpu on the next reboot
  
 
===Installing VirtualBox===
 
===Installing VirtualBox===
<code>
+
<pre>
 
sudo emerge virtualbox
 
sudo emerge virtualbox
 
sudo depmod
 
sudo depmod
Line 204: Line 208:
 
sudo useradd -g $USER vboxusers
 
sudo useradd -g $USER vboxusers
 
sudo modprobe -a vboxdrv vboxnetadp vboxnetflt
 
sudo modprobe -a vboxdrv vboxnetadp vboxnetflt
</code>
+
</pre>
  
 
Reboot if your kernel isn't up to date.
 
Reboot if your kernel isn't up to date.
 +
 +
===Wine with esync===
 +
First run:
 +
<pre>
 +
sudo sh -c "echo $USER\ N524288 >> /etc/limits"
 +
</pre>
 +
 +
To enable esync, use environment variable <pre>export WINEESYNC=1</pre> This can be added to <pre>~/.zshrc</pre> or <pre>~/.bashrc</pre>
  
 
===Steam stops working===
 
===Steam stops working===
Start steam with <code>rm -R ~/.steam/ && steam &</code>
+
Start steam with <pre>rm -R ~/.steam/ && steam &</pre>
  
 
===What are USE flags?===
 
===What are USE flags?===
<code>/etc/portage/package.use</code> generally determines what your Gentoo install will look like. The first thing new Gentoo users should do is read the USE flags for their packages.
+
<pre>/etc/portage/package.use</pre> generally determines what your Gentoo install will look like. The first thing new Gentoo users should do is read the USE flags for their packages.
  
 
https://packages.gentoo.org/packages/media-gfx/gimp
 
https://packages.gentoo.org/packages/media-gfx/gimp
Line 233: Line 245:
 
https://packages.gentoo.org/packages/media-gfx/gimp
 
https://packages.gentoo.org/packages/media-gfx/gimp
  
See the green and the yellow? Green means you can just <code>emerge gimp</code> and get that version. But what if you want 2.9? It's keyworded, which means it isn't stable.
+
See the green and the yellow? Green means you can just <pre>emerge gimp</pre> and get that version. But what if you want 2.9? It's keyworded, which means it isn't stable.
  
 
Gentoo Stable is using packages that aren't keyworded, as in they're tested and guaranteed to work.
 
Gentoo Stable is using packages that aren't keyworded, as in they're tested and guaranteed to work.
Line 244: Line 256:
  
 
===Emerge error relating to openssl, fix OpenGL 3/4 not working===
 
===Emerge error relating to openssl, fix OpenGL 3/4 not working===
Add this to <code>/etc/portage/package.use</code>:
+
This is a general Gentoo thing. Add this to <pre>/etc/portage/package.use</pre>:
<code>
+
<pre>
 
dev-libs/openssl -bindist
 
dev-libs/openssl -bindist
 
net-misc/openssh -bindist
 
net-misc/openssh -bindist
 
media-libs/mesa -bindist
 
media-libs/mesa -bindist
</code>
+
</pre>
  
 
===GPU passthrough example===
 
===GPU passthrough example===
<code>
+
<pre>
 
# fallocate -l 32GB drive && lspci
 
# fallocate -l 32GB drive && lspci
  
 
sudo sh -c '
 
sudo sh -c '
 +
modprobe vfio-pci
 
devices=(01:00.0 01:00.1 00:12.0 00:12.2)
 
devices=(01:00.0 01:00.1 00:12.0 00:12.2)
  
Line 270: Line 283:
 
echo 1 > /sys/bus/pci/devices/$devid/remove
 
echo 1 > /sys/bus/pci/devices/$devid/remove
 
echo 1 > /sys/bus/pci/rescan
 
echo 1 > /sys/bus/pci/rescan
done'
+
done
</code>
+
'
 +
</pre>
  
 
===Change FVWM titlebar color===
 
===Change FVWM titlebar color===
<code>
+
<pre>
 
color=69aEb6; sed -i "s/\(Style \* BackColor \).*/\1#$color/; s/\(Style \* HilightBack \).*/\1#$color/; s/\(Colorset 1 bg #\)......\(.*\)/\1$color\2/" ~/.fvwm2rc && killall fvwm && fvwm &
 
color=69aEb6; sed -i "s/\(Style \* BackColor \).*/\1#$color/; s/\(Style \* HilightBack \).*/\1#$color/; s/\(Colorset 1 bg #\)......\(.*\)/\1$color\2/" ~/.fvwm2rc && killall fvwm && fvwm &
</code>
+
</pre>
  
 
Alternatively, replace every instance of #056839 (green) manually.
 
Alternatively, replace every instance of #056839 (green) manually.
  
 
===KDE theme in qt5 programs without KDE===
 
===KDE theme in qt5 programs without KDE===
<code>
+
<pre>
 
sudo emerge qt5ct breeze
 
sudo emerge qt5ct breeze
 
QT_QPA_PLATFORMTHEME="qt5ct" qt5ct
 
QT_QPA_PLATFORMTHEME="qt5ct" qt5ct
 
QT_QPA_PLATFORMTHEME="qt5ct" your_program
 
QT_QPA_PLATFORMTHEME="qt5ct" your_program
</code>
+
</pre>
  
 
Open qt5ct and switch the style and the icon theme to Breeze.
 
Open qt5ct and switch the style and the icon theme to Breeze.
  
![Breeze theme](https://i.imgur.com/WZLQTV0.png)
+
[[File:Breeze.png|thumb|right|Breeze theme]]
  
 
===Firefox and Pulseaudio===
 
===Firefox and Pulseaudio===
 
Firefox 57+ still works with ALSA. If this changes, it will be built with apulse.
 
Firefox 57+ still works with ALSA. If this changes, it will be built with apulse.
 
===Vertical tabs in Firefox 57+===
 
https://addons.mozilla.org/en-US/firefox/addon/vertical-tabs-reloaded/
 
 
<code>mkdir ~/.mozilla/firefox/*.default/chrome/</code>
 
 
<code>nano ~/.mozilla/firefox/*.default/chrome/userChrome.css</code>
 
 
<code>
 
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* set default namespace to XUL */
 
/* Hide Horizontal TAB Bar */
 
#TabsToolbar {
 
visibility: collapse !important;
 
}
 
/* Hide White Header Tab Tree */
 
#sidebar-header {
 
display: none;
 
}
 
</code>
 
 
![Firefox](https://i.imgur.com/z6NaM5a.png)
 
 
To have built-in tab list button available at all times:
 
 
<code>~/.mozilla/firefox/*.default/chrome/userChrome.css</code>
 
 
<code>
 
#alltabs-button {
 
    visibility: visible !important;
 
}
 
</code>
 
 
===Firefox configuration hardening===
 
<code>
 
wget https://raw.githubusercontent.com/pyllyukko/user.js/master/user.js -P ~/.mozilla/firefox/*.default/
 
sed -i "s@\(.*\"browser.pr.*\)@//\1@; s@\(.*\"privacy.sanitize.s.*\)@//\1@; s@\(.*\"privacy.clearOnShutdown.s.*\)@//\1@; s@\(.*\"signon.r.*\)@//\1@" /home/user/.mozilla/firefox/*.default/user.js # if you require passwords/sessions to work
 
</code>
 
 
More information here: https://github.com/pyllyukko/user.js/
 
 
![Firefox user.js](https://i.imgur.com/3jopDjI.png)
 
  
 
===Enable tap to click on touchpads===
 
===Enable tap to click on touchpads===
<code>xinput set-prop "SynPS/2 Synaptics TouchPad" "libinput Tapping Enabled" 1</code>
+
<pre>xinput set-prop "SynPS/2 Synaptics TouchPad" "libinput Tapping Enabled" 1</pre>
  
 
===Disable mouse acceleration===
 
===Disable mouse acceleration===
<code>xinput list --id-only | xargs -I{} xinput set-prop {} "libinput Accel Profile Enabled" 0 1 &>/dev/null</code>
+
<pre>xinput list --id-only | xargs -I{} xinput set-prop {} "libinput Accel Profile Enabled" 0 1 &>/dev/null</pre>
  
 
===Suspend when laptop lid is closed===
 
===Suspend when laptop lid is closed===
First run <code>emerge acpid && /etc/init.d/acpid start</code>
+
First run <pre>emerge acpid && /etc/init.d/acpid start</pre>
  
Edit <code>/etc/acpi/default.sh</code>:
+
Edit <pre>/etc/acpi/default.sh</pre>:
  
<code>
+
<pre>
 
#!/bin/sh
 
#!/bin/sh
 
# /etc/acpi/default.sh
 
# /etc/acpi/default.sh
Line 412: Line 385:
 
*) log_unhandled $* ;;
 
*) log_unhandled $* ;;
 
esac
 
esac
</code>
+
</pre>
  
 
===Dnscrypt-proxy howto===
 
===Dnscrypt-proxy howto===
<code>
+
<pre>
 
sudo emerge dnscrypt-proxy
 
sudo emerge dnscrypt-proxy
 
sudo /etc/init.d/dnscrypt-proxy start
 
sudo /etc/init.d/dnscrypt-proxy start
Line 421: Line 394:
 
sudo sh -c 'echo "static domain_name_servers=127.0.0.1" >> /etc/dhcpcd.conf'
 
sudo sh -c 'echo "static domain_name_servers=127.0.0.1" >> /etc/dhcpcd.conf'
 
sudo /etc/init.d/dhcpcd restart
 
sudo /etc/init.d/dhcpcd restart
</code>
+
</pre>
  
 
===Clean outdated kernels===
 
===Clean outdated kernels===
<code>sudo find /boot/ /lib/modules/ -mindepth 1 -maxdepth 1 -name \*gentoo\* ! -name \*$(uname -r) -exec rm -R {} \;</code>
+
<pre>sudo find /boot/ /lib/modules/ -mindepth 1 -maxdepth 1 -name \*gentoo\* ! -name \*$(uname -r) -exec rm -R {} \;</pre>
  
 
===Sound in OBS / Open Broadcaster Software using ALSA===
 
===Sound in OBS / Open Broadcaster Software using ALSA===
Run <code>sudo modprobe snd_aloop</code> and edit the following file, replacing <code>device 0</code> and <code>hw:0,0</code> with your sound device:
+
Run <pre>sudo modprobe snd_aloop</pre> and edit the following file, replacing "device 0" and "hw:0,0" with your sound device:
  
<code>~/.asoundrc</code>
+
<pre>~/.asoundrc</pre>
  
<code>
+
<pre>
 
     pcm.!default {
 
     pcm.!default {
 
       type asym
 
       type asym
Line 442: Line 415:
 
         card "Loopback"
 
         card "Loopback"
 
         device 0
 
         device 0
         subdevice 0
+
         subdevice 1
 
     }
 
     }
  
Line 492: Line 465:
 
       }
 
       }
 
     }
 
     }
</code>
+
</pre>
 +
 
 +
Start playing something, then run <pre>obs</pre>, then add Audio Capture Device (ALSA) to your Sources. You can alternatively use ffmpeg to record using <pre>-f alsa -i hw:Loopback,1,0</pre> or <pre>-f alsa -i looprec</pre>.
 +
 
 +
[[File:Obs_with_alsa.png|thumb|right|OBS with ALSA]]
 +
 
 +
===Sound in OBS / Open Broadcaster Software using JACK===
 +
First get jack, alsa-plugins and qjackctl with <pre>sudo emerge jack-audio-connection-kit alsa-plugins qjackctl</pre> and add the following line to file, replacing "user" with your Linux username:
 +
 
 +
<pre>/etc/limits</pre>
 +
 
 +
<pre>
 +
user N524288 O99 M5300658
 +
</pre>
 +
 
 +
This gives jackd the rtprio/memlock it needs for realtime scheduling and wine the max open files it needs for esync.
 +
 
 +
Run jackd with <pre>jackd -d alsa -d hw:0 &</pre>, replace "hw:0" with your output audio device (speakers/headphones) and edit the following file:
 +
 
 +
<pre>~/.asoundrc</pre>
 +
 
 +
<pre>
 +
pcm.!default {
 +
    type plug
 +
    slave { pcm "rawjack" }
 +
}
 +
 
 +
pcm.rawjack {
 +
    type jack
 +
    playback_ports {
 +
        0 system:playback_1
 +
        1 system:playback_2
 +
    }
 +
    capture_ports {
 +
        0 system:capture_1
 +
        1 system:capture_2
 +
    }
 +
}
 +
 
 +
pcm.jack {
 +
    type plug
 +
    slave { pcm "rawjack" }
 +
    hint {
 +
        description "JACK Audio Connection Kit"
 +
    }
 +
}
 +
</pre>
  
Start playing something, then run <code>obs</code>, then add Audio Capture Device (ALSA) to your Sources.
+
Run <pre>obs</pre> and add JACK Input Client to your Sources. Then run <pre>qjackctl</pre> and click Start and then Connect. Drag and drop your program's audio channels to the input client (OBS). You can alternatively use ffmpeg to record using <pre>-f jack -i ffmpeginput</pre>.
  
![OBS with ALSA](https://i.imgur.com/tc1pMRX.png)
+
[[File:Obs_with_jack.png|thumb|right|OBS with JACK]]
  
 
===Bluetooth audio using ALSA===
 
===Bluetooth audio using ALSA===
<code>
+
<pre>
 
sudo emerge bluez-alsa
 
sudo emerge bluez-alsa
 
/etc/init.d/bluealsa start
 
/etc/init.d/bluealsa start
 
blueman-manager &
 
blueman-manager &
</code>
+
</pre>
  
 
~/.asoundrc:
 
~/.asoundrc:
<code>
+
<pre>
 
pcm.!default {
 
pcm.!default {
 
         type bluealsa
 
         type bluealsa
Line 512: Line 531:
 
         profile "a2dp"
 
         profile "a2dp"
 
}
 
}
</code>
+
</pre>
  
 
===Install Quake 3===
 
===Install Quake 3===
<code>
+
<pre>
 
sudo emerge quake3
 
sudo emerge quake3
 
sudo wget https://github.com/nrempel/q3-server/raw/master/baseq3/pak{0..8}.pk3 -P /usr/share/games/quake3/baseq3/
 
sudo wget https://github.com/nrempel/q3-server/raw/master/baseq3/pak{0..8}.pk3 -P /usr/share/games/quake3/baseq3/
 
ioquake3
 
ioquake3
</code>
+
</pre>
  
 
===What is Gentoo?===
 
===What is Gentoo?===
Line 531: Line 550:
  
 
===What is CloverOS Libre?===
 
===What is CloverOS Libre?===
CloverOS Libre doesn't have the <code>sys-kernel/linux-firmware</code> package.
+
CloverOS Libre doesn't have the <pre>sys-kernel/linux-firmware</pre> package.
  
The kernel is the same gentoo-sources with Liquorix config but with https://linux-libre.fsfla.org/pub/linux-libre/releases/5.0.8-gnu/deblob-5.0 ran on it.
+
The kernel is the same gentoo-sources with Liquorix config https://raw.githubusercontent.com/damentz/liquorix-package/master/linux-liquorix/debian/config/kernelarch-x86/config-arch-64 but with https://linux-libre.fsfla.org/pub/linux-libre/releases/5.0.8-gnu/deblob-5.0 ran on it.
  
 
===Turning CloverOS into CloverOS Libre===
 
===Turning CloverOS into CloverOS Libre===
<code>emerge -C linux-firmware</code>
+
<pre>emerge -C linux-firmware</pre>
  
<code>./cloveros_settings.sh</code> l) Update libre kernel
+
<pre>./cloveros_settings.sh</pre> l) Update libre kernel
  
 
Reboot; Advanced options, select -gnu kernel
 
Reboot; Advanced options, select -gnu kernel
  
 
===Turning CloverOS Libre into CloverOS===
 
===Turning CloverOS Libre into CloverOS===
<code>emerge linux-firmware</code>
+
<pre>emerge linux-firmware</pre>
  
<code>./cloveros_settings.sh</code> 4) Update kernel
+
<pre>./cloveros_settings.sh</pre> 4) Update kernel
  
 
Reboot; Advanced options, select -gentoo kernel
 
Reboot; Advanced options, select -gentoo kernel
  
 
===Starting X automatically after login===
 
===Starting X automatically after login===
Edit <code>~/.bash_profile</code>
+
Edit <pre>~/.bash_profile</pre>
  
 
Comment out
 
Comment out
  
<code>read -erp "Start X? [y/n] " -n 1 choice</code>
+
<pre>read -erp "Start X? [y/n] " -n 1 choice</pre>
  
 
And add in
 
And add in
  
<code>choice=y</code>
+
<pre>choice=y</pre>
 +
 
 +
Or any other WM option. You can also set up automatic login by editing <pre>/etc/inittab/</pre>:
 +
 
 +
Replace
 +
 
 +
<pre>c1:12345:respawn:/sbin/agetty --noclear 38400 tty1 linux</pre>
 +
 
 +
with
 +
 
 +
<pre>c1:12345:respawn:/sbin/agetty --autologin <username> --noclear 38400 tty1 linux</pre>
 +
 
 +
Automatic grub choice:
 +
 
 +
<pre>sudo sed -i 's/timeout=5/timeout=0/' /boot/grub/grub.cfg</pre>
  
 
===I want to bypass the mixer to play >48KHz audio / DSD===
 
===I want to bypass the mixer to play >48KHz audio / DSD===
 
Edit ~/.asoundrc:
 
Edit ~/.asoundrc:
  
<code>
+
<pre>
 
pcm.!default {
 
pcm.!default {
 
   type hw
 
   type hw
 
   card 0
 
   card 0
 
}
 
}
</code>
+
</pre>
  
Replace card 0 with your device number
+
Replace "card 0" with your device number
  
 
===Wayland howto===
 
===Wayland howto===
<code>
+
<pre>
 
emerge weston
 
emerge weston
 
useradd weston-launch
 
useradd weston-launch
Line 580: Line 613:
 
modules=xwayland.so' >> ~/.config/weston.ini
 
modules=xwayland.so' >> ~/.config/weston.ini
 
XDG_RUNTIME_DIR=. weston-launch
 
XDG_RUNTIME_DIR=. weston-launch
</code>
+
</pre>
 
 
===Things preventing CloverOS Libre from being 100% free software:===
 
- LiveCD kernel is taken from Gentoo, it needs to be made from scratch
 
  
 +
===Things preventing CloverOS Libre from being EFF-approved===
 
- /usr/portage/ needs to be filtered to not include the .ebuilds of proprietary software, also requiring a separate Portage mirror
 
- /usr/portage/ needs to be filtered to not include the .ebuilds of proprietary software, also requiring a separate Portage mirror
  
Line 590: Line 621:
  
 
===Does CloverOS have binaries?===
 
===Does CloverOS have binaries?===
Yes. It's a pre-setup Gentoo image with <code>PORTAGE_BINHOST="https://cloveros.ga" emerge -G package</code> preset in /etc/portage/make.conf. It uses Gentoo for everything (versions, ebuilds, etc.) and gets packages from cloveros.ga instead of building
+
Yes. It's a pre-setup Gentoo image with <pre>PORTAGE_BINHOST="https://cloveros.ga" emerge -G package</pre> preset in /etc/portage/make.conf. It uses Gentoo for everything (versions, ebuilds, etc.) and gets packages from cloveros.ga instead of building
  
 
===How often is this updated?===
 
===How often is this updated?===
 
It's stable rolling release (Gentoo Stable). The binaries reflect current Portage (amd64) about once a week: http://twitter.com/cloveros_ga
 
It's stable rolling release (Gentoo Stable). The binaries reflect current Portage (amd64) about once a week: http://twitter.com/cloveros_ga
  
===Does everything build with those CFLAGS?===
+
===Does everything build with Ofast, LTO, Graphite?===
 
These are all the packages that don't build with the full CFLAGS: https://gitgud.io/cloveros/cloveros/blob/master/binhost_settings/etc/portage/package.env
 
These are all the packages that don't build with the full CFLAGS: https://gitgud.io/cloveros/cloveros/blob/master/binhost_settings/etc/portage/package.env
  
Line 602: Line 633:
  
 
===Which DE does this come with?===
 
===Which DE does this come with?===
None, it comes with fvwm and a <code>~/.bash_profile</code> that can select/install a DE for you:
+
It comes with fvwm window manager and a <pre>~/.bash_profile</pre> that can select/install a DE for you:
  
![bash profile](https://i.imgur.com/YD4IPRf.png)
+
[[File:Bashprofile.png|thumb|right|.bash_profile]]
  
 
===Installing a DE===
 
===Installing a DE===
Line 612: Line 643:
  
 
===I want to donate/host a mirror===
 
===I want to donate/host a mirror===
Run <code>rsync -av --delete rsync://nl.cloveros.ga/cloveros /your/webserver/location/</code> and link me the https://
+
Run <pre>rsync -av --delete rsync://nl.cloveros.ga/cloveros /your/webserver/location/</pre> and link me the https://
 +
 
 +
===Disabling Intel mitigations for performance===
 +
<pre>
 +
sudo GRUB_CMDLINE_LINUX_DEFAULT="mitigations=off" grub-mkconfig -o /boot/grub/grub.cfg
 +
</pre>
 +
Make sure the computer you run this on has nothing important on it. (Dedicated gaming machines, etc.)
  
 
===Recompiling all packages/kernel with -march=native for performance===
 
===Recompiling all packages/kernel with -march=native for performance===
<code>
+
<pre>
 +
./cloveros_settings.sh c
 
./cloveros_settings.sh 5
 
./cloveros_settings.sh 5
./cloveros_settings.sh c
+
sudo emerge -eDv --jobs=4 --keep-going=y @world
sudo emerge -eDv --jobs=4 --keep-going=y --exclude=nodejs --exclude=qtnetwork @world
 
  
 
sudo emerge gentoo-sources genkernel lz4
 
sudo emerge gentoo-sources genkernel lz4
 
sudo eselect kernel set 1
 
sudo eselect kernel set 1
wget https://raw.githubusercontent.com/damentz/liquorix-package/5.0/linux-liquorix/debian/config/kernelarch-x86/config-arch-64 -O config-arch-64
+
wget https://raw.githubusercontent.com/damentz/liquorix-package/master/linux-liquorix/debian/config/kernelarch-x86/config-arch-64
sed -i "s/CONFIG_CRYPTO_CRC32C=m/CONFIG_CRYPTO_CRC32C=y/; s/CONFIG_FW_LOADER_USER_HELPER=y/CONFIG_FW_LOADER_USER_HELPER=n/; s/CONFIG_I2C_NVIDIA_GPU=/#CONFIG_I2C_NVIDIA_GPU=/" config-arch-64
+
sed -i "s/CONFIG_CRYPTO_CRC32C=m/CONFIG_CRYPTO_CRC32C=y/; s/CONFIG_FW_LOADER_USER_HELPER=y/CONFIG_FW_LOADER_USER_HELPER=n/; s/CONFIG_I2C_NVIDIA_GPU=/#CONFIG_I2C_NVIDIA_GPU=; s/CONFIG_R8169=m/CONFIG_R8169=y/" config-arch-64
 
echo -e "CONFIG_SND_HDA_INPUT_BEEP=y\nCONFIG_SND_HDA_INPUT_BEEP_MODE=0" >> config-arch-64
 
echo -e "CONFIG_SND_HDA_INPUT_BEEP=y\nCONFIG_SND_HDA_INPUT_BEEP_MODE=0" >> config-arch-64
 
wget https://raw.githubusercontent.com/graysky2/kernel_gcc_patch/master/enable_additional_cpu_optimizations_for_gcc_v8.1%2B_kernel_v4.13%2B.patch
 
wget https://raw.githubusercontent.com/graysky2/kernel_gcc_patch/master/enable_additional_cpu_optimizations_for_gcc_v8.1%2B_kernel_v4.13%2B.patch
 
sudo sh -c "patch -d /usr/src/linux/ -p1 < enable_additional_cpu_optimizations_for_gcc_v8.1+_kernel_v4.13+.patch"  
 
sudo sh -c "patch -d /usr/src/linux/ -p1 < enable_additional_cpu_optimizations_for_gcc_v8.1+_kernel_v4.13+.patch"  
 
sed -i "s/CONFIG_GENERIC_CPU=y/CONFIG_MNATIVE=y/;" config-arch-64
 
sed -i "s/CONFIG_GENERIC_CPU=y/CONFIG_MNATIVE=y/;" config-arch-64
sudo binutils-config --linker ld.bfd
+
sudo genkernel --kernel-ld=ld.bfd --kernel-config=config-arch-64 all
sudo genkernel --kernel-config=config-arch-64 all
+
sudo grub-mkconfig -o /boot/grub/grub.cfg
sudo emerge -b @module-rebuild
+
sudo LD=ld.bfd emerge @module-rebuild
sudo binutils-config --linker ld.gold
+
</pre>
sudo GRUB_CMDLINE_LINUX_DEFAULT="kpti=0 l1tf=off pti=off spectre_v2=off spectre_v2_user=off spec_store_bypass_disable=off ssbd=force-off" grub-mkconfig -o /boot/grub/grub.cfg
 
</code>
 
  
Remove the above GRUB_CMDLINE_LINUX_DEFAULT="" var if security is important.
+
To update the system using source: <pre>./cloveros_settings.sh c && sudo emerge --sync && sudo emerge -uavDN world</pre>
  
To update the system using source: <code>./cloveros_settings.sh c && sudo emerge --sync && sudo emerge -uavDN world</code>
+
To remove dbus: <pre>sudo USE="-dbus" emerge -1 glib qtgui && sudo emerge --depclean</pre>
  
To remove dbus: <code>sudo USE="-dbus" emerge -1 glib qtgui && sudo emerge --depclean</code>
+
==Backing up CloverOS binhost example==
  
Certain packages may be from an overlay. To install, add overlays:
+
<pre>
<code>
+
sudo mount /dev/sdb1 /mnt/usb/
sudo emerge eselect-repository
+
rsync -av --delete rsync://cloveros.ga/cloveros /mnt/usb/binhost/
sudo mkdir /etc/portage/repos.conf
+
sudo PKGDIR="/mnt/usb/binhost/" emerge -K [package]
sudo eselect repository enable $(grep -Po "(?<=\*/\*::).*" /etc/portage/package.mask | tr "\n" " ")
+
</pre>
sudo emerge --sync
 
</code>
 
  
 
===What if CloverOS dies? Will my install become useless?===
 
===What if CloverOS dies? Will my install become useless?===
No. Switch to source by running <code>./cloveros_settings.sh 5</code>
+
No. Just switch to source and manage it like any other Gentoo install. See Switching to source.
 
 
Or:
 
 
 
Edit <code>/etc/portage/make.conf</code> and edit the following line:
 
 
 
<code>EMERGE_DEFAULT_OPTS="--keep-going=y --autounmask-write=y --jobs=4 -G"</code>
 
 
 
to
 
 
 
<code>EMERGE_DEFAULT_OPTS="--keep-going=y --autounmask-write=y --jobs=4"</code>
 
 
 
and comment out the following lines, eg:
 
 
 
<code>
 
ACCEPT_KEYWORDS="**"
 
FETCHCOMMAND_HTTPS="...
 
</code>
 
 
 
to
 
 
 
<code>
 
#ACCEPT_KEYWORDS="**"   
 
#FETCHCOMMAND_HTTPS="...
 
</code>
 
 
 
Your system is now Gentoo Linux.
 
 
 
After emerge determines what it needs to install and checks dependencies, the -G switch tells emerge to check the binhost before it starts building source. Removing -G reverts to regular emerge operation. It's exactly the same as running <code>PORTAGE_BINHOST="https://cloveros.ga" emerge -G package</code> on any Gentoo install. Because it still uses Gentoo repo (versions, ebuilds), and only uses CloverOS as a binhost, you still need to run <code>emerge --sync</code>.
 
 
 
CloverOS is a default Gentoo install with programs and with the above defaulted in <code>/etc/portage/make.conf</code>. There's also some configuration files and scripts in the user's home directory for making things easier. With those files removed, CloverOS becomes a default Gentoo install.
 
  
You can see exactly what's done here: https://gitgud.io/cloveros/cloveros/blob/master/livecd_build.sh
+
You can see what CloverOS adds to a default Gentoo install here: https://gitgud.io/cloveros/cloveros/blob/master/livecd_build.sh

Latest revision as of 17:26, 21 February 2020

CloverOS GNU/Linux desktop

Logo.png

CloverOS GNU/Linux is a minimal (middleware-free) and default out-of-the-box Gentoo image (stage4), a performance-optimized packages repo (Binhost) and the scripts that create them.

Objectives: Lowest RAM usage desktop, no changes to Gentoo and kept as default as possible, easily install any package in its ideal form with emerge, easy out-of-the-box desktop, best CFLAGS

Contents

System Requirements

x86_64 CPU that supports SSSE3 (Core 2 Duo, AMD FX and higher), 5GB of disk space

Copying iso to usb drive:

dd if=CloverOS-x86_64-date.iso of=/dev/sdx bs=4M ; sync

Cheat sheet

Installing program

sudo emerge filezilla

Upgrading system

sudo emerge --sync
sudo emerge -uavD @world
sudo emerge --depclean

Updating config files after upgrading system (Optional)

sudo dispatch-conf

After you run it, it will show you the changes to config files it's going to make:

q To quit without making changes

u To update and make the changes

z To zap and disregard the changes

Hit z if you're not sure or wish to keep your configuration files the same.

Controlling fvwm

Open Applications menu: right click on desktop

Move windows: alt + left click

Resize Windows: alt + right click

Open Applications menu anywhere: alt + middle click

Switch windows: alt + tab and shift + alt + tab

Switch desktops: ctrl + shift + up/down/left/right (desktops are in a 3x3 grid)

Take screenshot: Print Screen

Lock: super + L

Brightness controls: Laptop (software) Brightness up/down keys

Volume control: Laptop (software) Volume up/down keys

fvwm's settings are in

~/.fvwm2rc

Setting default sound device

Run

./cloveros_settings.sh 3

Or:

Run

alsamixer

and hit F6 to see your audio devices. To make 1 the default device, edit

~/.asoundrc

and add this:

defaults.pcm.card 1
defaults.ctl.card 1

Included software

Window manager - fvwm

Terminal - urxvt

File manager - spacefm

Wifi configuration - wpa_gui

Browser - firefox

Text editor - emacs

Graphic editor - gimp

Video player - smplayer / mpv

Image Viewer - nomacs

Archiver - xarchiver

FTP client - sshfs / curlftpfs

Torrent client - rtorrent

IRC client - weechat

Listing available packages

Use

porthole

or

eix

Web interface: https://packages.gentoo.org

List of binaries (no dependencies): https://gitgud.io/cloveros/cloveros/blob/master/binhost_settings/var/lib/portage/world

List of all binaries: https://cloveros.ga/s/packages.html

Package isn't available

Make an issue so I can add the package to binhost. In the meantime, install from source using

~/cloveros_settings.sh 5 ; sudo emerge [package] ; ~/cloveros_settings.sh 5

Switching to source

Switch to source by running

./cloveros_settings.sh 5

Or:

Edit

/etc/portage/make.conf

and edit the following lines:

EMERGE_DEFAULT_OPTS="--keep-going=y --autounmask-write=y --jobs=4 -G"
ACCEPT_KEYWORDS="**"
FETCHCOMMAND_HTTPS="...

to

#EMERGE_DEFAULT_OPTS="--keep-going=y --autounmask-write=y --jobs=4 -G"
#ACCEPT_KEYWORDS="**"
#FETCHCOMMAND_HTTPS="...

This disables the binhost and uses Portage's ebuilds for packages. Now you can emerge from source.

Run

./cloveros_settings.sh c

to get the CloverOS Portage configuration.

FAQ

What is CloverOS?

It's a default Gentoo install with a binary packages repo. I made it to make my life easier.

How do I install systemd/avahi/pulseaudio?

Switch to source and then emerge

Nvidia card crashes on boot with a green screen

/etc/modprobe.d/blacklist.conf:

blacklist vga16fb
blacklist nouveau
blacklist rivafb
blacklist nvidiafb
blacklist rivatv

/boot/grub/grub.cfg:

linux   /boot/kernel-genkernel-x86_64-[ver]-gentoo root=UUID=[id] ro nomodeset nouveau.modeset=0

Using old Radeon card with new video drivers

sudo rmmod -f radeon && sudo modprobe amdgpu si_support=1

Installing proprietary Nvidia drivers

sudo EMERGE_DEFAULT_OPTS="" emerge \=gentoo-sources-$(uname -r | sed 's/-.*//')
sudo eselect kernel set linux-$(uname -r)
sudo wget https://raw.githubusercontent.com/damentz/liquorix-package/$(uname -r | sed 's/\.[^.]*$//')/linux-liquorix/debian/config/kernelarch-x86/config-arch-64 -O /usr/src/linux/.config
sudo sed -i "s/CONFIG_CRYPTO_CRC32C=m/CONFIG_CRYPTO_CRC32C=y/; s/CONFIG_FW_LOADER_USER_HELPER=y/CONFIG_FW_LOADER_USER_HELPER=n/; s/CONFIG_I2C_NVIDIA_GPU=/#CONFIG_I2C_NVIDIA_GPU=; s/CONFIG_R8169=m/CONFIG_R8169=y/" /usr/src/linux/.config
sudo emerge nvidia-drivers
sudo depmod
sudo eselect opengl set nvidia
sudo eselect opencl set nvidia
sudo sh -c 'echo -e "blacklist nouveau\nblacklist vga16fb\nblacklist rivafb\nblacklist nvidiafb\nblacklist rivatv" >> /etc/modprobe.d/blacklist.conf'

Reboot

or

Kill X,

sudo rmmod -f nouveau vga16fb rivafb nvidiafb rivatv && sudo modprobe nvidia

and restart X

Installing bumblebee for laptops

This is for laptops that have both Intel GPU and Nvidia GPU with Optimus

sudo emerge bumblebee
sudo depmod
sudo sed -i 's/^Driver=$/Driver=nvidia/; s/^Bridge=auto$/Bridge=primus/; s/^VGLTransport=proxy$/VGLTransport=rgb/; s@^PrimusLibraryPath=/usr/lib/primus:/usr/lib32/primus$@PrimusLibraryPath=/usr/lib/primus:/usr/lib32/primus:/usr/lib64/primus@; s/^KernelDriver=$/KernelDriver=nvidia/; s/^PMMethod=auto$/PMMethod=bbswitch/; s@^LibraryPath=$@LibraryPath=/usr/lib64/opengl/nvidia/lib:/usr/lib/opengl/nvidia/lib@; s@^XorgModulePath=$@XorgModulePath=/usr/lib64/opengl/nvidia/lib,/usr/lib64/opengl/nvidia/extensions,/usr/lib64/xorg/modules/drivers,/usr/lib64/xorg/modules@' /etc/bumblebee/bumblebee.conf

Depending on how new your laptop is, you will need to enable

GRUB_CMDLINE_LINUX_DEFAULT="acpi_osi=Linux nogpumanager"

in

/etc/default/grub

and use

sudo grub-mkconfig -o /boot/grub/grub.cfg

to have bbswitch manage your gpu on the next reboot

Installing VirtualBox

sudo emerge virtualbox
sudo depmod
./cloveros_settings.sh 4
sudo useradd -g $USER vboxusers
sudo modprobe -a vboxdrv vboxnetadp vboxnetflt

Reboot if your kernel isn't up to date.

Wine with esync

First run:

sudo sh -c "echo $USER\ N524288 >> /etc/limits"

To enable esync, use environment variable

export WINEESYNC=1

This can be added to

~/.zshrc

or

~/.bashrc

Steam stops working

Start steam with

rm -R ~/.steam/ && steam &

What are USE flags?

/etc/portage/package.use

generally determines what your Gentoo install will look like. The first thing new Gentoo users should do is read the USE flags for their packages.

https://packages.gentoo.org/packages/media-gfx/gimp

There's two types of USE flags that are treated equally: global and local.

Global USE flags are the ones that are in many packages, they generally do the same thing no matter what package uses them.

Local USE flags are the ones that are in a few packages and require you to read https://packages.gentoo.org to read what they do. You can also read the .ebuild to get an even better idea of what it does.

USE flags are basically ./configure parameters made easy.

Examples here:

https://gitgud.io/cloveros/cloveros/blob/master/binhost_settings/etc/portage/make.conf

https://gitgud.io/cloveros/cloveros/blob/master/binhost_settings/etc/portage/package.use

What are keywording and unmasking?

https://packages.gentoo.org/packages/media-gfx/gimp

See the green and the yellow? Green means you can just

emerge gimp

and get that version. But what if you want 2.9? It's keyworded, which means it isn't stable.

Gentoo Stable is using packages that aren't keyworded, as in they're tested and guaranteed to work.

Just add media-gfx/gimp to /etc/portage/package.keywords and you'll get the latest keyworded (Yellow) version.

Masked (Red) is just another step forward of keywording and the file is at /etc/portage/package.unmask

You can unmask or unkeyword a specific version by doing =media-gfx/gimp-2.9.6

Emerge error relating to openssl, fix OpenGL 3/4 not working

This is a general Gentoo thing. Add this to

/etc/portage/package.use

:

dev-libs/openssl -bindist
net-misc/openssh -bindist
media-libs/mesa -bindist

GPU passthrough example

# fallocate -l 32GB drive && lspci

sudo sh -c '
modprobe vfio-pci
devices=(01:00.0 01:00.1 00:12.0 00:12.2)

for devid in ${devices[@]}; do devid=0000:$devid
	echo $(</sys/bus/pci/devices/$devid/vendor) $(</sys/bus/pci/devices/$devid/device) > /sys/bus/pci/drivers/vfio-pci/new_id
	echo $devid > /sys/bus/pci/devices/$devid/driver/unbind
	echo $devid > /sys/bus/pci/drivers/vfio-pci/bind
	echo $(</sys/bus/pci/devices/$devid/vendor) $(</sys/bus/pci/devices/$devid/device) > /sys/bus/pci/drivers/vfio-pci/remove_id
done

qemu-system-x86_64 -enable-kvm -m 4G -cpu host -smp cores=8,threads=1 -vga none -display none -cdrom windows.iso -drive if=pflash,format=raw,readonly,file=/usr/share/edk2-ovmf/OVMF_CODE.fd -drive if=pflash,format=raw,file=/usr/share/edk2-ovmf/OVMF_VARS.fd -drive file=drive,format=raw $(sed "s/ / -device vfio-pci,host=/g" <<< \ ${devices[@]})

for devid in ${devices[@]}; do devid=0000:$devid
	echo 1 > /sys/bus/pci/devices/$devid/remove
	echo 1 > /sys/bus/pci/rescan
done
'

Change FVWM titlebar color

color=69aEb6; sed -i "s/\(Style \* BackColor \).*/\1#$color/; s/\(Style \* HilightBack \).*/\1#$color/; s/\(Colorset 1 bg #\)......\(.*\)/\1$color\2/" ~/.fvwm2rc && killall fvwm && fvwm &

Alternatively, replace every instance of #056839 (green) manually.

KDE theme in qt5 programs without KDE

sudo emerge qt5ct breeze
QT_QPA_PLATFORMTHEME="qt5ct" qt5ct
QT_QPA_PLATFORMTHEME="qt5ct" your_program

Open qt5ct and switch the style and the icon theme to Breeze.

Breeze theme

Firefox and Pulseaudio

Firefox 57+ still works with ALSA. If this changes, it will be built with apulse.

Enable tap to click on touchpads

xinput set-prop "SynPS/2 Synaptics TouchPad" "libinput Tapping Enabled" 1

Disable mouse acceleration

xinput list --id-only | xargs -I{} xinput set-prop {} "libinput Accel Profile Enabled" 0 1 &>/dev/null

Suspend when laptop lid is closed

First run

emerge acpid && /etc/init.d/acpid start

Edit

/etc/acpi/default.sh

:

#!/bin/sh
# /etc/acpi/default.sh
# Default acpi script that takes an entry for all actions

set $*

group=${1%%/*}
action=${1#*/}
device=$2
id=$3
value=$4

log_unhandled() {
	logger "ACPI event unhandled: $*"
}

case "$group" in
	button)
		case "$action" in
			lid)
				case "$id" in
					close) echo -n mem > /sys/power/state;;
				esac
				;;

			power)
				/etc/acpi/actions/powerbtn.sh
				;;

			# if your laptop doesnt turn on/off the display via hardware
			# switch and instead just generates an acpi event, you can force
			# X to turn off the display via dpms.  note you will have to run
			# 'xhost +local:0' so root can access the X DISPLAY.
			#lid)
			#	xset dpms force off
			#	;;

			*)	log_unhandled $* ;;
		esac
		;;

	ac_adapter)
		case "$value" in
			# Add code here to handle when the system is unplugged
			# (maybe change cpu scaling to powersave mode).  For
			# multicore systems, make sure you set powersave mode
			# for each core!
			#*0)
			#	cpufreq-set -g powersave
			#	;;

			# Add code here to handle when the system is plugged in
			# (maybe change cpu scaling to performance mode).  For
			# multicore systems, make sure you set performance mode
			# for each core!
			#*1)
			#	cpufreq-set -g performance
			#	;;

			*)	log_unhandled $* ;;
		esac
		;;

	*)	log_unhandled $* ;;
esac

Dnscrypt-proxy howto

sudo emerge dnscrypt-proxy
sudo /etc/init.d/dnscrypt-proxy start
sudo rc-config add dnscrypt-proxy
sudo sh -c 'echo "static domain_name_servers=127.0.0.1" >> /etc/dhcpcd.conf'
sudo /etc/init.d/dhcpcd restart

Clean outdated kernels

sudo find /boot/ /lib/modules/ -mindepth 1 -maxdepth 1 -name \*gentoo\* ! -name \*$(uname -r) -exec rm -R {} \;

Sound in OBS / Open Broadcaster Software using ALSA

Run

sudo modprobe snd_aloop

and edit the following file, replacing "device 0" and "hw:0,0" with your sound device:

~/.asoundrc
    pcm.!default {
      type asym
      playback.pcm "LoopAndReal"
      capture.pcm "looprec"
    }

    pcm.looprec {
        type hw
        card "Loopback"
        device 0
        subdevice 1
    }

    pcm.LoopAndReal {
      type plug
      slave.pcm mdev
      route_policy "duplicate"
    }

    pcm.mdev {
      type multi
      slaves.a.pcm pcm.MixReale
      slaves.a.channels 2
      slaves.b.pcm pcm.MixLoopback
      slaves.b.channels 2
      bindings.0.slave a
      bindings.0.channel 0
      bindings.1.slave a
      bindings.1.channel 1
      bindings.2.slave b
      bindings.2.channel 0
      bindings.3.slave b
      bindings.3.channel 1
    }

    pcm.MixReale {
      type dmix
      ipc_key 1024
      slave {
        pcm "hw:0,0"
        rate 48000
        periods 128
        period_time 0
        period_size 1024
        buffer_size 8192
      }
    }

    pcm.MixLoopback {
      type dmix
      ipc_key 1025
      slave {
        pcm "hw:Loopback,0,0"
        rate 48000
        periods 128
        period_time 0
        period_size 1024
        buffer_size 8192
      }
    }

Start playing something, then run

obs

, then add Audio Capture Device (ALSA) to your Sources. You can alternatively use ffmpeg to record using

-f alsa -i hw:Loopback,1,0

or

-f alsa -i looprec

.

OBS with ALSA

Sound in OBS / Open Broadcaster Software using JACK

First get jack, alsa-plugins and qjackctl with

sudo emerge jack-audio-connection-kit alsa-plugins qjackctl

and add the following line to file, replacing "user" with your Linux username:

/etc/limits
user N524288 O99 M5300658

This gives jackd the rtprio/memlock it needs for realtime scheduling and wine the max open files it needs for esync.

Run jackd with

jackd -d alsa -d hw:0 &

, replace "hw:0" with your output audio device (speakers/headphones) and edit the following file:

~/.asoundrc
pcm.!default {
    type plug
    slave { pcm "rawjack" }
}

pcm.rawjack {
    type jack
    playback_ports {
        0 system:playback_1
        1 system:playback_2
    }
    capture_ports {
        0 system:capture_1
        1 system:capture_2
    }
}

pcm.jack {
    type plug
    slave { pcm "rawjack" }
    hint {
        description "JACK Audio Connection Kit"
    }
}

Run

obs

and add JACK Input Client to your Sources. Then run

qjackctl

and click Start and then Connect. Drag and drop your program's audio channels to the input client (OBS). You can alternatively use ffmpeg to record using

-f jack -i ffmpeginput

.

OBS with JACK

Bluetooth audio using ALSA

sudo emerge bluez-alsa
/etc/init.d/bluealsa start
blueman-manager &

~/.asoundrc:

pcm.!default {
        type bluealsa
        device "RE:PL:AC:E:TH:IS"
        profile "a2dp"
}

Install Quake 3

sudo emerge quake3
sudo wget https://github.com/nrempel/q3-server/raw/master/baseq3/pak{0..8}.pk3 -P /usr/share/games/quake3/baseq3/
ioquake3

What is Gentoo?

Gentoo is a meta-distro. You can make any distro you want out of it. You can have a package.use/package.keywords that makes a binary-compatible Debian or Fedora or Arch or whatever. If there's something you don't like about Gentoo, you can just edit /etc/portage/package.use. Using Gentoo is like distro-hopping around the same distro. Also, by building everything yourself, that's one less botnet. If you have a problem with a package or the package doesn't exist, just add an overlay or write an ebuild and put it in your local portage directory and emerge.

Is this an overlay?

No, this uses regular Gentoo Portage only. Same versions and USE flag options.

Benefits of Gentoo/CloverOS over other distros

No systemd, maximized CFLAGS, lower RAM usage, it's Gentoo, package versions are stable, it's as default as possible while still being easy, has Infinality, UTF-8 and user groups configured, installs in 2 minutes, saves time by doing all the little things you would've done anyway.

What is CloverOS Libre?

CloverOS Libre doesn't have the

sys-kernel/linux-firmware

package.

The kernel is the same gentoo-sources with Liquorix config https://raw.githubusercontent.com/damentz/liquorix-package/master/linux-liquorix/debian/config/kernelarch-x86/config-arch-64 but with https://linux-libre.fsfla.org/pub/linux-libre/releases/5.0.8-gnu/deblob-5.0 ran on it.

Turning CloverOS into CloverOS Libre

emerge -C linux-firmware
./cloveros_settings.sh

l) Update libre kernel

Reboot; Advanced options, select -gnu kernel

Turning CloverOS Libre into CloverOS

emerge linux-firmware
./cloveros_settings.sh

4) Update kernel

Reboot; Advanced options, select -gentoo kernel

Starting X automatically after login

Edit

~/.bash_profile

Comment out

read -erp "Start X? [y/n] " -n 1 choice

And add in

choice=y

Or any other WM option. You can also set up automatic login by editing

/etc/inittab/

:

Replace

c1:12345:respawn:/sbin/agetty --noclear 38400 tty1 linux

with

c1:12345:respawn:/sbin/agetty --autologin <username> --noclear 38400 tty1 linux

Automatic grub choice:

sudo sed -i 's/timeout=5/timeout=0/' /boot/grub/grub.cfg

I want to bypass the mixer to play >48KHz audio / DSD

Edit ~/.asoundrc:

pcm.!default {
  type hw
  card 0
}

Replace "card 0" with your device number

Wayland howto

emerge weston
useradd weston-launch
gpasswd -a youruser weston-launch
echo '[core]
modules=xwayland.so' >> ~/.config/weston.ini
XDG_RUNTIME_DIR=. weston-launch

Things preventing CloverOS Libre from being EFF-approved

- /usr/portage/ needs to be filtered to not include the .ebuilds of proprietary software, also requiring a separate Portage mirror

- It needs a cloveros.ga mirror that doesn't host the non-free software packages

Does CloverOS have binaries?

Yes. It's a pre-setup Gentoo image with

PORTAGE_BINHOST="https://cloveros.ga" emerge -G package

preset in /etc/portage/make.conf. It uses Gentoo for everything (versions, ebuilds, etc.) and gets packages from cloveros.ga instead of building

How often is this updated?

It's stable rolling release (Gentoo Stable). The binaries reflect current Portage (amd64) about once a week: http://twitter.com/cloveros_ga

Does everything build with Ofast, LTO, Graphite?

These are all the packages that don't build with the full CFLAGS: https://gitgud.io/cloveros/cloveros/blob/master/binhost_settings/etc/portage/package.env

The default shell is bash but fvwm launches urxvt -e zsh?

This is done to keep it as default as possible.

Which DE does this come with?

It comes with fvwm window manager and a

~/.bash_profile

that can select/install a DE for you:

.bash_profile

Installing a DE

First, connect to wifi using wpa_gui ('wifi' in fvwm)

Kill X and re-login. After you log in and the "Start X?" dialog pops up, instead of y/n, type one of the WM options and hit y when it asks to install.

I want to donate/host a mirror

Run

rsync -av --delete rsync://nl.cloveros.ga/cloveros /your/webserver/location/

and link me the https://

Disabling Intel mitigations for performance

sudo GRUB_CMDLINE_LINUX_DEFAULT="mitigations=off" grub-mkconfig -o /boot/grub/grub.cfg

Make sure the computer you run this on has nothing important on it. (Dedicated gaming machines, etc.)

Recompiling all packages/kernel with -march=native for performance

./cloveros_settings.sh c
./cloveros_settings.sh 5
sudo emerge -eDv --jobs=4 --keep-going=y @world

sudo emerge gentoo-sources genkernel lz4
sudo eselect kernel set 1
wget https://raw.githubusercontent.com/damentz/liquorix-package/master/linux-liquorix/debian/config/kernelarch-x86/config-arch-64
sed -i "s/CONFIG_CRYPTO_CRC32C=m/CONFIG_CRYPTO_CRC32C=y/; s/CONFIG_FW_LOADER_USER_HELPER=y/CONFIG_FW_LOADER_USER_HELPER=n/; s/CONFIG_I2C_NVIDIA_GPU=/#CONFIG_I2C_NVIDIA_GPU=; s/CONFIG_R8169=m/CONFIG_R8169=y/" config-arch-64
echo -e "CONFIG_SND_HDA_INPUT_BEEP=y\nCONFIG_SND_HDA_INPUT_BEEP_MODE=0" >> config-arch-64
wget https://raw.githubusercontent.com/graysky2/kernel_gcc_patch/master/enable_additional_cpu_optimizations_for_gcc_v8.1%2B_kernel_v4.13%2B.patch
sudo sh -c "patch -d /usr/src/linux/ -p1 < enable_additional_cpu_optimizations_for_gcc_v8.1+_kernel_v4.13+.patch" 
sed -i "s/CONFIG_GENERIC_CPU=y/CONFIG_MNATIVE=y/;" config-arch-64
sudo genkernel --kernel-ld=ld.bfd --kernel-config=config-arch-64 all
sudo grub-mkconfig -o /boot/grub/grub.cfg
sudo LD=ld.bfd emerge @module-rebuild

To update the system using source:

./cloveros_settings.sh c && sudo emerge --sync && sudo emerge -uavDN world

To remove dbus:

sudo USE="-dbus" emerge -1 glib qtgui && sudo emerge --depclean

Backing up CloverOS binhost example

sudo mount /dev/sdb1 /mnt/usb/
rsync -av --delete rsync://cloveros.ga/cloveros /mnt/usb/binhost/
sudo PKGDIR="/mnt/usb/binhost/" emerge -K [package]

What if CloverOS dies? Will my install become useless?

No. Just switch to source and manage it like any other Gentoo install. See Switching to source.

You can see what CloverOS adds to a default Gentoo install here: https://gitgud.io/cloveros/cloveros/blob/master/livecd_build.sh