注意:

The Funtoo Linux project has transitioned to "Hobby Mode" and this wiki is now read-only.

Difference between revisions of "Lenovo Ideapad 320-14IAP"

From Funtoo
Jump to navigation Jump to search
(How to install Funtoo on the Lenovo Ideapad 320-14IAP laptop)
 
(Thanks for your contribs. Removing a line to work around a USE bug. This should now be fixed.)
 
(7 intermediate revisions by one other user not shown)
Line 1: Line 1:


== Introduction ==
== Introduction ==


Lenovo laptops are known to be difficult for Linux installations in general. Additionally even within the Ideapad 320 model there is a lot of variation, which is why I made a specific page for the Lenovo Ideapad 320-14IAP. It may not work the same with other Ideapad 320 models.  
Lenovo laptops are known to be difficult for Linux installations in general. Additionally even within the Ideapad 320 model there is a lot of variation, which is why I made a specific page for the Lenovo Ideapad 320-14IAP. It may not work the same with other Ideapad 320 models.  
Line 12: Line 12:
After you enter the BIOS the changes I have made was to turn off secure boot and set UEFI to "Legacy support".  
After you enter the BIOS the changes I have made was to turn off secure boot and set UEFI to "Legacy support".  


==== Installation ====
== Installation ==


You can follow the general Funtoo installation guide in most respects. I will only outline the differences I made below. I used the Manjaro Live on a USB stick to get started (Manjaro did not install successfully BTW).
You can follow the general Funtoo installation guide in most respects. I will only outline the differences I made below. I used the Manjaro Live on a USB stick to get started (Manjaro did not install successfully BTW).
Line 22: Line 22:
I followed https://www.funtoo.org/Install/MBR_Partitioning to setup MBR partions on my 128 GB SSD. 256MB boot, 4GB swap, the rest ext4. I'm sure other options will work too if you have a preference.  
I followed https://www.funtoo.org/Install/MBR_Partitioning to setup MBR partions on my 128 GB SSD. 256MB boot, 4GB swap, the rest ext4. I'm sure other options will work too if you have a preference.  


==== Bootloader ====
== Bootloader ==


After following the installation guide until you get to https://www.funtoo.org/Install/Bootloader, follow instructions for MBR install of GRUB. I added --debug to the options to observe anything that might go wrong, but following these small changes above everything should go without a hitch:
After following the installation guide until you get to https://www.funtoo.org/Install/Bootloader, follow instructions for MBR install of GRUB. I added --debug to the options to observe anything that might go wrong, but following these small changes above everything should go without a hitch:
Line 31: Line 31:




==== Finishing up ====
== Finishing up ==


When you reach the finishing up stage and reboot, GRUB should load just fine and send you to a command line. I enabled the profiles for KDE Plasma 5 with audio,video,media mix-ins and had to do one more thing before continuing: removing a USE flag from one package:
When you reach the finishing up stage and reboot, GRUB should load just fine and send you to a command line. I enabled the profiles for KDE Plasma 5 with audio,video,media mix-ins and had to do one more thing before continuing: removing a USE flag from one package:
Line 42: Line 42:
You could of course just add -vala to make.conf or something such, but I like to keep my settings sorted according to what requires them like I did above.
You could of course just add -vala to make.conf or something such, but I like to keep my settings sorted according to what requires them like I did above.


==== Dropbox tips ====
Now for installing the desktop environment (I use Swedish/Thai/US localizations, adapt to your own needs and wishes):
 
{{console|body=
(chroot) # ##i##emerge --ask kde-plasma/plasma-meta
(chroot) # ##i##usermod -a -G video sddm
(chroot) # ##i##nano /etc/sddm.conf
[X11]
DisplayCommand=/etc/sddm/scripts/Xsetup
(chroot) # ##i##mkdir -p /etc/sddm/scripts
(chroot) # ##i##nano /etc/sddm/scripts/Xsetup
setxkbmap sv_SE,th,us
(chroot) # ##i##chmod a+x /etc/sddm/scripts/Xsetup
(chroot) # ##i##nano /etc/conf.d/xdm
#change to DISPLAYMANAGER="sddm" instead of "xdm" or adapt the install to lightdm or whatever you want.
(chroot) # ##i##rc-update add xdm default
}}
 
Now you are done. Enjoy your laptop with Funtoo. Have a look at https://wiki.gentoo.org/wiki/KDE for more tips on KDE applications and settings.
 
{{console|body=
(chroot) # ##i##reboot
}}
 
In case of some interested party, I am continuing with some tips that may prove useful to setup a light system with dropbox. I put very little effort into making it look pretty, so you may want to press EDIT in the wiki to get source of the page for a more readable version.
 
== Dropbox tips ==


Like I said above, I chose to go with the KDE Plasma 5 this time for my desktop environment, but the Ideapad is not a powerful laptop so you might want to look at a leaner option like XFCE. Just in case, I have previously set up a dropbox environment under Funtoo that worked really well for me, so here are some tips on how that might look. There is no mix-in for dropbox, so you will need to do it yourself all the way, and many choices I made may look different if you make them. Any USE-flags I set was a couple years back or so, and there I didn't go through them to try if it is exactly the same today. Let me know if you have issues.  
Like I said above, I chose to go with the KDE Plasma 5 this time for my desktop environment, but the Ideapad is not a powerful laptop so you might want to look at a leaner option like XFCE. Just in case, I have previously set up a dropbox environment under Funtoo that worked really well for me, so here are some tips on how that might look. There is no mix-in for dropbox, so you will need to do it yourself all the way, and many choices I made may look different if you make them. Any USE-flags I set was a couple years back or so, and there I didn't go through them to try if it is exactly the same today. Let me know if you have issues.  
Dropbox is great, but it requires a lot of manual setup to get where you want to be. I have been too busy lately to deal with this, which is why I went with KDE above. Please note that the suggested setup below has not been tested for a couple of years and may not work well today.


