Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
I have just built the 3.13.3 kernel from kernel.org on my ubuntu 12.04 computer. I ran the make menuconfig command and then I did make which built the kernel and the modules. I want to run the kernel in the qemu emulator (qemu-system-x86_64) so I can start testing and building on top of it. Curently I am getting it to run with qemu-system-x86_64 -kernel bzImage however it is not booting properly. What changes should I make in order to make the kernel boot properly?
You need to have a bootable disk first of all. Have you tried booting without -kernel and specifying the disk to boot from ?
If and only if that works, then think about using -kernel as an optimization
to test out new kernels
Making a bootable disk can be a challenge unless you take the easy route and use dd to make a large empty file e.g.
sudo dd if=/dev/zero of=$OUTPUT_DISK bs=4096 count=524288
then boot qemu with the linux iso you downloaded and also tell it to use this disk (-hda) and let the installer set the disk up for you
If making a bootable disk by hand, I've done this a couple of times - not easy, but the following steps may help you. You need to format the disk, create partitions, install grub and then boot
Personally I would take the easy route and install to disk via linux installer
#!/bin/sh
#
# Change these settings
#
INPUT_ISO=mydownloadedlinux.iso
OUTPUT_DISK=mydisk
KERNEL_IMAGE_NAME=linux-kernel
QEMU=qemu-system-x86_64
#
# Stuff you should not need to change
#
TMP_BOOTDISK=/tmp/disk.$$
ISO_MOUNT_DIR=/mnt/iso
#
# Choose DOS or Linux disks
#
PARTITION_TYPE=ext2
MKFS_TYPE=ext2
#
# Mount the ISO
#
sudo mkdir -p $ISO_MOUNT_DIR
sudo umount $ISO_MOUNT_DIR 2>/dev/null
sudo mount -o loop -t iso9660 $INPUT_ISO $ISO_MOUNT_DIR
#
# Make a new disk
#
sudo dd if=/dev/zero of=$OUTPUT_DISK bs=4096 count=524288
LOOP=`sudo losetup -f --show $OUTPUT_DISK`
LOOPDEV=`echo $LOOP | sed 's/.*loop/loop/g'`
echo "Loopback device $LOOP, ($LOOPDEV)"
#
# Make two partitions on the disk
#
sudo parted -s $LOOP mktable msdos \
mkpart primary $PARTITION_TYPE 32K 50% \
mkpart primary $PARTITION_TYPE 50% 95%
#
# Make one bootable
#
sudo parted -s $LOOP set 1 boot on
sudo kpartx -l $LOOP
sudo kpartx -a $LOOP
#
# Make the filesystems
#
sudo mkfs.$MKFS_TYPE /dev/mapper/${LOOPDEV}p1
sudo mkfs.$MKFS_TYPE /dev/mapper/${LOOPDEV}p2
#
# List what we made
#
sudo kpartx -l -v $LOOP
#
# Mount this temporary disk so we can install grub on it
#
sudo mkdir -p $TMP_BOOTDISK
sudo mount /dev/mapper/${LOOPDEV}p1 $TMP_BOOTDISK
sudo grub-install --boot-directory=/$TMP_BOOTDISK $LOOP
#
# Make grub boot config
#
cat >/tmp/grub.cfg <<%%
serial
#terminal_input --append serial_com0
#terminal_output --append serial_com0
configfile /mybootfile
%%
cat >/tmp/mybootfile <<%%
set timeout=5
set default=0
menuentry 'mylinux' {
insmod ext2
set root='(hd0,1)'
linux /$KERNEL_IMAGE_NAME bigphysarea=28000
initrd /rootfs.img.gz
}
%%
#
# Just copy all the files off of the ISO into the mounted temp disk
# This would be the tricky part as you need enough so linux can boot
#
sudo cp -r $ISO_MOUNT_DIR/* $TMP_BOOTDISK
#
# But use our grub files we made above
#
sudo cp /tmp/grub.cfg $TMP_BOOTDISK/grub/grub.cfg
sudo cp /tmp/mybootfile $TMP_BOOTDISK/mybootfile
#
# Show all the files on the temp disk and then unmuont it
#
find $TMP_BOOTDISK
sudo umount $TMP_BOOTDISK
sudo losetup -d $LOOP
#
# Convert the temp disk from raw to vmdk format
#
sudo qemu-img convert $OUTPUT_DISK -O vmdk $OUTPUT_DISK.vmdk
#
# Boot the vmdk
#
sudo $QEMU -boot d -m 4096 \
-enable-kvm \
-drive file=$OUTPUT_DISK.vmdk,if=virtio,media=disk \
-serial telnet:localhost:4444,nowait,server,telnet \
-net nic,model=e1000,vlan=0 -net user \
Related
I'm experimenting with cryptsetup. My target is to be able to store data into and encrypted file into a non-encrypted hard drive.
I'm doing the following
mkdir /data/test && /data/test
# Create a key
openssl genrsa -out luks_key 4096
# Create file container
dd if=/dev/zero of=device bs=1G count=50 status=progress
# Create and open luks device
cryptsetup -v -y --batch-mode luksFormat device luks_key
sudo cryptsetup -v --batch-mode --key-file=luks_key --type luks open device device_name
# Format the device
sudo mkfs.ext4 -j /dev/mapper/device_name
# Create mount point
mkdir mount_point
# Mount the device
sudo mount -t ext4 /dev/mapper/device_name mount_point
cd mount_point
sudo dd if=/dev/zero of=random_data.bin bs=1G count=1 status=progress
# This will fail until I close the terminal window with "target is busy." error
sudo umount /data/test/mount_point
cryptsetup -v close device_name
All works well up to the point were I try to unmount. The error is:
umount: /data/test/mount_point: target is busy.
The only way to be able to unmount is to close the terminal window. Opening a second one isn't enough. I'm little bit puzzled :)
I run on LinuxMint 18.04 with Linux kernel 5.15.30-25.
Anyone seeing the same thing?
Thanks,
I'm trying to install tensorflow on a Amazon linux AMI EC2 micro instance, but I keep getting EnvironmentError: [Errno 28] No space left on device even while the disk is empty.
On ubuntu server, I fix this increasing the /tmp size with the command sudo mount -o remount,size=4G,noatime /tmp, however this command fails on Amazon Linux telling me that /tmp is not mounted at all.
How can I increase /tmp size on Amazon Linux 2?
Thx!
Following can help in achieving the tmp space.
cd # change to your home directory
fallocate -l 20G mydrive.img # create the virtual drive file
mkfs -t ext3 mydrive.img # format the virtual drive
sudo umount /tmp # unmount the /tmp
sudo mount -t auto -o loop mydrive.img /tmp # mount the virtual drive
I recently managed to install
Centos7 with kickstart.cfg file by using virt-install at my Archlinux.
However, if I simply want to use similar approach with Centos 8 - it does not work at all.
I suspect that it is because of the fact that Centos8 does not have any minimal version and you need to download like 7GB iso fiel with graphical installer.
sudo virt-install --name k8s-1 \
--description "this is my Centos 8 " \
--ram 2048 \
--vcpus 2 \
--disk path=/vm-disks/k8s-1.qcow2,size=15 \
--os-type linux \
--os-variant "centos8" \
--network bridge=virbr0 \
--graphics vnc,listen=127.0.0.1,port=5901 \
--location /cdimages/CentOS-8.1.1911-x86_64-dvd1.iso \
--noautoconsole \
--initrd-inject ks-1.cfg --extra-args="ks=file:/ks-1.cfg"
Setting input-charset to 'UTF-8' from locale.
Starting install...
Setting input-charset to 'UTF-8' from locale.
Retrieving file vmlinuz... | 7.7 MB 00:00:00
Setting input-charset to 'UTF-8' from locale.
Retrieving file initrd.img... | 59 MB 00:00:00
Domain installation still in progress. You can reconnect to
the console to complete the installation process.
Here is ks-1.cfg
# Install OS instead of upgrade
install
# Use network installation
cdrom
# Root password
rootpw Start123
# System authorization information
auth --useshadow --passalgo=sha512
# Firewall configuration
firewall --disabled
# SELinux configuration
selinux --permissive
# Installation logging level
logging --level=info
# Use text mode install
text
# Do not configure the X Window System
skipx
# System timezone, language and keyboard
timezone --utc Europe/Bratislava
lang en_US.UTF-8
# keyboard dk-latin1
# Network information
# network --bootproto=static --ip=192.168.122.110 --device=eth0 --onboot=on
# If you want to configure a static IP:
network --device eth0 --hostname k8s-1 --bootproto=static --ip=192.168.122.111 --netmask=255.255.255.0 --gateway=192.168.122.1 --nameserver 192.168.122.1
# System bootloader configuration
bootloader --location=mbr
# Partition clearing information
clearpart --all --initlabel
# Disk partitioning information
part /boot --fstype="ext4" --size=512
#part swap --fstype="swap" --recommended
part /var --fstype="ext4" --size=5120 --grow
part / --fstype="ext4" --size=1024 --grow
part /usr --fstype="ext4" --size=3072
part /home --fstype="ext4" --size=512
part /tmp --fstype="ext4" --size=1024
# Reboot after installation
reboot
%packages --nobase
#core
# #base
%end
%post --log=/root/ks-post.log
#---- Install packages used by kubernetes
#yum install -y socat libseccomp-devel btrfs-progs-devel util-linux nfs-utils conntrack-tools.x86_64
#---- Set bridge-nf-call
echo "net.bridge.bridge-nf-call-ip6tables=1
net.bridge.bridge-nf-call-iptables=1" > /etc/sysctl.conf
#---- Add user RKE -----
groupadd docker
adduser rke
echo "rke:praqma" | chpasswd
usermod -aG docker rke
#---- Install our SSH key ----
mkdir -m0700 /home/rke/.ssh/
cat <<EOF >/home/rke/.ssh/authorized_keys
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC9F5hTts3U+E10PHRxViM3PX+DZPgBIcL7Uj/Py+udJWehhobnJmj2EoaUYbykm7VdpjImLpjas2Vhb/gNZ+wVWGho1mzWoCPl2fZ7oLXrGdDHXhlyocvfX3XPB6Y1kbFlfh7+4bUaA7w2Dg4x8LO/iXlF34z6IOa2xgx1R70Xc/97lkRMhsKszRBzwGVin6qUqdVmdXg3d0dRUnq039+q8NWUcKAz2w6F/HO7u3N7NhsSLnlpQ9+AztLvHEPeRP6UNex9a8sSHo5Jzc/mjVKGfInfWjp3nru88mwM4UQRbhhW5IeLXgALCa++H4qZw1ivZtVadXBHjK4JMKC1UWD1 rancher#k8s
EOF
### Disabling swap (now and permently)
swapoff -a
sed -i '/^\/swapfile/ d' /etc/fstab
### set permissions
chmod 0600 /home/rke/.ssh/authorized_keys
chown -R rke:rke /home/rke/.ssh
### fix up selinux context
restorecon -R /home/rke/.ssh/authorized_keys
### Install Docker
#yum install docker -y
#systemctl enable docker
%end
If you take a look to virtual-manager GUI you willalways see dracut shell error
I had exactly the same issue. My solution:
for some reason parameter --initrd-inject for virt-install breaks the process.
So I removed it and load kickstart file via network with --extra-args "ks=http://192.168.xxx.xxx:8000/centos8_ks.cfg"
Hint: to run simple web server for this installation you can execute python3 -m http.server 8000 in folder with your kickstart file.
Of course you need to update your kickstart for CentOS-8 according to this - a lot has been changed.
Another option is to create a small floppy image with label OEMDRV and with file ks.cfg on it and attach it as a CDROM: How to automate CentOS7 minimal kickstart installation using OEMDRV volume?
I'm trying to deploy some binary files to /boot in a Yocto image for RPi CM3 but it deploys them to the wrong location.
do_install() {
install -d ${D}/boot/overlays
install -m 0664 ${WORKDIR}/*.dtb ${D}/boot/overlays/
install -m 0664 ${WORKDIR}/*.dtbo ${D}/boot/overlays/
}
The files are deployed to /boot in the / partition of the final image, but not to the /boot partition. So they are not available at boot time.
I already googled and studied the kernel recipes (and classes) of the Poky distribution but I didn't find the mechanism it uses how to ensure that the files are deployed to the boot image (and not to the /boot dir in the root image).
Any help is appreciated :)
Update #1
In my local.conf I did:
IMAGE_BOOT_FILES_append = " \
overlays/3dlab-nano-player.dtbo \
overlays/adau1977-adc.dtbo \
...
"
And in my rpi3-overlays.bb
do_deploy() {
install -d ${DEPLOYDIR}/${PN}
install -m 0664 ${WORKDIR}/*.dtb ${DEPLOYDIR}/${PN}
install -m 0664 ${WORKDIR}/*.dtbo ${DEPLOYDIR}/${PN}
touch ${DEPLOYDIR}/${PN}/${PN}-${PV}.stamp
}
Using this the image builds, but the files stillt don't get deployed in the /boot partition.
Using RPI_KERNEL_DEVICETREE_OVERLAYS I get a build error because the kernel recipe tries to build the dtbo files like dts files.
RPI images are created with sdimage-raspberrypi.wks WIC wks file. It contains:
part /boot --source bootimg-partition ...
so it uses bootimg-partition.py wic plugin to generate /boot partition. It copies every files defined by IMAGE_BOOT_FILES variable.
It seems you want to add some devicetree overlays, so you need to modify machine configuration and more specifically RPI_KERNEL_DEVICETREE_OVERLAYS variable. IMAGE_BOOT_FILES variable is set in rpi-base.inc.
If you don't have any custom machine or custom distro defined, you can add it in local.conf:
RPI_KERNEL_DEVICETREE_OVERLAYS_append = " <deploy-path>/<dto-path>"
You can see here how to add files in deploy directory.
After too many hours of investigation it turned out, that deploying files to other partitions than / is not easily possible. I now went the way of a post-processing script that mounts the final image, deploys the additional files and unmounts it.
# Ensure the first loopback device is free to use
sudo -n losetup -d /dev/loop0 || true
# Create a loopback device for the given image
sudo -n losetup -Pf ../deploy/images/bapi/ba.rootfs.rpi-sdimg
# Mount the loopback device
mkdir -p tmp
sudo -n mount /dev/loop0p1 tmp
# Deploy files
sudo -n cp -n ../../meta-ba-rpi-cm3/recipes-core/rpi3-overlays/files/* tmp/overlays/
sudo -n cp ../../conf/config.txt tmp/config.txt
sudo -n cp ../../conf/cmdline.txt tmp/cmdline.txt
# Unmount the image and free the loopback device
sudo -n umount tmp
sudo -n losetup -d /dev/loop0
I am pretty newbie to Linux and started LFS because I needed it for school. So my system is now perfectly running with an internet connection, but I still don't have any packet manager or something. The first binary I would like to have is basically wget, but I really don't know how to do...
Could someone explain to me please ?
I personally used (and would highly recommend) using the existing Linux system (the host) to download the wget package and its dependencies before booting your LFS system for the first time. However, seeing that you're already using your LFS system, if you still have the ability to log using the host, then use it to download wget as if it was one of the sources that you got when building the LFS system.
For me, I used a Linux Mint Host running in VirtualBox to build my LFS. To get wget I just had to re-add the Linux Mint host storage, and download wget and added it to the LFS sources. I then removed the Linux Mint host storage, logged in to my LFS machine, then followed the steps in BLFS.
Note: this is mainly just from parts of lfs and the wget page of blfs.
1. Boot into your host OS.
2. Enter the following commands in the command line to get into chroot(edit depending on your partitions and where you mount lfs):
sudo su -
export LFS=/mnt/lfs
mount -vt ext4 /dev/sda4 $LFS
mount -v --bind /dev $LFS/dev
mount -vt devpts devpts $LFS/dev/pts -o gid=5,mode=620
mount -vt proc proc $LFS/proc
mount -vt sysfs sysfs $LFS/sys
mount -vt tmpfs tmpfs $LFS/run
if [ -h $LFS/dev/shm ]; then
mkdir -pv $LFS/$(readlink $LFS/dev/shm)
fi
chroot "$LFS" /usr/bin/env -i \
HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \
PATH=/bin:/usr/bin:/sbin:/usr/sbin \
/bin/bash --login
3. Download wget from http://ftp.gnu.org/gnu/wget/wget-1.19.1.tar.xz and copy it into /mnt/lfs/sources from your host os.
4. Unpack and cd into it with:
tar -xf wget-1.19.1.tar.xz
cd wget-1.19.1
5. Configure and install wget with:
./configure --prefix=/usr \
--sysconfdir=/etc \
--with-ssl=openssl &&
make
make install
6. Delete the wget-1.19.1 folder if you want and your done!