You are not logged in.

#1 2020-07-13 07:11:28

origamisith
Member
Registered: 2020-07-13
Posts: 11

Won't shut down

Hi everyone,

I just installed Arch (dual-booted with Windows) for my first time on an LG Gram 17 2020 a few days ago. I recall it was rebooting correctly at some point. Now, when I execute reboot, shutdown, or halt, my system will not fully shutdown but have a persistent, blank display. Sometimes, it will just freeze on the terminal, with the last message being “watchdog did not stop!”. I waited for around ~40 minutes once just to be sure, but I always waited at least 90 seconds. So, I have to hold the power button to force it off, and then it boots up fine. When I run 'journalctl -p err..alert' for my most recent reboot I get

Jul 16 17:20:51 origamisith kernel: pci 0000:00:07.0: DPC: RP PIO log size 0 is invalid
Jul 16 17:20:52 origamisith wpa_supplicant[705]: nl80211: kernel reports: Attribute failed policy validation
Jul 16 17:20:52 origamisith wpa_supplicant[705]: Failed to create interface p2p-dev-wlp0s20f3: -22 (Invalid argument)
Jul 16 17:20:52 origamisith wpa_supplicant[705]: nl80211: Failed to create a P2P Device interface p2p-dev-wlp0s20f3

Also these ones from other attempts:
Jul 16 17:20:51 origamisith kernel: pci 0000:00:07.0: DPC: RP PIO log size 0 is invalid
Jul 16 17:02:28 origamisith akonadiserver[1002]: org.kde.pim.akonadiserver: Cannot connect to agent instance with identifier 'akonadi_maildir_resource_0', error message: ''
Jul 12 17:05:28 origamisith akonadiserver[1010]: org.kde.pim.akonadiserver: Control process died, committing suicide!
Jul 12 17:05:29 origamisith kglobalaccel5[1887]: This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
                                                 
                                                 Available platform plugins are: wayland-org.kde.kwin.qpa, eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, xcb.


I'm not sure if these logs are relevant to my problem or not. Also, here is a list of some of the basic things I remember doing to my system since I installed it:

Installed KDE Plasma
Installed dhcpcd, but then changed my mind and used NetworkManager instead. I removed dhcpcd.
Tried out Wayland, but that didn't work very well, so changed default to Xorg
Tried to figure out how to get a 2k internal display to work well with an external HD monitor (unsucessfully), which involved messing around with acpid (now uninstalled) and xrandr
Installed TLP so my battery might last longer (uninstalled for debugging)
Tried to change the behavior of mouse scrolling with imwheel (partially successful)
Tried to change the behavior of my touchpad with 'gestures' package (not successful yet)
Enabled bluetooth with bluez package

Tried to get hibernation working by putting RESUME=UUID=<partition uuid> in grub config file (unsuccessful, now removed from config file)


I have tried adding acpi_osi=’Windows 2019.2’ and ‘net.iframes=0’ to my grub config, to no avail. I tried reinstalling the 'akonadi' package. Now I'm at a dead end, and I don't know what other debugging steps to take next or which logs might be useful. What should I try next?

Offline

#2 2020-07-13 18:24:49

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 5,480
Website

Re: Won't shut down

origamisith wrote:

I don't know what other debugging steps to take next or which logs might be useful. What should I try next?

Check the journal contents for the failed shutdown. Post them here if they are of no help to you but please be sure to use code tags.

Offline

#3 2020-07-14 01:07:44

origamisith
Member
Registered: 2020-07-13
Posts: 11

Re: Won't shut down

There are approximately 20 seconds of recorded journal entries from the last failed shutdown, which encompass around 2000 lines. The only serious messages I found were these:

Jul 13 15:46:20 origamisith wpa_supplicant[439]: nl80211: kernel reports: Attribute failed policy validation
Jul 13 15:46:20 origamisith wpa_supplicant[439]: Failed to create interface p2p-dev-wlp0s20f3: -22 (Invalid argument)
Jul 13 15:46:20 origamisith wpa_supplicant[439]: nl80211: Failed to create a P2P Device interface p2p-dev-wlp0s20f3

However, around eight minutes later, while the screen was blank, there are two mysterious lines before complete silence.

Jul 13 15:54:38 origamisith dbus-daemon[384]: [system] Activating service name='org.kde.powerdevil.backlighthelper' requested by ':1.43' (uid=1000 pid=805 comm="/usr/lib/org_kde_powerdevil ") (using servicehelghthelper' requested by ':1.43' (uid=1000 pid=805 comm="/usr/lib/org_kde_powerdevil ") (using servicehelper)
Jul 15:54:38 origamisith dbus-daemon[384]: [system] Successfully activated service 'org.kde.powerdevil.backlighthelper'

And also, my logs' timestamps are messed up. I have some logs from that date a couple weeks before I owned the laptop, and some that are a few days in the future. I did find one relevant message, the first one after starting to shut down:

Jun 23 04:09:41 origamisith systemd-timesyncd[352]: System clock time unset or jumped backwards, restoring from recorded timestamp: Mon 2020-07-13 15:46:19 PDT

Last edited by origamisith (2020-07-14 01:23:26)

Offline

#4 2020-07-14 01:47:02

loqs
Member
Registered: 2014-03-06
Posts: 11,239

Re: Won't shut down

Is Windows Fast Startup enabled?  Please post the full journal for the shutdown.  If the 2000 lines is too much for code tags see pastebin.

Offline

#5 2020-07-14 01:59:26

origamisith
Member
Registered: 2020-07-13
Posts: 11

Re: Won't shut down

Fast startup and hibernation are disabled in windows. Didn't know about pastebin; that's pretty nifty. Here is the full log: http://ix.io/2rzM

Offline

#6 2020-07-14 02:30:51

loqs
Member
Registered: 2014-03-06
Posts: 11,239

Re: Won't shut down

Before the reboot message the messages I would expect to see for a shutdown are missing:

systemd-logind[#]: System is powering down.
...
systemd[1]: Reached target Shutdown.
...
systemd[1]: Reached target Power-Off.
systemd[1]: Shutting down.
systemd-shutdown[1]: Syncing filesystems and block devices.
systemd-shutdown[1]: Sending SIGTERM to remaining processes...
systemd-journald[#]: Journal stopped

Offline

#7 2020-07-14 03:21:12

origamisith
Member
Registered: 2020-07-13
Posts: 11

Re: Won't shut down

Yeah I don't see those. However, there are a ton of logs for June 23, 04:09:40 to 04:21:30 (before I even owned the laptop) that include a lot of messages (almost 30,000 lines), some of which mention rebooting. I think it's too big for ix.io in its entirety, but here are all messages with priority from warning to alert: http://ix.io/2rzV. If you really want to see the whole thing, I couldn't even get it on Google Drive, but FileDropper could handle it https://www.filedropper.com/juneerrors . Since I saw the timestamp being reset around shutdown time, I thought shutdown-related messages might be siphoned to June 23 logs. However, I still found no mention of the specific lines you listed above.

Offline

#8 2020-07-14 20:15:34

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 5,480
Website

Re: Won't shut down

Your system time does seem to be a bit messed up:

Jun 23 04:21:30 origamisith polkit-agent-helper-1[3929]: pam_unix(polkit-1:account): account origamisith has password changed in future

And the last message is from systemd-timesyncd reporting that the System Time Synchronized [sic] target has been reached.

Perhaps try replacing the CMOS battery on the motherboard but that shouldn't cause a failure like this hmm

How about if you disable Plasma before rebooting?

# systemctl isolate multi-user.target

Does it work then?

Pressing <ctrl>+<alt>+<delete> more than 7 times in 2 seconds during the shutdown process should force a reboot, have you tried that?

Last edited by Head_on_a_Stick (2020-07-14 20:16:22)

Offline

#9 2020-07-15 02:15:03

origamisith
Member
Registered: 2020-07-13
Posts: 11

Re: Won't shut down

Those tricks didn't work for me. I'll keep the CMOS battery in mind as a last resort, since the laptop is brand new. Unfortunately, I bone-headedly ran

sudo halt -f

and now the Linux side is unusable. Like, I boot in to the system and everything loads, goes to sleep after a couple of minutes, but it accepts no input. Not even Alt+PrtSc will jolt it back to normal. So, change of question: What can I do to fix it from a live USB stick? Just reinstall it?

Update: Can't even reboot from the live usb stick with my Linux boot partition mounted.  Here are the final logs before I had to power off from the live environment.

https://i.imgur.com/kw1hzzt.jpg

At least Windows still works tongue  And I can still just nuke my Linux partitions and start over if it comes to that...

P.S. Could all of this stem from using two separate EFI partitions for Linux and Windows? Apparently it's a point of contention...


moderator edit -- replaced oversized image with link.
Pasting pictures and code

Last edited by 2ManyDogs (2020-07-15 11:44:14)

Offline

#10 2020-07-15 19:43:18

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 5,480
Website

Re: Won't shut down

origamisith wrote:

Just reinstall it?

I am ashamed to admit that I am out of ideas here so that may be the best way forward at this point. I presume you have checked for filesystem corruption and hard drive or memory errors?

If the problems persist after a fresh installation then post back with your exact method, perhaps you are making a mistake somewhere.

origamisith wrote:

Could all of this stem from using two separate EFI partitions for Linux and Windows?

I don't think so, GRUB should be able to handle multiple ESPs and if your UEFI firmware has trouble with that then I wouldn't expect it to be able to boot Arch at all.

Offline

#11 2020-07-15 20:42:33

loqs
Member
Registered: 2014-03-06
Posts: 11,239

Re: Won't shut down

What if you try shutting the system down with SysRq REISUO ?

Offline

#12 2020-07-16 02:52:25

origamisith
Member
Registered: 2020-07-13
Posts: 11

Re: Won't shut down

REISUO didn't do anything. I have wiped and reinstalled Linux. Basically fresh. And the logs are still starting at June 23. Reboot doesn't work either. Intel i7 10th gen, Intel Irus Plus Graphics, GRUB bootloader, Windows hibernate and fastboot off, UEFI. Maybe I should try different boot-loader or even different Linux Flavor. Or maybe it's the dual boot. IDK

Offline

#13 2020-07-16 06:33:52

seth
Member
Registered: 2012-09-03
Posts: 15,751

Re: Won't shut down

Did you enable the sysrq beforehand?

Check the time in the UEFI (the time jumps because the system gets a wrong date from the HW and once there's a chance to sync that with a timeserver it jumps forward) and produce the output of "sudo journalctl -b -1" (no time filtering - for obvious reasons that won't work)

Tried to get hibernation working by putting RESUME=UUID=<partition uuid> in grub config file (unsuccessful, now removed from config file)

You will probably also have tried to "systemctl hibernate" (or equivalent)?
How was the attempt "unsuccessful"? Did you try to resume and the system just booted "normally"?

Can/could you reboot from the archiso (don't chroot or exit the chroot before you try)?

Also double, triple and quadruple check that windows fastboot is still disabled (because it re-enables it when it feels like).

Offline

#14 2020-07-20 07:39:17

origamisith
Member
Registered: 2020-07-13
Posts: 11

Re: Won't shut down

I pressed my Prt Sc key before typing REISUO. In the UEFI menu, the time seems to jump back to January 1st, 1998 when I have to force shutdown (hold power button). I'm not sure why the hibernation didn't work. I thought it was supposed to store the state of all my open programs and then go into a sort-of-shutdown state, but it didn't save any state. I couldn't find any way to reboot from the archiso. I found several places in Windows and bios that mentioned fastboot, and disabled them all. No change. Also, for the heck of it I tried installing mint, and there is no shutdown or time problem so far. I'll try a different boot loader and try using just one EFI partition for Arch+Windows instead of two, but I don't really have any idea what's going on. Maybe I'll test Manjaro too.

Offline

#15 2020-07-20 11:17:43

seth
Member
Registered: 2012-09-03
Posts: 15,751

Re: Won't shut down

I pressed my Prt Sc key before typing REISUO.

Maybe actually read https://wiki.archlinux.org/index.php/Ke … el_(SysRq)

I couldn't find any way to reboot from the archiso.

"systemctl reboot"??

Offline

#16 2020-07-31 06:30:07

lilgor
Member
Registered: 2020-07-31
Posts: 1

Re: Won't shut down

i am facing the exact problem as yours...
wondering if anyone have solution

Offline

#17 2020-07-31 21:15:53

regid
Member
Registered: 2016-06-06
Posts: 173

Re: Won't shut down

Head_on_a_Stick wrote:
origamisith wrote:

Could all of this stem from using two separate EFI partitions for Linux and Windows?

I don't think so, GRUB should be able to handle multiple ESPs and if your UEFI firmware has trouble with that then I wouldn't expect it to be able to boot Arch at all.

I do think two separate EFI system partitions is an absolute no-no. There should be only one EFI system partition. The same single EFI system partition should serve every OS in the machine. I don't know if the multiple EFI system partitions are the cause of one, or more, problems reported in this thread. Though I won't be surprised if it is. Yet I am sure each machine should have only one EFI system partition. Perhaps GRUB is able to handle multiple EFI system partitions. But not the system. That is, the hardware. After all, the EFI system partition is for the system. It is consulted by the system before GRUB is loaded. The EFI system partition is part of the enhanced BIOS, isn't it? How many machines are there with multiple BIOS?

Last edited by regid (2020-08-01 02:22:28)


pantum-p1000-p2000-p3000-m5100-m5200-ppd-driver (AUR): PPDs, drivers, for Pantum P1000, P2000, P3000, M5100, M5200 printers.
powerofforreboot.efi (AUR): Utilities to be used from within a UEFI boot manager or shell.

Offline

#18 2020-08-04 08:59:18

origamisith
Member
Registered: 2020-07-13
Posts: 11

Re: Won't shut down

Well, you all have been super helpful. However, a new clue I've found indicates that the solution to my problem lies outside the Arch community. I tried Manjaro, which, as expected didn't work. Since I had already verified that Mint worked, I figure that any non-arch distro would work just fine. However, surprisingly, the latest version of Fedora (32) had the same shutdown issue! I got a hunch that it was actually an update to the Linux kernel sometime this year that causes the shutdown problem on the LG Gram 17 2020. And, sure enough, Fedora 31 successfully shuts down (albeit sluggishly). So, I know that the 5.4 kernel in Mint 20 works, and 5.3 in Fedora 31. So, the error must lie between versions 5.4 and 5.7 of the Linux kernel. Any pointers of where to go from here (steps, other forums)? How can I test other versions of the Linux kernel?

Offline

#19 2020-08-04 11:30:52

Phrosgone
Member
From: Zurich
Registered: 2016-06-15
Posts: 14

Re: Won't shut down

You can find the 5.4 kernel in the Repo. Search for linux-lts.

Offline

#20 2020-08-04 13:30:12

regid
Member
Registered: 2016-06-06
Posts: 173

Re: Won't shut down

origamisith wrote:

Well, you all have been super helpful. However, a new clue I've found indicates that the solution to my problem lies outside the Arch community. I tried Manjaro, which, as expected didn't work. Since I had already verified that Mint worked, I figure that any non-arch distro would work just fine. However, surprisingly, the latest version of Fedora (32) had the same shutdown issue! I got a hunch that it was actually an update to the Linux kernel sometime this year that causes the shutdown problem on the LG Gram 17 2020. And, sure enough, Fedora 31 successfully shuts down (albeit sluggishly).

How is it albeit sluggishly?

origamisith wrote:

So, I know that the 5.4 kernel in Mint 20 works, and 5.3 in Fedora 31. So, the error must lie between versions 5.4 and 5.7 of the Linux kernel. Any pointers of where to go from here (steps, other forums)? How can I test other versions of the Linux kernel?

You can find practically any older kernel at https://archive.archlinux.org/. But you might get into a building initcpio difficulties, because of problems with the right tools, and their version. If you can, bisecting, or otherwise try to load and cleanly shutdown https://archive.archlinux.org/iso/*, looks to me easier.

If you can access the ESP, possibly from a working linux distro, you might want to install, and boot into, a UEFI shell. If I remember correctly, you can there

reboot --shutdow

, or

shutdown

, or

restart -s

, or something. I don't remember the exact UEFI command. That can verify that the final shutdown steps work as expected. I assume that Linux actually using that UEFI call, but I am only guessing. I didn't do any research to establish the correctness of my guess. And the fact that older kernels succeed to sluggishly shutdown the machine further negates the thought the real problem is from that point on.


pantum-p1000-p2000-p3000-m5100-m5200-ppd-driver (AUR): PPDs, drivers, for Pantum P1000, P2000, P3000, M5100, M5200 printers.
powerofforreboot.efi (AUR): Utilities to be used from within a UEFI boot manager or shell.

Offline

#21 2020-08-05 07:49:54

origamisith
Member
Registered: 2020-07-13
Posts: 11

Re: Won't shut down

So, I kept testing older and older versions of Arch until I found one that shut down. To reaffirm what I hypothesized, the February 2020 release shuts down successfully because it is running the 5.4 kernel version. 5.5 and onward will not shut down!

Offline

#22 2020-08-05 09:26:07

loqs
Member
Registered: 2014-03-06
Posts: 11,239

Re: Won't shut down

The following assumes the base-devel group and git are installed and I recomend enabling Makepkg#Parallel_compilation to reduce build times

$ git clone git://git.archlinux.org/svntogit/packages.git --single-branch --branch "packages/linux"
$ cd packages/trunk
$ git checkout dc8d69b59a7a529ec5aaeb6b32b16e59a3cc1569 #5.4.15.arch1-1
$ cd ../..
$ cp -r packages/trunk linux-git
$ rm -rf packages
$ cd linux-git
# Edit replace the PKGBUILD with the one below
$ makepkg -rsi #This is to confirm 5.4 as built on your system does not have the issue.

There should be one config change for SND_SOC_SOF_BROADWELL_SUPPORT which was was automatically disabled in 5.4.13 select the default.
This build may take a very long time.
Update bootloader for new kernel if needed

$ cd linux-git/src/linux
$ git checkout v5.5
$ cd ../..
$ makepkg -ersi #This is to confirm 5.5 as built on your system does have the issue select the default option for all prompted options

Start bisection

$ cd linux-git/src/linux/
$ git bisect start
$ git bisect good v5.4
$ git bisect bad v5.5
$ cd ../..
$ makepkg -ersif

Bisection loop

$ cd linux-git/src/linux/
$ git bisect $result #Substitue good or bad here
$ cd ../..
$ makepkg -ersif #Repeat these four lines and test the generated kernel until git has found the bad commit

PKGBUILD

# Maintainer: Boohbah <boohbah at gmail.com>
# Contributor: Tobias Powalowski <tpowa@archlinux.org>
# Contributor: Thomas Baechler <thomas@archlinux.org>
# Contributor: Jonathan Chan <jyc@fastmail.fm>
# Contributor: misc <tastky@gmail.com>
# Contributor: NextHendrix <cjones12 at sheffield.ac.uk>

pkgbase=linux-git
_srcname=linux
pkgver=5.4.r0.g219d54332a09
pkgrel=1
arch=('x86_64')
url="https://www.kernel.org/"
license=('GPL2')
makedepends=('kmod' 'bc' 'libelf' 'git')
options=('!strip')
source=('git+https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git#tag=v5.4'
        #'git+https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git#tag=vX.X.Y'
        'config'   # the main kernel config file
)

sha256sums=('SKIP'
            'eb95e2f45dc868b097136d75077b8861b85fea109de78bff253fbf98162e5cb6')

_kernelname=${pkgbase#linux}

pkgver() {
  cd $_srcname

  git describe --long | sed -E 's/^v//;s/([^-]*-g)/r\1/;s/-/./g;s/\.rc/rc/'
}

prepare() {
  cd ${_srcname}

  cp ../config .config

  echo "Setting version..."
  sed -i "s|CONFIG_LOCALVERSION=.*|CONFIG_LOCALVERSION=\"${_kernelname}\"|g" ./.config
  sed -i "s|^.*CONFIG_LOCALVERSION_AUTO.*|CONFIG_LOCALVERSION_AUTO=y|" ./.config

  # prepare for build
  make prepare

  # load configuration
  # Configure the kernel. Replace the line below with one of your choice.
  #make menuconfig # CLI menu for configuration
  #make nconfig # new CLI menu for configuration
  #make xconfig # X-based configuration
  #make oldconfig # using old config from previous kernel version
  #make olddefconfig # old config from previous kernel, defaults for new options
  # ... or manually edit .config
}

build() {
  cd $_srcname

  make LOCALVERSION= bzImage modules
}

_package() {
  pkgdesc="The Linux kernel and modules (git version)"
  depends=('coreutils' 'kmod' 'initramfs')
  optdepends=('crda: to set the correct wireless channels of your country'
              'linux-firmware: firmware images needed for some devices')

  cd $_srcname

  # get kernel version
  _kernver="$(make LOCALVERSION= kernelrelease)"
  _basekernel=${_kernver%%-*}
  _basekernel=${_basekernel%.*}
  local _modulesdir="$pkgdir/usr/lib/modules/$_kernver"

  echo "Installing boot image..."
  # systemd expects to find the kernel here to allow hibernation
  # https://github.com/systemd/systemd/commit/edda44605f06a41fb86b7ab8128dcf99161d2344
  install -Dm644 "$(make -s image_name)" "$_modulesdir/vmlinuz"

  # Used by mkinitcpio to name the kernel
  echo "$pkgbase" | install -Dm644 /dev/stdin "$_modulesdir/pkgbase"

  echo "Installing modules..."
  make LOCALVERSION= INSTALL_MOD_PATH="$pkgdir/usr" modules_install

  # remove build and source links
  rm "$_modulesdir"/{source,build}

  echo "Fixing permissions..."
  chmod -Rc u=rwX,go=rX "$pkgdir"
}

_package-headers() {
  pkgdesc="Header files and scripts for building modules for Linux kernel (git version)"

  cd $_srcname
  local _builddir="${pkgdir}/usr/lib/modules/${_kernver}/build"

  echo "Installing build files..."
  install -Dt "$_builddir" -m644 .config Makefile Module.symvers System.map vmlinux
  install -Dt "$_builddir/kernel" -m644 kernel/Makefile
  install -Dt "$_builddir/arch/x86" -m644 arch/x86/Makefile
  cp -t "$_builddir" -a scripts

  # add objtool for external module building and enabled VALIDATION_STACK option
  install -Dt "$_builddir/tools/objtool" tools/objtool/objtool

  # add xfs and shmem for aufs building
  mkdir -p "$_builddir"/{fs/xfs,mm}

  echo "Installing headers..."
  cp -t "$_builddir" -a include
  cp -t "$_builddir/arch/x86" -a arch/x86/include
  install -Dt "$_builddir/arch/x86/kernel" -m644 arch/x86/kernel/asm-offsets.s

  install -Dt "$_builddir/drivers/md" -m644 drivers/md/*.h
  install -Dt "$_builddir/net/mac80211" -m644 net/mac80211/*.h

  # http://bugs.archlinux.org/task/13146
  install -Dt "$_builddir/drivers/media/i2c" -m644 drivers/media/i2c/msp3400-driver.h

  # http://bugs.archlinux.org/task/20402
  install -Dt "$_builddir/drivers/media/usb/dvb-usb" -m644 drivers/media/usb/dvb-usb/*.h
  install -Dt "$_builddir/drivers/media/dvb-frontends" -m644 drivers/media/dvb-frontends/*.h
  install -Dt "$_builddir/drivers/media/tuners" -m644 drivers/media/tuners/*.h

  echo "Installing KConfig files..."
  find . -name 'Kconfig*' -exec install -Dm644 {} "$_builddir/{}" \;

  echo "Removing unneeded architectures..."
  local _arch
  for _arch in "$_builddir"/arch/*/; do
    [[ ${_arch} == */x86/ ]] && continue
    echo "Removing $(basename "$_arch")"
    rm -r "$_arch"
  done

  echo "Removing documentation..."
  rm -r "$_builddir/Documentation"

  echo "Removing broken symlinks..."
  find -L "$_builddir" -type l -printf 'Removing %P\n' -delete

  echo "Removing loose objects..."
  find "$_builddir" -type f -name '*.o' -printf 'Removing %P\n' -delete

  echo "Stripping build tools..."
  local file
  while read -rd '' file; do
    case "$(file -bi "$file")" in
      application/x-sharedlib\;*)      # Libraries (.so)
        strip -v $STRIP_SHARED "$file" ;;
      application/x-archive\;*)        # Libraries (.a)
        strip -v $STRIP_STATIC "$file" ;;
      application/x-executable\;*)     # Binaries
        strip -v $STRIP_BINARIES "$file" ;;
      application/x-pie-executable\;*) # Relocatable binaries
        strip -v $STRIP_SHARED "$file" ;;
    esac
  done < <(find "$_builddir" -type f -perm -u+x ! -name vmlinux -print0)

  echo "Adding symlink..."
  mkdir -p "$pkgdir/usr/src"
  ln -sr "_$builddir" "$pkgdir/usr/src/$pkgbase"

  echo "Fixing permissions..."
  chmod -Rc u=rwX,go=rX "$pkgdir"
}

pkgname=("$pkgbase" "$pkgbase-headers")
for _p in ${pkgname[@]}; do
  eval "package_$_p() {
    $(declare -f "_package${_p#$pkgbase}")
    _package${_p#$pkgbase}
  }"
done

# vim:set ts=8 sts=2 sw=2 et:

Offline

#23 Yesterday 08:06:11

origamisith
Member
Registered: 2020-07-13
Posts: 11

Re: Won't shut down

Hi, sorry it's been a while.
@loqs I tried following your steps in Virtualbox with Arch but eventually got an error when trying to run the makepkg command. It says

HOSTLD scripts/dtc/dtc
/usr/bin/ld: scripts/dtc/dtc-parser.tab.o:(.bss+0x20): multiple definition of 'yyloc'; scripts/dtc/dtc-lexer.lex.o:(.bss+0x0): first defined here
collect2: error: ld returned 1 exit status
make[1]: *** [scripts/Makefile.host:116: scripts/dtc/dtc] Error 1
make: *** [Makefile:1263: scripts_dtc] Error 2

I tried researching the error. I found a patch on Github (https://github.com/Tomoms/android_kerne … c7af3e54a6) that reportedly may solve my problem, but couldn't figure out how to implement it. I tried following the instructions from the "Patching Packages" wiki page, but when trying to run

makepkg -g >> PKGBUILD

to use the patch, it says

bash: PKGBUILD: Permission denied 

. I have no idea how to give myself, or the directory, or the script, or whatever the necessary permission.

Offline

#24 Yesterday 10:12:17

seth
Member
Registered: 2012-09-03
Posts: 15,751

Offline

#25 Yesterday 19:53:53

loqs
Member
Registered: 2014-03-06
Posts: 11,239

Re: Won't shut down

Updated PKGBUILD using gcc9

# Maintainer: Boohbah <boohbah at gmail.com>
# Contributor: Tobias Powalowski <tpowa@archlinux.org>
# Contributor: Thomas Baechler <thomas@archlinux.org>
# Contributor: Jonathan Chan <jyc@fastmail.fm>
# Contributor: misc <tastky@gmail.com>
# Contributor: NextHendrix <cjones12 at sheffield.ac.uk>

pkgbase=linux-git
_srcname=linux
pkgver=5.4.r0.g219d54332a09
pkgrel=1
arch=('x86_64')
url="https://www.kernel.org/"
license=('GPL2')
makedepends=('kmod' 'bc' 'libelf' 'git' 'gcc9')
options=('!strip')
source=('git+https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git#tag=v5.4'
        #'git+https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git#tag=vX.X.Y'
        'config'   # the main kernel config file
)

sha256sums=('SKIP'
            'eb95e2f45dc868b097136d75077b8861b85fea109de78bff253fbf98162e5cb6')

_kernelname=${pkgbase#linux}

pkgver() {
  cd $_srcname

  git describe --long | sed -E 's/^v//;s/([^-]*-g)/r\1/;s/-/./g;s/\.rc/rc/'
}

prepare() {
  mkdir bin
  ln -s /usr/bin/gcc-9 bin/gcc
  export PATH="$PWD/bin:$PATH"

  cd ${_srcname}
  cp ../config .config

  echo "Setting version..."
  sed -i "s|CONFIG_LOCALVERSION=.*|CONFIG_LOCALVERSION=\"${_kernelname}\"|g" ./.config
  sed -i "s|^.*CONFIG_LOCALVERSION_AUTO.*|CONFIG_LOCALVERSION_AUTO=y|" ./.config

  # prepare for build
  make prepare

  # load configuration
  # Configure the kernel. Replace the line below with one of your choice.
  #make menuconfig # CLI menu for configuration
  #make nconfig # new CLI menu for configuration
  #make xconfig # X-based configuration
  #make oldconfig # using old config from previous kernel version
  #make olddefconfig # old config from previous kernel, defaults for new options
  # ... or manually edit .config
}

build() {
  export PATH="$PWD/bin:$PATH"
  cd $_srcname

  make LOCALVERSION= bzImage modules
}

_package() {
  pkgdesc="The Linux kernel and modules (git version)"
  depends=('coreutils' 'kmod' 'initramfs')
  optdepends=('crda: to set the correct wireless channels of your country'
              'linux-firmware: firmware images needed for some devices')

  export PATH="$PWD/bin:$PATH"
  cd $_srcname

  # get kernel version
  _kernver="$(make LOCALVERSION= kernelrelease)"
  _basekernel=${_kernver%%-*}
  _basekernel=${_basekernel%.*}
  local _modulesdir="$pkgdir/usr/lib/modules/$_kernver"

  echo "Installing boot image..."
  # systemd expects to find the kernel here to allow hibernation
  # https://github.com/systemd/systemd/commit/edda44605f06a41fb86b7ab8128dcf99161d2344
  install -Dm644 "$(make -s image_name)" "$_modulesdir/vmlinuz"

  # Used by mkinitcpio to name the kernel
  echo "$pkgbase" | install -Dm644 /dev/stdin "$_modulesdir/pkgbase"

  echo "Installing modules..."
  make LOCALVERSION= INSTALL_MOD_PATH="$pkgdir/usr" modules_install

  # remove build and source links
  rm "$_modulesdir"/{source,build}

  echo "Fixing permissions..."
  chmod -Rc u=rwX,go=rX "$pkgdir"
}

_package-headers() {
  pkgdesc="Header files and scripts for building modules for Linux kernel (git version)"

  cd $_srcname
  local _builddir="${pkgdir}/usr/lib/modules/${_kernver}/build"

  echo "Installing build files..."
  install -Dt "$_builddir" -m644 .config Makefile Module.symvers System.map vmlinux
  install -Dt "$_builddir/kernel" -m644 kernel/Makefile
  install -Dt "$_builddir/arch/x86" -m644 arch/x86/Makefile
  cp -t "$_builddir" -a scripts

  # add objtool for external module building and enabled VALIDATION_STACK option
  install -Dt "$_builddir/tools/objtool" tools/objtool/objtool

  # add xfs and shmem for aufs building
  mkdir -p "$_builddir"/{fs/xfs,mm}

  echo "Installing headers..."
  cp -t "$_builddir" -a include
  cp -t "$_builddir/arch/x86" -a arch/x86/include
  install -Dt "$_builddir/arch/x86/kernel" -m644 arch/x86/kernel/asm-offsets.s

  install -Dt "$_builddir/drivers/md" -m644 drivers/md/*.h
  install -Dt "$_builddir/net/mac80211" -m644 net/mac80211/*.h

  # http://bugs.archlinux.org/task/13146
  install -Dt "$_builddir/drivers/media/i2c" -m644 drivers/media/i2c/msp3400-driver.h

  # http://bugs.archlinux.org/task/20402
  install -Dt "$_builddir/drivers/media/usb/dvb-usb" -m644 drivers/media/usb/dvb-usb/*.h
  install -Dt "$_builddir/drivers/media/dvb-frontends" -m644 drivers/media/dvb-frontends/*.h
  install -Dt "$_builddir/drivers/media/tuners" -m644 drivers/media/tuners/*.h

  echo "Installing KConfig files..."
  find . -name 'Kconfig*' -exec install -Dm644 {} "$_builddir/{}" \;

  echo "Removing unneeded architectures..."
  local _arch
  for _arch in "$_builddir"/arch/*/; do
    [[ ${_arch} == */x86/ ]] && continue
    echo "Removing $(basename "$_arch")"
    rm -r "$_arch"
  done

  echo "Removing documentation..."
  rm -r "$_builddir/Documentation"

  echo "Removing broken symlinks..."
  find -L "$_builddir" -type l -printf 'Removing %P\n' -delete

  echo "Removing loose objects..."
  find "$_builddir" -type f -name '*.o' -printf 'Removing %P\n' -delete

  echo "Stripping build tools..."
  local file
  while read -rd '' file; do
    case "$(file -bi "$file")" in
      application/x-sharedlib\;*)      # Libraries (.so)
        strip -v $STRIP_SHARED "$file" ;;
      application/x-archive\;*)        # Libraries (.a)
        strip -v $STRIP_STATIC "$file" ;;
      application/x-executable\;*)     # Binaries
        strip -v $STRIP_BINARIES "$file" ;;
      application/x-pie-executable\;*) # Relocatable binaries
        strip -v $STRIP_SHARED "$file" ;;
    esac
  done < <(find "$_builddir" -type f -perm -u+x ! -name vmlinux -print0)

  echo "Adding symlink..."
  mkdir -p "$pkgdir/usr/src"
  ln -sr "_$builddir" "$pkgdir/usr/src/$pkgbase"

  echo "Fixing permissions..."
  chmod -Rc u=rwX,go=rX "$pkgdir"
}

pkgname=("$pkgbase" "$pkgbase-headers")
for _p in ${pkgname[@]}; do
  eval "package_$_p() {
    $(declare -f "_package${_p#$pkgbase}")
    _package${_p#$pkgbase}
  }"
done

# vim:set ts=8 sts=2 sw=2 et:

Offline

Board footer

Powered by FluxBB