Note
The main issue here was guest additions, which allow shared folders and suchlike. They worked with the installed system, but not once I had updated to the 4.4.172 kernel. There seems to be an issue with that. It will be resolved I’m sure but has not been resolved yet. See step 116 below!
I found Slackware to be far less daunting than some comments on the web would suggest. As long as the user is OK with using a text-based disk partitioner (cfdisk), it’s quite straightforward. And with tools like slackpkg and sbotools, maintenance (install, remove and upgrade packages) is not a problem either, and the range of packages is good, although split between the Slackware repository and the stuff curated at slackbuilds.
Indeed, I think you could make a good case that the split has significant benefits — for example, an application built via slackbuilds is compiled natively on and for your system, which can/may/might give performance benefits. (https://www.linuxquestions.org/questions/slackware-14/how-to-set-slackbuild-cflags-cxxflags-qmake-c-cxx-flags-globally-4175621306/) See also the documents for sbotools for globally setting the -j option to speed compiling.
I tried to put in all the steps, but I might have missed out a detail. If so — sorry!
Introduction
I need to test some eLearning I’ve written on a variety of browsers and environments. I’ve tried the big 3 (Firefox, Chrome, Edge) on the Windows 10 machine on my desk. I want to try Linux. So I’m going to set up VirtualBox and install a distro. I’m sure there will be nothing of interest here, but if I am going to do the task I might as well record the steps.
I make a lot of dumb mistakes as I go, and I should probably read the docs more carefully, but this below is the truth of it!
The many steps
-
-
- Install VirtualBox on my Windows host machine: Went to https://www.virtualbox.org/wiki/Downloads and hit the big download button.
- Clicked on ‘Windows hosts’ and wait for the download. Ran the download.
- Clicked ‘Next >’
- Clicked ‘Next >’
- Unchecked creation of desktop shortcut and Quick Launch Bar icon — I don’t want that clutter.
- ‘Next >’
- Yes
- Clicked through the installer. Watch it go!
- Choose a Linux distribution: What distro shall we use? Try Slackware.
- In a Cygwin window: $ wget https://ftp.yzu.edu.tw/Linux/Slackware/slackware-iso/slackware-14.2-iso/slackware-14.2-install-dvd.iso
- check md5sum ($ md5sum slackware-14.2-install-dvd.iso) — looks good.
- Create the virtual machine: So began by starting VirtualBox and creating a new machine. (New; Name: Slack, Type: Linux 32-bit; Other 32-bit.
- 1GB RAM
- Defaults until set virtual hard disk size; chose 12GB.
- System → Processor → enable PAE/NX
- Boot the VM: Storage → Empty → Optical Driver → Choose virtual optical disk file
- Double-clicked to boot
- Hit Enter at ‘boot’ prompt
- Enter to select default keyboard map
- Log in as root
- Partition the disk: cfdisk
- Select dos partition
- New
- Set to 11G (later repeated this with 40GB)
- Set Type to Linux filesystem
- Highlight ‘Free space’
- New, remaining space (1023M)
- Set Type to Linux swap
- Write to disk — yes!
- Quit
- Set up Slackware: Ran setup
- Add swap (/dev/sda2) and accept defaults
- Select root partition (/dev/sda1)
- Quick format
- ext4 file system
- Source media selection — use Slackware CD or DVD
- auto
- Choose what to install — I left defaults
- full install
- watch it go
- Skip making USB boot stick
- simple (Try to install LILO automatically)
- standard console
- no kernel parameters
- no for UTF-8 console
- Install LILO to MBR
- Select USB mouse (not sure about this)
- Add gpm (I use it)
- Hostname
- Domain
- Choose Autoconfigure using NetworkManager
- Boot time services … accept defaults
- Not interested in custom screen fonts
- Hardware clock
- Time zone
- Choose window manager (KDE will do for now)
- Root password
- It’s not taking keyboard input! I cannot set root password!
- Use the VB menu to send Ctrl+Alt+Del to the virtual machine
- It captured my mouse and does not respond to the keyboard! I can’t do anything!
- Unplugged and replugged keyboard and got it back!
- Repeated the install
- Turn off/exit install
- The first boot from the virtual hard drive: Remove the virtual DVD and reboot
- Enter to boot
- Log in as root
- Add a user: Ran adduser
- Enter through most options, but add them to most groups (up arrow at the ‘Or press the UP arrow’ prompt)
- VirtualBox guest additions: Still as root, click on Devices menu and Insert Guest Additions
- Could not find it user /mnt or /media (turns out it is under ‘/run‘ or something)
- Ran # startx
- Launch the file manager and there it is ‘VBox_GAs_6.0.4’
- Run VBoxLinuxAdditions.run
- Seems good.
- Shut down the VM
- In the VB manager, chose Shared Folders
- Clicked the ‘Add folder’ icon — little folder with a green plus on it
- Click on Folder Path and Other and browse to the desired folder on the host
- I set it as Read-only since I am testing some files and do not want to change them
- Clicked Auto-mount ‘on’
- Put ‘tests’ in the ‘Mount point’ box — this is a change to the interface, and I think I misunderstood it — should have read the docs!
- OK
- Rebooted the guest and logged in again
- As regular user, got output of id -u (1000) and id -g (100)
- As superuser, in the guest:
- # mount -t vboxsf -o uid=1000,gid=100 tests /home/username/shareslack
- ‘Protocol error’ — uh oh
- Reinstalled guest additions
- as root, # usermod -a -G vboxsf username
- # mount -t vboxsf -o uid=1000,gid=100 tests /home/username/shareslack
- Turn off automount and make permanent and Read only and reboot the guest
- Turn on automount and read only and reboot
- Nope. This is proving a real problem
- Simplify the path to the host folder I want to share — a simple directory off C:
- Nope.
- I got myself tied in knots here. Start again.
- Shared folders — give it a name but no mount point and turn on Auto-mount
- Well, at some point the shared folder turned up under /media/sf_username. Not quite sure how, to be honest, but there it is
- Opened command prompt and switched to superuser (su command). Now update the system
- # vim /etc/slackpkg/mirrors and uncomment the one I want
- # slackpkg update
- # slackpkg install-new
- # slackpkg upgrade-all
- Boy, that was easy.
- Well, it seems pretty much set up now. Though the screen is not scalable. Check the log from compiling the additions
- Log says kernel config is invalid! Odd.
- 4.4.172 kernel does not play nicely with guest additions. https://slackblogs.blogspot.com/2019/02/kernel-44172-breaking-some-application.html
- Slackbuilds: Oh well. Use links to download the slackbuild files for sbotools, and install that to automate slackbuilds.
- Go to https://slackbuilds.org and search for sbotools. Download the build script and the source code and follow the instructions …
- See https://slackbuilds.org/howto/
- # sbosnap fetch
- # sboinstall --reinstall dkms
- groupadd -g 215 vboxusers
- # usermod -a -G vboxusers username (for root and my user)
- logout and back in again
- To get the guest additions to compile on the 4.4.172 kernel
- edit /etc/fstab and uncomment the cdrom line (so I can do this without gui); then Devices menu and insert guest additions CD
- # mount /dev/cdrom
- #cd /mnt/cdrom
- Try the install: #sh VBoxLinux ...etc...run
- Nope, something went wrong — it just won’t work
- It looks like this is not my fault! https://slackblogs.blogspot.com/2019/02/kernel-44172-breaking-some-application.html. It gives a fix
- Mount the GA CD and try to run it
- find / -name memobj-r0drv-linux.c
- Go there and make the changes shown at the link
- but vboxconfig is not in sbin! It is nowhere!
- Lower down the same post, though, it says:
-
PetslackSaturday, 06 April, 2019 The same path here for me (slack64-14.2 + virtualbox-6.0.4) and the patch worked. Here the steps: # apply the patch sed -i "s/4, 9, 0/4, 4, 168/" /opt/VBoxGuestAdditions-6.0.4/src/vboxguest-6.0.4/vboxguest/r0drv/linux/memobj-r0drv-linux.c # build the modules /sbin/rcvboxadd setup #test it without rebooting /usr/bin/VBoxClient-all
- And rcvboxadd is present, so try that
- Seems to have worked! Try a reboot
- Login as user and startx
- Autoresize guest display is not greyed out. How about shared folders? Yep. Clipboard — yep. That’s most of what I need.
- Shared folders found under /media/sf_darren, which will do!
- OK, so at last we are done, or done enough, at least.
-
Last thing I did was make a Windows batch file and put it in my path:
C:\>type c:\Users\username\bin\slack.bat "c:\Program Files\Oracle\VirtualBox\VBoxManage.exe" startvm Slack
And got a little icon and put a shortcut to the batch file on my desktop. So no need to run the VirtualBox GUI manager.
So I can’t pretend I did it all with complete mastery, but it works, more or less.
17 July 2019 / Los Angeles
Thanks a million for your log! You’ve done exactly what I want to do: as a longtime Slacker, I want to put Slack in a virtual machine as 1 linux distro, and I want to try Virtual Box on a Windows machine. Perfect!
Glad to be of assistance. I was doing it for my own ends, and just documented as I went, mistakes and all. I muddle through…
Any thoughts on getting sound to work in the VM on your set up?
I fired up the VirtualBox Manager and made sure Audio was enabled, and left it on ICH AC97 audio controller and booted the VM. Downloaded some sample audio files (mp3, ogg, wav).
$ mpg123 samplefile.mp3
And I plugged a USB headset into the Windows host and I could hear the sample file.
Did not seem to need to do anything.
You can try
$ alsamixer
and see what it shows you. But because I have not had to mess around with it, I cannot offer any more advice!
how do i mount my shared folder and access it to add files in the boot directory?
I don’t know if VirtualBox would be able to mount and read from a /boot that was a shared folder, because as I understand it shared folders need various kernel modules that are loaded during boot. Chicken and egg problem.
If I wanted to get new files into /boot, well, I don’t like the idea of exposing my /boot folder in that way, so I would probably just copy the files into the VM into a normal shared folder, boot up the VM, use sudo or su to copy the files into /boot, then reboot.
But I can see how it might be useful if you wanted to experiment with various kernels, initrds and boot configs to have /root as a direct share. Sorry, that doesn’t help much.