[LINUX] Building the strongest environment after introducing Manjaro to Dell XPS 15

Introduction

Based on the fact that Manjaro installation and basic settings have been completed, this is a memorandum of subsequent settings. Please refer to others for installation etc. Assuming the Dell XPS15 7590 model. Please let me know if there is a better setting. Also, update accordingly.

As a background, I got a MacBook Pro and a Dell XPS15 7590 on my work machine, but I had a MacBook Pro as my main development machine, but last night I had a problem that keyboard did not work, so I got it with a repair program Since I will be away from the Dell machine, I hurriedly put the Dell machine in the development environment. This time, I made a note of the settings that I tend to forget after putting Manjaro in the XPS 15 7590. By the way, my Linux history is about 20 years +, and my personal distro itinerary is Redhat => Ubuntu => Mint => Manjaro => Archlinux => Manjaro (here and now), but I still don't know anything. .. Akan. .. Linux has a high degree of freedom, so you can customize it in various ways, but if you stick to the GUI, dozens of hours of precious time will melt, so if you are not careful, you will be abandoned like me because of your main business. Absolutely no Conky.

The specifications of XPS15 7590 have been improved with the following hardware. It is quite the strongest at the moment. I use it by connecting it to Eizo's external LCD. 12 cores are used up, but there is still plenty of memory. If I port it to Docker or something from now on, I think it will be used up. The number of cores may be the bottleneck. By the way, the specs are good even if it is improved to a new one, but the power consumption is high, and if you run various applications you are developing, the battery will run out in about 3 hours. .. --Storage: 1TB (1TB PCIe NVMe M.2) --Memory: 64GB (PC4-21300 DDR4-2666 32GBx2)

Self-discipline

The work client machine, so as not to melt the time --Do not customize the GUI. Especially ** Conky ** is dangerous --Don't mess around with the kernel. Especially ** vanilla ** is dangerous --Use the default app mainly --Distro Doesn't shift. Especially ** Archlinux ** is dangerous --Back up as appropriate with timeshift-launcher --Prepare Boot USB just in case. Especially when playing around ** X **

desktop

So, for now, the desktop looks like this. I want to make my desktop gorgeous with Conky, but I'm holding back. The company's Google Drive is always connected by Stream using Fuse, the development machine is also mounted from the Thunar shortcut and easy to handle, and there is no complaint with visual studio code over ssh! The external display of EIZO can be used without any problem, which is wonderful! screenshot.png

Compile options

With makepkg, set up to compile to the best package for your machine.

terminal


$ sudo vim /etc/makepkg.conf

Please refer to the Gentoo Wiki for detailed option explanations. Refer to here for the architecture name. To put it simply, setting the O flag to 3 or more has no effect. 2 is recommended.

-O flag: This controls the overall optimization level, but especially by increasing this optimization level, the source code will take some time to compile and will use more memory. ..

-pipe flag: This flag has no effect on the generated binaries themselves, but it reduces compile time. This tells you to use a pipe instead of a temporary file between each process in compilation. This will use a lot of memory. For systems with insufficient memory, GCC may be killed. Do not use this flag in such cases.

/etc/makepkg.conf


