slow apt-get update when no /proc

Bug #1815426 reported by James Dingwall
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
apt (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

When building a disk image inside a docker container an `apt-get update` executed in the chroot filesystem is very slow. This seems similar to behaviour reported in #1332440.

Ubuntu bionic host docker-ce 5:18.09.1~3-0~ubuntu-bionic -> ubuntu:18.04 docker image -> bionic chroot in filesystem

This is the strace log for `time chroot /chroot strace -f -c apt-get update`. Without strace the time taken is several minutes.

% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
 64.10 3320.491672 15736927 211 wait4
 35.80 1854.413794 41 45088937 45088461 fcntl
  0.02 1.241204 51 24449 write
  0.02 1.139271 85 13385 select
  0.02 0.812803 30 26800 rt_sigprocmask
  0.01 0.576267 38 15216 952 stat
  0.01 0.417666 31 13475 gettimeofday
  0.00 0.134767 46 2910 mmap
  0.00 0.133443 20 6515 4 read
  0.00 0.125584 56 2252 mprotect
  0.00 0.105820 48 2211 283 openat
  0.00 0.090246 32 2821 24 close
  0.00 0.058151 43 1343 1334 access
  0.00 0.056635 34 1674 fstat
  0.00 0.028297 18 1586 rt_sigaction
  0.00 0.021441 34 636 brk
  0.00 0.017399 84 208 munmap
  0.00 0.017212 233 74 32 unlink
  0.00 0.012868 55 236 getdents
  0.00 0.008162 80 102 102 statfs
  0.00 0.007709 26 293 dup2
  0.00 0.006800 32 215 4 clone
  0.00 0.006028 40 152 arch_prctl
  0.00 0.005355 35 152 execve
  0.00 0.004548 31 147 prlimit64
  0.00 0.003690 27 139 set_robust_list
  0.00 0.003585 24 151 pipe
  0.00 0.003491 32 108 16 lseek
  0.00 0.003158 34 92 set_tid_address
  0.00 0.002912 38 77 futex
  0.00 0.002291 42 55 51 ioctl
  0.00 0.002144 13 164 1 rt_sigreturn
  0.00 0.001891 33 58 getuid
  0.00 0.001825 46 40 lstat
  0.00 0.001694 17 99 geteuid
  0.00 0.001461 27 54 getpid
  0.00 0.001402 33 43 umask
  0.00 0.001380 69 20 4 unlinkat
  0.00 0.000996 13 76 44 faccessat
  0.00 0.000797 50 16 4 newfstatat
  0.00 0.000703 35 20 4 fadvise64
  0.00 0.000698 175 4 mkdir
  0.00 0.000500 50 10 chmod
  0.00 0.000469 39 12 getgid
  0.00 0.000441 55 8 lchown
  0.00 0.000405 51 8 utimensat
  0.00 0.000402 50 8 sysinfo
  0.00 0.000392 33 12 sigaltstack
  0.00 0.000380 48 8 getppid
  0.00 0.000307 20 15 13 connect
  0.00 0.000273 68 4 fchmodat
  0.00 0.000269 17 16 socket
  0.00 0.000268 34 8 flistxattr
  0.00 0.000258 65 4 sched_getaffinity
  0.00 0.000254 32 8 8 fstatfs
  0.00 0.000219 55 4 fsetxattr
  0.00 0.000209 52 4 dup
  0.00 0.000202 29 7 getegid
  0.00 0.000179 45 4 getcwd
  0.00 0.000174 44 4 fchdir
  0.00 0.000166 42 4 4 fgetxattr
  0.00 0.000159 80 2 chown
  0.00 0.000151 38 4 uname
  0.00 0.000114 38 3 setgid
  0.00 0.000105 26 4 chdir
  0.00 0.000096 24 4 setgroups
  0.00 0.000089 22 4 setresuid
  0.00 0.000081 20 4 setresgid
  0.00 0.000070 18 4 kill
  0.00 0.000039 20 2 prctl
  0.00 0.000038 38 1 getgroups
  0.00 0.000000 0 4 poll
  0.00 0.000000 0 10 mremap
  0.00 0.000000 0 3 sendto
  0.00 0.000000 0 32 7 recvfrom
  0.00 0.000000 0 6 sendmsg
  0.00 0.000000 0 2 recvmsg
  0.00 0.000000 0 1 bind
  0.00 0.000000 0 1 getsockname
  0.00 0.000000 0 1 getsockopt
  0.00 0.000000 0 2 rename
  0.00 0.000000 0 4 fchmod
  0.00 0.000000 0 2 getrusage
  0.00 0.000000 0 2 getresuid
  0.00 0.000000 0 2 getresgid
  0.00 0.000000 0 3 clock_gettime
  0.00 0.000000 0 5 getrandom
------ ----------- ----------- --------- --------- ----------------
100.00 5179.973969 45207476 45091352 total

real 133m21.564s
user 30m10.764s
sys 139m27.158s

After bind mounting /proc to the chroot from the docker container the speed was normal. I'm not sure if this is an edge case that doesn't warrant attention or if it is revealing some adverse behaviour which needs attention. Now I know to mount /proc its not so much of a problem.

Revision history for this message
Julian Andres Klode (juliank) wrote :

This is to be expected, /proc is necessary in order to close open files for figuring out which files are open. Without proc, we just close _all_ file descriptors (~65k or so?).

Changed in apt (Ubuntu):
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.