- Package:
- initscripts
- Source:
- sysvinit
- Submitter:
- Harald Dunkel
- Date:
- 2025-02-21 17:15:02 UTC
- Severity:
- wishlist
For LXC systems all mounts are supposed to happen _before_ init is run. Every mount tried by one of the run level scripts creates a "permission denied" error message. Below is a sample boot session showing startup and shutdown of a LXC system (CONCURRENCY=none). The problem is that I cannot disable the "unwanted" scripts performing the mount, because I would loose other initialization steps as well. It would be very nice if the run level scripts doing mount/\ umount could be streamlined to support LXC systems. Many thanx Harri ------------------------------------------------------------------- # lxc-start -n wheezy INIT: version 2.88 booting @@@ /etc/rcS.d/S01checkroot-bootclean.sh start Cleaning up temporary files... /tmp /lib/init/rw /run /run/lock /run/shm. @@@ /etc/rcS.d/S01mountkernfs.sh start mount: permission denied mount: permission denied @@@ /etc/rcS.d/S01mtab.sh start mount: permission denied mount: permission denied mount: permission denied Mount point '/dev/console' does not exist. Skipping mount. ... (warning). Mount point '/dev/tty1' does not exist. Skipping mount. ... (warning). Mount point '/dev/tty2' does not exist. Skipping mount. ... (warning). Mount point '/dev/tty3' does not exist. Skipping mount. ... (warning). Mount point '/dev/tty4' does not exist. Skipping mount. ... (warning). Mount point '/dev/ptmx' does not exist. Skipping mount. ... (warning). @@@ /etc/rcS.d/S02mountdevsubfs.sh start mount: permission denied @@@ /etc/rcS.d/S03bootlogd start @@@ /etc/rcS.d/S04checkfs.sh start Activating lvm and md swap...done. Checking file systems...fsck from util-linux 2.20.1 done. @@@ /etc/rcS.d/S05hostname.sh start hostname: you must be root to change the host name @@@ /etc/rcS.d/S05mountall.sh start Mounting local filesystems...done. /etc/rcS.d/S05mountall.sh: 59: kill: Illegal number: 2 1 Activating swapfile swap...done. mount: permission denied mount: permission denied mount: permission denied @@@ /etc/rcS.d/S06mountall-bootclean.sh start Cleaning up temporary files.... @@@ /etc/rcS.d/S07procps start Setting kernel variables ...done. @@@ /etc/rcS.d/S07resolvconf start Setting up resolvconf...done. @@@ /etc/rcS.d/S07urandom start @@@ /etc/rcS.d/S08networking start Configuring network interfaces...Internet Systems Consortium DHCP Client 4.2.2 Copyright 2004-2011 Internet Systems Consortium. All rights reserved. For info, please visit https://www.isc.org/software/dhcp/ Listening on LPF/eth0/00:20:82:75:b6:ef Sending on LPF/eth0/00:20:82:75:b6:ef Sending on Socket/fallback DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 4 DHCPREQUEST on eth0 to 255.255.255.255 port 67 DHCPOFFER from 172.19.96.123 DHCPACK from 172.19.96.123 bound to 172.19.99.214 -- renewal in 885 seconds. done. @@@ /etc/rcS.d/S09mountnfs.sh start @@@ /etc/rcS.d/S10mountnfs-bootclean.sh start Cleaning up temporary files.... @@@ /etc/rcS.d/S11bootmisc.sh start @@@ /etc/rcS.d/S12stop-bootlogd-single start INIT: Entering runlevel: 3 @@@ /etc/rc3.d/S01bootlogs start @@@ /etc/rc3.d/S01motd start @@@ /etc/rc3.d/S01rsyslog start Starting enhanced syslogd: rsyslogd. @@@ /etc/rc3.d/S02cron start Starting periodic command scheduler: cron. @@@ /etc/rc3.d/S02rsync start @@@ /etc/rc3.d/S02ssh start Starting OpenBSD Secure Shell server: sshd. @@@ /etc/rc3.d/S03rc.local start @@@ /etc/rc3.d/S03rmnologin start @@@ /etc/rc3.d/S03stop-bootlogd start Debian GNU/Linux 7.0 wheezy.vs.aixigo.de console INIT: Switching to runlevel: 0 INIT: Sending processes the TERM signal @@@ /etc/rc0.d/K01resolvconf stop Stopping resolvconf...done. @@@ /etc/rc0.d/K01sendsigs stop Asking all remaining processes to terminate...done. All processes ended within 1 seconds...done. @@@ /etc/rc0.d/K01urandom stop @@@ /etc/rc0.d/K02rsyslog stop Stopping enhanced syslogd: rsyslogd. @@@ /etc/rc0.d/K03umountnfs.sh stop umount: /dev/ptmx: must be superuser to umount umount: /dev/tty4: must be superuser to umount umount: /dev/tty3: must be superuser to umount umount: /dev/tty2: must be superuser to umount umount: /dev/tty1: must be superuser to umount umount: /dev/console: must be superuser to umount @@@ /etc/rc0.d/K04networking stop Deconfiguring network interfaces...Internet Systems Consortium DHCP Client 4.2.2 Copyright 2004-2011 Internet Systems Consortium. All rights reserved. For info, please visit https://www.isc.org/software/dhcp/ Listening on LPF/eth0/00:20:82:75:b6:ef Sending on LPF/eth0/00:20:82:75:b6:ef Sending on Socket/fallback DHCPRELEASE on eth0 to 172.19.96.123 port 67 done. @@@ /etc/rc0.d/K05umountfs stop Unmounting temporary filesystems...umount: /lib/init/rw: must be superuser to umount failed. Deactivating swap...swapoff: Not superuser. failed. @@@ /etc/rc0.d/K06umountroot stop mount: permission denied @@@ /etc/rc0.d/K07halt stop Will now halt. INIT: no more processes left in this runlevel
If the scripts should be no-ops when lxc is in use, then this should be fairly straightforward to cater for. How do we detect unambigiously if lxc is in use? I'll be happy to review any apply any patches which improve lxc support. Thanks, Roger
I strongly recommend a more generic approach of detecting whether the required mount is already mounted, and skipping the operation if it is. This has two advantages: - this isn't specific to lxc, but will correctly handle any other (theoretical) cases where the mounts are handled prior to initscripts. - if the lxc environment doesn't match the initscripts expectations, there will still be a suitable error message at boot about the failure to mount any mounts that are missing.
There is the non-obvious, and quite vexing issue of mount options.
Non-obvious, but it did occur to me as I was writing this comment because of a related bug in Ubuntu about failing to remount initramfs-mounted filesystems with the mount options specified in /etc/fstab. I think it doesn't actually impact the correct design here. Either your mount does have a compatible set of mount options, in which case you don't need to do anything; or it doesn't, in which case a remount is the correct course of action and if it fails, it fails. The proper course of action for the admin in the case of a mismatch is the same, no matter how this is handled within the lxc environment - it needs to be fixed in the configuration outside the container.