Re: Half a success with chroot

2018-03-13 Thread Thorsten Wilms

On 12.03.2018 23:29, Gábor Boskovits wrote:

Could you please check, if the solution mentioned here works for you:
https://bugzilla.redhat.com/show_bug.cgi?id=1361043

A short summary: Similar error can be caused by shared mounts.

This way you can check if this applies.

Note 'shared' in the output:

grep -iP '/ /\s' /proc/$$/mountinfo
...
25 0 252:1 / / rw,relatime shared:1 - ext4 /dev/mapper/my--vg-root 
rw,errors=remount-ro,data=ordered
...


$ grep -iP '/ /\s' /proc/$$/mountinfo
26 0 8:17 / / rw,relatime shared:1 - ext4 /dev/sdb1 
rw,errors=remount-ro,data=ordered




This is usual in systemd systems, and Ubuntu is one of them.

Calling unshare -m within the process context helps this.


I interpreted that to mean after the chroot, but:
---
$ sudo chroot /media/ssd-alt-system /run/current-system/profile/bin/bash
root@charly /# source /etc/profile
root@charly /# unshare -m
unshare: failed to execute /bin/bash: No such file or directory
---

However, combined with chroot, it works:
---
$ sudo unshare -m sudo chroot /media/ssd-alt-system 
/run/current-system/profile/bin/bash

root@charly /# source /etc/profile
root@charly /# guix-daemon --build-users-group=guixbuild &
[1] 5907
root@charly /# su thorwil
thorwil@charly /$ source /etc/profile
thorwil@charly /$ guix package -i emacs-bash-completion
guile: warning: failed to install locale
warning: failed to install locale: Invalid argument
accepted connection from pid 5916, user thorwil
spurious SIGPOLL
spurious SIGPOLL
spurious SIGPOLL
The following package will be installed:
   emacs-bash-completion	2.0.0 
/gnu/store/7irxjifw4m8sj0if2nj0r26vf0n0imsj-emacs-bash-completion-2.0.0


substitute: guile: warning: failed to install locale
substitute: warning: failed to install locale: Invalid argument
spurious SIGPOLL
substitute: updating list of substitutes from 
'https://mirror.hydra.gnu.org'... 100.0%

The following derivations will be built:
   /gnu/store/gdihnrv0zykypajy7p94k9qzpmgqbkvz-profile.drv
   /gnu/store/xlyyh54y77nm8gzm81rckkcvzaihn7dh-fonts-dir.drv
   /gnu/store/pm80lbbbx2xhvnfb838zn90bwwcw2818-xdg-desktop-database.drv
   /gnu/store/nkcspwxnd7hmf144krxzv1clq4gch6ms-ca-certificate-bundle.drv
   /gnu/store/n72ahz242h07dz32g2fkpr308a6cwdb6-xdg-mime-database.drv
   /gnu/store/fw9k5rg7p6czcp4bnnqkr57gv1qcyg78-gtk-im-modules.drv
   /gnu/store/856smz8kn9l2gq2b6qcykv6aa06c3qv7-info-dir.drv
   /gnu/store/1bybb1dnry03qwkr2d2888xi2z0hb6y7-gtk-icon-themes.drv

/gnu/store/4vgn265kihmk1aayy3rg5h4z00dvlfmy-emacs-bash-completion-2.0.0.drv
   /gnu/store/gwlj87yvqfsrv6lzcphfm65ndwpar0df-manual-database.drv
grafting 
'/gnu/store/hfc5j4dq387s2iyvz392dja8zc75cvss-emacs-bash-completion-2.0.0' 
-> 
'/gnu/store/7irxjifw4m8sj0if2nj0r26vf0n0imsj-emacs-bash-completion-2.0.0'...

Creating manual page database...
32 entries processed in 0.2 s

warning: collision encountered:
/gnu/store/jfbf26368y3q897whlf8n5vina2scj82-gtk-icon-themes/share/icons/hicolor/icon-theme.cache
/gnu/store/wndka13848kxaxw2ymv7l4ajzi1abrbb-inkscape-0.92.2/share/icons/hicolor/icon-theme.cache
warning: arbitrarily choosing 
/gnu/store/jfbf26368y3q897whlf8n5vina2scj82-gtk-icon-themes/share/icons/hicolor/icon-theme.cache

44 packages in profile
thorwil@charly /$
---

There are still those "spurious SIGPOLL" and I don't think I saw 
"substitute: guile: warning: failed to install locale" when booted into 
Guix SD.



I'm forwarding this also to devel, so that we can discuss, if doing this 
is advisable in

general. WDYT?


OK, I just subscribed to guix-devel.


--
Thorsten Wilms

thorwil's design for free software:
http://thorwil.wordpress.com/



Re: Half a success with chroot