This takes up from the general installation guide after chroot into your funtoo environment (and setting up your locale if you are not US). One way to optimize your system is to find the CPU flags that you will put in make.conf later, make a note of the following output:
This takes up from the general installation guide after chroot into your funtoo environment (and setting up your locale if you are not US). One way to optimize your system is to find the CPU flags that you will put in make.conf later, make a note of the following output:
Line 58: Line 85:
(chroot) # ##i##cp /etc/portage/make.conf.example /etc/portage/make.conf
(chroot) # ##i##cp /etc/portage/make.conf.example /etc/portage/make.conf
(chroot) # ##i##nano -w /etc/portage/make.conf
(chroot) # ##i##nano -w /etc/portage/make.conf
}}
Modify make.conf according to:
CFLAGS="-march=native -O2 -pipe"
CFLAGS="-march=native -O2 -pipe"
CXXFLAGS="${CFLAGS}"
CXXFLAGS="${CFLAGS}"
Line 75: Line 99:
L10N="${LINGUAS}"
L10N="${LINGUAS}"
USE="ruby_targets_ruby24"
USE="ruby_targets_ruby24"
}}


When make.conf is taken care of, I set up my root account like so:
When make.conf is taken care of, I set up my root account like so:
Line 80: Line 105:
{{console|body=
{{console|body=
(chroot) # ##i##nano /root/.bashrc
(chroot) # ##i##nano /root/.bashrc
}}
.bashrc for root user should contain something like:
export NUMCPUS=$(nproc)
export NUMCPUS=$(nproc)
export NUMCPUSPLUSONE=$(( NUMCPUS + 1 ))
export NUMCPUSPLUSONE=$(( NUMCPUS + 1 ))
export MAKEOPTS="-j${NUMCPUSPLUSONE} -l${NUMCPUS}"
export MAKEOPTS="-j${NUMCPUSPLUSONE} -l${NUMCPUS}"
export EMERGE_DEFAULT_OPTS="--jobs=${NUMCPUSPLUSONE} --load-average=${NUMCPUS}"
export EMERGE_DEFAULT_OPTS="--jobs=${NUMCPUSPLUSONE} --load-average=${NUMCPUS}"
}}


This .bashrc should then be copied to your local user as well, along with the .bash_profile after copying it to the root user.
This .bashrc should then be copied to your local user as well, along with the .bash_profile after copying it to the root user. Especially if you intend to run emerge or such admin tasks from your own user.


{{console|body=
{{console|body=
Line 98: Line 121:
{{console|body=
{{console|body=
(chroot) # ##i##nano /etc/conf.d/hwclock
(chroot) # ##i##nano /etc/conf.d/hwclock
}}
local # changed from UTC
local # changed from UTC
clock_hctosys="YES"
clock_hctosys="YES"
clock_systohc="YES"
clock_systohc="YES"
{{console|body=
(chroot) # ##i##rc-service hwclock restart
(chroot) # ##i##rc-service hwclock restart
(chroot) # ##i##rc-update add hwclock boot
(chroot) # ##i##rc-update add hwclock boot
Line 124: Line 145:
(chroot) # ##i##ego sync
(chroot) # ##i##ego sync
(chroot) # ##i##emerge -quDN --with-bdeps=y @world
(chroot) # ##i##emerge -quDN --with-bdeps=y @world
}}
Install kernel and GRUB
{{console|body=
(chroot) # ##i##emerge -q debian-sources boot-update
(chroot) # ##i##emerge -q debian-sources boot-update
(chroot) # ##i##grub-install --target=i386-pc --no-floppy --debug /dev/sda
(chroot) # ##i##grub-install --target=i386-pc --no-floppy --debug /dev/sda
Line 144: Line 161:
(chroot) # ##i##cp /usr/share/doc/wpa_supplicant_2.6-r1/wpa_supplicant.conf /etc/wpa_supplicant/
(chroot) # ##i##cp /usr/share/doc/wpa_supplicant_2.6-r1/wpa_supplicant.conf /etc/wpa_supplicant/
(chroot) # ##i##nano /etc/wpa_supplicant/wpa_supplicant.conf
(chroot) # ##i##nano /etc/wpa_supplicant/wpa_supplicant.conf
}}
update_config=1 #this may be a bad idea, but it's supposed to update config and save settings automatically
update_config=1 #this may be a bad idea, but it's supposed to update config and save settings automatically
country=SV
country=SV
autoscan=periodic:60
autoscan=periodic:60
 
# add this at the end if you know the SSID of an open WiFi network without password, such as school or café.
--- add this at the end if you know the SSID of an open WiFi network without password, such as school or café.
network={
network={
ssid="Wifi"
ssid="Wifi"
key_mgmt=NONE
key_mgmt=NONE
}
}
{{console|body=
(chroot) # ##i##nano /etc/conf.d/net
(chroot) # ##i##nano /etc/conf.d/net
}}
modules="dhcp wpa_supplicant"
modules="dhcp wpa_supplicant"
wpa_supplicant_eth0="-iwlwifi"
wpa_supplicant_eth0="-iwlwifi"
ifplugd_enp0s25="..."
ifplugd_enp0s25="..."
config_enp0s25="dhcp"
config_enp0s25="dhcp"
{{console|body=
(chroot) # ##i##rc-update add dhcpcd default
(chroot) # ##i##rc-update add dhcpcd default
(chroot) # ##i##rc-update add wpa_supplicant default
(chroot) # ##i##rc-update add wpa_supplicant default
(chroot) # ##i##nano -w /etc/conf.d/hostname
(chroot) # ##i##nano -w /etc/conf.d/hostname
}}
hostname="laptop"
hostname="laptop"
{{console|body=
(chroot) # ##i##nano -w /etc/hosts
(chroot) # ##i##nano -w /etc/hosts
127.0.0.1 localhost KVISlaptop KVISlaptop.local
}}
}}
127.0.0.1 localhost KVISlaptop KVISlaptop.local


Create my own user:
Create my own user:
Line 183: Line 193:
}}
}}


Network Time Protocol:
Network Time Protocol (I get sync errors at startup for some reason, may need tweaking):


