Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
RPI 3B+ LXQt 64 Bit with VC4
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo on ARM
View previous topic :: View next topic  
Author Message
Burt Reynolds
n00b
n00b


Joined: 15 Mar 2020
Posts: 4

PostPosted: Sun Mar 15, 2020 7:47 pm    Post subject: RPI 3B+ LXQt 64 Bit with VC4 Reply with quote

The problem I am trying to solve is when my system boots without VC4 it boot without any problems. If I boot with VC4 X11 does not start.

I installed Gentoo 64 Bit on a RPI 3B+ with the following packages:

/var/lib/portage/world:
Code:
app-admin/syslog-ng
dev-libs/libconfig
dev-libs/libmodbus
dev-qt/qtserialport
lxqt-base/lxqt-meta
net-analyzer/zabbix
sys-app/usbutils
sys-boot/rasberrypi-firmware
sys-kernel/raspberrypi-sources
sys-process/htop
x11-apps/mesa-progs
x11-apps/xinput-calibrator
x11-base/xorg-x11
x11-drivers/xf86-input-evdev
x11-drivers/xf86-input-keyboard
x11-drivers/xf86-input-mouse
x11-drivers/xf86-video-fbdev
x11-misc/x11vnc
x11-terms/qterminal


My make.conf is:
Code:


# These settings were set by the catalyst build script that automatically
# built this stage.
# Please consult /usr/share/portage/config/make.conf.example for a more
# detailed example.
CFLAGS="-O2 -pipe -march=armv8-a+crc"
CXXFLAGS="${CFLAGS}"
# WARNING: Changing your CHOST is not something that should be done lightly.
# Please consult https://wiki.gentoo.org/wiki/Changing_the_CHOST_variable before changing.
ARCH=arm64
CHOST="aarch64-unknown-linux-gnu"

# NOTE: This stage was built with the bindist Use flag enabled
PORTDIR="/usr/portage"
DISTDIR="/usr/portage/distfiles"
PKGDIR="/usr/portage/packages"

# This sets the language of build output to English.
# Please keep this setting intact when reporting bugs.
LC_MESSAGES=C
FEATURES="-pid-sandbox"

# Set logging
PORTAGE_ELOG_CLASSES="info wan error log qa"
PORT_LOGDIR=/var/log/portage/


MAKEOPTS="-j8"

USE="${ARCH} egl gles1 gles2 qt5 suid systemd udev udisks X
-consolekit -doc -gnome -gtk -gtk3 -ipv6 -man -pam -qt4 -sqlite"

GENTOO_MIRRORS="ftp://www.gtlib.gatech.edu/pub/gentoo
http://www.gtlib.gatech.edu/pub/gentoo
http://gentoo.mirrors.pair.com/
http://mirror.lug.udel.edu/pub/gentoo/"

ACCEPT_LICENSE="*"
ACCEPT_KEYWORDS="arm64 ~arm64"

LINGUAS="en en_US"

QEMU_USER_TARGETS="aarch64"
QEMU_SOFTMMU_TARGETS="aarch64"

INPUT_DEVICES="evdev mouse keyboard"
VIDEO_CARDS="fbdev vc4"


I am using it for an embedded application that auto-logins in. To do this I followed these guides:

https://wiki.gentoo.org/wiki/LXQt
https://wiki.gentoo.org/wiki/X_without_Display_Manager

X11 autologin with systemd

/etc/systemd/system/x11.service
Code:
[Unit]
After=systemd-user-sessions.service

[Service]
ExecStart=/sbin/agetty --autologin username --login-program /usr/local/sbin/x11login --noclear tty 38400

[Install]
WantedBy=multi-user.target


/usr/local/sbin/x11login
Code:
#!/bin/sh
exec /bin/login "${@}" START_X11=1


~/.bashrc
Code:
if [[ ${START_X11} == 1 ]]; then
    unset START_X11
    exec xinit -- -nocursor
fi


~/.xinitrc
Code:
exec startlxqt


When my config.txt is set so VC4 is not used X11 works just fine.

config.txt
Code:
disable_overscan=1
hdmi_blanking=1
avoid_warnings=2
enable_uart=1


