{
errno = 0;
- /* drop supplementary groups */
- if (setgroups(0, NULL) != 0)
- goto fail;
-
/* drop GID */
if (setgid(getgid()) < 0)
goto fail;
if (ioctl(dev_fd, LOOP_CONFIGURE, &lc->config) < 0) {
rc = -errno;
errsv = errno;
- if (errno != EINVAL) {
+ if (errno != EINVAL && errno != ENOTTY) {
DBG(SETUP, ul_debugobj(lc, "LOOP_CONFIGURE failed: %m"));
goto err;
}
tc = 0;
ret = pass;
+ ret = pass;
tty.c_iflag &= ~(IUCLC|IXON|IXOFF|IXANY);
tty.c_lflag &= ~(ECHO|ECHOE|ECHOK|ECHONL|TOSTOP|ISIG);
err(EXIT_FAILURE, _("cannot chdir to '%s'"), newdir);
if (procmnt) {
- if (!newroot && mount("none", procmnt, NULL, MS_PRIVATE|MS_REC, NULL) != 0)
- err(EXIT_FAILURE, _("cannot change %s filesystem propagation"), procmnt);
+ /* When not changing root and using the default propagation flags
+ then the recursive propagation change of root will
+ automatically change that of an existing proc mount. */
+ if (!newroot && propagation != (MS_PRIVATE|MS_REC)) {
+ int rc = mount("none", procmnt, NULL, MS_PRIVATE|MS_REC, NULL);
+
+ /* Custom procmnt means that proc is very likely not mounted, causing EINVAL.
+ Ignoring the error in this specific instance is considered safe. */
+ if(rc != 0 && errno != EINVAL)
+ err(EXIT_FAILURE, _("cannot change %s filesystem propagation"), procmnt);
+ }
+
if (mount("proc", procmnt, "proc", MS_NOSUID|MS_NOEXEC|MS_NODEV, NULL) != 0)
err(EXIT_FAILURE, _("mount %s failed"), procmnt);
}
Disklabel type: dos
Disk identifier: <removed>
-Device Boot Start End Sectors Size Id Type
-<removed>1 2048 4095 2048 1M 83 Linux
+Device Boot Start End Sectors Id Type Start-C/H/S End-C/H/S Attrs
+<removed>1 2048 4095 2048 83 Linux 0/32/33 0/65/1
-------------------
Create 2nd primary partition
00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
000001b0 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 20 |............... |
-000001c0 21 00 83 41 01 00 00 08 00 00 00 08 00 00 00 04 |!..A............|
-000001d0 01 3e 83 13 41 36 00 10 00 00 00 40 00 00 00 00 |.>..A6.....@....|
+000001c0 21 00 83 41 01 00 00 08 00 00 00 08 00 00 00 41 |!..A...........A|
+000001d0 02 00 83 46 05 01 00 10 00 00 00 40 00 00 00 00 |...F.......@....|
000001e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.|
00000200 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
000001b0 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 20 |............... |
-000001c0 21 00 83 41 01 00 00 08 00 00 00 08 00 00 00 04 |!..A............|
-000001d0 01 3e a5 13 41 36 00 10 00 00 00 40 00 00 00 00 |.>..A6.....@....|
+000001c0 21 00 83 41 01 00 00 08 00 00 00 08 00 00 00 41 |!..A...........A|
+000001d0 02 00 a5 46 05 01 00 10 00 00 00 40 00 00 00 00 |...F.......@....|
000001e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.|
00000200 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
Disklabel type: dos
Disk identifier: <removed>
-Device Boot Start End Sectors Size Id Type
-<removed>1 2048 4095 2048 1M 83 Linux
-<removed>2 4096 20479 16384 8M a5 FreeBSD
+Device Boot Start End Sectors Id Type Start-C/H/S End-C/H/S Attrs
+<removed>1 2048 4095 2048 83 Linux 0/32/33 0/65/1
+<removed>2 4096 20479 16384 a5 FreeBSD 0/65/2 1/70/5
-------------------
Create default BSD
00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
000001b0 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 20 |............... |
-000001c0 21 00 83 41 01 00 00 08 00 00 00 08 00 00 00 04 |!..A............|
-000001d0 01 3e a5 13 41 36 00 10 00 00 00 40 00 00 00 00 |.>..A6.....@....|
+000001c0 21 00 83 41 01 00 00 08 00 00 00 08 00 00 00 41 |!..A...........A|
+000001d0 02 00 a5 46 05 01 00 10 00 00 00 40 00 00 00 00 |...F.......@....|
000001e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.|
00000200 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
000001b0 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 20 |............... |
-000001c0 21 00 83 41 01 00 00 08 00 00 00 08 00 00 00 04 |!..A............|
-000001d0 01 3e a5 13 41 36 00 10 00 00 00 40 00 00 00 00 |.>..A6.....@....|
+000001c0 21 00 83 41 01 00 00 08 00 00 00 08 00 00 00 41 |!..A...........A|
+000001d0 02 00 a5 46 05 01 00 10 00 00 00 40 00 00 00 00 |...F.......@....|
000001e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.|
00000200 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
Disklabel type: dos
Disk identifier: <removed>
-Device Boot Start End Sectors Size Id Type
-<removed>1 2048 4095 2048 1M 83 Linux
+Device Boot Start End Sectors Id Type Start-C/H/S End-C/H/S Attrs
+<removed>1 2048 4095 2048 83 Linux 0/32/33 0/65/1
-------------------
Create 2nd primary partition
00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
000001b0 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 20 |............... |
-000001c0 21 00 83 41 01 00 00 08 00 00 00 08 00 00 00 04 |!..A............|
-000001d0 01 3e 83 13 41 36 00 10 00 00 00 40 00 00 00 00 |.>..A6.....@....|
+000001c0 21 00 83 41 01 00 00 08 00 00 00 08 00 00 00 41 |!..A...........A|
+000001d0 02 00 83 46 05 01 00 10 00 00 00 40 00 00 00 00 |...F.......@....|
000001e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.|
00000200 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
000001b0 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 20 |............... |
-000001c0 21 00 83 41 01 00 00 08 00 00 00 08 00 00 00 04 |!..A............|
-000001d0 01 3e a5 13 41 36 00 10 00 00 00 40 00 00 00 00 |.>..A6.....@....|
+000001c0 21 00 83 41 01 00 00 08 00 00 00 08 00 00 00 41 |!..A...........A|
+000001d0 02 00 a5 46 05 01 00 10 00 00 00 40 00 00 00 00 |...F.......@....|
000001e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.|
00000200 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
Disklabel type: dos
Disk identifier: <removed>
-Device Boot Start End Sectors Size Id Type
-<removed>1 2048 4095 2048 1M 83 Linux
-<removed>2 4096 20479 16384 8M a5 FreeBSD
+Device Boot Start End Sectors Id Type Start-C/H/S End-C/H/S Attrs
+<removed>1 2048 4095 2048 83 Linux 0/32/33 0/65/1
+<removed>2 4096 20479 16384 a5 FreeBSD 0/65/2 1/70/5
-------------------
Create default BSD
00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
000001b0 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 20 |............... |
-000001c0 21 00 83 41 01 00 00 08 00 00 00 08 00 00 00 04 |!..A............|
-000001d0 01 3e a5 13 41 36 00 10 00 00 00 40 00 00 00 00 |.>..A6.....@....|
+000001c0 21 00 83 41 01 00 00 08 00 00 00 08 00 00 00 41 |!..A...........A|
+000001d0 02 00 a5 46 05 01 00 10 00 00 00 40 00 00 00 00 |...F.......@....|
000001e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.|
00000200 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
000001b0 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 20 |............... |
-000001c0 21 00 83 41 01 00 00 08 00 00 00 08 00 00 00 04 |!..A............|
-000001d0 01 3e a5 13 41 36 00 10 00 00 00 40 00 00 00 00 |.>..A6.....@....|
+000001c0 21 00 83 41 01 00 00 08 00 00 00 08 00 00 00 41 |!..A...........A|
+000001d0 02 00 a5 46 05 01 00 10 00 00 00 40 00 00 00 00 |...F.......@....|
000001e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.|
00000200 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|