tramp-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: sh -c 'whoami' gives permission error in docker container and puts m


From: ParetoOptimalDev
Subject: Re: sh -c 'whoami' gives permission error in docker container and puts me in weird prompt/subshell
Date: Tue, 02 May 2023 09:50:21 -0500
User-agent: Gnus/5.13 (Gnus v5.13)

Michael Albinus <michael.albinus@gmx.de> writes:

> ParetoOptimalDev <pareto.optimal@mailfence.com> writes:
>
> Hi,
>
>> Hello, I have created a qcow2 image with emacs and docker installed
>> using Nix that reproduces the problem.
>
> Thanks!
>
>> You can download it here (link valid for 3 days from 2023-05-01):
>>
>> https://spideroak.com/storage/OVPXG4DJMRSXE33BNNPWC5LUN5PTSMRUGM4DA/shared/8421734-1-1001/Rick.qcow2?7adec1ee798c032b87be2c4c450cbd5c
>
> I've installed it like this:
>
> # sudo virt-install --name NixOS --memory 4096 --vcpus 2 --disk 
> /home/albinus/Downloads/Rick.qcow2,bus=sata --import --os-variant 
> nixos-unknown --network default
>
>> Let me know if you are able to boot the vm fine.
>
> When I start the VM, I get "No bootable device.". What do I miss?

Oh no! I'm sorry. I didn't have another linux device to test from so I
asked in the NixOS matrix room and was essentially told what you did
above should work.

I don't have time to setup a new VM with a different linux and debug
further, but... I did look further into the script NixOS generates when
I built the VM to run it. Here is the full script that booted the vm for
me I'm referencing.

Note it doesn't use virt-install but lower level commands like qemu-img
and qemu-kvm. I don't have the knowledge to map these low level commands
back to virt-install, sorry.

If the below script doesn't help or will require too much debugging time
on your part, I can get more help from the NixOS
matrix room.

```
#! /nix/store/kga2r02rmyxl14sg96nxbdhifq3rb8lc-bash-5.1-p16/bin/bash

export 
PATH=/nix/store/l6jgwxkc3jhr029vfzfwzcy28iyckwsj-coreutils-9.1/bin${PATH:+:}$PATH

set -e

NIX_DISK_IMAGE=$(readlink -f "${NIX_DISK_IMAGE:-./Rick.qcow2}")

if ! test -e "$NIX_DISK_IMAGE"; then
    
/nix/store/m41y5lq386mwlz0xni98v0lknvc5dy37-qemu-host-cpu-only-7.1.0/bin/qemu-img
 create -f qcow2 "$NIX_DISK_IMAGE" \
      1024M
fi

# Create a directory for storing temporary data of the running VM.
if [ -z "$TMPDIR" ] || [ -z "$USE_TMPDIR" ]; then
    TMPDIR=$(mktemp -d nix-vm.XXXXXXXXXX --tmpdir)
fi



# Create a directory for exchanging data with the VM.
mkdir -p "$TMPDIR/xchg"



cd "$TMPDIR"




# Start QEMU.
exec 
/nix/store/m41y5lq386mwlz0xni98v0lknvc5dy37-qemu-host-cpu-only-7.1.0/bin/qemu-kvm
 -cpu max \
    -name Rick \
    -m 1024 \
    -smp 1 \
    -device virtio-rng-pci \
    -net nic,netdev=user.0,model=virtio -netdev user,id=user.0,"$QEMU_NET_OPTS" 
\
    -virtfs local,path=/nix/store,security_model=none,mount_tag=nix-store \
    -virtfs 
local,path="${SHARED_DIR:-$TMPDIR/xchg}",security_model=none,mount_tag=shared \
    -virtfs local,path="$TMPDIR"/xchg,security_model=none,mount_tag=xchg \
    -drive 
cache=writeback,file="$NIX_DISK_IMAGE",id=drive1,if=none,index=1,werror=report 
-device virtio-blk-pci,drive=drive1 \
    -device virtio-keyboard \
    -usb \
    -device usb-tablet,bus=usb-bus.0 \
    -kernel 
${NIXPKGS_QEMU_KERNEL_Rick:-/nix/store/6p7igcddhf9vzbylq1pk4idx5a3w4wrf-nixos-system-Rick-22.11.20230501.d529862/kernel}
 \
    -initrd 
/nix/store/6p7igcddhf9vzbylq1pk4idx5a3w4wrf-nixos-system-Rick-22.11.20230501.d529862/initrd
 \
    -append "$(cat 
/nix/store/6p7igcddhf9vzbylq1pk4idx5a3w4wrf-nixos-system-Rick-22.11.20230501.d529862/kernel-params)
 
init=/nix/store/6p7igcddhf9vzbylq1pk4idx5a3w4wrf-nixos-system-Rick-22.11.20230501.d529862/init
 regInfo=/nix/store/y8f892lblkks70anyym4s8bgysn7wy0k-closure-info/registration 
console=ttyS0,115200n8 console=tty0 $QEMU_KERNEL_PARAMS" \
    $QEMU_OPTS \
    "$@"
```

Thanks.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]