When I set my config.txt to X11 will not start:
Code:
disable_overscan=1
hdmi_blanking=1
avoid_warnings=2
enable_uart=1
dtoverlay=vc4-fkms-v3d,cma-256
gpu_mem=16


I also tried using dtoverlay=vc4-kms-v3d and had the same error.

The error I get when using VC4 is:
Code:
...
[ 73.105] Module class: X.Org Video Driver
[ 73.105] ABI class: X.Org Video Driver, version 24.1
[ 73.105] (II) modesetting: Driver for Modesetting Kernel Drivers: kms
[ 73.105] (II) FBDEV: driver for framebuffer: fbdev
[ 73.105] (EE)
Fatal server error:
[ 73.111] (EE) parse_vt_settings: Cannot open /dev/tty0 (Permission denied)
[ 73.114] (EE)
[ 73.117] (EE)
Please consult the The X.Org Foundation support
at http://wiki.x.org
for help.
[ 73.129] (EE) Please also check the log file at "/home/user/.local/share/xorg/Xorg.0.log" for additional information.
[ 73.132] (EE)
[ 73.136] (WW) xf86CloseConsole: KDSETMODE failed: Bad file descriptor
[ 73.136] (WW) xf86CloseConsole: VT_GETMODE failed: Bad file descriptor
[ 73.136] (EE) Server terminated with error (1). Closing log file.


I found a forum post that said adding the user to the tty group could fix it but is was not recommended and a bad idea for security reasons. I tried it anyway just to see if it would fix it or not.

If I add the user to the tty group I get this error:
Code:
...
[ 493.099] (II) modesetting: Driver for Modesetting Kernel Drivers: kms
[ 493.099] (II) FBDEV: driver for framebuffer: fbdev
[ 493.100] (EE)
Fatal server error:
[ 493.106] (EE) xf86OpenConsole: Cannot open virtual console 2 (Permission denied)
[ 493.109] (EE)
[ 493.112] (EE)
Please consult the The X.Org Foundation support
at http://wiki.x.org
for help.
[ 493.124] (EE) Please also check the log file at "/home/user/.local/share/xorg/Xorg.0.log" for additional information.
[ 493.127] (EE)
[ 493.131] (WW) xf86CloseConsole: KDSETMODE failed: Bad file descriptor
[ 493.131] (WW) xf86CloseConsole: VT_GETMODE failed: Bad file descriptor
[ 493.131] (EE) Server terminated with error (1). Closing log file.


I have not been able to get passed this error message.

Anyone know how to get VC4 working with X11 and LXQt on the RPI 3B+ 64 Bit?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 47055
Location: 56N 3W

PostPosted: Sun Mar 15, 2020 8:03 pm    Post subject: Reply with quote

Burt Reynolds,

Welcome to Gentoo.

What is the output of
Code:
mount


Your error messages point to devtmpfs not mounted at /dev, devpts not mounted at /dev/pts, or mounted but with the wrong permissions, or possibly udev not runnnig.

The mouse and keyboard INPUT_DEVICES are not used if evdev works.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 47055
Location: 56N 3W

PostPosted: Sun Mar 15, 2020 8:03 pm    Post subject: Reply with quote

Moved from Desktop Environments to Gentoo on ARM.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Burt Reynolds
n00b
n00b


Joined: 15 Mar 2020
Posts: 4

PostPosted: Sun Mar 15, 2020 9:51 pm    Post subject: Reply with quote

The output for mount is:

Code:
root-rw on /rw type tmpfs (rw,relatime)
/dev/mmcblk0p3 on /ro type f2fs (ro,relatime,lazytime,background_gc=off,discard,no_heap,user_xattr,inline_xattr,acl,
inline_data,inline_dentry,extent_cache,mode=adaptive,active_logs=6,alloc_mode=reuse,fsync_mode=posix)
overlayfs-root on / type overlay (rw,relatime,lowerdir=/mnt/ro,upperdir=/mnt/rw/upper,workdir=/mnt/rw/work)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
devtmpfs on /dev type devtmpfs (rw,nosuid,size=361588k,nr_inodes=90397,mode=755)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,nodev,mode=755)
cgroup2 on /sys/fs/cgroup type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate)
none on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,relatime,mode=700)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=29,pgrp=1,timeout=0,minproto=5,maxproto=5,direct)
mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime)
tracefs on /sys/kernel/tracing type tracefs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev)
configfs on /sys/kernel/config type configfs (rw,nosuid,nodev,noexec,relatime)