CFLAGS="-march=skylake -O2 -pipe"
CXXFLAGS=${CFLAGS}
MAKEFLAGS="-j$(($(nproc)+1))"
PACKAGER="<Name>"`

Automatic key addition

config:~/.gnupg/gpg.conf


keyserver-options auto-key-retrieve
auto-key-locate hkp://pool.sks-keyservers.net

Settings for PKG BUILDS

Set to be asked to overwrite PKG BUILDS when installing via yay

terminal


$ yay --editmenu --nodiffmenu --save

Custom kernel installation

For example, if you want to put in a custom kernel [^ 1], it looks like this. This time, install xanmod. However, there are cases where the original Manjaro is faster, so it is not necessary to install a custom kernel so much, but if you have time to play, please [^ 1]: Be careful of getting stuck こんなロゴ

terminal


$ mkdir -p ~/opt/src #Create folder for build
$ cd ~/opt/src #Move to build folder
$ yay -G linux-xanmod #xanmod kernel download
$ cd linux-xanmod #Move to folder

And change the parameters according to the microarchitecture

~/opt/src/linux-xanmod/PKGBUILDS


_microarchitecture=42

Then compile

terminal


$ makepkg -s

Install the finished package

terminal


$ tree -sh
.
├── [3.7K]  0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-CLONE_NEWUSER.patch
├── [4.1K]  choose-gcc-optimization.sh
├── [ 983]  linux-5.5.tar.sign
├── [106M]  linux-5.5.tar.xz
├── [828K]  patch-5.5.13-xanmod1.xz
├── [557K]  patch-5.5.13.xz
├── [ 12K]  PKGBUILD
└── [4.0K]  src

$ sudo pacman -U ./*.tar.xz

Library build

Create a package that suits your architecture and try to optimize it.

terminal


$ cd ~/opt/src
$ yay -G glibc
$ cd glibc
$ makepkg -si 

Download the source with the above pattern (yay -G), build and install the following library / app

atom dropbox glibc gtk2 gtkmm3 libglademm chromium glade gtk3 libglade libxml2

Required package installation

A package to put in with pacman. Here and there, you can use whatever you need.

terminal


$ sudo pacman -Syu yay vim wget curl atom fcitx-im fcitx-mozc fcitx-configtool jq sysstat plank unrar p7zip unarchiver

Package to put in yay. Here and there, you can use whatever you need.

terminal


$ sudo yay dropbox libglademm slack-desktop visual-studio-code-bin

Japanese environment settings

To use Mozc

~/.xprofile


export XMODIFIERS="@im=fcitx"
export XMODIFIER="@im=fcitx"
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
export DefaultIMModule=fcitx

~/.zshrc


export GTK_IM_MODULE=fcitx
export XMODIFIERS=@im=fcitx
export QT_IM_MODULE=fcitx

Get the Gruvbox Color Schema

Get various app schemas and apply them to your apps

terminal


$ git clone https://github.com/morhetz/gruvbox-contrib

Font I like this too. I'm putting Ricty for the time being.

terminal


$ git clone https://github.com/edihbrandon/RictyDiminished.git
$ cp RictyDiminished/*.ttf ~/.local/share/fonts/
$ fc-cache -f -v

zsh settings

In the past, I added it by referring to the pages of various smart people, but since there are various machines and I want to reduce environment dependence as much as possible, I will omit it as much as possible and keep it simple. ..

~/.zshrc



#Locale
export LC=en_US.UTF-8
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8

#Mozc
export GTK_IM_MODULE=fcitx
export XMODIFIERS=@im=fcitx
export QT_IM_MODULE=fcitx

##################
#  Global setting
##################
export EDITOR=vim #Set editor to vim

#Prompt settings
#PROMPT='[%~:%n] %# '
PROMPT='[%n@%m] %# '
RPROMPT='[%d]'

# history
HISTFILE=~/.zsh_hist
#Number of histories stored in memory
HISTSIZE=10000
#Number of histories saved in the file specified by HISTFILE
SAVEHIST=10000
setopt extended_history #Save execution time in history
setopt hist_ignore_dups #Do not add the same command as before to history

#You can operate like vi
bindkey -v

#Complement
autoload -Uz compinit
compinit

#Add the cd destination directory to the directory stack
setopt auto_pushd

#When pushedd, if the directory is already on the stack, it will not be added to the stack
setopt pushd_ignore_dups

#Correct the spelling of the command
setopt correct

# <Tab>After displaying the path name completion candidates with
#continue<Tab>You will be able to select a path name from the candidates by pressing
zstyle ':completion:*:default' menu select=1

autoload colors
zstyle ':completion:*' list-lolors "${LS_COLORS}"

#Run ls after cd

chpwd() { ls -ltrG  }

##################
##    Alias
##################
alias pac_list="pacman -Qqen"
alias yay_list="pacman -Qqem"
alias ug="sudo pacman -Syyu && yay"
alias ssdtrim="echo 'sudo fstrim -v /';sudo fstrim -v /"
alias io="iostat -x | awk '{if (NF>7){printf \"%-10s%10s%10s%10s%10s%10s%10s\n%-10s%10s%10s%10s%10s%10s%10s\n\",\$1,\$2,\$3,\$4,\$5,\$6,\$7,\"\",\$8,\$9,\$10,\$11,\$12,\$13,\$14}else print}'"

So, the Function part becomes long, so here, break once and it will be the Function part of Zsh.

~/.zshrc


##################
##   Functions
##################
# ex - archive extractor
# usage: ex <file>
function ex() {
  if [ -f $1 ] ; then
    case $1 in
      *.tar.bz2)   tar xjf $1   ;;
      *.tar.gz)    tar xzf $1   ;;
      *.bz2)       bunzip2 $1   ;;
      *.rar)       unrar x $1     ;;
      *.gz)        gunzip $1    ;;
      *.tar)       tar xf $1    ;;
      *.tbz2)      tar xjf $1   ;;
      *.tgz)       tar xzf $1   ;;
      *.zip)       unzip $1     ;;
      *.Z)         uncompress $1;;
      *.7z)        7z x $1      ;;
      *)           echo "'$1' cannot be extracted via ex()" ;;
    esac
  else
    echo "'$1' is not a valid file"
  fi
}

# fx - foreign exchange
# usage: fx <FROM CURRENCY> <TO CURRENCY>
function fx() {
  rate=`wget https://rate-exchange-1.appspot.com/currency\?from=$1\&to=$2 -q -O - | jq -r ".from,.rate,.to" | tr '\n' ',' | awk -F, '{print "1 "$1"="$2" "$3}'`
  echo "$rate"
}