2018-03-12 Thread Gábor Boskovits
2018-03-12 22:10 GMT+01:00 Thorsten Wilms :

> On 12.03.2018 20:17, Gábor Boskovits wrote:
>
> Hello! It would be nice to know the error code returned by the pivot_root
>> syscall. It might point to the reason of the failure.
>> Most probably you can get that using strace. Stracing the daemon is
>> possible using strace -fp pid_of_daemon.
>>
>
> Result of `strace -fp 3364 &> strace_guix-daemon.txt &` attached.
>
> grep -b4 -a4 pivot strace_guix-daemon.txt
> 5208309-[pid  3421] mount("none", "/gnu/store/4vgn265kihmk1aayy3
> rg5h4z00dvlfmy-emacs-bash-completion-2.0.0.drv.chroot/dev/shm", "tmpfs",
> 0, NULL) = 0
> 5208451-[pid  3421] lstat("/dev/pts/ptmx", 0x7fff0a3217a0) = -1 ENOENT (No
> such file or directory)
> 5208542-[pid  3421] chdir("/gnu/store/4vgn265kihmk
> 1aayy3rg5h4z00dvlfmy-emacs-bash-completion-2.0.0.drv.chroot") = 0
> 5208650-[pid  3421] mkdir("real-root", 000) = 0
> 5208694:[pid  3421] pivot_root(".", "real-root") = -1 EINVAL (Invalid
> argument)
> 5208766-[pid  3421] write(2, "while setting up the build envir"..., 190) =
> 190
> 5208837-[pid  3411] <... read resumed> "w", 1)  = 1
> 5208881-[pid  3421] exit_group(1 
> 5208923-[pid  3411] read(15,  
>
>
> Context:
> ---
> root@charly # guix-daemon --build-users-group=guixbuild &
> [1] 3364
> root@charly /# strace -fp 3364 &> strace_guix-daemon.txt &
> [2] 3395
> root@charly /# su thorwil
> thorwil@charly /$ source /etc/profile
> thorwil@charly /$ guix package -i emacs-bash-completion
> guile: warning: failed to install locale
> warning: failed to install locale: Invalid argument
> accepted connection from pid 3407, user thorwil
> spurious SIGPOLL
> The following package will be installed:
>emacs-bash-completion2.0.0 /gnu/store/7irxjifw4m8sj0if2nj
> 0r26vf0n0imsj-emacs-bash-completion-2.0.0
>
> substitute: guile: warning: failed to install locale
> substitute: warning: failed to install locale: Invalid argument
> substitute: updating list of substitutes from '
> https://mirror.hydra.gnu.org'... 100.0%
> The following derivations will be built:
>/gnu/store/gdihnrv0zykypajy7p94k9qzpmgqbkvz-profile.drv
>/gnu/store/xlyyh54y77nm8gzm81rckkcvzaihn7dh-fonts-dir.drv
>/gnu/store/pm80lbbbx2xhvnfb838zn90bwwcw2818-xdg-desktop-database.drv
>/gnu/store/nkcspwxnd7hmf144krxzv1clq4gch6ms-ca-certificate-bundle.drv
>/gnu/store/n72ahz242h07dz32g2fkpr308a6cwdb6-xdg-mime-database.drv
>/gnu/store/fw9k5rg7p6czcp4bnnqkr57gv1qcyg78-gtk-im-modules.drv
>/gnu/store/856smz8kn9l2gq2b6qcykv6aa06c3qv7-info-dir.drv
>/gnu/store/1bybb1dnry03qwkr2d2888xi2z0hb6y7-gtk-icon-themes.drv
>
> /gnu/store/4vgn265kihmk1aayy3rg5h4z00dvlfmy-emacs-bash-
> completion-2.0.0.drv
>/gnu/store/gwlj87yvqfsrv6lzcphfm65ndwpar0df-manual-database.drv
> guix package: error: build failed: while setting up the build environment:
> cannot pivot old root directory onto '/gnu/store/4vgn265kihmk1aayy3
> rg5h4z00dvlfmy-emacs-bash-completion-2.0.0.drv.chroot/real-root': Invalid
> argument
> ---
>
>
>
Could you please check, if the solution mentioned here works for you:
https://bugzilla.redhat.com/show_bug.cgi?id=1361043

A short summary: Similar error can be caused by shared mounts.

This way you can check if this applies.

Note 'shared' in the output:

grep -iP '/ /\s' /proc/$$/mountinfo
...
25 0 252:1 / / rw,relatime shared:1 - ext4 /dev/mapper/my--vg-root
rw,errors=remount-ro,data=ordered
...

This is usual in systemd systems, and Ubuntu is one of them.

Calling unshare -m within the process context helps this.

I'm forwarding this also to devel, so that we can discuss, if doing this is
advisable in
general. WDYT?


>
> --
> Thorsten Wilms
>
> thorwil's design for free software:
> http://thorwil.wordpress.com/
>


Re: Half a success with chroot

2018-03-12 Thread Gábor Boskovits
2018-03-12 18:39 GMT+01:00 Thorsten Wilms :

> Hi!
>
> Thanks to mbakke in #guix, I managed to chroot from my comfortable Ubuntu
> into the rather naked Guix SD installation, with a few things working,
> though it ended with a "cannot pivot old root directory".
>
> Maybe someone here can improve on it; otherwise see it as a rough note
> about the possibilities and limitations.
>
> Given a Guix SD on /dev/sdb2:
>
> 
> sudo mkdir /mnt/guixsd
> sudo mount /dev/sdb2 /mnt/guixsd
> cd /mnt/guixsd
> sudo mount --bind /dev dev
> sudo mount --bind /proc proc
> sudo mount --bind /sys sys
> sudo chroot /mnt/guixsd /run/current-system/profile/bin/bash
> => logged in as root, no commands available
> source /etc/profile
> => at least basic shell commands work, as does `guix package -s banana`
> (yes, that does find something!)
> 
>
> 
> # su thorwil
> $ guix package -i emacs-bash-completion
> bash: guix: command not found
> $ source /etc/profile
> $ guix package -i emacs-bash-completion
> guile: warning: failed to install locale
> warning: failed to install locale: Invalid argument
> guix package: error: failed to connect to `/var/guix/daemon-socket/socket':
> Connection refused
> $ exit
> 
>
> Oops, starting guix-daemon:
> 
> # guix-daemon --build-users-group=guixbuild &
> [1] 4347
> # su thorwil
> $ source /etc/profile
> $ guix package -i emacs-bash-completion
> guile: warning: failed to install locale
> warning: failed to install locale: Invalid argument
> accepted connection from pid 4350, user thorwil
> substitute: guile: warning: failed to install locale
> substitute: warning: failed to install locale: Invalid argument
> substitute: updating list of substitutes from '
> https://mirror.hydra.gnu.org'... 100.0%
> The following package will be installed:
>emacs-bash-completion2.0.0 /gnu/store/7irxjifw4m8sj0if2nj
> 0r26vf0n0imsj-emacs-bash-completion-2.0.0
>
> substitute: updating list of substitutes from '
> https://mirror.hydra.gnu.org'... 100.0%
> The following derivations will be built:
>/gnu/store/z55j7zi1hgzyikbmv5gpnbv6sw49j6kw-profile.drv
>/gnu/store/yli3x8jscrcy4vicjvqlcd7z2cnyzc9q-gtk-im-modules.drv
>/gnu/store/sk4l43zrsjjgrnvbwcayf2lm484pnqxd-fonts-dir.drv
>/gnu/store/kk4yd0k0g30fmqwnmrmqv3ygnvl8s2fw-info-dir.drv
>/gnu/store/hffz6p320akp7sbqskxrdlxjslld5qpg-gtk-icon-themes.drv
>/gnu/store/ac501lz2zg8dc51acdcz457fr32r6r0c-xdg-desktop-database.drv
>/gnu/store/2gjkjjrbv8x3xx6xgma2wcaq3xga8wha-xdg-mime-database.drv
>/gnu/store/0mxc3m4l8n7l2h5p95s4cmfzhwhqpjbc-ca-certificate-bundle.drv
>
> /gnu/store/4vgn265kihmk1aayy3rg5h4z00dvlfmy-emacs-bash-
> completion-2.0.0.drv
>/gnu/store/d3pp0bl6f8ml06yzgm08pnyg3624rlc2-manual-database.drv
> 0.0 MB will be downloaded:
>/gnu/store/hfc5j4dq387s2iyvz392dja8zc75cvss-emacs-bash-completion-2.0.0
> guile: warning: failed to install locale
> warning: failed to install locale: Invalid argument
> Downloading https://mirror.hydra.gnu.org/guix/nar/gzip/hfc5j4dq387s2iyvz
> 392dja8zc75cvss-emacs-bash-completion-2.0.0...
>  emacs-bash-completion-2.0.0  31KiB
>  5.3MiB/s 00:00 [##] 100.0%
>
> guix package: error: build failed: while setting up the build environment:
> cannot pivot old root directory onto '/gnu/store/4vgn265kihmk1aayy3
> rg5h4z00dvlfmy-emacs-bash-completion-2.0.0.drv.chroot/real-root':$
> 
>
>
Hello! It would be nice to know the error code returned by the pivot_root
syscall. It might point to the reason of the failure.
Most probably you can get that using strace. Stracing the daemon is
possible using strace -fp pid_of_daemon.


> --
> Thorsten Wilms
>
> thorwil's design for free software:
> http://thorwil.wordpress.com/
>
>