Since you are asking about mount I am going to add that I setup the OS to be read-only with this script.

Code:
#!/bin/sh
#  Read-only Root-FS for Raspian using overlayfs
#  Version 1.0
#
#  Created 2017 by Pascal Suter @ DALCO AG, Switzerland to work on Raspian as custom init script
#  (raspbian does not use an initramfs on boot)
#
#  This program is free software: you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation, either version 3 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see
#    <http://www.gnu.org/licenses/>.
#
#
#  Tested with Raspbian mini, 2017-01-11
#
#  This script will mount the root filesystem read-only and overlay it with a temporary tempfs
#  which is read-write mounted. This is done using the overlayFS which is part of the linux kernel
#  since version 3.18.
#  when this script is in use, all changes made to anywhere in the root filesystem mount will be lost
#  upon reboot of the system. The SD card will only be accessed as read-only drive, which significantly
#  helps to prolong its life and prevent filesystem coruption in environments where the system is usually
#  not shut down properly
#
#  Install:
#  copy this script to /sbin/overlayRoot.sh and add "init=/sbin/overlayRoot.sh" to the cmdline.txt
#  file in the raspbian image's boot partition.
#  I strongly recommend to disable swapping before using this. it will work with swap but that just does
#  not make sens as the swap file will be stored in the tempfs which again resides in the ram.
#  run these commands on the booted raspberry pi BEFORE you set the init=/sbin/overlayRoot.sh boot option:
#  sudo dphys-swapfile swapoff
#  sudo dphys-swapfile uninstall
#  sudo update-rc.d dphys-swapfile remove
#
#  To install software, run upgrades and do other changes to the raspberry setup, simply remove the init=
#  entry from the cmdline.txt file and reboot, make the changes, add the init= entry and reboot once more.
#
# Update:
# Remove the loading of overlayfs modules, overlayfs is built into kernel.
# Added section to mount a custom partition with all the files being copied over to the newly mounted
# root-fs, then unmounting the partition and removing it from the fstab.
# Divided the script into functions and formatted script to make it more readable.

#############################################################
#                                                           #
# main and fail functions                                   #
#                                                           #
#############################################################
main()
{
   get_mount_points
   mount_proc
   mount_mnt_tmpfs
   mount_custom
   load_new_image
   mount_overlay_fs
   load_custom_files
   unmount_custom
   chroot_overlay
}

fail()
{
   echo -e "$1"
   /bin/bash
}



#############################################################
#                                                           #
# get mount points from the fstab                           #
#                                                           #
#############################################################
get_mount_points()
{
   bootDev=`awk '$2 == "/boot" {print $1}' /etc/fstab`
   bootMountOpt=`awk '$2 == "/boot" {print $4}' /etc/fstab`
   bootFsType=`awk '$2 == "/boot" {print $3}' /etc/fstab`

   rootDev=`awk '$2 == "/" {print $1}' /etc/fstab`
   rootMountOpt=`awk '$2 == "/" {print $4}' /etc/fstab`
   rootFsType=`awk '$2 == "/" {print $3}' /etc/fstab`

   customDev=`awk '$2 == "/mnt/custom" {print $1}' /etc/fstab`
   customMountOpt=`awk '$2 == "/mnt/custom" {print $4}' /etc/fstab`
   customFsType=`awk '$2 == "/mnt/custom" {print $3}' /etc/fstab`
}



#############################################################
#                                                           #
# mount the proc file                                       #
#                                                           #
#############################################################
mount_proc()
{
   mount -t proc proc /proc
   if [ $? -ne 0 ]; then
      fail "ERROR: could not mount proc"
   fi
}



#############################################################
#                                                           #
# mount the tmpfs to /mnt                                   #
#                                                           #
#############################################################
mount_mnt_tmpfs()
{
   mount -t tmpfs inittemp /mnt
   if [ $? -ne 0 ]; then
      fail "ERROR: could not create a temporary filesystem to mount the base filesystems for overlayfs"
   fi
}