{{console|body=
{{console|body=
(chroot) # ##i##emerge net-misc/ntp
(chroot) # ##i##emerge net-misc/ntp
(chroot) # ##i##nano /etc/conf.d/ntp-client
(chroot) # ##i##nano /etc/conf.d/ntp-client
}}
NTPCLIENT-OPTS="-s -b -u \
NTPCLIENT-OPTS="-s -b -u \
   0.pool.ntp.org \
   0.pool.ntp.org \
Line 194: Line 203:
   2.pool.ntp.org \
   2.pool.ntp.org \
   3.pool.ntp.org"
   3.pool.ntp.org"
{{console|body=
(chroot) # ##i##rc-update add ntp-client default
(chroot) # ##i##rc-update add ntp-client default
(chroot) # ##i##rc
(chroot) # ##i##rc
Line 206: Line 214:
(chroot) # ##i##emerge -q app-misc/screen sudo htop app-admin/sysklogd sys-process/cronie sys-fs/dosfstools app-admin/logrotate sys-apps/{usbutils,hwinfo} app-portage/{eix,gentoolkit,euses}
(chroot) # ##i##emerge -q app-misc/screen sudo htop app-admin/sysklogd sys-process/cronie sys-fs/dosfstools app-admin/logrotate sys-apps/{usbutils,hwinfo} app-portage/{eix,gentoolkit,euses}
(chroot) # ##i##nano /etc/sudoers
(chroot) # ##i##nano /etc/sudoers
}}
%wheel ALL=(ALL) ALL
%wheel ALL=(ALL) ALL
%wheel ALL=(ALL) NOPASSWD: /usr/bin/wpa_gui
%wheel ALL=(ALL) NOPASSWD: /usr/bin/wpa_gui
{{console|body=
(chroot) # ##i##rc-update add sysklogd default
(chroot) # ##i##rc-update add sysklogd default
(chroot) # ##i##rc-update add cronie default
(chroot) # ##i##rc-update add cronie default
Line 223: Line 229:
(chroot) # ##i##emerge -quDN --with-bdeps=y @world xorg-x11
(chroot) # ##i##emerge -quDN --with-bdeps=y @world xorg-x11
(chroot) # ##i##nano /etc/X11/xorg.conf
(chroot) # ##i##nano /etc/X11/xorg.conf
}}
#These xorg.conf settings were based on a different laptop than the Ideapad 320-14IAP and I have not tried them yet. Will update if I do get around to trying it, or you can let me know if something should be different.
 
---These xorg.conf settings were based on a different laptop than the Ideapad 320-14IAP and I have not tried them yet. Will update if I do get around to trying it, or you can let me know if something should be different.
 
Section "Module"
Section "Module"
   Load "dri"
   Load "dri"
Line 239: Line 242:
Section "Device"
Section "Device"
   Identifier "intelVGA"
   Identifier "intelVGA"
---remove:  Driver "intel" # using the intel driver prevents X/SDDM from starting
#remove:  Driver "intel" # using the intel driver prevents X/SDDM from starting
   Option "NoAccel" "False"
   Option "NoAccel" "False"
   Option "DRI" "True"
   Option "DRI" "True"
---remove:  Option "AccelMethod" "uxa" #using this option causes massive lag
#remove:  Option "AccelMethod" "uxa" #using this option causes massive lag on my other laptop even though it is recommended
EndSection
EndSection
Section "Screen"
Section "Screen"
Line 262: Line 265:
   Option "Composite" "On"
   Option "Composite" "On"
EndSection
EndSection
}}


Install Openbox and Compton:
Install Openbox and Compton:


SDDM and stuff
{{console|body=
{{console|body=
(chroot) # ##i##echo "app-text/xmlto text" > /etc/portage/package.use/xmlto
(chroot) # ##i##echo "app-text/xmlto text" > /etc/portage/package.use/xmlto
Line 271: Line 274:
(chroot) # ##i##emerge -quDN media-libs/alsa-lib sys-auth/consolekit dbus sys-fs/eudev net-print/cups x11-misc/sddm alsa-tools
(chroot) # ##i##emerge -quDN media-libs/alsa-lib sys-auth/consolekit dbus sys-fs/eudev net-print/cups x11-misc/sddm alsa-tools
(chroot) # ##i##nano /etc/modprobe.d/alsa.conf
(chroot) # ##i##nano /etc/modprobe.d/alsa.conf
}}
# Make HDMI second card (not default output) so that you still have sound when external screen etc connected
--- Make HDMI second card (not default output)
options snd cards_limit=2
options snd cards_limit=2
options snd-hda-intel id=PCH index=0
options snd-hda-intel id=PCH index=0
options snd-hda-intel id=HDMI index=1
options snd-hda-intel id=HDMI index=1
{{console|body=
(chroot) # ##i##rc-update add dbus default
(chroot) # ##i##rc-update add dbus default
(chroot) # ##i##rc-update add alsasound boot
(chroot) # ##i##rc-update add alsasound boot
Line 282: Line 283:
(chroot) # ##i##rc-update add consolekit default
(chroot) # ##i##rc-update add consolekit default
(chroot) # ##i##nano /etc/udev/rules.d/10-usb-drives.rules
(chroot) # ##i##nano /etc/udev/rules.d/10-usb-drives.rules
}}
# Auto-mount USB drives when you plug them in and unmount when you remove
(replace --- with # to comment away that row, it messes with the wiki to put it first)
--- Auto-mount USB drives when you plug them in and unmount when you remove
!/bin/sh
!/bin/sh
--- start at sdb to ignore the system hard drive
# start at sdb to ignore the system hard drive
KERNEL!="sd[b-z]*", GOTO="exit"
KERNEL!="sd[b-z]*", GOTO="exit"
ACTION=="add", PROGRAM!="/sbin/blkid %N", GOTO="exit"
ACTION=="add", PROGRAM!="/sbin/blkid %N", GOTO="exit"
--- import some useful filesystem info as variables
# import some useful filesystem info as variables
IMPORT{program}="/sbin/blkid -o udev -p %N"
IMPORT{program}="/sbin/blkid -o udev -p %N"
--- get the label if present, otherwise assign one based on device/partition
# get the label if present, otherwise assign one based on device/partition
ENV{ID_FS_LABEL}!="", ENV{dir_name}="%E{ID_FS_LABEL}"
ENV{ID_FS_LABEL}!="", ENV{dir_name}="%E{ID_FS_LABEL}"
ENV{ID_FS_LABEL}=="", ENV{dir_name}="flash_drive_%k"
ENV{ID_FS_LABEL}=="", ENV{dir_name}="flash_drive_%k"
--- create the dir in /media and symlink it to /mnt
# create the dir in /media and symlink it to /mnt
ACTION=="add", RUN+="/bin/mkdir -p '/media/%E{dir_name}'"
ACTION=="add", RUN+="/bin/mkdir -p '/media/%E{dir_name}'"
--- filesystem-specific mount options (777/666 dir/file perms for vfat)
# filesystem-specific mount options (777/666 dir/file perms for vfat)
ACTION=="add",ENV{mount_options_vfat}="gid=100,dmask=000,fmask=111,utf8,flush,rw,noatime,users"
ACTION=="add",ENV{mount_options_vfat}="gid=100,dmask=000,fmask=111,utf8,flush,rw,noatime,users"
--- add device to /etc/fstab
# add device to /etc/fstab
ACTION=="add", ENV{ID_FS_TYPE}=="vfat", RUN+="/bin/sed -i '$a\/dev/%k /media/%E{dir_name} vfat %E{mount_options_vfat} 0 0' /etc/fstab"
ACTION=="add", ENV{ID_FS_TYPE}=="vfat", RUN+="/bin/sed -i '$a\/dev/%k /media/%E{dir_name} vfat %E{mount_options_vfat} 0 0' /etc/fstab"
--- mount device
# mount device
ACTION=="add", ENV{ID_FS_TYPE}=="vfat", RUN+="/bin/mount -t auto -o %E{mount_options_vfat} /dev/%k '/media/%E{dir_name}'"
ACTION=="add", ENV{ID_FS_TYPE}=="vfat", RUN+="/bin/mount -t auto -o %E{mount_options_vfat} /dev/%k '/media/%E{dir_name}'"
  clean up after device removal
  clean up after device removal
ACTION=="remove", ENV{dir_name}!="", RUN+="/bin/umount -l '/media/%E{dir_name}'", RUN+="/bin/rmdir '/media/%E{dir_name}'"
ACTION=="remove", ENV{dir_name}!="", RUN+="/bin/umount -l '/media/%E{dir_name}'", RUN+="/bin/rmdir '/media/%E{dir_name}'"
ACTION=="remove", ENV{ID_FS_TYPE}!="", RUN+="/bin/sed -i '/\/dev\/%k /d' /etc/fstab"
ACTION=="remove", ENV{ID_FS_TYPE}!="", RUN+="/bin/sed -i '/\/dev\/%k /d' /etc/fstab"
--- exit
# exit
LABEL="exit"
LABEL="exit"
Restart udev to load rules:
{{console|body=
(chroot) # ##i##/etc/init.d/udev --nodeps restart
(chroot) # ##i##/etc/init.d/udev --nodeps restart
(chroot) # ##i##sddm --example-config > /etc/sddm.conf
(chroot) # ##i##sddm --example-config > /etc/sddm.conf
Line 315: Line 311:
(chroot) # ##i##gpasswd -a sddm video
(chroot) # ##i##gpasswd -a sddm video
(chroot) # ##i##nano /etc/conf.d/xdm
(chroot) # ##i##nano /etc/conf.d/xdm
}}
DISPLAYMANAGER="sddm"
DISPLAYMANAGER="sddm"
{{console|body=
(chroot) # ##i##rc-update add xdm default
(chroot) # ##i##rc-update add xdm default
(chroot) # ##i##rc
(chroot) # ##i##rc
Line 334: Line 328:
{{console|body=
{{console|body=
(chroot) # ##i##nano /etc/xdg/openbox/autostart
(chroot) # ##i##nano /etc/xdg/openbox/autostart
}}
nitrogen --restore &
nitrogen --restore &
compton -b -c -r 13 -o 0.39 -l 0 -t 0 -m 0.91 -G --paint-on-overlay --backend xrender --vsync drm &
compton -b -c -r 13 -o 0.39 -l 0 -t 0 -m 0.91 -G --paint-on-overlay --backend xrender --vsync drm &
{{console|body=
(chroot) # ##i##nano /etc/xdg/openbox/rc.xml
(chroot) # ##i##nano /etc/xdg/openbox/rc.xml
}}
<keybind key="XF86AudioRaiseVolume">
<keybind key="XF86AudioRaiseVolume">
     <action name="Execute">
     <action name="Execute">
Line 386: Line 376:
     </action>
     </action>
</keybind>
</keybind>
Compton:
{{console|body=
(chroot) # ##i##emerge -q x11-misc/compton
(chroot) # ##i##emerge -q x11-misc/compton
(chroot) # ##i##emerge -q x11-misc/nitrogen
(chroot) # ##i##emerge -q x11-misc/nitrogen
Line 395: Line 382:
(chroot) # ##i##emerge -q tilda xterm
(chroot) # ##i##emerge -q tilda xterm
(chroot) # ##i##nano /home/username/.Xresources
(chroot) # ##i##nano /home/username/.Xresources
}}
#Set Xterm to have default font inconsolata and black background.
---Set Xterm to have default font inconsolata and black background.
xterm*faceName: Inconsolata
xterm*faceName: Inconsolata
xterm*faceSize: 13
xterm*faceSize: 13
xterm*loginshell: true
xterm*loginshell: true
---! DOS-box colours...
# DOS-box colours...
xterm*foreground: rgb:a8/a8/a8
xterm*foreground: rgb:a8/a8/a8
xterm*background: rgb:00/00/00
xterm*background: rgb:00/00/00
Line 419: Line 405:
xterm*color14: rgb:54/fc/fc
xterm*color14: rgb:54/fc/fc
xterm*color15: rgb:fc/fc/fc
xterm*color15: rgb:fc/fc/fc
 
# stop output to terminal from jumping down to bottom of scroll again
---! stop output to terminal from jumping down to bottom of scroll again
xterm*scrollTtyOutput: false
xterm*scrollTtyOutput: false
}}


Look and feel like icons and screensavers:
Look and feel like icons and screensavers:
Line 432: Line 418:
(chroot) # ##i##cp /usr/share/icons/breeze-dark/* .
(chroot) # ##i##cp /usr/share/icons/breeze-dark/* .
(chroot) # ##i##nano index.theme
(chroot) # ##i##nano index.theme
}}
[Icon Theme]
[Icon Theme]
Name=MyThemeName
Name=MyThemeName
Comment=This is my theme
Comment=This is my theme
Inherits=Breeze Dark
Inherits=Breeze Dark
{{console|body=
(chroot) # ##i##ln -s #link some icons that you like
(chroot) # ##i##ln -s #link some icons that you like
}}
{{console|body=
(chroot) # ##i##emerge -q tint2
(chroot) # ##i##emerge -q tint2
(chroot) # ##i##emerge -q volumeicon
(chroot) # ##i##emerge -q volumeicon
Line 453: Line 434:
Here are some applications that I have been using in this setup:
Here are some applications that I have been using in this setup:


Dropbox
{{console|body=
{{console|body=
(chroot) # ##i##nano /etc/portage/make.conf
(chroot) # ##i##nano /etc/portage/make.conf
}}
  RUBY_TARGETS="ruby24"
  RUBY_TARGETS="ruby24"
{{console|body=
(chroot) # ##i##emerge -q dropbox thunar-dropbox
(chroot) # ##i##emerge -q dropbox thunar-dropbox
(chroot) # ##i##nano /etc/conf.d/dropbox
(chroot) # ##i##nano /etc/conf.d/dropbox
}}
DROPBOX_USERS="username"
DROPBOX_USERS="username"
{{console|body=
(chroot) # ##i##rc-update add dropbox default
(chroot) # ##i##rc-update add dropbox default
(chroot) # ##i##dropbox start
(chroot) # ##i##dropbox start

Latest revision as of 02:53, March 31, 2019

Introduction

Lenovo laptops are known to be difficult for Linux installations in general. Additionally even within the Ideapad 320 model there is a lot of variation, which is why I made a specific page for the Lenovo Ideapad 320-14IAP. It may not work the same with other Ideapad 320 models.

After trying a number of different distributions, the only one I got to work on the Lenovo Ideapad 320-14IAP without altering default BIOS settings was openSUSE Tumbleweed. All other distributions, including Funtoo, would appear to install fine up until trying to install GRUB when the system freezes. From what I have found it is therefore necessary to make some changes in the BIOS if you want to install a different distribution than openSUSE; e.g. Funtoo.

Getting Started

To access BIOS settings on the Lenovo Ideapad 320 there is not any standard key press available (e.g. F1, Alt-F2, etc). Instead, there is a tiny hole on the left side of the laptop where you insert a paper clip or similar to press a hidden button. In the manual, this is known as the "NOVO button", and the function is the same as the power button that it turns on your computer except that it brings up a menu where you can choose to enter a boot menu or change BIOS settings.

After you enter the BIOS the changes I have made was to turn off secure boot and set UEFI to "Legacy support".

Installation

You can follow the general Funtoo installation guide in most respects. I will only outline the differences I made below. I used the Manjaro Live on a USB stick to get started (Manjaro did not install successfully BTW).

My Ideapad 320-14IAP has a Pentium N4200 processor belonging to the Apollo lake family. As far as I can see there is no arch suitable for this so just use the general_64 arch.

Partitioning

I followed https://www.funtoo.org/Install/MBR_Partitioning to setup MBR partions on my 128 GB SSD. 256MB boot, 4GB swap, the rest ext4. I'm sure other options will work too if you have a preference.

Bootloader

After following the installation guide until you get to https://www.funtoo.org/Install/Bootloader, follow instructions for MBR install of GRUB. I added --debug to the options to observe anything that might go wrong, but following these small changes above everything should go without a hitch:

(chroot) # grub-install --target=i386-pc --no-floppy --debug /dev/sda


Finishing up

When you reach the finishing up stage and reboot, GRUB should load just fine and send you to a command line. I enabled the profiles for KDE Plasma 5 with audio,video,media mix-ins and had to do one more thing before continuing: removing a USE flag from one package:

(chroot) # mkdir /etc/portage/package.use
(chroot) # echo "gnome-base/librsvg -vala" > /etc/portage/package.use/librsvg

You could of course just add -vala to make.conf or something such, but I like to keep my settings sorted according to what requires them like I did above.

Now for installing the desktop environment (I use Swedish/Thai/US localizations, adapt to your own needs and wishes):

(chroot) # emerge --ask kde-plasma/plasma-meta
(chroot) # usermod -a -G video sddm
(chroot) # nano /etc/sddm.conf
[X11]
DisplayCommand=/etc/sddm/scripts/Xsetup
(chroot) # mkdir -p /etc/sddm/scripts
(chroot) # nano /etc/sddm/scripts/Xsetup
setxkbmap sv_SE,th,us
(chroot) # chmod a+x /etc/sddm/scripts/Xsetup
(chroot) # nano /etc/conf.d/xdm
root #change to DISPLAYMANAGER="sddm" instead of "xdm" or adapt the install to lightdm or whatever you want.
(chroot) # rc-update add xdm default

Now you are done. Enjoy your laptop with Funtoo. Have a look at https://wiki.gentoo.org/wiki/KDE for more tips on KDE applications and settings.

(chroot) # reboot

In case of some interested party, I am continuing with some tips that may prove useful to setup a light system with dropbox. I put very little effort into making it look pretty, so you may want to press EDIT in the wiki to get source of the page for a more readable version.

Dropbox tips

Like I said above, I chose to go with the KDE Plasma 5 this time for my desktop environment, but the Ideapad is not a powerful laptop so you might want to look at a leaner option like XFCE. Just in case, I have previously set up a dropbox environment under Funtoo that worked really well for me, so here are some tips on how that might look. There is no mix-in for dropbox, so you will need to do it yourself all the way, and many choices I made may look different if you make them. Any USE-flags I set was a couple years back or so, and there I didn't go through them to try if it is exactly the same today. Let me know if you have issues.

Dropbox is great, but it requires a lot of manual setup to get where you want to be. I have been too busy lately to deal with this, which is why I went with KDE above. Please note that the suggested setup below has not been tested for a couple of years and may not work well today.

This takes up from the general installation guide after chroot into your funtoo environment (and setting up your locale if you are not US). One way to optimize your system is to find the CPU flags that you will put in make.conf later, make a note of the following output:

(chroot) # emerge -quDN app-portage/cpuid2cpuflags
(chroot) # cpuid2cpuflags

Now edit make.conf and add the use-flags below. Some of these are my own preference and not necessary - you can try your way forward by removing some you don't want to use yourself.

(chroot) # cp /etc/portage/make.conf.example /etc/portage/make.conf
(chroot) # nano -w /etc/portage/make.conf
CFLAGS="-march=native -O2 -pipe"
CXXFLAGS="${CFLAGS}"
CPU_FLAGS_X86= "3dnow 3dnowext aes avx avx2 fma3 fma4 mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3 xop"
XORGUSE="cairo compositor encode faac ffmpeg gif glamor gpl jpeg jpeg2k lm_sensors mp3 mp4 mpeg ogg openal opencl opengl openssl opentype opus pdf png postproc proprietary-codecs qt qt5 raw sdl speex svg theora truetype v4l vaapi vdpau vorbis vpx -wayland -wayland-compositor X x264 x265 xorg xvfb xvid zlib"
USE="${CPU_FLAGS_X86} ${XORGUSE} aac alsa amd64 amr bluetooth cpudetection cups dbus dvd exif ipv6 llvm nls -systemd threads udev usb"
ACCEPT_LICENSE="* -@EULA OPERA-2014"
AUTOCLEAN="yes"
EMERGE_DEFAULT_OPS="${EMERGE_DEFAULT_OPS} --quiet-build=y --with-bdeps=y"
VIDEO_CARDS="intel i965 vesa"
FFTOOLS="aviocat cws2fws ffescape ffeval ffhash fourcc2pixfmt graph2dot ismindex pktdumper qt-faststart sidxindex trasher"
INPUT_DEVICES="evdev synaptics wacom"
LINGUAS="de en fi fr it sv sv_SE th"
L10N="${LINGUAS}"
USE="ruby_targets_ruby24"

When make.conf is taken care of, I set up my root account like so:

(chroot) # nano /root/.bashrc
export NUMCPUS=$(nproc)
export NUMCPUSPLUSONE=$(( NUMCPUS + 1 ))
export MAKEOPTS="-j${NUMCPUSPLUSONE} -l${NUMCPUS}"
export EMERGE_DEFAULT_OPTS="--jobs=${NUMCPUSPLUSONE} --load-average=${NUMCPUS}"

This .bashrc should then be copied to your local user as well, along with the .bash_profile after copying it to the root user. Especially if you intend to run emerge or such admin tasks from your own user.

(chroot) # cp -v /etc/skel/.bash_profile /root/

Hardware clock in local time - necessary if Windows dual-boot

(chroot) # nano /etc/conf.d/hwclock
local # changed from UTC
clock_hctosys="YES"
clock_systohc="YES"
(chroot) # rc-service hwclock restart
(chroot) # rc-update add hwclock boot
(chroot) # passwd

--- Update the system ---

Some specific new USE flags are needed, due to our changes in make.conf we set these on a package basis before we sync and update the system.

(chroot) # mkdir /etc/portage/package.use
(chroot) # echo "x11-libs/libxcb xkb" > /etc/portage/package.use/libxcb
(chroot) # echo "dev-libs/libpcre pcre16" > /etc/portage/package.use/libpcre
(chroot) # echo "dev-libs/libpcre2 pcre16" > /etc/portage/package.use/libpcre2
(chroot) # echo "media-libs/mesa -vaapi -llvm -opencl" > /etc/portage/package.use/mesa
(chroot) # echo "sys-devel/llvm clang" > /etc/portage/package.use/llvm
(chroot) # echo "media-libs/harfbuzz -graphite" > /etc/portage/package.use/harfbuzz 
(chroot) # ego sync
(chroot) # emerge -quDN --with-bdeps=y @world
(chroot) # emerge -q debian-sources boot-update
(chroot) # grub-install --target=i386-pc --no-floppy --debug /dev/sda
(chroot) # ego boot update

Configure Network

The name of your ethernet adapter may be different from enp0s25.

(chroot) # cd /etc/init.d
(chroot) # ln -s net.lo net.enp0s25
(chroot) # rc-update add net.enp0s25 default
(chroot) # emerge -q linux-firmware net-wireless/wpa_supplicant net-misc/dhcpcd sys-apps/ifplugd net-misc/netifrc
(chroot) # bzip2 -d /usr/share/doc/wpa_supplicant_2.6-r1/wpa_supplicant.conf.bz2
(chroot) # cp /usr/share/doc/wpa_supplicant_2.6-r1/wpa_supplicant.conf /etc/wpa_supplicant/
(chroot) # nano /etc/wpa_supplicant/wpa_supplicant.conf
update_config=1 #this may be a bad idea, but it's supposed to update config and save settings automatically
country=SV
autoscan=periodic:60
root # add this at the end if you know the SSID of an open WiFi network without password, such as school or café.
network={
	ssid="Wifi"
	key_mgmt=NONE
}
(chroot) # nano /etc/conf.d/net
modules="dhcp wpa_supplicant"
wpa_supplicant_eth0="-iwlwifi"
ifplugd_enp0s25="..."
config_enp0s25="dhcp"
(chroot) # rc-update add dhcpcd default
(chroot) # rc-update add wpa_supplicant default
(chroot) # nano -w /etc/conf.d/hostname
hostname="laptop"
(chroot) # nano -w /etc/hosts
127.0.0.1		localhost	KVISlaptop	KVISlaptop.local

Create my own user:

(chroot) # useradd -m -G users,wheel,audio,video,usb,portage,lp -s /bin/bash --comment “me” username
(chroot) # passwd username
(chroot) # exit
(chroot) # cd /
(chroot) # umount -lR funtoo
(chroot) # reboot

Network Time Protocol (I get sync errors at startup for some reason, may need tweaking):

(chroot) # emerge net-misc/ntp
(chroot) # nano /etc/conf.d/ntp-client
NTPCLIENT-OPTS="-s -b -u \
   0.pool.ntp.org \
   1.pool.ntp.org \
   2.pool.ntp.org \
   3.pool.ntp.org"
(chroot) # rc-update add ntp-client default
(chroot) # rc

--- Desktop Environment ---

Install some basic apps:

(chroot) # emerge -q app-misc/screen sudo htop app-admin/sysklogd sys-process/cronie sys-fs/dosfstools app-admin/logrotate sys-apps/{usbutils,hwinfo} app-portage/{eix,gentoolkit,euses}
(chroot) # nano /etc/sudoers
wheel ALL=(ALL) ALL
wheel ALL=(ALL) NOPASSWD: /usr/bin/wpa_gui
(chroot) # rc-update add sysklogd default
(chroot) # rc-update add cronie default
(chroot) # eix-update

Install X.org:

(chroot) # epro show
(chroot) # epro flavor desktop
(chroot) # epro mix-ins X audio media print
(chroot) # emerge -quDN --with-bdeps=y @world xorg-x11
(chroot) # nano /etc/X11/xorg.conf
root #These xorg.conf settings were based on a different laptop than the Ideapad 320-14IAP and I have not tried them yet. Will update if I do get around to trying it, or you can let me know if something should be different.
Section "Module"
   Load "dri"
   Load "i2c"
   Load "bitmap"
   Load "ddc"
   Load "int10"
   Load "vbe"
   Load "glx"
   Load "extmod"
EndSection
Section "Device"
   Identifier "intelVGA"
root #remove:   Driver "intel" # using the intel driver prevents X/SDDM from starting
   Option "NoAccel" "False"
   Option "DRI" "True"
root #remove:   Option "AccelMethod" "uxa" #using this option causes massive lag on my other laptop even though it is recommended
EndSection
Section "Screen"
   Identifier "Monitor"
   Device "intelVGA"
   Monitor "StandardMonitor"
   DefaultDepth 24
   Subsection "Display"
      Viewport 0 0
      Depth 24
      Modes "1920x1080" "1280x720" "1024x768"
   EndSubsection
EndSection
Section "DRI"
   Group "video"
   Mode 0666
EndSection
Section "Extensions"
   Option "Composite" "On"
EndSection

Install Openbox and Compton:

(chroot) # echo "app-text/xmlto text" > /etc/portage/package.use/xmlto
(chroot) # usermod -a -G video sddm
(chroot) # emerge -quDN media-libs/alsa-lib sys-auth/consolekit dbus sys-fs/eudev net-print/cups x11-misc/sddm alsa-tools
(chroot) # nano /etc/modprobe.d/alsa.conf
root # Make HDMI second card (not default output) so that you still have sound when external screen etc connected
options snd cards_limit=2
options snd-hda-intel id=PCH index=0
options snd-hda-intel id=HDMI index=1
(chroot) # rc-update add dbus default
(chroot) # rc-update add alsasound boot
(chroot) # rc-update add cupsd default
(chroot) # rc-update add consolekit default
(chroot) # nano /etc/udev/rules.d/10-usb-drives.rules
root # Auto-mount USB drives when you plug them in and unmount when you remove
!/bin/sh
root # start at sdb to ignore the system hard drive
KERNEL!="sd[b-z]*", GOTO="exit"
ACTION=="add", PROGRAM!="/sbin/blkid %N", GOTO="exit"
root # import some useful filesystem info as variables
IMPORT{program}="/sbin/blkid -o udev -p %N"
root # get the label if present, otherwise assign one based on device/partition
ENV{ID_FS_LABEL}!="", ENV{dir_name}="%E{ID_FS_LABEL}"
ENV{ID_FS_LABEL}=="", ENV{dir_name}="flash_drive_%k"
root # create the dir in /media and symlink it to /mnt
ACTION=="add", RUN+="/bin/mkdir -p '/media/%E{dir_name}'"
root # filesystem-specific mount options (777/666 dir/file perms for vfat)
ACTION=="add",ENV{mount_options_vfat}="gid=100,dmask=000,fmask=111,utf8,flush,rw,noatime,users"
root # add device to /etc/fstab
ACTION=="add", ENV{ID_FS_TYPE}=="vfat", RUN+="/bin/sed -i '$a\/dev/%k /media/%E{dir_name} vfat %E{mount_options_vfat} 0 0' /etc/fstab"
root # mount device
ACTION=="add", ENV{ID_FS_TYPE}=="vfat", RUN+="/bin/mount -t auto -o %E{mount_options_vfat} /dev/%k '/media/%E{dir_name}'"
 clean up after device removal
ACTION=="remove", ENV{dir_name}!="", RUN+="/bin/umount -l '/media/%E{dir_name}'", RUN+="/bin/rmdir '/media/%E{dir_name}'"
ACTION=="remove", ENV{ID_FS_TYPE}!="", RUN+="/bin/sed -i '/\/dev\/%k /d' /etc/fstab"
root # exit
LABEL="exit"
(chroot) # /etc/init.d/udev --nodeps restart
(chroot) # sddm --example-config > /etc/sddm.conf
(chroot) # nano /etc/sddm.conf
(chroot) # gpasswd -a sddm video
(chroot) # nano /etc/conf.d/xdm
DISPLAYMANAGER="sddm"
(chroot) # rc-update add xdm default
(chroot) # rc

Openbox and config:

(chroot) # echo "x11-wm/openbox imlib nls svg" > /etc/portage/package.use/openbox
(chroot) # emerge --ask x11-wm/openbox obconf lxappearance-obconf obtheme
(chroot) # emerge -q playerctl xbacklight
(chroot) # mkdir -p ~/.config/openbox
(chroot) # cp /etc/xdg/openbox/* ~/.config/openbox/

For keyboard buttons that control sound and similar things, they have to be added manually to the openbox files. Here I also use nitrogen to display a desktop wallpaper, and compton:

(chroot) # nano /etc/xdg/openbox/autostart
nitrogen --restore &
compton -b -c -r 13 -o 0.39 -l 0 -t 0 -m 0.91 -G --paint-on-overlay --backend xrender --vsync drm &
(chroot) # nano /etc/xdg/openbox/rc.xml
<keybind key="XF86AudioRaiseVolume">
    <action name="Execute">
        <command>amixer set Master 5%+ unmute</command>
    </action>
</keybind>
<keybind key="XF86AudioLowerVolume">
    <action name="Execute">
        <command>amixer set Master 5%- unmute</command>
    </action>
</keybind>
<keybind key="XF86AudioMute">
    <action name="Execute">
        <command>amixer set Master toggle</command>
    </action>
</keybind>
<keybind key="XF86AudioPlay">
    <action name="Execute">
        <command>playerctl play</command>
    </action>
</keybind>
<keybind key="XF86AudioPause">
    <action name="Execute">
        <command>playerctl pause</command>
    </action>
</keybind>
<keybind key="XF86AudioNext">
    <action name="Execute">
        <command>playerctl next</command>
    </action>
</keybind>
<keybind key="XF86AudioPrev">
    <action name="Execute">
        <command>playerctl previous</command>
    </action>
</keybind>
<keybind key="XF86MonBrightnessUp">
     <action name="Execute">
       <command>xbacklight +10</command>
     </action>
</keybind>
<keybind key="XF86MonBrightnessDown">
     <action name="Execute">
       <command>xbacklight -10</command>
     </action>
</keybind>
(chroot) # emerge -q x11-misc/compton
(chroot) # emerge -q x11-misc/nitrogen
(chroot) # emerge -q x11-misc/pcmanfm-qt
(chroot) # emerge -q thunar xfce-base/thunar xfce-extra/thunar-archive-plugin
(chroot) # emerge -q tilda xterm
(chroot) # nano /home/username/.Xresources
root #Set Xterm to have default font inconsolata and black background.
xterm*faceName: Inconsolata
xterm*faceSize: 13
xterm*loginshell: true
root # DOS-box colours...
xterm*foreground: rgb:a8/a8/a8
xterm*background: rgb:00/00/00
xterm*color0: rgb:00/00/00
xterm*color1: rgb:a8/00/00
xterm*color2: rgb:00/a8/00
xterm*color3: rgb:a8/54/00
xterm*color4: rgb:00/00/a8
xterm*color5: rgb:a8/00/a8
xterm*color6: rgb:00/a8/a8
xterm*color7: rgb:a8/a8/a8
xterm*color8: rgb:54/54/54
xterm*color9: rgb:fc/54/54
xterm*color10: rgb:54/fc/54
xterm*color11: rgb:fc/fc/54
xterm*color12: rgb:54/54/fc
xterm*color13: rgb:fc/54/fc
xterm*color14: rgb:54/fc/fc
xterm*color15: rgb:fc/fc/fc
root # stop output to terminal from jumping down to bottom of scroll again
xterm*scrollTtyOutput: false

Look and feel like icons and screensavers:

(chroot) # emerge -q x11-themes/flatsvg x11-themes/human-icon-theme x11-themes/elementary-xfce-icon-theme kde-frameworks/breeze-icons kde-frameworks/oxygen-icons x11-themes/gnome-icon-theme x11-themes/gnome-icon-theme-extras x11-themes/gnome-icon-theme-symbolic
(chroot) # lxappearance
(chroot) # emerge -q lxqt-base/lxqt-config
(chroot) # mkdir /home/username/.icons/mytheme
(chroot) # cd .icons/mytheme
(chroot) # cp /usr/share/icons/breeze-dark/* .
(chroot) # nano index.theme
[Icon Theme]
Name=MyThemeName
Comment=This is my theme
Inherits=Breeze Dark
(chroot) # ln -s #link some icons that you like
(chroot) # emerge -q tint2
(chroot) # emerge -q volumeicon
(chroot) # emerge -q connman wpa_supplicant bluez
(chroot) # emerge -q x11-misc/qxkb
(chroot) # emerge -q x11-misc/xscreensaver
(chroot) # emerge -q x11-misc/screengrab
(chroot) # emerge -q lximage-qt

Here are some applications that I have been using in this setup:

(chroot) # nano /etc/portage/make.conf
 RUBY_TARGETS="ruby24"
(chroot) # emerge -q dropbox thunar-dropbox
(chroot) # nano /etc/conf.d/dropbox
DROPBOX_USERS="username"
(chroot) # rc-update add dropbox default
(chroot) # dropbox start
(chroot) # emerge -q qlipper
(chroot) # echo "app-text/texlive epspdf extra games graphics humanities luatex music png pstricks publishers science truetype xetex xindy X" > /etc/portage/package.use/texlive
(chroot) # echo "app-text/texlive-core xetex" > /etc/portage/package.use/texlive-core
(chroot) # echo "media-libs/harfbuzz fontconfig graphite truetype" > /etc/portage/package.use/harfbuzz
(chroot) # echo "media-libs/gd fontconfig" > /etc/portage/package.use/gd
(chroot) # emerge -q texstudio
(chroot) # emerge -q www-client/firefox
(chroot) # emerge -q kvirc
(chroot) # echo "media-libs/libmypaint gegl introspection nls" > /etc/portage/package.use/libmypaint
(chroot) # echo "media-libs/gexiv2 introspection python" > /etc/portage/package.use/gexiv2
(chroot) # emerge -q gimp
(chroot) # echo "media-gfx/inkscape dbus exif jpeg latex nls openmp visio" > /etc/portage/package.use/inkscape
(chroot) # emerge -q inkscape
(chroot) # emerge -q obs-studio
(chroot) # echo "media-gfx/blender cycles doc -elbeem game-engine jack libav llvm man nls player tiff" > /etc/portage/package.use/blender
(chroot) # emerge -q blender
(chroot) # echo "media-video/vlc alsa bluray dbus dvd ffmpeg jpeg kate mp3 mpeg ogg opengl png qt5 skins svg truetype udev upnp v4l vorbis" > /etc/portage/package.use/vlc
(chroot) # emerge -q vlc
(chroot) # emerge -q smplayer smplayer-themes smplayer-skins
(chroot) # emerge -q clementine
(chroot) # emerge -q audacity
(chroot) # emerge -q layman
(chroot) # layman -L # same as emerge --sync
(chroot) # layman -a gamerlay
(chroot) # layman -S
(chroot) # emerge steam-launcher
(chroot) # usermod -a -G games danerik #<-- Username
(chroot) # echo 'media-libs/libtxc_dxtn abi_x86_32' >> /etc/portage/package.use   #This is said to fix some Dota2 screen problem
(chroot) # emerge media-libs/libtxc_dxtn
(chroot) # #Create menu.xml menu entry for /usr/games/bin/steam
(chroot) # emerge -q gromit-mpx

At this point your dropbox-based desktop environment should be fully setup. Perhaps you need to tweak menu items and such things a bit more. Fonts are worth looking over too. Like I said, the dropbox part of this wiki page is something I used on different hardware, but I think it is worth looking at for a more snappy experience on the Ideapad.