# mem - Calcurate memory
# usage: mem
function mem() {
  free | awk -v param="$1" '
  BEGIN{
    total=0;used=0;available=0;rate=0;
  }

  /^Mem:/{
    total=$2;
    available=$7;
  }

  END{
    used=total-available;
    rate=100*used/total;
    totalG= total/1024/1024;
    usedG=used/1024/1024;
    availableG=available/1024/1024;

    switch(param){
      case "rate" :
        printf("%02.1f % \n",rate);
        break
      case "free" :
        printf("%2.2f GB\n",availableG);
        break
      case "used" :
        printf("%2.2f GB\n",usedG);
        break
      case "total":
        printf("%.2f GB\n",totalG);
        break
      default:
        printf("Used Rate: %02.1f % \n",rate);
        printf("Available: %2.2f GB\n",availableG);
        printf("Used:\t   %2.2f GB\n",usedG);
        printf("Total:\t   %.2f GB\n",totalG);
        break
    }
  }';
}

vim settings

Simple settings such as vim's Gruvbox schema. It seems that there are various package managers, but for the time being, at the major Vundle

terminal


$ mkdir -p .vim
$ git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim

Setting

~/.vimrc


set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()

Plugin 'VundleVim/Vundle.vim'

"The plugins you want to install are listed below
" Plugin '[Github Author]/[Github repo]'Fill in in the format of
Plugin 'airblade/vim-gitgutter'
Plugin 'morhetz/gruvbox'

call vundle#end()
filetype plugin indent on

"Write other custom settings below
syntax enable
set background=dark
colorscheme gruvbox

Run

$ vim +PluginInstall +qall 

Then it looks like this Screenshot_2020-04-05_15-27-06.png

plank settings

After all, Dock is convenient. So I set it up quickly. Auto start setting

config:~/.config/autostart/Plank.desktop


[Desktop Entry]
Encoding=UTF-8
Version=0.9.4
Type=Application
Name=Plank
Comment=dock
Exec=plank
OnlyShowIn=XFCE;
RunHook=0
StartupNotify=false
Terminal=false
Hidden=false

In addition, Plank to your liking

terminal


$ plank --preferences

Then it looks like this Screenshot_2020-04-05_17-04-06.png

XPS15 7590 related

Power Management

optimization of grub kernel parameters

/etc/default/grub


GRUB_CMDLINE_LINUX_DEFAULT="quiet  apparmor=1 mem_sleep_default=deep security=apparmor udev.log_priority=3 acpi_backlight=native"

Intel code installation

terminal


sudo pacman -S intel-ucode

grub update

terminal


$ sudo update-grub

Power management optimization

Optimize battery usage with powertop

terminal


$ pacman -S powertop
$ powertop --calibrate
$ powertop --auto-tune

And automated with sysytemd

/etc/systemd/system/powertop.service


[Unit]
Description=Powertop tunings

[Service]
Type=oneshot
ExecStart=/usr/bin/powertop --auto-tune

[Install]
WantedBy=multi-user.target

Enable for systemctl

terminal


$ systemctl enable powertop.service

Further mode setting

config:/etc/sysctl.d/laptop.conf


vm.laptop_mode = 5

Nvidia Driver This is the part I was most addicted to. There are many ways to do it on the web, and the only one I've tried to get the nvidia driver working. I've spent dozens of hours. ..

  1. Remove the nvidia driver if it is installed
  2. Install nvidia driver
  3. prime installation
  4. Delete unnecessary X-based config files that have been tampered with so far

terminal


$ sudo mhwd -li #List of installed drivers
$ sudo mhwd -r xxx #Driver removal
$ sudo mhwd -i pci video-nvidia-440xx #Driver installation
$ sudo pacman -S nvidia-prime
# /etc/X11/xorg.conf.d/Or/etc/modprobe.d/Delete X-related configuration files in

And after entering the settings, restart

config:/etc/X11/xorg.conf.d/90-nvidia-intel-custom.conf


Section "Module"
    Load "modesetting"
EndSection

Section "Device"
  Identifier "iGPU"
  Driver "modesetting"
EndSection

Section "Screen"
  Identifier "iGPU"
  Device "iGPU"
EndSection

Section "Device"
  Identifier "dGPU"
  Driver "nvidia"
EndSection

LightDM resolution change

The resolution of the login screen is too high and too small, so make it a little larger.

/etc/lightdm/lightdm.conf


greeter-setup-script =/etc/lightdm/Xsetup

/etc/lightdm/Xsetup


xrandr --output eDP-1 --mode 1920x1080 --dpi 96

Bluetooth keyboard / mouse settings

Dell's Bluetooh keyboard and mouse are now connected stably. If it is unstable, you can stabilize it by deleting the blueman profile and re-registering it.

terminal


$ sudo pacman -S bluez-utils pulseaudio-bluetooth
$ bluetoothctl
agent KeyboardOnly
default-agent
power on
scan on
pair 00:12:34:56:78:90
connect 00:12:34:56:78:90

Bluetooth settings

/etc/bluetooth/main.conf


[General]
DiscoverableTimeout = 0
Discoverable=true

[Policy]
AutoEnable=true

Module settings

/etc/pulse/system.pa


load-module module-bluetooth-policy
load-module module-bluetooth-discover

Touchpad related

Make it possible to swipe with Touchpad or like a Mac. There is a developer description on Github, so if you want to know more, go there

terminal


$ sudo pacman -S xdotool wmctrl libinput-gestures libinput-gestures-setup
$ sudo gpasswd -a $USER input

$ sudo libinput list-devices
$ libinput-gestures-setup autostart
$ libinput-gestures-setup start

Then, create a mapping file. The following is changed according to your WM environment.

config:~/.config/libinput-gestures.conf



gesture swipe up    3 xdotool key ctrl+alt+d
gesture swipe down  3 xdotool key alt+Shift+Tab
gesture swipe left  3 xdotool key ctrl+Tab
gesture swipe right 3 xdotool key ctrl+Shift+Tab

After that, it will be enabled by restarting the service or logging in again.

terminal


libinput-gestures-setup restart

Printer related

I am using EPSON EP-882A. Set using CUPS.

terminal


$ sudo yay epson-inkjet-printer-escpr2 
$ sudo gpasswd -a ${USER} sys
$ sudo systemctl enable --now org.cups.cupsd.service
$ lpinfo --include-schemes dnssd -v
$ network dnssd://EPSON%20EP-882A...
$ lpadmin -p home_epson -v "dnssd://EPSON%20EP-882A...

Scanner related

I am using EPSON EP-882A. Scanning via Network is also OK below

terminal


$ avahi-browse --all -t -r #IP search with Network scan
$ yay imagescan imagescan-plugin-networkscan 

And if you put the IP of the scanner in the configuration file, you can also scan via Network

/etc/utsushi/utsushi.conf


dev2.udi    = esci:networkscan://192.168.0.21:1865 #IP is above avahi-Browse for scanner
dev2.model  = EP-882A
dev2.vendor = EPSON

Now, hit utsushi from the terminal to launch the front-end scanner app. Since it is not displayed in the Xface menu, enter the following settings

config:~/.local/share/applications/utsushi.desktop


[Desktop Entry]
Version=1.0
Type=Application
Name=Utsushi EPSON Scanner
Comment=EPSON EP-802A Scanner FrontEnd
Exec=/usr/bin/utsushi
Icon=
Categories=Graphics
Terminal=false

It will be displayed after reloading.

terminal


$ xfdesktop --reload

WiFi There is a Mac with the same environment at about 200 Mbps, but this child is about 40 Mbps. There are various threads that the XPS WiFi module and Linux are not compatible, but communication is stable, so that's enough. But I wondered if there would be a little more. The following is what I tried. So far, there is only a change that seems to be a little faster. .. I'd like to investigate and try a method to find the cause, but I'm busy with work, so for the time being, this is it.

Once I pointed to NVMe on Windows and measured the speed with the latest Windows driver, I found that it was only about the same speed, so I found that this was probably the limit of the chip, so for the time being WiFi This is related.

ARP settings

/etc/dhcpcd.conf


# No ARP RFC2131
noarp

DNS settings

Settings related to Google's DNS server usage

config:/etc/resolv.conf.opendns


#Google DNS
nameserver 8.8.8.8
nameserver 8.8.4.4

/etc/NetworkManager/dispatcher.d/dns-servers-opendns


#!/bin/bash
# Use OpenDNS servers over DHCP discovered servers

cp -f /etc/resolv.conf.opendns /etc/resolv.conf

terminal


$ sudo chmod +x /etc/NetworkManager/dispatcher.d/dns-servers-opendns

terminal


$ sudo pacman -S dnsmasq

/etc/NetworkManager/NetworkManager.conf


[main]
dns=dnsmasq

I will measure the speed. With speedtest-cli, you can check it with one command from the terminal, which is convenient. Bandwidth is crowded at the time of measurement, it is a little slow

terminal


$ sudo pacman -S speedtest-cli
$ speedtest 
Retrieving speedtest.net configuration...
Testing from NTT (153.214.xxx.xxx)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by IPA CyberLab (Bunkyo) [x.87 km]: 12.68 ms
Testing download speed...................
Download: 19.84 Mbit/s
Testing upload speed.....................
Upload: 66.28 Mbit/s

Recommended Posts