#############################################################
#                                                           #
# check for new image and load if exists.                   #
# reboot when done loading.                                 #
#                                                           #
#############################################################
load_new_image()
{
   if [ -e /mnt/custom/image.tar.gz ]; then
      sleep 2
      echo "*************************************************************************"
      echo "*                                                                       *"
      echo "* Loading new image............                                         *"
      echo "*                                                                       *"
      echo "*************************************************************************"
      make_dir /mnt/custom/image
      mv /mnt/custom/image.tar.gz /mnt/custom/image/
      cd /mnt/custom/image
      echo "Extracting image..."
      tar xpf image.tar.gz --xattrs-include='*.*' --numeric-owner --checkpoint=.500 2>/dev/null
      echo ""
      rm image.tar.gz
      cd /

      echo "Rsyncing root partition"
      mount -t ${rootFsType} -o ${rootMountOpt},rw,remount ${rootDev} /
      if [ $? -ne 0 ]; then
         fail "ERROR: could not remount the root filesystem"
      fi

      rsync_dir bin
      rsync_dir etc
      rsync_dir home
      rsync_dir lib
      rsync_dir lib64
      rsync_dir media
      rsync_dir opt
      rsync_dir root
      rsync_dir run
      rsync_dir sbin
      rsync_dir srv
      rsync_dir sys
      rsync_dir tmp
      rsync_dir usr
      rsync_dir var

      echo "Rsyncing boot partition"
      mount -t ${bootFsType} -o ${bootMountOpt},rw ${bootDev} /boot
      if [ $? -ne 0 ]; then
         fail "ERROR: could not mount boot filesystem"
      fi
      rsync -avc --delete-during --exclude 'config.txt' /mnt/custom/image/boot /
      sync
      umount /boot

      rm -r /mnt/custom/image
      unmount_custom
      echo "*************************************************************************"
      echo "*                                                                       *"
      echo "* Image loaded rebooting.......                                         *"
      echo "*                                                                       *"
      echo "*************************************************************************"
      sleep 5
      reboot -f
      exit
   fi
}



#############################################################
#                                                           #
# mount custom                                              #
#                                                           #
#############################################################
rsync_dir()
{
   local source=/mnt/custom/image/$1
   echo "Syncing /${1}"

   # return -1 if missing param
   if [[ -z ${source} ]]; then
      return -1
   fi

   make_dir /${1}
   rsync -av --delete-during ${source} /
   sync
}



#############################################################
#                                                           #
# mount custom                                              #
#                                                           #
#############################################################
mount_custom()
{
   make_dir /mnt/custom
   mount -t ${customFsType} -o ${customMountOpt},rw ${customDev} /mnt/custom
   if [ $? -ne 0 ]; then
      fail "ERROR: could not mount the custom filesystem"
   fi
}



#############################################################
#                                                           #
# unmount custom                                            #
#                                                           #
#############################################################
unmount_custom()
{
   umount /mnt/custom
   rmdir -r /mnt/custom
}



#############################################################
#                                                           #
# mount overlay file system read-only                       #
#                                                           #
#############################################################
mount_overlay_fs()
{
   create_mount_rw_dir
   create_mount_ro_dir

   make_dir /mnt/newroot
   mount -t overlay -o lowerdir=/mnt/ro,upperdir=/mnt/rw/upper,workdir=/mnt/rw/work overlayfs-root /mnt/newroot
   if [ $? -ne 0 ]; then
      fail "ERROR: could not mount overlayFS"
   fi
}



#############################################################
#                                                           #
# create read-write partition                               #
#                                                           #
#############################################################
create_mount_rw_dir()
{
   make_dir /mnt/rw
   mount -t tmpfs root-rw /mnt/rw
   if [ $? -ne 0 ]; then
      fail "ERROR: could not create tempfs for upper filesystem"
   fi
   make_dir /mnt/rw/upper
   make_dir /mnt/rw/work
}



#############################################################
#                                                           #
# create read-only partition                                #
#                                                           #
#############################################################
create_mount_ro_dir()
{
   make_dir /mnt/ro
   mount -t ${rootFsType} -o ${rootMountOpt},ro ${rootDev} /mnt/ro
   if [ $? -ne 0 ]; then
      fail "ERROR: could not ro-mount original root partition"
   fi
}



