Bug 12241 - Permission denied while running "make"
Summary: Permission denied while running "make"
Status: RESOLVED FIXED
Alias: None
Product: buildroot
Classification: Unclassified
Component: Other (show other bugs)
Version: 2019.08
Hardware: PC Linux
: P5 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-09-19 18:19 UTC by Cerem Cem ASLAN
Modified: 2019-09-25 20:09 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Cerem Cem ASLAN 2019-09-19 18:19:03 UTC
I'm getting the following error when I run "make": 


 INSTALL include/linux/iio (2 files)
  INSTALL include/linux/isdn (1 file)
  INSTALL include/linux/mmc (1 file)
  INSTALL include/linux/netfilter (88 files)
  INSTALL include/linux/netfilter_arp (2 files)
  INSTALL include/linux/netfilter_bridge (17 files)
  INSTALL include/linux/netfilter_ipv4 (9 files)
  INSTALL include/linux/netfilter/ipset (4 files)
  INSTALL include/linux/netfilter_ipv6 (13 files)
  INSTALL include/linux/nfsd (5 files)
  INSTALL include/linux/raid (2 files)
  INSTALL include/linux/sched (1 file)
  INSTALL include/linux/spi (1 file)
  INSTALL include/linux/sunrpc (1 file)
  INSTALL include/linux/tc_act (15 files)
  INSTALL include/linux/tc_ematch (5 files)
  INSTALL include/linux/usb (13 files)
  INSTALL include/linux/wimax (1 file)
  INSTALL include/asm (38 files)
make[1]: Leaving directory '/home/ceremcem/sync/curr-projects/scada-gateway/os/disk-images/rpi-buildroot/output/build/linux-headers-4.19.38'
if ! support/scripts/check-kernel-headers.sh  /home/ceremcem/sync/curr-projects/scada-gateway/os/disk-images/rpi-buildroot/output/host/arm-buildroot-linux-uclibcgnueabihf/sysroot  4.19; then exit 1; fi
support/scripts/check-kernel-headers.sh: 38: support/scripts/check-kernel-headers.sh: /tmp/check-headers.rQZuHv: Permission denied
make: *** [package/pkg-generic.mk:283: /home/ceremcem/sync/curr-projects/scada-gateway/os/disk-images/rpi-buildroot/output/build/linux-headers-4.19.38/.stamp_staging_installed] Error 1

-----------------


I'm using a git clone: cd8ab1853d (HEAD -> latest-release, tag: 2019.08-rc3) Update for 2019.08-rc3

Host is: Linux cca-erik 4.19.0-1-amd64 #1 SMP Debian 4.19.12-1 (2018-12-22) x86_64 GNU/Linux
Comment 1 Thomas Petazzoni 2019-09-19 19:42:57 UTC
I'm afraid this does not look like a Buildroot issue, but a system configuration issue on your machine: /tmp is not writable by the user with which you're doing the Buildroot build. Could you try to just run "touch /tmp/foobar" ? I guess you'll get the same Permission denied issue. If it's the case, then you have to fix your system /tmp permissions.
Comment 2 Cerem Cem ASLAN 2019-09-20 00:06:41 UTC
"touch /tmp/foobar" works correctly:

ceremcem@cca-erik:~$ touch /tmp/foobar
ceremcem@cca-erik:~$ ls -l /tmp/foobar
-rw-r--r-- 1 ceremcem ceremcem 0 Sep 20 03:04 /tmp/foobar


FYI: I've been using this installation for more than 2 years without any issue.
Comment 3 Carlos Santos 2019-09-20 00:29:23 UTC
(In reply to Cerem Cem ASLAN from comment #2)

Is your /tmp mounted with "noexec" option? What's the output of the command

    mount | grep -F /tmp
Comment 4 Cerem Cem ASLAN 2019-09-20 06:58:06 UTC
Exactly: 

ceremcem@cca-erik:~$  mount | grep -F /tmp
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noexec,noatime,size=524288k)


I remounted with "exec": 

sudo mount -o remount,exec /tmp

Then compilation continued. Would you consider adding that checking into makefile? (I may provide a patch for that)
Comment 5 Thomas Petazzoni 2019-09-20 11:30:29 UTC
(In reply to Carlos Santos from comment #3)
Good finding Carlos! Is mounting /tmp with noexec a common thing? From a quick Google search seems like a number of people are recommending to do this. Not sure if this is good advice.

But, for this specific case, Buildroot generally puts all its generated contents in $(O), even temporary things. Perhaps we should do the same for this check-headers script?
Comment 6 Carlos Santos 2019-09-20 15:09:25 UTC
(In reply to Thomas Petazzoni from comment #5)

Some people recommend mounting /tmp with nodev, noexec and nosuid options for
security reasons. It is pretty common on FreeBSD but it's not default on Linux
distros.

I will send a patch for check-kernel-headers.sh to fix this.
Comment 7 Thomas Petazzoni 2019-09-25 20:09:58 UTC
Fixed by https://git.buildroot.org/buildroot/commit/?id=6136765b23abd9faba610dd54ed276a777811575. Thanks Carlos for the investigation and fix!