#############################################################
#                                                           #
# copy over custom files                                    #
#                                                           #
#############################################################
load_custom_files()
{
   cp -a /mnt/custom/* /mnt/newroot/
}



#############################################################
#                                                           #
# chroot into the new overlay root fs                       #
#                                                           #
#############################################################
chroot_overlay()
{
   # create mountpoints inside the new root filesystem-overlay
   make_dir /mnt/newroot/ro
   make_dir /mnt/newroot/rw

   # remove root mount from fstab (this is already a non-permanent modification)
   grep -v "$rootDev" /mnt/lower/etc/fstab | grep -v "$customDev" > /mnt/newroot/etc/fstab

   # change to the new overlay root
   cd /mnt/newroot
   pivot_root . mnt
   exec chroot . sh -c "$(cat <<END

      # move ro and rw mounts to the new root
      mount --move /mnt/mnt/ro/ /ro
      if [ $? -ne 0 ]; then
         echo "ERROR: could not move ro-root into newroot"
         /bin/bash
      fi
      mount --move /mnt/mnt/rw /rw
      if [ $? -ne 0 ]; then
         echo "ERROR: could not move tempfs rw mount into newroot"
         /bin/bash
      fi

      # unmount unneeded mounts so we can unmout the old readonly root
      umount /mnt/mnt
      umount /mnt/proc
      umount /mnt/dev
      umount /mnt

      # continue with regular init
      exec /usr/lib/systemd/systemd
END
)"
}



#############################################################
#                                                           #
# create directory if it does not exist                     #
#                                                           #
#############################################################
make_dir() {
   local dir=$1

   # return -1 if missing directory param
   if [[ -z ${dir} ]]; then
      return -1
   fi

   # create dir if it does not exist
   if [[ ! -d ${dir} ]]; then
      echo "${FUNCNAME[0]}(): creating director ${dir}"
      mkdir -p ${dir}
      if [[ $? -ne 0 ]]; then
         echo "${FUNCNAME[0]}(): failed to create ${dir}"
      fi
      return $?
   fi

   return 0
}



#############################################################
#                                                           #
# call main function                                        #
#                                                           #
#############################################################
main

Wrapped a long line to make the forum layout behave.Chiitoo
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 47055
Location: 56N 3W

PostPosted: Sun Mar 15, 2020 10:28 pm    Post subject: Reply with quote

Burt Reynolds,

Code:
# Set logging
PORTAGE_ELOG_CLASSES="info wan error log qa"


wan is a typo for warn. I did that that too. :)
Everything looks OK so far.

Your dmesg output will be interesting. That will be too big for a post, so it needs to go to a pastebin.

What do you have in cmdline.txt ?

Its not really a read only root you have there, root is read/write due to the overlay filesystem doing copy on write.
When you write to a file, overlay filesystem make a new file in RAM and hides the original.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Burt Reynolds
n00b
n00b


Joined: 15 Mar 2020
Posts: 4

PostPosted: Mon Mar 16, 2020 1:10 pm    Post subject: Reply with quote

Thanks for the info on the typo.

My cmdline.txt is:
Code:
dwc_otg.lpm_enable=0 root=/dev/mmcblk0p3 rootfstype=f2fs elevator=deadline rootwait init=/sbin/overlayRoot.sh


This is my dmesg
http://codepad.org/V8u3D2MD

As I am using systemd this is my journalctl
http://codepad.org/0VDBfibL
Back to top
View user's profile Send private message
Burt Reynolds
n00b
n00b


Joined: 15 Mar 2020
Posts: 4

PostPosted: Thu Mar 19, 2020 1:52 am    Post subject: Reply with quote

Additional data:

Realized that the permissions error was stating tty0, when X should be running on tty7 so I decided to change ~/.bashrc to (making it use tty7):
Code:
-- exec xinit -- -nocursor
++ exec xinit -- vt7 -nocursor


I get:
Code:
UnloadModule: "fbdev"
Unloading fbdev
UnloadSubModule: "fbdevhw"
Unloading fbdevhw
modeset(0): drmSetMaster failed: Permission denied
Fatal server error:
AddScreen/ScreenInit failed for driver 0


When I run "X -configure" I get this error message:

Code:
List of video drivers:
          modesetting
          fbdev
No devices to configure. Configuration failed.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on ARM All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum